[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / 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
6 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
7 #define int64_t jlong
8 #include <lightning.h>
9 #include <string.h>
10 #include <stdatomic.h>
11 #include <stdlib.h>
12
13 #define LIKELY(v) __builtin_expect(!!(v), 1)
14 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
15
16 #include <stdio.h>
17 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
18 #define do_MALLOC(a, _b, _c) malloc(a)
19 #define MALLOC(a, _) malloc(a)
20 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
21 #define CHECK_ACCESS(p)
22 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
23 #define DO_ASSERT(a) (void)(a)
24 #define CHECK(a)
25
26
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31
32 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
33
34 // Int types across Windows/Linux are different, so make sure we're using the right headers.
35 _Static_assert(sizeof(void*) == sizeof(uintptr_t), "stdints must be correct");
36 _Static_assert(sizeof(void*) == sizeof(intptr_t), "stdints must be correct");
37 _Static_assert(sizeof(uint64_t) == 8, "stdints must be correct");
38 _Static_assert(sizeof(int64_t) == 8, "stdints must be correct");
39 _Static_assert(sizeof(uint32_t) == 4, "stdints must be correct");
40 _Static_assert(sizeof(int32_t) == 4, "stdints must be correct");
41 _Static_assert(sizeof(uint16_t) == 2, "stdints must be correct");
42 _Static_assert(sizeof(int16_t) == 2, "stdints must be correct");
43 _Static_assert(sizeof(uint8_t) == 1, "stdints must be correct");
44 _Static_assert(sizeof(int8_t) == 1, "stdints must be correct");
45
46 #define DECL_ARR_TYPE(ty, name) \
47         struct name##array { \
48                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
49                 ty elems[]; \
50         }; \
51         typedef struct name##array * name##Array; \
52         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
53                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
54                 arr->arr_len = arr_len; \
55                 return arr; \
56         }
57
58 DECL_ARR_TYPE(int64_t, int64_t);
59 DECL_ARR_TYPE(uint64_t, uint64_t);
60 DECL_ARR_TYPE(int8_t, int8_t);
61 DECL_ARR_TYPE(int16_t, int16_t);
62 DECL_ARR_TYPE(uint32_t, uint32_t);
63 DECL_ARR_TYPE(void*, ptr);
64 DECL_ARR_TYPE(char, char);
65 typedef charArray jstring;
66
67 static inline jstring str_ref_to_cs(const char* chars, size_t len) {
68         charArray arr = init_charArray(len, __LINE__);
69         memcpy(arr->elems, chars, len);
70         return arr;
71 }
72 static inline LDKStr str_ref_to_owned_c(const jstring str) {
73         char* newchars = MALLOC(str->arr_len + 1, "String chars");
74         memcpy(newchars, str->elems, str->arr_len);
75         newchars[str->arr_len] = 0;
76         LDKStr res = {
77                 .chars = newchars,
78                 .len = str->arr_len,
79                 .chars_is_owned = true
80         };
81         return res;
82 }
83
84 typedef bool jboolean;
85
86 int64_t CS_LDK_allocate_buffer(int64_t len) {
87         return (int64_t)MALLOC(len, "C#-requested buffer");
88 }
89
90 void CS_LDK_free_buffer(int64_t buf) {
91         FREE((void*)buf);
92 }
93
94 jstring CS_LDK_get_ldk_c_bindings_version() {
95         return str_ref_to_cs(check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
96 }
97 jstring CS_LDK_get_ldk_version() {
98         return str_ref_to_cs(check_get_ldk_version(), strlen(check_get_ldk_version()));
99 }
100 #include "version.c"
101
102 typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
103 static invoker_l_l js_invoke_function_l_l;
104 int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
105         js_invoke_function_l_l = invoker;
106         return 0;
107 }
108
109 typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
110 static invoker_l_ll js_invoke_function_l_ll;
111 int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
112         js_invoke_function_l_ll = invoker;
113         return 0;
114 }
115
116 typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
117 static invoker_l_ js_invoke_function_l_;
118 int CS_LDK_register_l__invoker(invoker_l_ invoker) {
119         js_invoke_function_l_ = invoker;
120         return 0;
121 }
122
123 typedef void (*invoker_void_l)(int obj_ptr, int fn_id, int64_t a);
124 static invoker_void_l js_invoke_function_void_l;
125 int CS_LDK_register_void_l_invoker(invoker_void_l invoker) {
126         js_invoke_function_void_l = invoker;
127         return 0;
128 }
129
130 typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
131 static invoker_l_lll js_invoke_function_l_lll;
132 int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
133         js_invoke_function_l_lll = invoker;
134         return 0;
135 }
136
137 typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
138 static invoker_l_llll js_invoke_function_l_llll;
139 int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
140         js_invoke_function_l_llll = invoker;
141         return 0;
142 }
143
144 typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e);
145 static invoker_l_lllll js_invoke_function_l_lllll;
146 int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
147         js_invoke_function_l_lllll = invoker;
148         return 0;
149 }
150
151 typedef void (*invoker_void_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
152 static invoker_void_lll js_invoke_function_void_lll;
153 int CS_LDK_register_void_lll_invoker(invoker_void_lll invoker) {
154         js_invoke_function_void_lll = invoker;
155         return 0;
156 }
157
158 typedef void (*invoker_void_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
159 static invoker_void_ll js_invoke_function_void_ll;
160 int CS_LDK_register_void_ll_invoker(invoker_void_ll invoker) {
161         js_invoke_function_void_ll = invoker;
162         return 0;
163 }
164
165 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
166 static invoker_ChannelMonitorUpdateStatus_ll js_invoke_function_ChannelMonitorUpdateStatus_ll;
167 int CS_LDK_register_ChannelMonitorUpdateStatus_ll_invoker(invoker_ChannelMonitorUpdateStatus_ll invoker) {
168         js_invoke_function_ChannelMonitorUpdateStatus_ll = invoker;
169         return 0;
170 }
171
172 typedef int64_t (*invoker_l_Recipient)(int obj_ptr, int fn_id, int32_t a);
173 static invoker_l_Recipient js_invoke_function_l_Recipient;
174 int CS_LDK_register_l_Recipient_invoker(invoker_l_Recipient invoker) {
175         js_invoke_function_l_Recipient = invoker;
176         return 0;
177 }
178
179 typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
180 static invoker_l_Recipientll js_invoke_function_l_Recipientll;
181 int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
182         js_invoke_function_l_Recipientll = invoker;
183         return 0;
184 }
185
186 typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
187 static invoker_l_llRecipient js_invoke_function_l_llRecipient;
188 int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
189         js_invoke_function_l_llRecipient = invoker;
190         return 0;
191 }
192
193 typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
194 static invoker_l_bll js_invoke_function_l_bll;
195 int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
196         js_invoke_function_l_bll = invoker;
197         return 0;
198 }
199
200 typedef int32_t (*invoker_i_ConfirmationTarget)(int obj_ptr, int fn_id, int32_t a);
201 static invoker_i_ConfirmationTarget js_invoke_function_i_ConfirmationTarget;
202 int CS_LDK_register_i_ConfirmationTarget_invoker(invoker_i_ConfirmationTarget invoker) {
203         js_invoke_function_i_ConfirmationTarget = invoker;
204         return 0;
205 }
206
207 typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, int64_t f);
208 static invoker_l_llllll js_invoke_function_l_llllll;
209 int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
210         js_invoke_function_l_llllll = invoker;
211         return 0;
212 }
213
214 typedef int16_t (*invoker_s_)(int obj_ptr, int fn_id);
215 static invoker_s_ js_invoke_function_s_;
216 int CS_LDK_register_s__invoker(invoker_s_ invoker) {
217         js_invoke_function_s_ = invoker;
218         return 0;
219 }
220
221 typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
222 static invoker_l_lllb js_invoke_function_l_lllb;
223 int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
224         js_invoke_function_l_lllb = invoker;
225         return 0;
226 }
227
228 typedef int64_t (*invoker_l_lllil)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d, int64_t e);
229 static invoker_l_lllil js_invoke_function_l_lllil;
230 int CS_LDK_register_l_lllil_invoker(invoker_l_lllil invoker) {
231         js_invoke_function_l_lllil = invoker;
232         return 0;
233 }
234
235 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
236 static invoker_ChannelMonitorUpdateStatus_lll js_invoke_function_ChannelMonitorUpdateStatus_lll;
237 int CS_LDK_register_ChannelMonitorUpdateStatus_lll_invoker(invoker_ChannelMonitorUpdateStatus_lll invoker) {
238         js_invoke_function_ChannelMonitorUpdateStatus_lll = invoker;
239         return 0;
240 }
241
242 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
243 static invoker_ChannelMonitorUpdateStatus_llll js_invoke_function_ChannelMonitorUpdateStatus_llll;
244 int CS_LDK_register_ChannelMonitorUpdateStatus_llll_invoker(invoker_ChannelMonitorUpdateStatus_llll invoker) {
245         js_invoke_function_ChannelMonitorUpdateStatus_llll = invoker;
246         return 0;
247 }
248
249 typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
250 static invoker_void_lli js_invoke_function_void_lli;
251 int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
252         js_invoke_function_void_lli = invoker;
253         return 0;
254 }
255
256 typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
257 static invoker_void_li js_invoke_function_void_li;
258 int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
259         js_invoke_function_void_li = invoker;
260         return 0;
261 }
262
263 typedef void (*invoker_void_)(int obj_ptr, int fn_id);
264 static invoker_void_ js_invoke_function_void_;
265 int CS_LDK_register_void__invoker(invoker_void_ invoker) {
266         js_invoke_function_void_ = invoker;
267         return 0;
268 }
269
270 typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
271 static invoker_l_llb js_invoke_function_l_llb;
272 int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
273         js_invoke_function_l_llb = invoker;
274         return 0;
275 }
276
277 typedef jboolean (*invoker_b_)(int obj_ptr, int fn_id);
278 static invoker_b_ js_invoke_function_b_;
279 int CS_LDK_register_b__invoker(invoker_b_ invoker) {
280         js_invoke_function_b_ = invoker;
281         return 0;
282 }
283
284 typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
285 static invoker_l_sl js_invoke_function_l_sl;
286 int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
287         js_invoke_function_l_sl = invoker;
288         return 0;
289 }
290
291 typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
292 static invoker_l_lb js_invoke_function_l_lb;
293 int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
294         js_invoke_function_l_lb = invoker;
295         return 0;
296 }
297
298 typedef jboolean (*invoker_b_l)(int obj_ptr, int fn_id, int64_t a);
299 static invoker_b_l js_invoke_function_b_l;
300 int CS_LDK_register_b_l_invoker(invoker_b_l invoker) {
301         js_invoke_function_b_l = invoker;
302         return 0;
303 }
304
305 typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
306 static invoker_l_llli js_invoke_function_l_llli;
307 int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
308         js_invoke_function_l_llli = invoker;
309         return 0;
310 }
311 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
312
313 static inline void* untag_ptr(uint64_t ptr) {
314         if (ptr < 4096) return (void*)ptr;
315         if (sizeof(void*) == 4) {
316                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
317                 return (void*)(uintptr_t)ptr;
318         } else {
319                 // For 64-bit systems, assume the top byte is used for tagging, then
320                 // use bit 9 ^ bit 10.
321                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
322                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
323 #ifdef LDK_DEBUG_BUILD
324                 // On debug builds we also use the 11th bit as a debug flag
325                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
326                 CHECK(tenth_bit != eleventh_bit);
327                 p ^= 1ULL << 53;
328 #endif
329                 return (void*)p;
330         }
331 }
332 static inline bool ptr_is_owned(uint64_t ptr) {
333         if(ptr < 4096) return true;
334         if (sizeof(void*) == 4) {
335                 return ptr & (1ULL << 32);
336         } else {
337                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
338                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
339 #ifdef LDK_DEBUG_BUILD
340                 // On debug builds we also use the 11th bit as a debug flag
341                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
342                 CHECK(tenth_bit != eleventh_bit);
343 #endif
344                 return (ninth_bit ^ tenth_bit) ? true : false;
345         }
346 }
347 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
348         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
349         if (sizeof(void*) == 4) {
350                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
351         } else {
352                 CHECK(sizeof(uintptr_t) == 8);
353                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
354                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
355 #ifdef LDK_DEBUG_BUILD
356                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
357                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
358                 CHECK(ninth_bit == tenth_bit);
359                 CHECK(ninth_bit == eleventh_bit);
360                 t ^= 1ULL << 53;
361 #endif
362                 CHECK(ptr_is_owned(t) == is_owned);
363                 CHECK(untag_ptr(t) == ptr);
364                 return t;
365         }
366 }
367
368 static inline LDKBlindedFailure LDKBlindedFailure_from_cs(int32_t ord) {
369         switch (ord) {
370                 case 0: return LDKBlindedFailure_FromIntroductionNode;
371                 case 1: return LDKBlindedFailure_FromBlindedNode;
372                 default: abort();
373         }
374 }
375 static inline int32_t LDKBlindedFailure_to_cs(LDKBlindedFailure val) {
376         switch (val) {
377                 case LDKBlindedFailure_FromIntroductionNode: return 0;
378                 case LDKBlindedFailure_FromBlindedNode: return 1;
379                 default: abort();
380         }
381 }
382 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_cs(int32_t ord) {
383         switch (ord) {
384                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
385                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
386                 case 2: return LDKBolt11SemanticError_NoDescription;
387                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
388                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
389                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
390                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
391                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
392                 case 8: return LDKBolt11SemanticError_InvalidSignature;
393                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
394                 default: abort();
395         }
396 }
397 static inline int32_t LDKBolt11SemanticError_to_cs(LDKBolt11SemanticError val) {
398         switch (val) {
399                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
400                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
401                 case LDKBolt11SemanticError_NoDescription: return 2;
402                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
403                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
404                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
405                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
406                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
407                 case LDKBolt11SemanticError_InvalidSignature: return 8;
408                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
409                 default: abort();
410         }
411 }
412 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_cs(int32_t ord) {
413         switch (ord) {
414                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
415                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
416                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
417                 case 3: return LDKBolt12SemanticError_MissingAmount;
418                 case 4: return LDKBolt12SemanticError_InvalidAmount;
419                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
420                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
421                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
422                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
423                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
424                 case 10: return LDKBolt12SemanticError_MissingDescription;
425                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
426                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
427                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
428                 case 14: return LDKBolt12SemanticError_MissingQuantity;
429                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
430                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
431                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
432                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
433                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
434                 case 20: return LDKBolt12SemanticError_MissingPayerId;
435                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
436                 case 22: return LDKBolt12SemanticError_MissingPaths;
437                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
438                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
439                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
440                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
441                 case 27: return LDKBolt12SemanticError_MissingSignature;
442                 default: abort();
443         }
444 }
445 static inline int32_t LDKBolt12SemanticError_to_cs(LDKBolt12SemanticError val) {
446         switch (val) {
447                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
448                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
449                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
450                 case LDKBolt12SemanticError_MissingAmount: return 3;
451                 case LDKBolt12SemanticError_InvalidAmount: return 4;
452                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
453                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
454                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
455                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
456                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
457                 case LDKBolt12SemanticError_MissingDescription: return 10;
458                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
459                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
460                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
461                 case LDKBolt12SemanticError_MissingQuantity: return 14;
462                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
463                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
464                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
465                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
466                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
467                 case LDKBolt12SemanticError_MissingPayerId: return 20;
468                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
469                 case LDKBolt12SemanticError_MissingPaths: return 22;
470                 case LDKBolt12SemanticError_UnexpectedPaths: return 23;
471                 case LDKBolt12SemanticError_InvalidPayInfo: return 24;
472                 case LDKBolt12SemanticError_MissingCreationTime: return 25;
473                 case LDKBolt12SemanticError_MissingPaymentHash: return 26;
474                 case LDKBolt12SemanticError_MissingSignature: return 27;
475                 default: abort();
476         }
477 }
478 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_cs(int32_t ord) {
479         switch (ord) {
480                 case 0: return LDKCOption_NoneZ_Some;
481                 case 1: return LDKCOption_NoneZ_None;
482                 default: abort();
483         }
484 }
485 static inline int32_t LDKCOption_NoneZ_to_cs(LDKCOption_NoneZ val) {
486         switch (val) {
487                 case LDKCOption_NoneZ_Some: return 0;
488                 case LDKCOption_NoneZ_None: return 1;
489                 default: abort();
490         }
491 }
492 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_cs(int32_t ord) {
493         switch (ord) {
494                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
495                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
496                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
497                 default: abort();
498         }
499 }
500 static inline int32_t LDKChannelMonitorUpdateStatus_to_cs(LDKChannelMonitorUpdateStatus val) {
501         switch (val) {
502                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
503                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
504                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
505                 default: abort();
506         }
507 }
508 static inline LDKChannelShutdownState LDKChannelShutdownState_from_cs(int32_t ord) {
509         switch (ord) {
510                 case 0: return LDKChannelShutdownState_NotShuttingDown;
511                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
512                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
513                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
514                 case 4: return LDKChannelShutdownState_ShutdownComplete;
515                 default: abort();
516         }
517 }
518 static inline int32_t LDKChannelShutdownState_to_cs(LDKChannelShutdownState val) {
519         switch (val) {
520                 case LDKChannelShutdownState_NotShuttingDown: return 0;
521                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
522                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
523                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
524                 case LDKChannelShutdownState_ShutdownComplete: return 4;
525                 default: abort();
526         }
527 }
528 static inline LDKConfirmationTarget LDKConfirmationTarget_from_cs(int32_t ord) {
529         switch (ord) {
530                 case 0: return LDKConfirmationTarget_OnChainSweep;
531                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
532                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
533                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
534                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
535                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
536                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
537                 default: abort();
538         }
539 }
540 static inline int32_t LDKConfirmationTarget_to_cs(LDKConfirmationTarget val) {
541         switch (val) {
542                 case LDKConfirmationTarget_OnChainSweep: return 0;
543                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
544                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
545                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
546                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
547                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
548                 case LDKConfirmationTarget_OutputSpendingFee: return 6;
549                 default: abort();
550         }
551 }
552 static inline LDKCreationError LDKCreationError_from_cs(int32_t ord) {
553         switch (ord) {
554                 case 0: return LDKCreationError_DescriptionTooLong;
555                 case 1: return LDKCreationError_RouteTooLong;
556                 case 2: return LDKCreationError_TimestampOutOfBounds;
557                 case 3: return LDKCreationError_InvalidAmount;
558                 case 4: return LDKCreationError_MissingRouteHints;
559                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
560                 default: abort();
561         }
562 }
563 static inline int32_t LDKCreationError_to_cs(LDKCreationError val) {
564         switch (val) {
565                 case LDKCreationError_DescriptionTooLong: return 0;
566                 case LDKCreationError_RouteTooLong: return 1;
567                 case LDKCreationError_TimestampOutOfBounds: return 2;
568                 case LDKCreationError_InvalidAmount: return 3;
569                 case LDKCreationError_MissingRouteHints: return 4;
570                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
571                 default: abort();
572         }
573 }
574 static inline LDKCurrency LDKCurrency_from_cs(int32_t ord) {
575         switch (ord) {
576                 case 0: return LDKCurrency_Bitcoin;
577                 case 1: return LDKCurrency_BitcoinTestnet;
578                 case 2: return LDKCurrency_Regtest;
579                 case 3: return LDKCurrency_Simnet;
580                 case 4: return LDKCurrency_Signet;
581                 default: abort();
582         }
583 }
584 static inline int32_t LDKCurrency_to_cs(LDKCurrency val) {
585         switch (val) {
586                 case LDKCurrency_Bitcoin: return 0;
587                 case LDKCurrency_BitcoinTestnet: return 1;
588                 case LDKCurrency_Regtest: return 2;
589                 case LDKCurrency_Simnet: return 3;
590                 case LDKCurrency_Signet: return 4;
591                 default: abort();
592         }
593 }
594 static inline LDKDirection LDKDirection_from_cs(int32_t ord) {
595         switch (ord) {
596                 case 0: return LDKDirection_NodeOne;
597                 case 1: return LDKDirection_NodeTwo;
598                 default: abort();
599         }
600 }
601 static inline int32_t LDKDirection_to_cs(LDKDirection val) {
602         switch (val) {
603                 case LDKDirection_NodeOne: return 0;
604                 case LDKDirection_NodeTwo: return 1;
605                 default: abort();
606         }
607 }
608 static inline LDKHTLCClaim LDKHTLCClaim_from_cs(int32_t ord) {
609         switch (ord) {
610                 case 0: return LDKHTLCClaim_OfferedTimeout;
611                 case 1: return LDKHTLCClaim_OfferedPreimage;
612                 case 2: return LDKHTLCClaim_AcceptedTimeout;
613                 case 3: return LDKHTLCClaim_AcceptedPreimage;
614                 case 4: return LDKHTLCClaim_Revocation;
615                 default: abort();
616         }
617 }
618 static inline int32_t LDKHTLCClaim_to_cs(LDKHTLCClaim val) {
619         switch (val) {
620                 case LDKHTLCClaim_OfferedTimeout: return 0;
621                 case LDKHTLCClaim_OfferedPreimage: return 1;
622                 case LDKHTLCClaim_AcceptedTimeout: return 2;
623                 case LDKHTLCClaim_AcceptedPreimage: return 3;
624                 case LDKHTLCClaim_Revocation: return 4;
625                 default: abort();
626         }
627 }
628 static inline LDKIOError LDKIOError_from_cs(int32_t ord) {
629         switch (ord) {
630                 case 0: return LDKIOError_NotFound;
631                 case 1: return LDKIOError_PermissionDenied;
632                 case 2: return LDKIOError_ConnectionRefused;
633                 case 3: return LDKIOError_ConnectionReset;
634                 case 4: return LDKIOError_ConnectionAborted;
635                 case 5: return LDKIOError_NotConnected;
636                 case 6: return LDKIOError_AddrInUse;
637                 case 7: return LDKIOError_AddrNotAvailable;
638                 case 8: return LDKIOError_BrokenPipe;
639                 case 9: return LDKIOError_AlreadyExists;
640                 case 10: return LDKIOError_WouldBlock;
641                 case 11: return LDKIOError_InvalidInput;
642                 case 12: return LDKIOError_InvalidData;
643                 case 13: return LDKIOError_TimedOut;
644                 case 14: return LDKIOError_WriteZero;
645                 case 15: return LDKIOError_Interrupted;
646                 case 16: return LDKIOError_Other;
647                 case 17: return LDKIOError_UnexpectedEof;
648                 default: abort();
649         }
650 }
651 static inline int32_t LDKIOError_to_cs(LDKIOError val) {
652         switch (val) {
653                 case LDKIOError_NotFound: return 0;
654                 case LDKIOError_PermissionDenied: return 1;
655                 case LDKIOError_ConnectionRefused: return 2;
656                 case LDKIOError_ConnectionReset: return 3;
657                 case LDKIOError_ConnectionAborted: return 4;
658                 case LDKIOError_NotConnected: return 5;
659                 case LDKIOError_AddrInUse: return 6;
660                 case LDKIOError_AddrNotAvailable: return 7;
661                 case LDKIOError_BrokenPipe: return 8;
662                 case LDKIOError_AlreadyExists: return 9;
663                 case LDKIOError_WouldBlock: return 10;
664                 case LDKIOError_InvalidInput: return 11;
665                 case LDKIOError_InvalidData: return 12;
666                 case LDKIOError_TimedOut: return 13;
667                 case LDKIOError_WriteZero: return 14;
668                 case LDKIOError_Interrupted: return 15;
669                 case LDKIOError_Other: return 16;
670                 case LDKIOError_UnexpectedEof: return 17;
671                 default: abort();
672         }
673 }
674 static inline LDKLevel LDKLevel_from_cs(int32_t ord) {
675         switch (ord) {
676                 case 0: return LDKLevel_Gossip;
677                 case 1: return LDKLevel_Trace;
678                 case 2: return LDKLevel_Debug;
679                 case 3: return LDKLevel_Info;
680                 case 4: return LDKLevel_Warn;
681                 case 5: return LDKLevel_Error;
682                 default: abort();
683         }
684 }
685 static inline int32_t LDKLevel_to_cs(LDKLevel val) {
686         switch (val) {
687                 case LDKLevel_Gossip: return 0;
688                 case LDKLevel_Trace: return 1;
689                 case LDKLevel_Debug: return 2;
690                 case LDKLevel_Info: return 3;
691                 case LDKLevel_Warn: return 4;
692                 case LDKLevel_Error: return 5;
693                 default: abort();
694         }
695 }
696 static inline LDKNetwork LDKNetwork_from_cs(int32_t ord) {
697         switch (ord) {
698                 case 0: return LDKNetwork_Bitcoin;
699                 case 1: return LDKNetwork_Testnet;
700                 case 2: return LDKNetwork_Regtest;
701                 case 3: return LDKNetwork_Signet;
702                 default: abort();
703         }
704 }
705 static inline int32_t LDKNetwork_to_cs(LDKNetwork val) {
706         switch (val) {
707                 case LDKNetwork_Bitcoin: return 0;
708                 case LDKNetwork_Testnet: return 1;
709                 case LDKNetwork_Regtest: return 2;
710                 case LDKNetwork_Signet: return 3;
711                 default: abort();
712         }
713 }
714 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_cs(int32_t ord) {
715         switch (ord) {
716                 case 0: return LDKPaymentFailureReason_RecipientRejected;
717                 case 1: return LDKPaymentFailureReason_UserAbandoned;
718                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
719                 case 3: return LDKPaymentFailureReason_PaymentExpired;
720                 case 4: return LDKPaymentFailureReason_RouteNotFound;
721                 case 5: return LDKPaymentFailureReason_UnexpectedError;
722                 default: abort();
723         }
724 }
725 static inline int32_t LDKPaymentFailureReason_to_cs(LDKPaymentFailureReason val) {
726         switch (val) {
727                 case LDKPaymentFailureReason_RecipientRejected: return 0;
728                 case LDKPaymentFailureReason_UserAbandoned: return 1;
729                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
730                 case LDKPaymentFailureReason_PaymentExpired: return 3;
731                 case LDKPaymentFailureReason_RouteNotFound: return 4;
732                 case LDKPaymentFailureReason_UnexpectedError: return 5;
733                 default: abort();
734         }
735 }
736 static inline LDKRecipient LDKRecipient_from_cs(int32_t ord) {
737         switch (ord) {
738                 case 0: return LDKRecipient_Node;
739                 case 1: return LDKRecipient_PhantomNode;
740                 default: abort();
741         }
742 }
743 static inline int32_t LDKRecipient_to_cs(LDKRecipient val) {
744         switch (val) {
745                 case LDKRecipient_Node: return 0;
746                 case LDKRecipient_PhantomNode: return 1;
747                 default: abort();
748         }
749 }
750 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_cs(int32_t ord) {
751         switch (ord) {
752                 case 0: return LDKRetryableSendFailure_PaymentExpired;
753                 case 1: return LDKRetryableSendFailure_RouteNotFound;
754                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
755                 default: abort();
756         }
757 }
758 static inline int32_t LDKRetryableSendFailure_to_cs(LDKRetryableSendFailure val) {
759         switch (val) {
760                 case LDKRetryableSendFailure_PaymentExpired: return 0;
761                 case LDKRetryableSendFailure_RouteNotFound: return 1;
762                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
763                 default: abort();
764         }
765 }
766 static inline LDKSecp256k1Error LDKSecp256k1Error_from_cs(int32_t ord) {
767         switch (ord) {
768                 case 0: return LDKSecp256k1Error_IncorrectSignature;
769                 case 1: return LDKSecp256k1Error_InvalidMessage;
770                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
771                 case 3: return LDKSecp256k1Error_InvalidSignature;
772                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
773                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
774                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
775                 case 7: return LDKSecp256k1Error_InvalidTweak;
776                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
777                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
778                 case 10: return LDKSecp256k1Error_InvalidParityValue;
779                 default: abort();
780         }
781 }
782 static inline int32_t LDKSecp256k1Error_to_cs(LDKSecp256k1Error val) {
783         switch (val) {
784                 case LDKSecp256k1Error_IncorrectSignature: return 0;
785                 case LDKSecp256k1Error_InvalidMessage: return 1;
786                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
787                 case LDKSecp256k1Error_InvalidSignature: return 3;
788                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
789                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
790                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
791                 case LDKSecp256k1Error_InvalidTweak: return 7;
792                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
793                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
794                 case LDKSecp256k1Error_InvalidParityValue: return 10;
795                 default: abort();
796         }
797 }
798 static inline LDKShortChannelIdError LDKShortChannelIdError_from_cs(int32_t ord) {
799         switch (ord) {
800                 case 0: return LDKShortChannelIdError_BlockOverflow;
801                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
802                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
803                 default: abort();
804         }
805 }
806 static inline int32_t LDKShortChannelIdError_to_cs(LDKShortChannelIdError val) {
807         switch (val) {
808                 case LDKShortChannelIdError_BlockOverflow: return 0;
809                 case LDKShortChannelIdError_TxIndexOverflow: return 1;
810                 case LDKShortChannelIdError_VoutIndexOverflow: return 2;
811                 default: abort();
812         }
813 }
814 static inline LDKSiPrefix LDKSiPrefix_from_cs(int32_t ord) {
815         switch (ord) {
816                 case 0: return LDKSiPrefix_Milli;
817                 case 1: return LDKSiPrefix_Micro;
818                 case 2: return LDKSiPrefix_Nano;
819                 case 3: return LDKSiPrefix_Pico;
820                 default: abort();
821         }
822 }
823 static inline int32_t LDKSiPrefix_to_cs(LDKSiPrefix val) {
824         switch (val) {
825                 case LDKSiPrefix_Milli: return 0;
826                 case LDKSiPrefix_Micro: return 1;
827                 case LDKSiPrefix_Nano: return 2;
828                 case LDKSiPrefix_Pico: return 3;
829                 default: abort();
830         }
831 }
832 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_cs(int32_t ord) {
833         switch (ord) {
834                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
835                 case 1: return LDKSocketAddressParseError_InvalidInput;
836                 case 2: return LDKSocketAddressParseError_InvalidPort;
837                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
838                 default: abort();
839         }
840 }
841 static inline int32_t LDKSocketAddressParseError_to_cs(LDKSocketAddressParseError val) {
842         switch (val) {
843                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
844                 case LDKSocketAddressParseError_InvalidInput: return 1;
845                 case LDKSocketAddressParseError_InvalidPort: return 2;
846                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
847                 default: abort();
848         }
849 }
850 static inline LDKUtxoLookupError LDKUtxoLookupError_from_cs(int32_t ord) {
851         switch (ord) {
852                 case 0: return LDKUtxoLookupError_UnknownChain;
853                 case 1: return LDKUtxoLookupError_UnknownTx;
854                 default: abort();
855         }
856 }
857 static inline int32_t LDKUtxoLookupError_to_cs(LDKUtxoLookupError val) {
858         switch (val) {
859                 case LDKUtxoLookupError_UnknownChain: return 0;
860                 case LDKUtxoLookupError_UnknownTx: return 1;
861                 default: abort();
862         }
863 }
864 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
865         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
866         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
867         return ret;
868 }
869 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
870         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
871         return ret;
872 }
873 int8_tArray  CS_LDK_BigEndianScalar_get_bytes(int64_t thing) {
874         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
875         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
876         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
877         return ret_arr;
878 }
879
880 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
881 void  CS_LDK_BigEndianScalar_free(int64_t thing) {
882         if (!ptr_is_owned(thing)) return;
883         void* thing_ptr = untag_ptr(thing);
884         CHECK_ACCESS(thing_ptr);
885         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
886         FREE(untag_ptr(thing));
887         BigEndianScalar_free(thing_conv);
888 }
889
890 uint32_t CS_LDK_LDKBech32Error_ty_from_ptr(int64_t ptr) {
891         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
892         switch(obj->tag) {
893                 case LDKBech32Error_MissingSeparator: return 0;
894                 case LDKBech32Error_InvalidChecksum: return 1;
895                 case LDKBech32Error_InvalidLength: return 2;
896                 case LDKBech32Error_InvalidChar: return 3;
897                 case LDKBech32Error_InvalidData: return 4;
898                 case LDKBech32Error_InvalidPadding: return 5;
899                 case LDKBech32Error_MixedCase: return 6;
900                 default: abort();
901         }
902 }
903 int32_t CS_LDK_LDKBech32Error_InvalidChar_get_invalid_char(int64_t ptr) {
904         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
905         CHECK(obj->tag == LDKBech32Error_InvalidChar);
906         int32_t invalid_char_conv = obj->invalid_char;
907         return invalid_char_conv;
908 }
909 int8_t CS_LDK_LDKBech32Error_InvalidData_get_invalid_data(int64_t ptr) {
910         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
911         CHECK(obj->tag == LDKBech32Error_InvalidData);
912         int8_t invalid_data_conv = obj->invalid_data;
913         return invalid_data_conv;
914 }
915 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
916         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
917         ret.is_owned = false;
918         return ret;
919 }
920 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
921         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
922         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
923         int64_t ret_ref = 0;
924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
926         return ret_ref;
927 }
928
929 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
930 CHECK(!owner->result_ok);
931         return Bolt12SemanticError_clone(&*owner->contents.err);
932 }
933 int32_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
934         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
935         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
936         return ret_conv;
937 }
938
939 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
940         LDKRefund ret = *owner->contents.result;
941         ret.is_owned = false;
942         return ret;
943 }
944 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_get_ok(int64_t owner) {
945         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
946         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
947         int64_t ret_ref = 0;
948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
950         return ret_ref;
951 }
952
953 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
954 CHECK(!owner->result_ok);
955         return Bolt12SemanticError_clone(&*owner->contents.err);
956 }
957 int32_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_get_err(int64_t owner) {
958         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
959         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
960         return ret_conv;
961 }
962
963 uint32_t CS_LDK_LDKCOption_u64Z_ty_from_ptr(int64_t ptr) {
964         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
965         switch(obj->tag) {
966                 case LDKCOption_u64Z_Some: return 0;
967                 case LDKCOption_u64Z_None: return 1;
968                 default: abort();
969         }
970 }
971 int64_t CS_LDK_LDKCOption_u64Z_Some_get_some(int64_t ptr) {
972         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
973         CHECK(obj->tag == LDKCOption_u64Z_Some);
974         int64_t some_conv = obj->some;
975         return some_conv;
976 }
977 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
978         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
979         for (size_t i = 0; i < ret.datalen; i++) {
980                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
981         }
982         return ret;
983 }
984 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
985         LDKRefund ret = *owner->contents.result;
986         ret.is_owned = false;
987         return ret;
988 }
989 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_ok(int64_t owner) {
990         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
991         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
992         int64_t ret_ref = 0;
993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
995         return ret_ref;
996 }
997
998 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
999         LDKBolt12ParseError ret = *owner->contents.err;
1000         ret.is_owned = false;
1001         return ret;
1002 }
1003 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_err(int64_t owner) {
1004         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1005         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1006         int64_t ret_ref = 0;
1007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1009         return ret_ref;
1010 }
1011
1012 uint32_t CS_LDK_LDKRetry_ty_from_ptr(int64_t ptr) {
1013         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1014         switch(obj->tag) {
1015                 case LDKRetry_Attempts: return 0;
1016                 case LDKRetry_Timeout: return 1;
1017                 default: abort();
1018         }
1019 }
1020 int32_t CS_LDK_LDKRetry_Attempts_get_attempts(int64_t ptr) {
1021         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1022         CHECK(obj->tag == LDKRetry_Attempts);
1023         int32_t attempts_conv = obj->attempts;
1024         return attempts_conv;
1025 }
1026 int64_t CS_LDK_LDKRetry_Timeout_get_timeout(int64_t ptr) {
1027         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1028         CHECK(obj->tag == LDKRetry_Timeout);
1029         int64_t timeout_conv = obj->timeout;
1030         return timeout_conv;
1031 }
1032 uint32_t CS_LDK_LDKDecodeError_ty_from_ptr(int64_t ptr) {
1033         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1034         switch(obj->tag) {
1035                 case LDKDecodeError_UnknownVersion: return 0;
1036                 case LDKDecodeError_UnknownRequiredFeature: return 1;
1037                 case LDKDecodeError_InvalidValue: return 2;
1038                 case LDKDecodeError_ShortRead: return 3;
1039                 case LDKDecodeError_BadLengthDescriptor: return 4;
1040                 case LDKDecodeError_Io: return 5;
1041                 case LDKDecodeError_UnsupportedCompression: return 6;
1042                 case LDKDecodeError_DangerousValue: return 7;
1043                 default: abort();
1044         }
1045 }
1046 int32_t CS_LDK_LDKDecodeError_Io_get_io(int64_t ptr) {
1047         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1048         CHECK(obj->tag == LDKDecodeError_Io);
1049         int32_t io_conv = LDKIOError_to_cs(obj->io);
1050         return io_conv;
1051 }
1052 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1053 CHECK(owner->result_ok);
1054         return Retry_clone(&*owner->contents.result);
1055 }
1056 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_ok(int64_t owner) {
1057         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1058         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1059         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1060         int64_t ret_ref = tag_ptr(ret_copy, true);
1061         return ret_ref;
1062 }
1063
1064 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1065 CHECK(!owner->result_ok);
1066         return DecodeError_clone(&*owner->contents.err);
1067 }
1068 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_err(int64_t owner) {
1069         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1070         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1071         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1072         int64_t ret_ref = tag_ptr(ret_copy, true);
1073         return ret_ref;
1074 }
1075
1076 uint32_t CS_LDK_LDKAPIError_ty_from_ptr(int64_t ptr) {
1077         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1078         switch(obj->tag) {
1079                 case LDKAPIError_APIMisuseError: return 0;
1080                 case LDKAPIError_FeeRateTooHigh: return 1;
1081                 case LDKAPIError_InvalidRoute: return 2;
1082                 case LDKAPIError_ChannelUnavailable: return 3;
1083                 case LDKAPIError_MonitorUpdateInProgress: return 4;
1084                 case LDKAPIError_IncompatibleShutdownScript: return 5;
1085                 default: abort();
1086         }
1087 }
1088 jstring CS_LDK_LDKAPIError_APIMisuseError_get_err(int64_t ptr) {
1089         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1090         CHECK(obj->tag == LDKAPIError_APIMisuseError);
1091         LDKStr err_str = obj->api_misuse_error.err;
1092                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1093         return err_conv;
1094 }
1095 jstring CS_LDK_LDKAPIError_FeeRateTooHigh_get_err(int64_t ptr) {
1096         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1097         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1098         LDKStr err_str = obj->fee_rate_too_high.err;
1099                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1100         return err_conv;
1101 }
1102 int32_t CS_LDK_LDKAPIError_FeeRateTooHigh_get_feerate(int64_t ptr) {
1103         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1104         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1105         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1106         return feerate_conv;
1107 }
1108 jstring CS_LDK_LDKAPIError_InvalidRoute_get_err(int64_t ptr) {
1109         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1110         CHECK(obj->tag == LDKAPIError_InvalidRoute);
1111         LDKStr err_str = obj->invalid_route.err;
1112                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1113         return err_conv;
1114 }
1115 jstring CS_LDK_LDKAPIError_ChannelUnavailable_get_err(int64_t ptr) {
1116         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1117         CHECK(obj->tag == LDKAPIError_ChannelUnavailable);
1118         LDKStr err_str = obj->channel_unavailable.err;
1119                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1120         return err_conv;
1121 }
1122 int64_t CS_LDK_LDKAPIError_IncompatibleShutdownScript_get_script(int64_t ptr) {
1123         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1124         CHECK(obj->tag == LDKAPIError_IncompatibleShutdownScript);
1125         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1126                         int64_t script_ref = 0;
1127                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1128                         script_ref = tag_ptr(script_var.inner, false);
1129         return script_ref;
1130 }
1131 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1132 CHECK(owner->result_ok);
1133         return *owner->contents.result;
1134 }
1135 void  CS_LDK_CResult_NoneAPIErrorZ_get_ok(int64_t owner) {
1136         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1137         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1138 }
1139
1140 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1141 CHECK(!owner->result_ok);
1142         return APIError_clone(&*owner->contents.err);
1143 }
1144 int64_t  CS_LDK_CResult_NoneAPIErrorZ_get_err(int64_t owner) {
1145         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1146         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1147         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1148         int64_t ret_ref = tag_ptr(ret_copy, true);
1149         return ret_ref;
1150 }
1151
1152 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1153         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1154         for (size_t i = 0; i < ret.datalen; i++) {
1155                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1156         }
1157         return ret;
1158 }
1159 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1160         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1161         for (size_t i = 0; i < ret.datalen; i++) {
1162                 ret.data[i] = APIError_clone(&orig->data[i]);
1163         }
1164         return ret;
1165 }
1166 uint32_t CS_LDK_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(int64_t ptr) {
1167         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1168         switch(obj->tag) {
1169                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
1170                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
1171                 default: abort();
1172         }
1173 }
1174 int8_tArray CS_LDK_LDKCOption_ThirtyTwoBytesZ_Some_get_some(int64_t ptr) {
1175         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1176         CHECK(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
1177         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1178         memcpy(some_arr->elems, obj->some.data, 32);
1179         return some_arr;
1180 }
1181 uint32_t CS_LDK_LDKCOption_CVec_u8ZZ_ty_from_ptr(int64_t ptr) {
1182         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1183         switch(obj->tag) {
1184                 case LDKCOption_CVec_u8ZZ_Some: return 0;
1185                 case LDKCOption_CVec_u8ZZ_None: return 1;
1186                 default: abort();
1187         }
1188 }
1189 int8_tArray CS_LDK_LDKCOption_CVec_u8ZZ_Some_get_some(int64_t ptr) {
1190         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1191         CHECK(obj->tag == LDKCOption_CVec_u8ZZ_Some);
1192         LDKCVec_u8Z some_var = obj->some;
1193                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
1194                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
1195         return some_arr;
1196 }
1197 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1198         LDKRecipientOnionFields ret = *owner->contents.result;
1199         ret.is_owned = false;
1200         return ret;
1201 }
1202 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(int64_t owner) {
1203         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1204         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1205         int64_t ret_ref = 0;
1206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1208         return ret_ref;
1209 }
1210
1211 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1212 CHECK(!owner->result_ok);
1213         return DecodeError_clone(&*owner->contents.err);
1214 }
1215 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(int64_t owner) {
1216         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1218         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1219         int64_t ret_ref = tag_ptr(ret_copy, true);
1220         return ret_ref;
1221 }
1222
1223 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1224         return owner->a;
1225 }
1226 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_a(int64_t owner) {
1227         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1228         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1229         return ret_conv;
1230 }
1231
1232 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1233         return CVec_u8Z_clone(&owner->b);
1234 }
1235 int8_tArray  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_b(int64_t owner) {
1236         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1237         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1238         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1239         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1240         CVec_u8Z_free(ret_var);
1241         return ret_arr;
1242 }
1243
1244 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1245         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1246         for (size_t i = 0; i < ret.datalen; i++) {
1247                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1248         }
1249         return ret;
1250 }
1251 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1252         LDKRecipientOnionFields ret = *owner->contents.result;
1253         ret.is_owned = false;
1254         return ret;
1255 }
1256 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_ok(int64_t owner) {
1257         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1258         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1259         int64_t ret_ref = 0;
1260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1262         return ret_ref;
1263 }
1264
1265 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1266 CHECK(!owner->result_ok);
1267         return *owner->contents.err;
1268 }
1269 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_err(int64_t owner) {
1270         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1271         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1272 }
1273
1274 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1275         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
1276         ret.is_owned = false;
1277         return ret;
1278 }
1279 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(int64_t owner) {
1280         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1281         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1282         int64_t ret_ref = 0;
1283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1285         return ret_ref;
1286 }
1287
1288 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1289 CHECK(!owner->result_ok);
1290         return Bolt12SemanticError_clone(&*owner->contents.err);
1291 }
1292 int32_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(int64_t owner) {
1293         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1294         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1295         return ret_conv;
1296 }
1297
1298 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1299         LDKBolt12Invoice ret = *owner->contents.result;
1300         ret.is_owned = false;
1301         return ret;
1302 }
1303 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(int64_t owner) {
1304         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1305         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1306         int64_t ret_ref = 0;
1307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1309         return ret_ref;
1310 }
1311
1312 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1313 CHECK(!owner->result_ok);
1314         return Bolt12SemanticError_clone(&*owner->contents.err);
1315 }
1316 int32_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(int64_t owner) {
1317         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1318         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1319         return ret_conv;
1320 }
1321
1322 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1323 CHECK(owner->result_ok);
1324         return *owner->contents.result;
1325 }
1326 int8_tArray  CS_LDK_CResult_SchnorrSignatureNoneZ_get_ok(int64_t owner) {
1327         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1328         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1329         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1330         return ret_arr;
1331 }
1332
1333 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1334 CHECK(!owner->result_ok);
1335         return *owner->contents.err;
1336 }
1337 void  CS_LDK_CResult_SchnorrSignatureNoneZ_get_err(int64_t owner) {
1338         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1339         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1340 }
1341
1342 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1343         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1344         for (size_t i = 0; i < ret.datalen; i++) {
1345                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1346         }
1347         return ret;
1348 }
1349 uint32_t CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(int64_t ptr) {
1350         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1351         switch(obj->tag) {
1352                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1353                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1354                 default: abort();
1355         }
1356 }
1357 ptrArray CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(int64_t ptr) {
1358         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1359         CHECK(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1360         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1361                         ptrArray some_arr = NULL;
1362                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1363                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1364                         for (size_t i = 0; i < some_var.datalen; i++) {
1365                                 int8_tArray some_conv_8_arr = init_int8_tArray(32, __LINE__);
1366                                 memcpy(some_conv_8_arr->elems, some_var.data[i].data, 32);
1367                                 some_arr_ptr[i] = some_conv_8_arr;
1368                         }
1369                         
1370         return some_arr;
1371 }
1372 uint32_t CS_LDK_LDKAmount_ty_from_ptr(int64_t ptr) {
1373         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1374         switch(obj->tag) {
1375                 case LDKAmount_Bitcoin: return 0;
1376                 case LDKAmount_Currency: return 1;
1377                 default: abort();
1378         }
1379 }
1380 int64_t CS_LDK_LDKAmount_Bitcoin_get_amount_msats(int64_t ptr) {
1381         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1382         CHECK(obj->tag == LDKAmount_Bitcoin);
1383         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
1384         return amount_msats_conv;
1385 }
1386 int8_tArray CS_LDK_LDKAmount_Currency_get_iso4217_code(int64_t ptr) {
1387         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1388         CHECK(obj->tag == LDKAmount_Currency);
1389         int8_tArray iso4217_code_arr = init_int8_tArray(3, __LINE__);
1390         memcpy(iso4217_code_arr->elems, obj->currency.iso4217_code.data, 3);
1391         return iso4217_code_arr;
1392 }
1393 int64_t CS_LDK_LDKAmount_Currency_get_amount(int64_t ptr) {
1394         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1395         CHECK(obj->tag == LDKAmount_Currency);
1396         int64_t amount_conv = obj->currency.amount;
1397         return amount_conv;
1398 }
1399 uint32_t CS_LDK_LDKCOption_AmountZ_ty_from_ptr(int64_t ptr) {
1400         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1401         switch(obj->tag) {
1402                 case LDKCOption_AmountZ_Some: return 0;
1403                 case LDKCOption_AmountZ_None: return 1;
1404                 default: abort();
1405         }
1406 }
1407 int64_t CS_LDK_LDKCOption_AmountZ_Some_get_some(int64_t ptr) {
1408         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1409         CHECK(obj->tag == LDKCOption_AmountZ_Some);
1410         int64_t some_ref = tag_ptr(&obj->some, false);
1411         return some_ref;
1412 }
1413 uint32_t CS_LDK_LDKQuantity_ty_from_ptr(int64_t ptr) {
1414         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1415         switch(obj->tag) {
1416                 case LDKQuantity_Bounded: return 0;
1417                 case LDKQuantity_Unbounded: return 1;
1418                 case LDKQuantity_One: return 2;
1419                 default: abort();
1420         }
1421 }
1422 int64_t CS_LDK_LDKQuantity_Bounded_get_bounded(int64_t ptr) {
1423         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1424         CHECK(obj->tag == LDKQuantity_Bounded);
1425         int64_t bounded_conv = obj->bounded;
1426         return bounded_conv;
1427 }
1428 uint32_t CS_LDK_LDKCOption_QuantityZ_ty_from_ptr(int64_t ptr) {
1429         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1430         switch(obj->tag) {
1431                 case LDKCOption_QuantityZ_Some: return 0;
1432                 case LDKCOption_QuantityZ_None: return 1;
1433                 default: abort();
1434         }
1435 }
1436 int64_t CS_LDK_LDKCOption_QuantityZ_Some_get_some(int64_t ptr) {
1437         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1438         CHECK(obj->tag == LDKCOption_QuantityZ_Some);
1439         int64_t some_ref = tag_ptr(&obj->some, false);
1440         return some_ref;
1441 }
1442 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1443 CHECK(owner->result_ok);
1444         return ThirtyTwoBytes_clone(&*owner->contents.result);
1445 }
1446 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_ok(int64_t owner) {
1447         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1448         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1449         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1450         return ret_arr;
1451 }
1452
1453 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1454 CHECK(!owner->result_ok);
1455         return *owner->contents.err;
1456 }
1457 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_err(int64_t owner) {
1458         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1459         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1460 }
1461
1462 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1463         LDKBlindedPayInfo ret = *owner->contents.result;
1464         ret.is_owned = false;
1465         return ret;
1466 }
1467 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_ok(int64_t owner) {
1468         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1469         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1470         int64_t ret_ref = 0;
1471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1473         return ret_ref;
1474 }
1475
1476 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1477 CHECK(!owner->result_ok);
1478         return DecodeError_clone(&*owner->contents.err);
1479 }
1480 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_err(int64_t owner) {
1481         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1483         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1484         int64_t ret_ref = tag_ptr(ret_copy, true);
1485         return ret_ref;
1486 }
1487
1488 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1489         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1490         ret.is_owned = false;
1491         return ret;
1492 }
1493 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1494         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1495         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1496         int64_t ret_ref = 0;
1497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1499         return ret_ref;
1500 }
1501
1502 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1503 CHECK(!owner->result_ok);
1504         return DecodeError_clone(&*owner->contents.err);
1505 }
1506 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1507         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1509         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1510         int64_t ret_ref = tag_ptr(ret_copy, true);
1511         return ret_ref;
1512 }
1513
1514 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1515         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1516         ret.is_owned = false;
1517         return ret;
1518 }
1519 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1520         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1521         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1522         int64_t ret_ref = 0;
1523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1525         return ret_ref;
1526 }
1527
1528 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1529 CHECK(!owner->result_ok);
1530         return DecodeError_clone(&*owner->contents.err);
1531 }
1532 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1533         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1535         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1536         int64_t ret_ref = tag_ptr(ret_copy, true);
1537         return ret_ref;
1538 }
1539
1540 uint32_t CS_LDK_LDKSpendableOutputDescriptor_ty_from_ptr(int64_t ptr) {
1541         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1542         switch(obj->tag) {
1543                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1544                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1545                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1546                 default: abort();
1547         }
1548 }
1549 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(int64_t ptr) {
1550         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1551         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1552         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1553                         int64_t outpoint_ref = 0;
1554                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1555                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1556         return outpoint_ref;
1557 }
1558 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_output(int64_t ptr) {
1559         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1560         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1561         LDKTxOut* output_ref = &obj->static_output.output;
1562         return tag_ptr(output_ref, false);
1563 }
1564 int8_tArray CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(int64_t ptr) {
1565         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1566         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1567         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1568         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1569         return channel_keys_id_arr;
1570 }
1571 int64_t CS_LDK_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(int64_t ptr) {
1572         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1573         CHECK(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1574         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1575                         int64_t delayed_payment_output_ref = 0;
1576                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1577                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1578         return delayed_payment_output_ref;
1579 }
1580 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(int64_t ptr) {
1581         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1582         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1583         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1584                         int64_t static_payment_output_ref = 0;
1585                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1586                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1587         return static_payment_output_ref;
1588 }
1589 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1590 CHECK(owner->result_ok);
1591         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1592 }
1593 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1594         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1595         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1596         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1597         int64_t ret_ref = tag_ptr(ret_copy, true);
1598         return ret_ref;
1599 }
1600
1601 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1602 CHECK(!owner->result_ok);
1603         return DecodeError_clone(&*owner->contents.err);
1604 }
1605 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1606         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1608         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1609         int64_t ret_ref = tag_ptr(ret_copy, true);
1610         return ret_ref;
1611 }
1612
1613 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1614         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1615         for (size_t i = 0; i < ret.datalen; i++) {
1616                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1617         }
1618         return ret;
1619 }
1620 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1621         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1622         for (size_t i = 0; i < ret.datalen; i++) {
1623                 ret.data[i] = TxOut_clone(&orig->data[i]);
1624         }
1625         return ret;
1626 }
1627 uint32_t CS_LDK_LDKCOption_u32Z_ty_from_ptr(int64_t ptr) {
1628         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1629         switch(obj->tag) {
1630                 case LDKCOption_u32Z_Some: return 0;
1631                 case LDKCOption_u32Z_None: return 1;
1632                 default: abort();
1633         }
1634 }
1635 int32_t CS_LDK_LDKCOption_u32Z_Some_get_some(int64_t ptr) {
1636         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1637         CHECK(obj->tag == LDKCOption_u32Z_Some);
1638         int32_t some_conv = obj->some;
1639         return some_conv;
1640 }
1641 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1642         return CVec_u8Z_clone(&owner->a);
1643 }
1644 int8_tArray  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_a(int64_t owner) {
1645         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1646         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1649         CVec_u8Z_free(ret_var);
1650         return ret_arr;
1651 }
1652
1653 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1654         return owner->b;
1655 }
1656 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_b(int64_t owner) {
1657         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1658         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1659         return ret_conv;
1660 }
1661
1662 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1663 CHECK(owner->result_ok);
1664         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1665 }
1666 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(int64_t owner) {
1667         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1668         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1669         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1670         return tag_ptr(ret_conv, true);
1671 }
1672
1673 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1674 CHECK(!owner->result_ok);
1675         return *owner->contents.err;
1676 }
1677 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(int64_t owner) {
1678         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1679         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1680 }
1681
1682 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1683         LDKChannelDerivationParameters ret = *owner->contents.result;
1684         ret.is_owned = false;
1685         return ret;
1686 }
1687 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(int64_t owner) {
1688         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1689         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1690         int64_t ret_ref = 0;
1691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1693         return ret_ref;
1694 }
1695
1696 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1697 CHECK(!owner->result_ok);
1698         return DecodeError_clone(&*owner->contents.err);
1699 }
1700 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(int64_t owner) {
1701         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1702         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1703         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1704         int64_t ret_ref = tag_ptr(ret_copy, true);
1705         return ret_ref;
1706 }
1707
1708 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1709         LDKHTLCDescriptor ret = *owner->contents.result;
1710         ret.is_owned = false;
1711         return ret;
1712 }
1713 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1714         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1715         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1716         int64_t ret_ref = 0;
1717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1719         return ret_ref;
1720 }
1721
1722 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1723 CHECK(!owner->result_ok);
1724         return DecodeError_clone(&*owner->contents.err);
1725 }
1726 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_err(int64_t owner) {
1727         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1728         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1729         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1730         int64_t ret_ref = tag_ptr(ret_copy, true);
1731         return ret_ref;
1732 }
1733
1734 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1735 CHECK(owner->result_ok);
1736         return *owner->contents.result;
1737 }
1738 void  CS_LDK_CResult_NoneNoneZ_get_ok(int64_t owner) {
1739         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1740         CResult_NoneNoneZ_get_ok(owner_conv);
1741 }
1742
1743 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1744 CHECK(!owner->result_ok);
1745         return *owner->contents.err;
1746 }
1747 void  CS_LDK_CResult_NoneNoneZ_get_err(int64_t owner) {
1748         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1749         CResult_NoneNoneZ_get_err(owner_conv);
1750 }
1751
1752 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1753 CHECK(owner->result_ok);
1754         return *owner->contents.result;
1755 }
1756 int8_tArray  CS_LDK_CResult_PublicKeyNoneZ_get_ok(int64_t owner) {
1757         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1758         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1759         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1760         return ret_arr;
1761 }
1762
1763 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1764 CHECK(!owner->result_ok);
1765         return *owner->contents.err;
1766 }
1767 void  CS_LDK_CResult_PublicKeyNoneZ_get_err(int64_t owner) {
1768         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1769         CResult_PublicKeyNoneZ_get_err(owner_conv);
1770 }
1771
1772 uint32_t CS_LDK_LDKCOption_BigEndianScalarZ_ty_from_ptr(int64_t ptr) {
1773         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1774         switch(obj->tag) {
1775                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1776                 case LDKCOption_BigEndianScalarZ_None: return 1;
1777                 default: abort();
1778         }
1779 }
1780 int64_t CS_LDK_LDKCOption_BigEndianScalarZ_Some_get_some(int64_t ptr) {
1781         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1782         CHECK(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1783         LDKBigEndianScalar* some_ref = &obj->some;
1784         return tag_ptr(some_ref, false);
1785 }
1786 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1787 CHECK(owner->result_ok);
1788         return *owner->contents.result;
1789 }
1790 int8_tArray  CS_LDK_CResult_RecoverableSignatureNoneZ_get_ok(int64_t owner) {
1791         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1792         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1793         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1794         return ret_arr;
1795 }
1796
1797 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1798 CHECK(!owner->result_ok);
1799         return *owner->contents.err;
1800 }
1801 void  CS_LDK_CResult_RecoverableSignatureNoneZ_get_err(int64_t owner) {
1802         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1803         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1804 }
1805
1806 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1807 CHECK(owner->result_ok);
1808         return *owner->contents.result;
1809 }
1810 int8_tArray  CS_LDK_CResult_ECDSASignatureNoneZ_get_ok(int64_t owner) {
1811         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1812         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1813         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1814         return ret_arr;
1815 }
1816
1817 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1818 CHECK(!owner->result_ok);
1819         return *owner->contents.err;
1820 }
1821 void  CS_LDK_CResult_ECDSASignatureNoneZ_get_err(int64_t owner) {
1822         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1823         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1824 }
1825
1826 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1827 CHECK(owner->result_ok);
1828         return *owner->contents.result;
1829 }
1830 int8_tArray  CS_LDK_CResult_TransactionNoneZ_get_ok(int64_t owner) {
1831         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1832         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
1833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1835         return ret_arr;
1836 }
1837
1838 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1839 CHECK(!owner->result_ok);
1840         return *owner->contents.err;
1841 }
1842 void  CS_LDK_CResult_TransactionNoneZ_get_err(int64_t owner) {
1843         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1844         CResult_TransactionNoneZ_get_err(owner_conv);
1845 }
1846
1847 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1848         return owner->a;
1849 }
1850 int8_tArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(int64_t owner) {
1851         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1852         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1853         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1854         return ret_arr;
1855 }
1856
1857 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1858         return owner->b;
1859 }
1860 ptrArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(int64_t owner) {
1861         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1862         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1863         ptrArray ret_arr = NULL;
1864         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1865         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1866         for (size_t i = 0; i < ret_var.datalen; i++) {
1867                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
1868                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
1869                 ret_arr_ptr[i] = ret_conv_8_arr;
1870         }
1871         
1872         return ret_arr;
1873 }
1874
1875 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1876 CHECK(owner->result_ok);
1877         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1878 }
1879 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(int64_t owner) {
1880         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1881         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1882         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1883         return tag_ptr(ret_conv, true);
1884 }
1885
1886 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1887 CHECK(!owner->result_ok);
1888         return *owner->contents.err;
1889 }
1890 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(int64_t owner) {
1891         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1892         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1893 }
1894
1895 typedef struct LDKChannelSigner_JCalls {
1896         atomic_size_t refcnt;
1897         uint32_t instance_ptr;
1898 } LDKChannelSigner_JCalls;
1899 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1900         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1901         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1902                 FREE(j_calls);
1903         }
1904 }
1905 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1906         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1907         int64_t idx_conv = idx;
1908         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 0, idx_conv);
1909         LDKPublicKey ret_ref;
1910         CHECK(ret->arr_len == 33);
1911         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1912         return ret_ref;
1913 }
1914 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1915         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1916         int64_t idx_conv = idx;
1917         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 1, idx_conv);
1918         LDKThirtyTwoBytes ret_ref;
1919         CHECK(ret->arr_len == 32);
1920         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1921         return ret_ref;
1922 }
1923 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1924         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1925         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1926         int64_t holder_tx_ref = 0;
1927         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1928         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1929         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1930         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1931         ptrArray outbound_htlc_preimages_arr = NULL;
1932         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1933         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1934         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1935                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1936                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1937                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1938         }
1939         
1940         FREE(outbound_htlc_preimages_var.data);
1941         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 2, holder_tx_ref, (int64_t)outbound_htlc_preimages_arr);
1942         void* ret_ptr = untag_ptr(ret);
1943         CHECK_ACCESS(ret_ptr);
1944         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1945         FREE(untag_ptr(ret));
1946         return ret_conv;
1947 }
1948 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1949         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1950         int64_t idx_conv = idx;
1951         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1952         memcpy(secret_arr->elems, *secret, 32);
1953         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 3, idx_conv, (int64_t)secret_arr);
1954         void* ret_ptr = untag_ptr(ret);
1955         CHECK_ACCESS(ret_ptr);
1956         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1957         FREE(untag_ptr(ret));
1958         return ret_conv;
1959 }
1960 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1961         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1962         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 4);
1963         LDKThirtyTwoBytes ret_ref;
1964         CHECK(ret->arr_len == 32);
1965         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1966         return ret_ref;
1967 }
1968 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1969         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1970         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1971         int64_t channel_parameters_ref = 0;
1972         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1973         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1974         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1975         js_invoke_function_void_l(j_calls->instance_ptr, 5, channel_parameters_ref);
1976 }
1977 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1978         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1979         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1980 }
1981 static inline LDKChannelSigner LDKChannelSigner_init (int64_t o, int64_t pubkeys) {
1982         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1983         atomic_init(&calls->refcnt, 1);
1984         calls->instance_ptr = o;
1985
1986         LDKChannelPublicKeys pubkeys_conv;
1987         pubkeys_conv.inner = untag_ptr(pubkeys);
1988         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1989         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1990
1991         LDKChannelSigner ret = {
1992                 .this_arg = (void*) calls,
1993                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1994                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1995                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1996                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1997                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1998                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1999                 .free = LDKChannelSigner_JCalls_free,
2000                 .pubkeys = pubkeys_conv,
2001                 .set_pubkeys = NULL,
2002         };
2003         return ret;
2004 }
2005 uint64_t  CS_LDK_LDKChannelSigner_new(int32_t o, int64_t pubkeys) {
2006         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2007         *res_ptr = LDKChannelSigner_init(o, pubkeys);
2008         return tag_ptr(res_ptr, true);
2009 }
2010 int8_tArray  CS_LDK_ChannelSigner_get_per_commitment_point(int64_t this_arg, int64_t idx) {
2011         void* this_arg_ptr = untag_ptr(this_arg);
2012         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2013         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2014         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2015         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2016         return ret_arr;
2017 }
2018
2019 int8_tArray  CS_LDK_ChannelSigner_release_commitment_secret(int64_t this_arg, int64_t idx) {
2020         void* this_arg_ptr = untag_ptr(this_arg);
2021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2022         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2023         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2024         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2025         return ret_arr;
2026 }
2027
2028 int64_t  CS_LDK_ChannelSigner_validate_holder_commitment(int64_t this_arg, int64_t holder_tx, ptrArray outbound_htlc_preimages) {
2029         void* this_arg_ptr = untag_ptr(this_arg);
2030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2031         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2032         LDKHolderCommitmentTransaction holder_tx_conv;
2033         holder_tx_conv.inner = untag_ptr(holder_tx);
2034         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2035         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2036         holder_tx_conv.is_owned = false;
2037         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2038         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2039         if (outbound_htlc_preimages_constr.datalen > 0)
2040                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2041         else
2042                 outbound_htlc_preimages_constr.data = NULL;
2043         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2044         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2045                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2046                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2047                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2048                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2049                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2050         }
2051         FREE(outbound_htlc_preimages);
2052         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2053         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
2054         return tag_ptr(ret_conv, true);
2055 }
2056
2057 int64_t  CS_LDK_ChannelSigner_validate_counterparty_revocation(int64_t this_arg, int64_t idx, int8_tArray secret) {
2058         void* this_arg_ptr = untag_ptr(this_arg);
2059         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2060         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2061         uint8_t secret_arr[32];
2062         CHECK(secret->arr_len == 32);
2063         memcpy(secret_arr, secret->elems, 32); FREE(secret);
2064         uint8_t (*secret_ref)[32] = &secret_arr;
2065         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2066         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2067         return tag_ptr(ret_conv, true);
2068 }
2069
2070 int8_tArray  CS_LDK_ChannelSigner_channel_keys_id(int64_t this_arg) {
2071         void* this_arg_ptr = untag_ptr(this_arg);
2072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2073         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2074         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2075         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2076         return ret_arr;
2077 }
2078
2079 void  CS_LDK_ChannelSigner_provide_channel_parameters(int64_t this_arg, int64_t channel_parameters) {
2080         void* this_arg_ptr = untag_ptr(this_arg);
2081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2082         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2083         LDKChannelTransactionParameters channel_parameters_conv;
2084         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2085         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2087         channel_parameters_conv.is_owned = false;
2088         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2089 }
2090
2091 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2092         if (this_arg->set_pubkeys != NULL)
2093                 this_arg->set_pubkeys(this_arg);
2094         return this_arg->pubkeys;
2095 }
2096 int64_t  CS_LDK_ChannelSigner_get_pubkeys(int64_t this_arg) {
2097         void* this_arg_ptr = untag_ptr(this_arg);
2098         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2099         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2100         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2101         int64_t ret_ref = 0;
2102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2104         return ret_ref;
2105 }
2106
2107 typedef struct LDKEcdsaChannelSigner_JCalls {
2108         atomic_size_t refcnt;
2109         uint32_t instance_ptr;
2110         LDKChannelSigner_JCalls* ChannelSigner;
2111 } LDKEcdsaChannelSigner_JCalls;
2112 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2113         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2114         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2115                 FREE(j_calls);
2116         }
2117 }
2118 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) {
2119         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2120         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2121         int64_t commitment_tx_ref = 0;
2122         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2123         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2124         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2125         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
2126         ptrArray inbound_htlc_preimages_arr = NULL;
2127         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
2128         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
2129         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
2130                 int8_tArray inbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
2131                 memcpy(inbound_htlc_preimages_conv_8_arr->elems, inbound_htlc_preimages_var.data[i].data, 32);
2132                 inbound_htlc_preimages_arr_ptr[i] = inbound_htlc_preimages_conv_8_arr;
2133         }
2134         
2135         FREE(inbound_htlc_preimages_var.data);
2136         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2137         ptrArray outbound_htlc_preimages_arr = NULL;
2138         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
2139         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
2140         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2141                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
2142                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
2143                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
2144         }
2145         
2146         FREE(outbound_htlc_preimages_var.data);
2147         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 6, commitment_tx_ref, (int64_t)inbound_htlc_preimages_arr, (int64_t)outbound_htlc_preimages_arr);
2148         void* ret_ptr = untag_ptr(ret);
2149         CHECK_ACCESS(ret_ptr);
2150         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2151         FREE(untag_ptr(ret));
2152         return ret_conv;
2153 }
2154 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2155         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2156         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2157         int64_t commitment_tx_ref = 0;
2158         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2159         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2160         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2161         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 7, commitment_tx_ref);
2162         void* ret_ptr = untag_ptr(ret);
2163         CHECK_ACCESS(ret_ptr);
2164         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2165         FREE(untag_ptr(ret));
2166         return ret_conv;
2167 }
2168 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]) {
2169         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2170         LDKTransaction justice_tx_var = justice_tx;
2171         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2172         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2173         Transaction_free(justice_tx_var);
2174         int64_t input_conv = input;
2175         int64_t amount_conv = amount;
2176         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2177         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2178         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 8, (int64_t)justice_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_key_arr);
2179         void* ret_ptr = untag_ptr(ret);
2180         CHECK_ACCESS(ret_ptr);
2181         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2182         FREE(untag_ptr(ret));
2183         return ret_conv;
2184 }
2185 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) {
2186         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2187         LDKTransaction justice_tx_var = justice_tx;
2188         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2189         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2190         Transaction_free(justice_tx_var);
2191         int64_t input_conv = input;
2192         int64_t amount_conv = amount;
2193         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2194         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2195         LDKHTLCOutputInCommitment htlc_var = *htlc;
2196         int64_t htlc_ref = 0;
2197         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2198         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2199         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2200         uint64_t ret = js_invoke_function_l_lllll(j_calls->instance_ptr, 9, (int64_t)justice_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_key_arr, htlc_ref);
2201         void* ret_ptr = untag_ptr(ret);
2202         CHECK_ACCESS(ret_ptr);
2203         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2204         FREE(untag_ptr(ret));
2205         return ret_conv;
2206 }
2207 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2208         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2209         LDKTransaction htlc_tx_var = htlc_tx;
2210         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2211         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2212         Transaction_free(htlc_tx_var);
2213         int64_t input_conv = input;
2214         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2215         int64_t htlc_descriptor_ref = 0;
2216         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2217         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2218         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2219         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 10, (int64_t)htlc_tx_arr, input_conv, htlc_descriptor_ref);
2220         void* ret_ptr = untag_ptr(ret);
2221         CHECK_ACCESS(ret_ptr);
2222         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2223         FREE(untag_ptr(ret));
2224         return ret_conv;
2225 }
2226 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) {
2227         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2228         LDKTransaction htlc_tx_var = htlc_tx;
2229         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2230         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2231         Transaction_free(htlc_tx_var);
2232         int64_t input_conv = input;
2233         int64_t amount_conv = amount;
2234         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2235         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2236         LDKHTLCOutputInCommitment htlc_var = *htlc;
2237         int64_t htlc_ref = 0;
2238         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2239         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2240         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2241         uint64_t ret = js_invoke_function_l_lllll(j_calls->instance_ptr, 11, (int64_t)htlc_tx_arr, input_conv, amount_conv, (int64_t)per_commitment_point_arr, htlc_ref);
2242         void* ret_ptr = untag_ptr(ret);
2243         CHECK_ACCESS(ret_ptr);
2244         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2245         FREE(untag_ptr(ret));
2246         return ret_conv;
2247 }
2248 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2249         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2250         LDKClosingTransaction closing_tx_var = *closing_tx;
2251         int64_t closing_tx_ref = 0;
2252         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2253         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2254         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2255         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 12, closing_tx_ref);
2256         void* ret_ptr = untag_ptr(ret);
2257         CHECK_ACCESS(ret_ptr);
2258         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2259         FREE(untag_ptr(ret));
2260         return ret_conv;
2261 }
2262 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2263         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2264         LDKTransaction anchor_tx_var = anchor_tx;
2265         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2266         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2267         Transaction_free(anchor_tx_var);
2268         int64_t input_conv = input;
2269         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 13, (int64_t)anchor_tx_arr, input_conv);
2270         void* ret_ptr = untag_ptr(ret);
2271         CHECK_ACCESS(ret_ptr);
2272         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2273         FREE(untag_ptr(ret));
2274         return ret_conv;
2275 }
2276 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2277         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2278         LDKUnsignedChannelAnnouncement msg_var = *msg;
2279         int64_t msg_ref = 0;
2280         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2281         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2282         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2283         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 14, msg_ref);
2284         void* ret_ptr = untag_ptr(ret);
2285         CHECK_ACCESS(ret_ptr);
2286         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2287         FREE(untag_ptr(ret));
2288         return ret_conv;
2289 }
2290 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2291         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2292         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2293         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2294 }
2295 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (int64_t o, int64_t ChannelSigner, int64_t pubkeys) {
2296         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2297         atomic_init(&calls->refcnt, 1);
2298         calls->instance_ptr = o;
2299
2300         LDKChannelPublicKeys pubkeys_conv;
2301         pubkeys_conv.inner = untag_ptr(pubkeys);
2302         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2303         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2304
2305         LDKEcdsaChannelSigner ret = {
2306                 .this_arg = (void*) calls,
2307                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2308                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2309                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2310                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2311                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2312                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2313                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2314                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2315                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2316                 .free = LDKEcdsaChannelSigner_JCalls_free,
2317                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2318         };
2319         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2320         return ret;
2321 }
2322 uint64_t  CS_LDK_LDKEcdsaChannelSigner_new(int32_t o, int32_t ChannelSigner, int64_t pubkeys) {
2323         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2324         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2325         return tag_ptr(res_ptr, true);
2326 }
2327 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_commitment(int64_t this_arg, int64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
2328         void* this_arg_ptr = untag_ptr(this_arg);
2329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2330         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2331         LDKCommitmentTransaction commitment_tx_conv;
2332         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2333         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2334         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2335         commitment_tx_conv.is_owned = false;
2336         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2337         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2338         if (inbound_htlc_preimages_constr.datalen > 0)
2339                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2340         else
2341                 inbound_htlc_preimages_constr.data = NULL;
2342         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2343         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
2344                 int8_tArray inbound_htlc_preimages_conv_8 = inbound_htlc_preimages_vals[i];
2345                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
2346                 CHECK(inbound_htlc_preimages_conv_8->arr_len == 32);
2347                 memcpy(inbound_htlc_preimages_conv_8_ref.data, inbound_htlc_preimages_conv_8->elems, 32); FREE(inbound_htlc_preimages_conv_8);
2348                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
2349         }
2350         FREE(inbound_htlc_preimages);
2351         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2352         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2353         if (outbound_htlc_preimages_constr.datalen > 0)
2354                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2355         else
2356                 outbound_htlc_preimages_constr.data = NULL;
2357         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2358         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2359                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2360                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2361                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2362                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2363                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2364         }
2365         FREE(outbound_htlc_preimages);
2366         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2367         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2368         return tag_ptr(ret_conv, true);
2369 }
2370
2371 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_commitment(int64_t this_arg, int64_t commitment_tx) {
2372         void* this_arg_ptr = untag_ptr(this_arg);
2373         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2374         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2375         LDKHolderCommitmentTransaction commitment_tx_conv;
2376         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2377         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2378         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2379         commitment_tx_conv.is_owned = false;
2380         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2381         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2382         return tag_ptr(ret_conv, true);
2383 }
2384
2385 int64_t  CS_LDK_EcdsaChannelSigner_sign_justice_revoked_output(int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2386         void* this_arg_ptr = untag_ptr(this_arg);
2387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2388         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2389         LDKTransaction justice_tx_ref;
2390         justice_tx_ref.datalen = justice_tx->arr_len;
2391         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2392         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2393         justice_tx_ref.data_is_owned = true;
2394         uint8_t per_commitment_key_arr[32];
2395         CHECK(per_commitment_key->arr_len == 32);
2396         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2397         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2398         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2399         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2400         return tag_ptr(ret_conv, true);
2401 }
2402
2403 int64_t  CS_LDK_EcdsaChannelSigner_sign_justice_revoked_htlc(int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2404         void* this_arg_ptr = untag_ptr(this_arg);
2405         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2406         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2407         LDKTransaction justice_tx_ref;
2408         justice_tx_ref.datalen = justice_tx->arr_len;
2409         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2410         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2411         justice_tx_ref.data_is_owned = true;
2412         uint8_t per_commitment_key_arr[32];
2413         CHECK(per_commitment_key->arr_len == 32);
2414         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2415         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2416         LDKHTLCOutputInCommitment htlc_conv;
2417         htlc_conv.inner = untag_ptr(htlc);
2418         htlc_conv.is_owned = ptr_is_owned(htlc);
2419         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2420         htlc_conv.is_owned = false;
2421         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2422         *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);
2423         return tag_ptr(ret_conv, true);
2424 }
2425
2426 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
2427         void* this_arg_ptr = untag_ptr(this_arg);
2428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2429         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2430         LDKTransaction htlc_tx_ref;
2431         htlc_tx_ref.datalen = htlc_tx->arr_len;
2432         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2433         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2434         htlc_tx_ref.data_is_owned = true;
2435         LDKHTLCDescriptor htlc_descriptor_conv;
2436         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2437         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2438         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2439         htlc_descriptor_conv.is_owned = false;
2440         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2441         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2442         return tag_ptr(ret_conv, true);
2443 }
2444
2445 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2446         void* this_arg_ptr = untag_ptr(this_arg);
2447         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2448         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2449         LDKTransaction htlc_tx_ref;
2450         htlc_tx_ref.datalen = htlc_tx->arr_len;
2451         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2452         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2453         htlc_tx_ref.data_is_owned = true;
2454         LDKPublicKey per_commitment_point_ref;
2455         CHECK(per_commitment_point->arr_len == 33);
2456         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2457         LDKHTLCOutputInCommitment htlc_conv;
2458         htlc_conv.inner = untag_ptr(htlc);
2459         htlc_conv.is_owned = ptr_is_owned(htlc);
2460         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2461         htlc_conv.is_owned = false;
2462         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2463         *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);
2464         return tag_ptr(ret_conv, true);
2465 }
2466
2467 int64_t  CS_LDK_EcdsaChannelSigner_sign_closing_transaction(int64_t this_arg, int64_t closing_tx) {
2468         void* this_arg_ptr = untag_ptr(this_arg);
2469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2470         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2471         LDKClosingTransaction closing_tx_conv;
2472         closing_tx_conv.inner = untag_ptr(closing_tx);
2473         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2474         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2475         closing_tx_conv.is_owned = false;
2476         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2477         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2478         return tag_ptr(ret_conv, true);
2479 }
2480
2481 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_anchor_input(int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
2482         void* this_arg_ptr = untag_ptr(this_arg);
2483         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2484         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2485         LDKTransaction anchor_tx_ref;
2486         anchor_tx_ref.datalen = anchor_tx->arr_len;
2487         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2488         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2489         anchor_tx_ref.data_is_owned = true;
2490         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2491         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2492         return tag_ptr(ret_conv, true);
2493 }
2494
2495 int64_t  CS_LDK_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(int64_t this_arg, int64_t msg) {
2496         void* this_arg_ptr = untag_ptr(this_arg);
2497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2498         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2499         LDKUnsignedChannelAnnouncement msg_conv;
2500         msg_conv.inner = untag_ptr(msg);
2501         msg_conv.is_owned = ptr_is_owned(msg);
2502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2503         msg_conv.is_owned = false;
2504         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2505         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2506         return tag_ptr(ret_conv, true);
2507 }
2508
2509 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2510         atomic_size_t refcnt;
2511         uint32_t instance_ptr;
2512         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2513         LDKChannelSigner_JCalls* ChannelSigner;
2514 } LDKWriteableEcdsaChannelSigner_JCalls;
2515 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2516         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2517         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2518                 FREE(j_calls);
2519         }
2520 }
2521 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2522         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2523         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 15);
2524         LDKCVec_u8Z ret_ref;
2525         ret_ref.datalen = ret->arr_len;
2526         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2527         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2528         return ret_ref;
2529 }
2530 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2531         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2532         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2533         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2534         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2535 }
2536 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (int64_t o, int64_t EcdsaChannelSigner, int64_t ChannelSigner, int64_t pubkeys) {
2537         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2538         atomic_init(&calls->refcnt, 1);
2539         calls->instance_ptr = o;
2540
2541         LDKChannelPublicKeys pubkeys_conv;
2542         pubkeys_conv.inner = untag_ptr(pubkeys);
2543         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2544         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2545
2546         LDKWriteableEcdsaChannelSigner ret = {
2547                 .this_arg = (void*) calls,
2548                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2549                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2550                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2551                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2552         };
2553         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2554         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2555         return ret;
2556 }
2557 uint64_t  CS_LDK_LDKWriteableEcdsaChannelSigner_new(int32_t o, int32_t EcdsaChannelSigner, int32_t ChannelSigner, int64_t pubkeys) {
2558         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2559         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2560         return tag_ptr(res_ptr, true);
2561 }
2562 int8_tArray  CS_LDK_WriteableEcdsaChannelSigner_write(int64_t this_arg) {
2563         void* this_arg_ptr = untag_ptr(this_arg);
2564         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2565         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2566         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2567         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2568         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2569         CVec_u8Z_free(ret_var);
2570         return ret_arr;
2571 }
2572
2573 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2574 CHECK(owner->result_ok);
2575         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2576 }
2577 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(int64_t owner) {
2578         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2579         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2580         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2581         return tag_ptr(ret_ret, true);
2582 }
2583
2584 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2585 CHECK(!owner->result_ok);
2586         return DecodeError_clone(&*owner->contents.err);
2587 }
2588 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(int64_t owner) {
2589         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2591         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2592         int64_t ret_ref = tag_ptr(ret_copy, true);
2593         return ret_ref;
2594 }
2595
2596 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2597 CHECK(owner->result_ok);
2598         return CVec_u8Z_clone(&*owner->contents.result);
2599 }
2600 int8_tArray  CS_LDK_CResult_CVec_u8ZNoneZ_get_ok(int64_t owner) {
2601         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2602         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2605         CVec_u8Z_free(ret_var);
2606         return ret_arr;
2607 }
2608
2609 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2610 CHECK(!owner->result_ok);
2611         return *owner->contents.err;
2612 }
2613 void  CS_LDK_CResult_CVec_u8ZNoneZ_get_err(int64_t owner) {
2614         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2615         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2616 }
2617
2618 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2619         LDKShutdownScript ret = *owner->contents.result;
2620         ret.is_owned = false;
2621         return ret;
2622 }
2623 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_get_ok(int64_t owner) {
2624         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2625         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2626         int64_t ret_ref = 0;
2627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2629         return ret_ref;
2630 }
2631
2632 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2633 CHECK(!owner->result_ok);
2634         return *owner->contents.err;
2635 }
2636 void  CS_LDK_CResult_ShutdownScriptNoneZ_get_err(int64_t owner) {
2637         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2638         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2639 }
2640
2641 uint32_t CS_LDK_LDKCOption_u16Z_ty_from_ptr(int64_t ptr) {
2642         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2643         switch(obj->tag) {
2644                 case LDKCOption_u16Z_Some: return 0;
2645                 case LDKCOption_u16Z_None: return 1;
2646                 default: abort();
2647         }
2648 }
2649 int16_t CS_LDK_LDKCOption_u16Z_Some_get_some(int64_t ptr) {
2650         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2651         CHECK(obj->tag == LDKCOption_u16Z_Some);
2652         int16_t some_conv = obj->some;
2653         return some_conv;
2654 }
2655 uint32_t CS_LDK_LDKCOption_boolZ_ty_from_ptr(int64_t ptr) {
2656         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2657         switch(obj->tag) {
2658                 case LDKCOption_boolZ_Some: return 0;
2659                 case LDKCOption_boolZ_None: return 1;
2660                 default: abort();
2661         }
2662 }
2663 jboolean CS_LDK_LDKCOption_boolZ_Some_get_some(int64_t ptr) {
2664         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2665         CHECK(obj->tag == LDKCOption_boolZ_Some);
2666         jboolean some_conv = obj->some;
2667         return some_conv;
2668 }
2669 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2670 CHECK(owner->result_ok);
2671         return Witness_clone(&*owner->contents.result);
2672 }
2673 int8_tArray  CS_LDK_CResult_WitnessNoneZ_get_ok(int64_t owner) {
2674         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2675         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2676         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2677         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2678         Witness_free(ret_var);
2679         return ret_arr;
2680 }
2681
2682 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2683 CHECK(!owner->result_ok);
2684         return *owner->contents.err;
2685 }
2686 void  CS_LDK_CResult_WitnessNoneZ_get_err(int64_t owner) {
2687         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2688         CResult_WitnessNoneZ_get_err(owner_conv);
2689 }
2690
2691 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2692         LDKInMemorySigner ret = *owner->contents.result;
2693         ret.is_owned = false;
2694         return ret;
2695 }
2696 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_ok(int64_t owner) {
2697         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2698         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2699         int64_t ret_ref = 0;
2700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2702         return ret_ref;
2703 }
2704
2705 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2706 CHECK(!owner->result_ok);
2707         return DecodeError_clone(&*owner->contents.err);
2708 }
2709 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_err(int64_t owner) {
2710         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2712         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2713         int64_t ret_ref = tag_ptr(ret_copy, true);
2714         return ret_ref;
2715 }
2716
2717 uint32_t CS_LDK_LDKCandidateRouteHop_ty_from_ptr(int64_t ptr) {
2718         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2719         switch(obj->tag) {
2720                 case LDKCandidateRouteHop_FirstHop: return 0;
2721                 case LDKCandidateRouteHop_PublicHop: return 1;
2722                 case LDKCandidateRouteHop_PrivateHop: return 2;
2723                 case LDKCandidateRouteHop_Blinded: return 3;
2724                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
2725                 default: abort();
2726         }
2727 }
2728 int64_t CS_LDK_LDKCandidateRouteHop_FirstHop_get_first_hop(int64_t ptr) {
2729         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2730         CHECK(obj->tag == LDKCandidateRouteHop_FirstHop);
2731         LDKFirstHopCandidate first_hop_var = obj->first_hop;
2732                         int64_t first_hop_ref = 0;
2733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
2734                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
2735         return first_hop_ref;
2736 }
2737 int64_t CS_LDK_LDKCandidateRouteHop_PublicHop_get_public_hop(int64_t ptr) {
2738         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2739         CHECK(obj->tag == LDKCandidateRouteHop_PublicHop);
2740         LDKPublicHopCandidate public_hop_var = obj->public_hop;
2741                         int64_t public_hop_ref = 0;
2742                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
2743                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
2744         return public_hop_ref;
2745 }
2746 int64_t CS_LDK_LDKCandidateRouteHop_PrivateHop_get_private_hop(int64_t ptr) {
2747         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2748         CHECK(obj->tag == LDKCandidateRouteHop_PrivateHop);
2749         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
2750                         int64_t private_hop_ref = 0;
2751                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
2752                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
2753         return private_hop_ref;
2754 }
2755 int64_t CS_LDK_LDKCandidateRouteHop_Blinded_get_blinded(int64_t ptr) {
2756         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2757         CHECK(obj->tag == LDKCandidateRouteHop_Blinded);
2758         LDKBlindedPathCandidate blinded_var = obj->blinded;
2759                         int64_t blinded_ref = 0;
2760                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
2761                         blinded_ref = tag_ptr(blinded_var.inner, false);
2762         return blinded_ref;
2763 }
2764 int64_t CS_LDK_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(int64_t ptr) {
2765         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2766         CHECK(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
2767         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
2768                         int64_t one_hop_blinded_ref = 0;
2769                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
2770                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
2771         return one_hop_blinded_ref;
2772 }
2773 typedef struct LDKScoreLookUp_JCalls {
2774         atomic_size_t refcnt;
2775         uint32_t instance_ptr;
2776 } LDKScoreLookUp_JCalls;
2777 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
2778         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2780                 FREE(j_calls);
2781         }
2782 }
2783 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
2784         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2785         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
2786         *ret_candidate = CandidateRouteHop_clone(candidate);
2787         int64_t ref_candidate = tag_ptr(ret_candidate, true);
2788         LDKChannelUsage usage_var = usage;
2789         int64_t usage_ref = 0;
2790         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
2791         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
2792         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
2793         int64_t score_params_ref = 0;
2794         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
2795         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
2796         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
2797         return js_invoke_function_l_lll(j_calls->instance_ptr, 16, ref_candidate, usage_ref, score_params_ref);
2798 }
2799 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
2800         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
2801         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2802 }
2803 static inline LDKScoreLookUp LDKScoreLookUp_init (int64_t o) {
2804         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
2805         atomic_init(&calls->refcnt, 1);
2806         calls->instance_ptr = o;
2807
2808         LDKScoreLookUp ret = {
2809                 .this_arg = (void*) calls,
2810                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
2811                 .free = LDKScoreLookUp_JCalls_free,
2812         };
2813         return ret;
2814 }
2815 uint64_t  CS_LDK_LDKScoreLookUp_new(int32_t o) {
2816         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2817         *res_ptr = LDKScoreLookUp_init(o);
2818         return tag_ptr(res_ptr, true);
2819 }
2820 int64_t  CS_LDK_ScoreLookUp_channel_penalty_msat(int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
2821         void* this_arg_ptr = untag_ptr(this_arg);
2822         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2823         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
2824         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
2825         LDKChannelUsage usage_conv;
2826         usage_conv.inner = untag_ptr(usage);
2827         usage_conv.is_owned = ptr_is_owned(usage);
2828         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
2829         usage_conv = ChannelUsage_clone(&usage_conv);
2830         LDKProbabilisticScoringFeeParameters score_params_conv;
2831         score_params_conv.inner = untag_ptr(score_params);
2832         score_params_conv.is_owned = ptr_is_owned(score_params);
2833         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
2834         score_params_conv.is_owned = false;
2835         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
2836         return ret_conv;
2837 }
2838
2839 typedef struct LDKScoreUpdate_JCalls {
2840         atomic_size_t refcnt;
2841         uint32_t instance_ptr;
2842 } LDKScoreUpdate_JCalls;
2843 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
2844         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2845         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2846                 FREE(j_calls);
2847         }
2848 }
2849 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2850         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2851         LDKPath path_var = *path;
2852         int64_t path_ref = 0;
2853         path_var = Path_clone(&path_var);
2854         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2855         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2856         int64_t short_channel_id_conv = short_channel_id;
2857         int64_t duration_since_epoch_conv = duration_since_epoch;
2858         js_invoke_function_void_lll(j_calls->instance_ptr, 17, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2859 }
2860 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2861         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2862         LDKPath path_var = *path;
2863         int64_t path_ref = 0;
2864         path_var = Path_clone(&path_var);
2865         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2866         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2867         int64_t duration_since_epoch_conv = duration_since_epoch;
2868         js_invoke_function_void_ll(j_calls->instance_ptr, 18, path_ref, duration_since_epoch_conv);
2869 }
2870 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2871         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2872         LDKPath path_var = *path;
2873         int64_t path_ref = 0;
2874         path_var = Path_clone(&path_var);
2875         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2876         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2877         int64_t short_channel_id_conv = short_channel_id;
2878         int64_t duration_since_epoch_conv = duration_since_epoch;
2879         js_invoke_function_void_lll(j_calls->instance_ptr, 19, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2880 }
2881 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2882         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2883         LDKPath path_var = *path;
2884         int64_t path_ref = 0;
2885         path_var = Path_clone(&path_var);
2886         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2887         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2888         int64_t duration_since_epoch_conv = duration_since_epoch;
2889         js_invoke_function_void_ll(j_calls->instance_ptr, 20, path_ref, duration_since_epoch_conv);
2890 }
2891 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
2892         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2893         int64_t duration_since_epoch_conv = duration_since_epoch;
2894         js_invoke_function_void_l(j_calls->instance_ptr, 21, duration_since_epoch_conv);
2895 }
2896 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
2897         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
2898         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2899 }
2900 static inline LDKScoreUpdate LDKScoreUpdate_init (int64_t o) {
2901         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
2902         atomic_init(&calls->refcnt, 1);
2903         calls->instance_ptr = o;
2904
2905         LDKScoreUpdate ret = {
2906                 .this_arg = (void*) calls,
2907                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
2908                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
2909                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
2910                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
2911                 .time_passed = time_passed_LDKScoreUpdate_jcall,
2912                 .free = LDKScoreUpdate_JCalls_free,
2913         };
2914         return ret;
2915 }
2916 uint64_t  CS_LDK_LDKScoreUpdate_new(int32_t o) {
2917         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2918         *res_ptr = LDKScoreUpdate_init(o);
2919         return tag_ptr(res_ptr, true);
2920 }
2921 void  CS_LDK_ScoreUpdate_payment_path_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2922         void* this_arg_ptr = untag_ptr(this_arg);
2923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2924         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2925         LDKPath path_conv;
2926         path_conv.inner = untag_ptr(path);
2927         path_conv.is_owned = ptr_is_owned(path);
2928         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2929         path_conv.is_owned = false;
2930         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2931 }
2932
2933 void  CS_LDK_ScoreUpdate_payment_path_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2934         void* this_arg_ptr = untag_ptr(this_arg);
2935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2936         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2937         LDKPath path_conv;
2938         path_conv.inner = untag_ptr(path);
2939         path_conv.is_owned = ptr_is_owned(path);
2940         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2941         path_conv.is_owned = false;
2942         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2943 }
2944
2945 void  CS_LDK_ScoreUpdate_probe_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2946         void* this_arg_ptr = untag_ptr(this_arg);
2947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2948         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2949         LDKPath path_conv;
2950         path_conv.inner = untag_ptr(path);
2951         path_conv.is_owned = ptr_is_owned(path);
2952         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2953         path_conv.is_owned = false;
2954         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2955 }
2956
2957 void  CS_LDK_ScoreUpdate_probe_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2958         void* this_arg_ptr = untag_ptr(this_arg);
2959         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2960         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2961         LDKPath path_conv;
2962         path_conv.inner = untag_ptr(path);
2963         path_conv.is_owned = ptr_is_owned(path);
2964         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2965         path_conv.is_owned = false;
2966         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2967 }
2968
2969 void  CS_LDK_ScoreUpdate_time_passed(int64_t this_arg, int64_t duration_since_epoch) {
2970         void* this_arg_ptr = untag_ptr(this_arg);
2971         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2972         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2973         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
2974 }
2975
2976 typedef struct LDKLockableScore_JCalls {
2977         atomic_size_t refcnt;
2978         uint32_t instance_ptr;
2979 } LDKLockableScore_JCalls;
2980 static void LDKLockableScore_JCalls_free(void* this_arg) {
2981         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2982         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2983                 FREE(j_calls);
2984         }
2985 }
2986 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
2987         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2988         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 22);
2989         void* ret_ptr = untag_ptr(ret);
2990         CHECK_ACCESS(ret_ptr);
2991         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
2992         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
2993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2994                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
2995         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
2996         
2997         return ret_conv;
2998 }
2999 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
3000         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3001         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 23);
3002         void* ret_ptr = untag_ptr(ret);
3003         CHECK_ACCESS(ret_ptr);
3004         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
3005         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
3006                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3007                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
3008         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
3009         
3010         return ret_conv;
3011 }
3012 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
3013         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
3014         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3015 }
3016 static inline LDKLockableScore LDKLockableScore_init (int64_t o) {
3017         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
3018         atomic_init(&calls->refcnt, 1);
3019         calls->instance_ptr = o;
3020
3021         LDKLockableScore ret = {
3022                 .this_arg = (void*) calls,
3023                 .read_lock = read_lock_LDKLockableScore_jcall,
3024                 .write_lock = write_lock_LDKLockableScore_jcall,
3025                 .free = LDKLockableScore_JCalls_free,
3026         };
3027         return ret;
3028 }
3029 uint64_t  CS_LDK_LDKLockableScore_new(int32_t o) {
3030         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
3031         *res_ptr = LDKLockableScore_init(o);
3032         return tag_ptr(res_ptr, true);
3033 }
3034 int64_t  CS_LDK_LockableScore_read_lock(int64_t this_arg) {
3035         void* this_arg_ptr = untag_ptr(this_arg);
3036         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3037         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3038         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3039         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
3040         return tag_ptr(ret_ret, true);
3041 }
3042
3043 int64_t  CS_LDK_LockableScore_write_lock(int64_t this_arg) {
3044         void* this_arg_ptr = untag_ptr(this_arg);
3045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3046         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3047         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
3048         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
3049         return tag_ptr(ret_ret, true);
3050 }
3051
3052 typedef struct LDKWriteableScore_JCalls {
3053         atomic_size_t refcnt;
3054         uint32_t instance_ptr;
3055         LDKLockableScore_JCalls* LockableScore;
3056 } LDKWriteableScore_JCalls;
3057 static void LDKWriteableScore_JCalls_free(void* this_arg) {
3058         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3059         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3060                 FREE(j_calls);
3061         }
3062 }
3063 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
3064         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3065         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 24);
3066         LDKCVec_u8Z ret_ref;
3067         ret_ref.datalen = ret->arr_len;
3068         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3069         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
3070         return ret_ref;
3071 }
3072 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
3073         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
3074         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3075         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
3076 }
3077 static inline LDKWriteableScore LDKWriteableScore_init (int64_t o, int64_t LockableScore) {
3078         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
3079         atomic_init(&calls->refcnt, 1);
3080         calls->instance_ptr = o;
3081
3082         LDKWriteableScore ret = {
3083                 .this_arg = (void*) calls,
3084                 .write = write_LDKWriteableScore_jcall,
3085                 .free = LDKWriteableScore_JCalls_free,
3086                 .LockableScore = LDKLockableScore_init(LockableScore),
3087         };
3088         calls->LockableScore = ret.LockableScore.this_arg;
3089         return ret;
3090 }
3091 uint64_t  CS_LDK_LDKWriteableScore_new(int32_t o, int32_t LockableScore) {
3092         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3093         *res_ptr = LDKWriteableScore_init(o, LockableScore);
3094         return tag_ptr(res_ptr, true);
3095 }
3096 int8_tArray  CS_LDK_WriteableScore_write(int64_t this_arg) {
3097         void* this_arg_ptr = untag_ptr(this_arg);
3098         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3099         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
3100         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3103         CVec_u8Z_free(ret_var);
3104         return ret_arr;
3105 }
3106
3107 uint32_t CS_LDK_LDKCOption_WriteableScoreZ_ty_from_ptr(int64_t ptr) {
3108         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3109         switch(obj->tag) {
3110                 case LDKCOption_WriteableScoreZ_Some: return 0;
3111                 case LDKCOption_WriteableScoreZ_None: return 1;
3112                 default: abort();
3113         }
3114 }
3115 int64_t CS_LDK_LDKCOption_WriteableScoreZ_Some_get_some(int64_t ptr) {
3116         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3117         CHECK(obj->tag == LDKCOption_WriteableScoreZ_Some);
3118         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3119         *some_ret = obj->some;
3120                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3121                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
3122                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3123                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
3124                         }
3125         return tag_ptr(some_ret, true);
3126 }
3127 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
3128 CHECK(owner->result_ok);
3129         return *owner->contents.result;
3130 }
3131 void  CS_LDK_CResult_NoneIOErrorZ_get_ok(int64_t owner) {
3132         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
3133         CResult_NoneIOErrorZ_get_ok(owner_conv);
3134 }
3135
3136 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
3137 CHECK(!owner->result_ok);
3138         return *owner->contents.err;
3139 }
3140 int32_t  CS_LDK_CResult_NoneIOErrorZ_get_err(int64_t owner) {
3141         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
3142         int32_t ret_conv = LDKIOError_to_cs(CResult_NoneIOErrorZ_get_err(owner_conv));
3143         return ret_conv;
3144 }
3145
3146 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
3147         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
3148         for (size_t i = 0; i < ret.datalen; i++) {
3149                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
3150         }
3151         return ret;
3152 }
3153 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
3154         LDKRoute ret = *owner->contents.result;
3155         ret.is_owned = false;
3156         return ret;
3157 }
3158 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_ok(int64_t owner) {
3159         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
3160         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
3161         int64_t ret_ref = 0;
3162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3164         return ret_ref;
3165 }
3166
3167 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
3168         LDKLightningError ret = *owner->contents.err;
3169         ret.is_owned = false;
3170         return ret;
3171 }
3172 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_err(int64_t owner) {
3173         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
3174         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
3175         int64_t ret_ref = 0;
3176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3178         return ret_ref;
3179 }
3180
3181 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
3182         LDKBlindedPayInfo ret = owner->a;
3183         ret.is_owned = false;
3184         return ret;
3185 }
3186 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(int64_t owner) {
3187         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
3188         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
3189         int64_t ret_ref = 0;
3190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3192         return ret_ref;
3193 }
3194
3195 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
3196         LDKBlindedPath ret = owner->b;
3197         ret.is_owned = false;
3198         return ret;
3199 }
3200 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(int64_t owner) {
3201         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
3202         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
3203         int64_t ret_ref = 0;
3204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3206         return ret_ref;
3207 }
3208
3209 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
3210         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
3211         for (size_t i = 0; i < ret.datalen; i++) {
3212                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
3213         }
3214         return ret;
3215 }
3216 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3217 CHECK(owner->result_ok);
3218         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
3219 }
3220 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(int64_t owner) {
3221         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3222         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
3223         int64_tArray ret_arr = NULL;
3224         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3225         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3226         for (size_t l = 0; l < ret_var.datalen; l++) {
3227                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
3228                 *ret_conv_37_conv = ret_var.data[l];
3229                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
3230         }
3231         
3232         FREE(ret_var.data);
3233         return ret_arr;
3234 }
3235
3236 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3237 CHECK(!owner->result_ok);
3238         return *owner->contents.err;
3239 }
3240 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(int64_t owner) {
3241         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3242         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
3243 }
3244
3245 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3246         LDKOnionMessagePath ret = *owner->contents.result;
3247         ret.is_owned = false;
3248         return ret;
3249 }
3250 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_get_ok(int64_t owner) {
3251         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3252         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
3253         int64_t ret_ref = 0;
3254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3256         return ret_ref;
3257 }
3258
3259 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3260 CHECK(!owner->result_ok);
3261         return *owner->contents.err;
3262 }
3263 void  CS_LDK_CResult_OnionMessagePathNoneZ_get_err(int64_t owner) {
3264         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3265         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
3266 }
3267
3268 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3269 CHECK(owner->result_ok);
3270         return CVec_BlindedPathZ_clone(&*owner->contents.result);
3271 }
3272 int64_tArray  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_ok(int64_t owner) {
3273         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3274         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
3275         int64_tArray ret_arr = NULL;
3276         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3277         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3278         for (size_t n = 0; n < ret_var.datalen; n++) {
3279                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
3280                 int64_t ret_conv_13_ref = 0;
3281                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
3282                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
3283                 ret_arr_ptr[n] = ret_conv_13_ref;
3284         }
3285         
3286         FREE(ret_var.data);
3287         return ret_arr;
3288 }
3289
3290 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3291 CHECK(!owner->result_ok);
3292         return *owner->contents.err;
3293 }
3294 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_err(int64_t owner) {
3295         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3296         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
3297 }
3298
3299 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3300         LDKInFlightHtlcs ret = *owner->contents.result;
3301         ret.is_owned = false;
3302         return ret;
3303 }
3304 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_ok(int64_t owner) {
3305         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3306         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
3307         int64_t ret_ref = 0;
3308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3310         return ret_ref;
3311 }
3312
3313 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3314 CHECK(!owner->result_ok);
3315         return DecodeError_clone(&*owner->contents.err);
3316 }
3317 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_err(int64_t owner) {
3318         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3319         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3320         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
3321         int64_t ret_ref = tag_ptr(ret_copy, true);
3322         return ret_ref;
3323 }
3324
3325 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3326         LDKRouteHop ret = *owner->contents.result;
3327         ret.is_owned = false;
3328         return ret;
3329 }
3330 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_ok(int64_t owner) {
3331         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3332         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
3333         int64_t ret_ref = 0;
3334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3336         return ret_ref;
3337 }
3338
3339 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3340 CHECK(!owner->result_ok);
3341         return DecodeError_clone(&*owner->contents.err);
3342 }
3343 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_err(int64_t owner) {
3344         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3346         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
3347         int64_t ret_ref = tag_ptr(ret_copy, true);
3348         return ret_ref;
3349 }
3350
3351 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
3352         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
3353         for (size_t i = 0; i < ret.datalen; i++) {
3354                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
3355         }
3356         return ret;
3357 }
3358 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3359         LDKBlindedTail ret = *owner->contents.result;
3360         ret.is_owned = false;
3361         return ret;
3362 }
3363 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_ok(int64_t owner) {
3364         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3365         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
3366         int64_t ret_ref = 0;
3367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3369         return ret_ref;
3370 }
3371
3372 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3373 CHECK(!owner->result_ok);
3374         return DecodeError_clone(&*owner->contents.err);
3375 }
3376 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_err(int64_t owner) {
3377         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3379         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
3380         int64_t ret_ref = tag_ptr(ret_copy, true);
3381         return ret_ref;
3382 }
3383
3384 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3385         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3386         for (size_t i = 0; i < ret.datalen; i++) {
3387                 ret.data[i] = RouteHop_clone(&orig->data[i]);
3388         }
3389         return ret;
3390 }
3391 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
3392         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
3393         for (size_t i = 0; i < ret.datalen; i++) {
3394                 ret.data[i] = Path_clone(&orig->data[i]);
3395         }
3396         return ret;
3397 }
3398 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3399         LDKRoute ret = *owner->contents.result;
3400         ret.is_owned = false;
3401         return ret;
3402 }
3403 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_ok(int64_t owner) {
3404         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3405         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
3406         int64_t ret_ref = 0;
3407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3409         return ret_ref;
3410 }
3411
3412 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3413 CHECK(!owner->result_ok);
3414         return DecodeError_clone(&*owner->contents.err);
3415 }
3416 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_err(int64_t owner) {
3417         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3418         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3419         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
3420         int64_t ret_ref = tag_ptr(ret_copy, true);
3421         return ret_ref;
3422 }
3423
3424 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3425         LDKRouteParameters ret = *owner->contents.result;
3426         ret.is_owned = false;
3427         return ret;
3428 }
3429 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_ok(int64_t owner) {
3430         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3431         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
3432         int64_t ret_ref = 0;
3433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3435         return ret_ref;
3436 }
3437
3438 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3439 CHECK(!owner->result_ok);
3440         return DecodeError_clone(&*owner->contents.err);
3441 }
3442 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_err(int64_t owner) {
3443         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3445         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
3446         int64_t ret_ref = tag_ptr(ret_copy, true);
3447         return ret_ref;
3448 }
3449
3450 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3451         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3452         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3453         return ret;
3454 }
3455 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3456         LDKPaymentParameters ret = *owner->contents.result;
3457         ret.is_owned = false;
3458         return ret;
3459 }
3460 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_ok(int64_t owner) {
3461         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3462         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
3463         int64_t ret_ref = 0;
3464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3466         return ret_ref;
3467 }
3468
3469 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3470 CHECK(!owner->result_ok);
3471         return DecodeError_clone(&*owner->contents.err);
3472 }
3473 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_err(int64_t owner) {
3474         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3475         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3476         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
3477         int64_t ret_ref = tag_ptr(ret_copy, true);
3478         return ret_ref;
3479 }
3480
3481 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3482         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3483         for (size_t i = 0; i < ret.datalen; i++) {
3484                 ret.data[i] = RouteHint_clone(&orig->data[i]);
3485         }
3486         return ret;
3487 }
3488 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
3489         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
3490         for (size_t i = 0; i < ret.datalen; i++) {
3491                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
3492         }
3493         return ret;
3494 }
3495 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3496         LDKRouteHint ret = *owner->contents.result;
3497         ret.is_owned = false;
3498         return ret;
3499 }
3500 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_ok(int64_t owner) {
3501         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3502         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
3503         int64_t ret_ref = 0;
3504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3506         return ret_ref;
3507 }
3508
3509 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3510 CHECK(!owner->result_ok);
3511         return DecodeError_clone(&*owner->contents.err);
3512 }
3513 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_err(int64_t owner) {
3514         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3516         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
3517         int64_t ret_ref = tag_ptr(ret_copy, true);
3518         return ret_ref;
3519 }
3520
3521 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3522         LDKRouteHintHop ret = *owner->contents.result;
3523         ret.is_owned = false;
3524         return ret;
3525 }
3526 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_ok(int64_t owner) {
3527         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3528         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
3529         int64_t ret_ref = 0;
3530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3532         return ret_ref;
3533 }
3534
3535 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3536 CHECK(!owner->result_ok);
3537         return DecodeError_clone(&*owner->contents.err);
3538 }
3539 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_err(int64_t owner) {
3540         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3541         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3542         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
3543         int64_t ret_ref = tag_ptr(ret_copy, true);
3544         return ret_ref;
3545 }
3546
3547 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3548         LDKFixedPenaltyScorer ret = *owner->contents.result;
3549         ret.is_owned = false;
3550         return ret;
3551 }
3552 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(int64_t owner) {
3553         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3554         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3555         int64_t ret_ref = 0;
3556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3558         return ret_ref;
3559 }
3560
3561 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3562 CHECK(!owner->result_ok);
3563         return DecodeError_clone(&*owner->contents.err);
3564 }
3565 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(int64_t owner) {
3566         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3568         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3569         int64_t ret_ref = tag_ptr(ret_copy, true);
3570         return ret_ref;
3571 }
3572
3573 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3574         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3575         for (size_t i = 0; i < ret.datalen; i++) {
3576                 ret.data[i] = NodeId_clone(&orig->data[i]);
3577         }
3578         return ret;
3579 }
3580 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3581         return owner->a;
3582 }
3583 int64_t  CS_LDK_C2Tuple_u64u64Z_get_a(int64_t owner) {
3584         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3585         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3586         return ret_conv;
3587 }
3588
3589 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3590         return owner->b;
3591 }
3592 int64_t  CS_LDK_C2Tuple_u64u64Z_get_b(int64_t owner) {
3593         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3594         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3595         return ret_conv;
3596 }
3597
3598 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(int64_t ptr) {
3599         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3600         switch(obj->tag) {
3601                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3602                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3603                 default: abort();
3604         }
3605 }
3606 int64_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(int64_t ptr) {
3607         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3608         CHECK(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3609         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3610         *some_conv = obj->some;
3611                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3612         return tag_ptr(some_conv, true);
3613 }
3614 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3615         return owner->a;
3616 }
3617 int16_tArray  CS_LDK_C2Tuple_Z_get_a(int64_t owner) {
3618         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3619         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3620         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
3621         return ret_arr;
3622 }
3623
3624 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3625         return owner->b;
3626 }
3627 int16_tArray  CS_LDK_C2Tuple_Z_get_b(int64_t owner) {
3628         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3629         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3630         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
3631         return ret_arr;
3632 }
3633
3634 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3635         return owner->a;
3636 }
3637 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_a(int64_t owner) {
3638         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3639         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3640         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
3641         return ret_arr;
3642 }
3643
3644 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3645         return owner->b;
3646 }
3647 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_b(int64_t owner) {
3648         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3649         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3650         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3651         return ret_arr;
3652 }
3653
3654 uint32_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(int64_t ptr) {
3655         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3656         switch(obj->tag) {
3657                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3658                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3659                 default: abort();
3660         }
3661 }
3662 int64_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(int64_t ptr) {
3663         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3664         CHECK(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3665         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3666                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3667         return tag_ptr(some_conv, false);
3668 }
3669 uint32_t CS_LDK_LDKCOption_f64Z_ty_from_ptr(int64_t ptr) {
3670         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3671         switch(obj->tag) {
3672                 case LDKCOption_f64Z_Some: return 0;
3673                 case LDKCOption_f64Z_None: return 1;
3674                 default: abort();
3675         }
3676 }
3677 double CS_LDK_LDKCOption_f64Z_Some_get_some(int64_t ptr) {
3678         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3679         CHECK(obj->tag == LDKCOption_f64Z_Some);
3680         double some_conv = obj->some;
3681         return some_conv;
3682 }
3683 typedef struct LDKLogger_JCalls {
3684         atomic_size_t refcnt;
3685         uint32_t instance_ptr;
3686 } LDKLogger_JCalls;
3687 static void LDKLogger_JCalls_free(void* this_arg) {
3688         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3689         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3690                 FREE(j_calls);
3691         }
3692 }
3693 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3694         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3695         LDKRecord record_var = record;
3696         int64_t record_ref = 0;
3697         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3698         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3699         js_invoke_function_void_l(j_calls->instance_ptr, 25, record_ref);
3700 }
3701 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3702         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3703         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3704 }
3705 static inline LDKLogger LDKLogger_init (int64_t o) {
3706         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3707         atomic_init(&calls->refcnt, 1);
3708         calls->instance_ptr = o;
3709
3710         LDKLogger ret = {
3711                 .this_arg = (void*) calls,
3712                 .log = log_LDKLogger_jcall,
3713                 .free = LDKLogger_JCalls_free,
3714         };
3715         return ret;
3716 }
3717 uint64_t  CS_LDK_LDKLogger_new(int32_t o) {
3718         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3719         *res_ptr = LDKLogger_init(o);
3720         return tag_ptr(res_ptr, true);
3721 }
3722 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3723         LDKProbabilisticScorer ret = *owner->contents.result;
3724         ret.is_owned = false;
3725         return ret;
3726 }
3727 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(int64_t owner) {
3728         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3729         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3730         int64_t ret_ref = 0;
3731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3733         return ret_ref;
3734 }
3735
3736 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3737 CHECK(!owner->result_ok);
3738         return DecodeError_clone(&*owner->contents.err);
3739 }
3740 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_err(int64_t owner) {
3741         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3743         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3744         int64_t ret_ref = tag_ptr(ret_copy, true);
3745         return ret_ref;
3746 }
3747
3748 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3749         LDKBestBlock ret = *owner->contents.result;
3750         ret.is_owned = false;
3751         return ret;
3752 }
3753 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_get_ok(int64_t owner) {
3754         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3755         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
3756         int64_t ret_ref = 0;
3757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3759         return ret_ref;
3760 }
3761
3762 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3763 CHECK(!owner->result_ok);
3764         return DecodeError_clone(&*owner->contents.err);
3765 }
3766 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_get_err(int64_t owner) {
3767         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3769         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
3770         int64_t ret_ref = tag_ptr(ret_copy, true);
3771         return ret_ref;
3772 }
3773
3774 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3775         return owner->a;
3776 }
3777 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_get_a(int64_t owner) {
3778         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3779         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3780         return ret_conv;
3781 }
3782
3783 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3784         return owner->b;
3785 }
3786 int8_tArray  CS_LDK_C2Tuple_usizeTransactionZ_get_b(int64_t owner) {
3787         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3788         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3789         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3790         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3791         return ret_arr;
3792 }
3793
3794 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3795         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3796         for (size_t i = 0; i < ret.datalen; i++) {
3797                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3798         }
3799         return ret;
3800 }
3801 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3802         return ThirtyTwoBytes_clone(&owner->a);
3803 }
3804 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(int64_t owner) {
3805         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3806         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3807         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3808         return ret_arr;
3809 }
3810
3811 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3812         return owner->b;
3813 }
3814 int32_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(int64_t owner) {
3815         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3816         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3817         return ret_conv;
3818 }
3819
3820 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3821         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3822 }
3823 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(int64_t owner) {
3824         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3825         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3826         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3827         int64_t ret_ref = tag_ptr(ret_copy, true);
3828         return ret_ref;
3829 }
3830
3831 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3832         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3833         for (size_t i = 0; i < ret.datalen; i++) {
3834                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3835         }
3836         return ret;
3837 }
3838 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3839 CHECK(owner->result_ok);
3840         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3841 }
3842 int32_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(int64_t owner) {
3843         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3844         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3845         return ret_conv;
3846 }
3847
3848 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3849 CHECK(!owner->result_ok);
3850         return *owner->contents.err;
3851 }
3852 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(int64_t owner) {
3853         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3854         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3855 }
3856
3857 uint32_t CS_LDK_LDKClosureReason_ty_from_ptr(int64_t ptr) {
3858         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3859         switch(obj->tag) {
3860                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3861                 case LDKClosureReason_HolderForceClosed: return 1;
3862                 case LDKClosureReason_LegacyCooperativeClosure: return 2;
3863                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: return 3;
3864                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: return 4;
3865                 case LDKClosureReason_CommitmentTxConfirmed: return 5;
3866                 case LDKClosureReason_FundingTimedOut: return 6;
3867                 case LDKClosureReason_ProcessingError: return 7;
3868                 case LDKClosureReason_DisconnectedPeer: return 8;
3869                 case LDKClosureReason_OutdatedChannelManager: return 9;
3870                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 10;
3871                 case LDKClosureReason_FundingBatchClosure: return 11;
3872                 case LDKClosureReason_HTLCsTimedOut: return 12;
3873                 default: abort();
3874         }
3875 }
3876 int64_t CS_LDK_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(int64_t ptr) {
3877         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3878         CHECK(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3879         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3880                         int64_t peer_msg_ref = 0;
3881                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3882                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3883         return peer_msg_ref;
3884 }
3885 jstring CS_LDK_LDKClosureReason_ProcessingError_get_err(int64_t ptr) {
3886         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3887         CHECK(obj->tag == LDKClosureReason_ProcessingError);
3888         LDKStr err_str = obj->processing_error.err;
3889                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
3890         return err_conv;
3891 }
3892 uint32_t CS_LDK_LDKMonitorEvent_ty_from_ptr(int64_t ptr) {
3893         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3894         switch(obj->tag) {
3895                 case LDKMonitorEvent_HTLCEvent: return 0;
3896                 case LDKMonitorEvent_HolderForceClosedWithInfo: return 1;
3897                 case LDKMonitorEvent_HolderForceClosed: return 2;
3898                 case LDKMonitorEvent_Completed: return 3;
3899                 default: abort();
3900         }
3901 }
3902 int64_t CS_LDK_LDKMonitorEvent_HTLCEvent_get_htlc_event(int64_t ptr) {
3903         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3904         CHECK(obj->tag == LDKMonitorEvent_HTLCEvent);
3905         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3906                         int64_t htlc_event_ref = 0;
3907                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3908                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3909         return htlc_event_ref;
3910 }
3911 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason(int64_t ptr) {
3912         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3913         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3914         int64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
3915         return reason_ref;
3916 }
3917 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint(int64_t ptr) {
3918         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3919         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3920         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
3921                         int64_t outpoint_ref = 0;
3922                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3923                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3924         return outpoint_ref;
3925 }
3926 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id(int64_t ptr) {
3927         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3928         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3929         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
3930                         int64_t channel_id_ref = 0;
3931                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3932                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3933         return channel_id_ref;
3934 }
3935 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(int64_t ptr) {
3936         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3937         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosed);
3938         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3939                         int64_t holder_force_closed_ref = 0;
3940                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3941                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3942         return holder_force_closed_ref;
3943 }
3944 int64_t CS_LDK_LDKMonitorEvent_Completed_get_funding_txo(int64_t ptr) {
3945         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3946         CHECK(obj->tag == LDKMonitorEvent_Completed);
3947         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3948                         int64_t funding_txo_ref = 0;
3949                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3950                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3951         return funding_txo_ref;
3952 }
3953 int64_t CS_LDK_LDKMonitorEvent_Completed_get_channel_id(int64_t ptr) {
3954         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3955         CHECK(obj->tag == LDKMonitorEvent_Completed);
3956         LDKChannelId channel_id_var = obj->completed.channel_id;
3957                         int64_t channel_id_ref = 0;
3958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3959                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3960         return channel_id_ref;
3961 }
3962 int64_t CS_LDK_LDKMonitorEvent_Completed_get_monitor_update_id(int64_t ptr) {
3963         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3964         CHECK(obj->tag == LDKMonitorEvent_Completed);
3965         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3966         return monitor_update_id_conv;
3967 }
3968 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3969         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3970         for (size_t i = 0; i < ret.datalen; i++) {
3971                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3972         }
3973         return ret;
3974 }
3975 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3976         LDKOutPoint ret = owner->a;
3977         ret.is_owned = false;
3978         return ret;
3979 }
3980 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(int64_t owner) {
3981         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3982         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3983         int64_t ret_ref = 0;
3984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3986         return ret_ref;
3987 }
3988
3989 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3990         LDKChannelId ret = owner->b;
3991         ret.is_owned = false;
3992         return ret;
3993 }
3994 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(int64_t owner) {
3995         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3996         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3997         int64_t ret_ref = 0;
3998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4000         return ret_ref;
4001 }
4002
4003 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4004         return CVec_MonitorEventZ_clone(&owner->c);
4005 }
4006 int64_tArray  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(int64_t owner) {
4007         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4008         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
4009         int64_tArray ret_arr = NULL;
4010         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
4011         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
4012         for (size_t o = 0; o < ret_var.datalen; o++) {
4013                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4014                 *ret_conv_14_copy = ret_var.data[o];
4015                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
4016                 ret_arr_ptr[o] = ret_conv_14_ref;
4017         }
4018         
4019         FREE(ret_var.data);
4020         return ret_arr;
4021 }
4022
4023 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4024         return owner->d;
4025 }
4026 int8_tArray  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(int64_t owner) {
4027         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4028         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4029         memcpy(ret_arr->elems, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form, 33);
4030         return ret_arr;
4031 }
4032
4033 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
4034         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4035         for (size_t i = 0; i < ret.datalen; i++) {
4036                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
4037         }
4038         return ret;
4039 }
4040 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4041         LDKInitFeatures ret = *owner->contents.result;
4042         ret.is_owned = false;
4043         return ret;
4044 }
4045 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4046         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4047         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4048         int64_t ret_ref = 0;
4049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4051         return ret_ref;
4052 }
4053
4054 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4055 CHECK(!owner->result_ok);
4056         return DecodeError_clone(&*owner->contents.err);
4057 }
4058 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_err(int64_t owner) {
4059         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4061         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4062         int64_t ret_ref = tag_ptr(ret_copy, true);
4063         return ret_ref;
4064 }
4065
4066 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4067         LDKChannelFeatures ret = *owner->contents.result;
4068         ret.is_owned = false;
4069         return ret;
4070 }
4071 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4072         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4073         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4074         int64_t ret_ref = 0;
4075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4077         return ret_ref;
4078 }
4079
4080 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4081 CHECK(!owner->result_ok);
4082         return DecodeError_clone(&*owner->contents.err);
4083 }
4084 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_err(int64_t owner) {
4085         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4086         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4087         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4088         int64_t ret_ref = tag_ptr(ret_copy, true);
4089         return ret_ref;
4090 }
4091
4092 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4093         LDKNodeFeatures ret = *owner->contents.result;
4094         ret.is_owned = false;
4095         return ret;
4096 }
4097 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4098         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4099         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4100         int64_t ret_ref = 0;
4101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4103         return ret_ref;
4104 }
4105
4106 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4107 CHECK(!owner->result_ok);
4108         return DecodeError_clone(&*owner->contents.err);
4109 }
4110 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_err(int64_t owner) {
4111         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4113         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4114         int64_t ret_ref = tag_ptr(ret_copy, true);
4115         return ret_ref;
4116 }
4117
4118 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4119         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
4120         ret.is_owned = false;
4121         return ret;
4122 }
4123 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4124         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4125         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4126         int64_t ret_ref = 0;
4127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4129         return ret_ref;
4130 }
4131
4132 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4133 CHECK(!owner->result_ok);
4134         return DecodeError_clone(&*owner->contents.err);
4135 }
4136 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
4137         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4139         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4140         int64_t ret_ref = tag_ptr(ret_copy, true);
4141         return ret_ref;
4142 }
4143
4144 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4145         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
4146         ret.is_owned = false;
4147         return ret;
4148 }
4149 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4150         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4151         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4152         int64_t ret_ref = 0;
4153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4155         return ret_ref;
4156 }
4157
4158 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4159 CHECK(!owner->result_ok);
4160         return DecodeError_clone(&*owner->contents.err);
4161 }
4162 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
4163         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4165         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4166         int64_t ret_ref = tag_ptr(ret_copy, true);
4167         return ret_ref;
4168 }
4169
4170 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4171         LDKBlindedHopFeatures ret = *owner->contents.result;
4172         ret.is_owned = false;
4173         return ret;
4174 }
4175 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4176         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4177         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
4178         int64_t ret_ref = 0;
4179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4181         return ret_ref;
4182 }
4183
4184 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4185 CHECK(!owner->result_ok);
4186         return DecodeError_clone(&*owner->contents.err);
4187 }
4188 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(int64_t owner) {
4189         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4191         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
4192         int64_t ret_ref = tag_ptr(ret_copy, true);
4193         return ret_ref;
4194 }
4195
4196 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4197         LDKChannelTypeFeatures ret = *owner->contents.result;
4198         ret.is_owned = false;
4199         return ret;
4200 }
4201 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4202         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4203         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4204         int64_t ret_ref = 0;
4205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4207         return ret_ref;
4208 }
4209
4210 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4211 CHECK(!owner->result_ok);
4212         return DecodeError_clone(&*owner->contents.err);
4213 }
4214 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(int64_t owner) {
4215         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4217         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4218         int64_t ret_ref = tag_ptr(ret_copy, true);
4219         return ret_ref;
4220 }
4221
4222 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
4223         LDKOfferId ret = *owner->contents.result;
4224         ret.is_owned = false;
4225         return ret;
4226 }
4227 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_get_ok(int64_t owner) {
4228         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
4229         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
4230         int64_t ret_ref = 0;
4231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4233         return ret_ref;
4234 }
4235
4236 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
4237 CHECK(!owner->result_ok);
4238         return DecodeError_clone(&*owner->contents.err);
4239 }
4240 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_get_err(int64_t owner) {
4241         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
4242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4243         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
4244         int64_t ret_ref = tag_ptr(ret_copy, true);
4245         return ret_ref;
4246 }
4247
4248 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
4249 CHECK(owner->result_ok);
4250         return *owner->contents.result;
4251 }
4252 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_ok(int64_t owner) {
4253         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
4254         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
4255 }
4256
4257 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
4258 CHECK(!owner->result_ok);
4259         return Bolt12SemanticError_clone(&*owner->contents.err);
4260 }
4261 int32_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_err(int64_t owner) {
4262         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
4263         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
4264         return ret_conv;
4265 }
4266
4267 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
4268         LDKOffer ret = *owner->contents.result;
4269         ret.is_owned = false;
4270         return ret;
4271 }
4272 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_get_ok(int64_t owner) {
4273         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
4274         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
4275         int64_t ret_ref = 0;
4276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4278         return ret_ref;
4279 }
4280
4281 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
4282 CHECK(!owner->result_ok);
4283         return Bolt12SemanticError_clone(&*owner->contents.err);
4284 }
4285 int32_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_get_err(int64_t owner) {
4286         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
4287         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
4288         return ret_conv;
4289 }
4290
4291 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4292         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
4293         ret.is_owned = false;
4294         return ret;
4295 }
4296 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
4297         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4298         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
4299         int64_t ret_ref = 0;
4300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4302         return ret_ref;
4303 }
4304
4305 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4306 CHECK(!owner->result_ok);
4307         return Bolt12SemanticError_clone(&*owner->contents.err);
4308 }
4309 int32_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
4310         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4311         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
4312         return ret_conv;
4313 }
4314
4315 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4316         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
4317         ret.is_owned = false;
4318         return ret;
4319 }
4320 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
4321         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4322         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
4323         int64_t ret_ref = 0;
4324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4326         return ret_ref;
4327 }
4328
4329 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4330 CHECK(!owner->result_ok);
4331         return Bolt12SemanticError_clone(&*owner->contents.err);
4332 }
4333 int32_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
4334         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4335         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
4336         return ret_conv;
4337 }
4338
4339 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4340         LDKOffer ret = *owner->contents.result;
4341         ret.is_owned = false;
4342         return ret;
4343 }
4344 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_ok(int64_t owner) {
4345         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
4346         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
4347         int64_t ret_ref = 0;
4348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4350         return ret_ref;
4351 }
4352
4353 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4354         LDKBolt12ParseError ret = *owner->contents.err;
4355         ret.is_owned = false;
4356         return ret;
4357 }
4358 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_err(int64_t owner) {
4359         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
4360         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
4361         int64_t ret_ref = 0;
4362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4364         return ret_ref;
4365 }
4366
4367 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4368         LDKNodeId ret = *owner->contents.result;
4369         ret.is_owned = false;
4370         return ret;
4371 }
4372 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_ok(int64_t owner) {
4373         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4374         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
4375         int64_t ret_ref = 0;
4376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4378         return ret_ref;
4379 }
4380
4381 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4382 CHECK(!owner->result_ok);
4383         return DecodeError_clone(&*owner->contents.err);
4384 }
4385 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_err(int64_t owner) {
4386         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4388         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
4389         int64_t ret_ref = tag_ptr(ret_copy, true);
4390         return ret_ref;
4391 }
4392
4393 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
4394 CHECK(owner->result_ok);
4395         return *owner->contents.result;
4396 }
4397 int8_tArray  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_ok(int64_t owner) {
4398         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
4399         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4400         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
4401         return ret_arr;
4402 }
4403
4404 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
4405 CHECK(!owner->result_ok);
4406         return *owner->contents.err;
4407 }
4408 int32_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_err(int64_t owner) {
4409         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
4410         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
4411         return ret_conv;
4412 }
4413
4414 uint32_t CS_LDK_LDKNetworkUpdate_ty_from_ptr(int64_t ptr) {
4415         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4416         switch(obj->tag) {
4417                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
4418                 case LDKNetworkUpdate_ChannelFailure: return 1;
4419                 case LDKNetworkUpdate_NodeFailure: return 2;
4420                 default: abort();
4421         }
4422 }
4423 int64_t CS_LDK_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(int64_t ptr) {
4424         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4425         CHECK(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
4426         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
4427                         int64_t msg_ref = 0;
4428                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4429                         msg_ref = tag_ptr(msg_var.inner, false);
4430         return msg_ref;
4431 }
4432 int64_t CS_LDK_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(int64_t ptr) {
4433         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4434         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4435         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
4436         return short_channel_id_conv;
4437 }
4438 jboolean CS_LDK_LDKNetworkUpdate_ChannelFailure_get_is_permanent(int64_t ptr) {
4439         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4440         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4441         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
4442         return is_permanent_conv;
4443 }
4444 int8_tArray CS_LDK_LDKNetworkUpdate_NodeFailure_get_node_id(int64_t ptr) {
4445         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4446         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4447         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4448         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
4449         return node_id_arr;
4450 }
4451 jboolean CS_LDK_LDKNetworkUpdate_NodeFailure_get_is_permanent(int64_t ptr) {
4452         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4453         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4454         jboolean is_permanent_conv = obj->node_failure.is_permanent;
4455         return is_permanent_conv;
4456 }
4457 uint32_t CS_LDK_LDKCOption_NetworkUpdateZ_ty_from_ptr(int64_t ptr) {
4458         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4459         switch(obj->tag) {
4460                 case LDKCOption_NetworkUpdateZ_Some: return 0;
4461                 case LDKCOption_NetworkUpdateZ_None: return 1;
4462                 default: abort();
4463         }
4464 }
4465 int64_t CS_LDK_LDKCOption_NetworkUpdateZ_Some_get_some(int64_t ptr) {
4466         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4467         CHECK(obj->tag == LDKCOption_NetworkUpdateZ_Some);
4468         int64_t some_ref = tag_ptr(&obj->some, false);
4469         return some_ref;
4470 }
4471 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4472 CHECK(owner->result_ok);
4473         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4474 }
4475 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(int64_t owner) {
4476         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4477         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4478         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4479         int64_t ret_ref = tag_ptr(ret_copy, true);
4480         return ret_ref;
4481 }
4482
4483 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4484 CHECK(!owner->result_ok);
4485         return DecodeError_clone(&*owner->contents.err);
4486 }
4487 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(int64_t owner) {
4488         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4490         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4491         int64_t ret_ref = tag_ptr(ret_copy, true);
4492         return ret_ref;
4493 }
4494
4495 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4496 CHECK(owner->result_ok);
4497         return TxOut_clone(&*owner->contents.result);
4498 }
4499 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_ok(int64_t owner) {
4500         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4501         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4502         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
4503         return tag_ptr(ret_ref, true);
4504 }
4505
4506 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4507 CHECK(!owner->result_ok);
4508         return UtxoLookupError_clone(&*owner->contents.err);
4509 }
4510 int32_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_err(int64_t owner) {
4511         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4512         int32_t ret_conv = LDKUtxoLookupError_to_cs(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
4513         return ret_conv;
4514 }
4515
4516 uint32_t CS_LDK_LDKUtxoResult_ty_from_ptr(int64_t ptr) {
4517         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4518         switch(obj->tag) {
4519                 case LDKUtxoResult_Sync: return 0;
4520                 case LDKUtxoResult_Async: return 1;
4521                 default: abort();
4522         }
4523 }
4524 int64_t CS_LDK_LDKUtxoResult_Sync_get_sync(int64_t ptr) {
4525         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4526         CHECK(obj->tag == LDKUtxoResult_Sync);
4527         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
4528         *sync_conv = obj->sync;
4529                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
4530         return tag_ptr(sync_conv, true);
4531 }
4532 int64_t CS_LDK_LDKUtxoResult_Async_get_async(int64_t ptr) {
4533         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4534         CHECK(obj->tag == LDKUtxoResult_Async);
4535         LDKUtxoFuture async_var = obj->async;
4536                         int64_t async_ref = 0;
4537                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
4538                         async_ref = tag_ptr(async_var.inner, false);
4539         return async_ref;
4540 }
4541 typedef struct LDKUtxoLookup_JCalls {
4542         atomic_size_t refcnt;
4543         uint32_t instance_ptr;
4544 } LDKUtxoLookup_JCalls;
4545 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
4546         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4547         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4548                 FREE(j_calls);
4549         }
4550 }
4551 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
4552         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4553         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
4554         memcpy(chain_hash_arr->elems, *chain_hash, 32);
4555         int64_t short_channel_id_conv = short_channel_id;
4556         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 26, (int64_t)chain_hash_arr, short_channel_id_conv);
4557         void* ret_ptr = untag_ptr(ret);
4558         CHECK_ACCESS(ret_ptr);
4559         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
4560         FREE(untag_ptr(ret));
4561         return ret_conv;
4562 }
4563 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
4564         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
4565         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4566 }
4567 static inline LDKUtxoLookup LDKUtxoLookup_init (int64_t o) {
4568         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
4569         atomic_init(&calls->refcnt, 1);
4570         calls->instance_ptr = o;
4571
4572         LDKUtxoLookup ret = {
4573                 .this_arg = (void*) calls,
4574                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
4575                 .free = LDKUtxoLookup_JCalls_free,
4576         };
4577         return ret;
4578 }
4579 uint64_t  CS_LDK_LDKUtxoLookup_new(int32_t o) {
4580         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4581         *res_ptr = LDKUtxoLookup_init(o);
4582         return tag_ptr(res_ptr, true);
4583 }
4584 int64_t  CS_LDK_UtxoLookup_get_utxo(int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
4585         void* this_arg_ptr = untag_ptr(this_arg);
4586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4587         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
4588         uint8_t chain_hash_arr[32];
4589         CHECK(chain_hash->arr_len == 32);
4590         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
4591         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
4592         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
4593         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
4594         int64_t ret_ref = tag_ptr(ret_copy, true);
4595         return ret_ref;
4596 }
4597
4598 uint32_t CS_LDK_LDKCOption_UtxoLookupZ_ty_from_ptr(int64_t ptr) {
4599         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4600         switch(obj->tag) {
4601                 case LDKCOption_UtxoLookupZ_Some: return 0;
4602                 case LDKCOption_UtxoLookupZ_None: return 1;
4603                 default: abort();
4604         }
4605 }
4606 int64_t CS_LDK_LDKCOption_UtxoLookupZ_Some_get_some(int64_t ptr) {
4607         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4608         CHECK(obj->tag == LDKCOption_UtxoLookupZ_Some);
4609         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4610         *some_ret = obj->some;
4611                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4612                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4613                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4614                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4615                         }
4616         return tag_ptr(some_ret, true);
4617 }
4618 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4619 CHECK(owner->result_ok);
4620         return *owner->contents.result;
4621 }
4622 void  CS_LDK_CResult_NoneLightningErrorZ_get_ok(int64_t owner) {
4623         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4624         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4625 }
4626
4627 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4628         LDKLightningError ret = *owner->contents.err;
4629         ret.is_owned = false;
4630         return ret;
4631 }
4632 int64_t  CS_LDK_CResult_NoneLightningErrorZ_get_err(int64_t owner) {
4633         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4634         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4635         int64_t ret_ref = 0;
4636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4638         return ret_ref;
4639 }
4640
4641 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4642 CHECK(owner->result_ok);
4643         return *owner->contents.result;
4644 }
4645 jboolean  CS_LDK_CResult_boolLightningErrorZ_get_ok(int64_t owner) {
4646         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4647         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4648         return ret_conv;
4649 }
4650
4651 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4652         LDKLightningError ret = *owner->contents.err;
4653         ret.is_owned = false;
4654         return ret;
4655 }
4656 int64_t  CS_LDK_CResult_boolLightningErrorZ_get_err(int64_t owner) {
4657         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4658         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4659         int64_t ret_ref = 0;
4660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4662         return ret_ref;
4663 }
4664
4665 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4666         LDKChannelAnnouncement ret = owner->a;
4667         ret.is_owned = false;
4668         return ret;
4669 }
4670 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(int64_t owner) {
4671         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4672         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4673         int64_t ret_ref = 0;
4674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4676         return ret_ref;
4677 }
4678
4679 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4680         LDKChannelUpdate ret = owner->b;
4681         ret.is_owned = false;
4682         return ret;
4683 }
4684 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(int64_t owner) {
4685         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4686         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4687         int64_t ret_ref = 0;
4688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4690         return ret_ref;
4691 }
4692
4693 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4694         LDKChannelUpdate ret = owner->c;
4695         ret.is_owned = false;
4696         return ret;
4697 }
4698 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(int64_t owner) {
4699         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4700         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4701         int64_t ret_ref = 0;
4702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4704         return ret_ref;
4705 }
4706
4707 uint32_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(int64_t ptr) {
4708         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4709         switch(obj->tag) {
4710                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4711                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4712                 default: abort();
4713         }
4714 }
4715 int64_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(int64_t ptr) {
4716         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4717         CHECK(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4718         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4719         *some_conv = obj->some;
4720                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4721         return tag_ptr(some_conv, true);
4722 }
4723 uint32_t CS_LDK_LDKErrorAction_ty_from_ptr(int64_t ptr) {
4724         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4725         switch(obj->tag) {
4726                 case LDKErrorAction_DisconnectPeer: return 0;
4727                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4728                 case LDKErrorAction_IgnoreError: return 2;
4729                 case LDKErrorAction_IgnoreAndLog: return 3;
4730                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4731                 case LDKErrorAction_SendErrorMessage: return 5;
4732                 case LDKErrorAction_SendWarningMessage: return 6;
4733                 default: abort();
4734         }
4735 }
4736 int64_t CS_LDK_LDKErrorAction_DisconnectPeer_get_msg(int64_t ptr) {
4737         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4738         CHECK(obj->tag == LDKErrorAction_DisconnectPeer);
4739         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4740                         int64_t msg_ref = 0;
4741                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4742                         msg_ref = tag_ptr(msg_var.inner, false);
4743         return msg_ref;
4744 }
4745 int64_t CS_LDK_LDKErrorAction_DisconnectPeerWithWarning_get_msg(int64_t ptr) {
4746         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4747         CHECK(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4748         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4749                         int64_t msg_ref = 0;
4750                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4751                         msg_ref = tag_ptr(msg_var.inner, false);
4752         return msg_ref;
4753 }
4754 int32_t CS_LDK_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(int64_t ptr) {
4755         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4756         CHECK(obj->tag == LDKErrorAction_IgnoreAndLog);
4757         int32_t ignore_and_log_conv = LDKLevel_to_cs(obj->ignore_and_log);
4758         return ignore_and_log_conv;
4759 }
4760 int64_t CS_LDK_LDKErrorAction_SendErrorMessage_get_msg(int64_t ptr) {
4761         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4762         CHECK(obj->tag == LDKErrorAction_SendErrorMessage);
4763         LDKErrorMessage msg_var = obj->send_error_message.msg;
4764                         int64_t msg_ref = 0;
4765                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4766                         msg_ref = tag_ptr(msg_var.inner, false);
4767         return msg_ref;
4768 }
4769 int64_t CS_LDK_LDKErrorAction_SendWarningMessage_get_msg(int64_t ptr) {
4770         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4771         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4772         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4773                         int64_t msg_ref = 0;
4774                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4775                         msg_ref = tag_ptr(msg_var.inner, false);
4776         return msg_ref;
4777 }
4778 int32_t CS_LDK_LDKErrorAction_SendWarningMessage_get_log_level(int64_t ptr) {
4779         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4780         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4781         int32_t log_level_conv = LDKLevel_to_cs(obj->send_warning_message.log_level);
4782         return log_level_conv;
4783 }
4784 uint32_t CS_LDK_LDKMessageSendEvent_ty_from_ptr(int64_t ptr) {
4785         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4786         switch(obj->tag) {
4787                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4788                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4789                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4790                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4791                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4792                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4793                 case LDKMessageSendEvent_SendStfu: return 6;
4794                 case LDKMessageSendEvent_SendSplice: return 7;
4795                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4796                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4797                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4798                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4799                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4800                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4801                 case LDKMessageSendEvent_SendTxComplete: return 14;
4802                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4803                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4804                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4805                 case LDKMessageSendEvent_SendTxAbort: return 18;
4806                 case LDKMessageSendEvent_SendChannelReady: return 19;
4807                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4808                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4809                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4810                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4811                 case LDKMessageSendEvent_SendShutdown: return 24;
4812                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4813                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4814                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4815                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4816                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4817                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4818                 case LDKMessageSendEvent_HandleError: return 31;
4819                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4820                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4821                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4822                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4823                 default: abort();
4824         }
4825 }
4826 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_node_id(int64_t ptr) {
4827         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4828         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4829         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4830         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4831         return node_id_arr;
4832 }
4833 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_msg(int64_t ptr) {
4834         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4835         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4836         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4837                         int64_t msg_ref = 0;
4838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4839                         msg_ref = tag_ptr(msg_var.inner, false);
4840         return msg_ref;
4841 }
4842 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(int64_t ptr) {
4843         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4844         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4845         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4846         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4847         return node_id_arr;
4848 }
4849 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(int64_t ptr) {
4850         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4851         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4852         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4853                         int64_t msg_ref = 0;
4854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4855                         msg_ref = tag_ptr(msg_var.inner, false);
4856         return msg_ref;
4857 }
4858 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_node_id(int64_t ptr) {
4859         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4860         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4861         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4862         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4863         return node_id_arr;
4864 }
4865 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_msg(int64_t ptr) {
4866         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4867         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4868         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4869                         int64_t msg_ref = 0;
4870                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4871                         msg_ref = tag_ptr(msg_var.inner, false);
4872         return msg_ref;
4873 }
4874 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(int64_t ptr) {
4875         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4876         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4877         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4878         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4879         return node_id_arr;
4880 }
4881 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_msg(int64_t ptr) {
4882         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4883         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4884         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4885                         int64_t msg_ref = 0;
4886                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4887                         msg_ref = tag_ptr(msg_var.inner, false);
4888         return msg_ref;
4889 }
4890 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_node_id(int64_t ptr) {
4891         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4892         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4893         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4894         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4895         return node_id_arr;
4896 }
4897 int64_t CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_msg(int64_t ptr) {
4898         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4899         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4900         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4901                         int64_t msg_ref = 0;
4902                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4903                         msg_ref = tag_ptr(msg_var.inner, false);
4904         return msg_ref;
4905 }
4906 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_node_id(int64_t ptr) {
4907         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4908         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4909         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4910         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4911         return node_id_arr;
4912 }
4913 int64_t CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_msg(int64_t ptr) {
4914         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4915         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4916         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4917                         int64_t msg_ref = 0;
4918                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4919                         msg_ref = tag_ptr(msg_var.inner, false);
4920         return msg_ref;
4921 }
4922 int8_tArray CS_LDK_LDKMessageSendEvent_SendStfu_get_node_id(int64_t ptr) {
4923         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4924         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4925         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4926         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4927         return node_id_arr;
4928 }
4929 int64_t CS_LDK_LDKMessageSendEvent_SendStfu_get_msg(int64_t ptr) {
4930         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4931         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4932         LDKStfu msg_var = obj->send_stfu.msg;
4933                         int64_t msg_ref = 0;
4934                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4935                         msg_ref = tag_ptr(msg_var.inner, false);
4936         return msg_ref;
4937 }
4938 int8_tArray CS_LDK_LDKMessageSendEvent_SendSplice_get_node_id(int64_t ptr) {
4939         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4940         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4941         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4942         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4943         return node_id_arr;
4944 }
4945 int64_t CS_LDK_LDKMessageSendEvent_SendSplice_get_msg(int64_t ptr) {
4946         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4947         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4948         LDKSplice msg_var = obj->send_splice.msg;
4949                         int64_t msg_ref = 0;
4950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4951                         msg_ref = tag_ptr(msg_var.inner, false);
4952         return msg_ref;
4953 }
4954 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_node_id(int64_t ptr) {
4955         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4956         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4957         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4958         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4959         return node_id_arr;
4960 }
4961 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_msg(int64_t ptr) {
4962         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4963         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4964         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4965                         int64_t msg_ref = 0;
4966                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4967                         msg_ref = tag_ptr(msg_var.inner, false);
4968         return msg_ref;
4969 }
4970 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_node_id(int64_t ptr) {
4971         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4972         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4973         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4974         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4975         return node_id_arr;
4976 }
4977 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_msg(int64_t ptr) {
4978         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4979         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4980         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4981                         int64_t msg_ref = 0;
4982                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4983                         msg_ref = tag_ptr(msg_var.inner, false);
4984         return msg_ref;
4985 }
4986 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_node_id(int64_t ptr) {
4987         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4988         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4989         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4990         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4991         return node_id_arr;
4992 }
4993 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_msg(int64_t ptr) {
4994         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4995         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4996         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4997                         int64_t msg_ref = 0;
4998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4999                         msg_ref = tag_ptr(msg_var.inner, false);
5000         return msg_ref;
5001 }
5002 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_node_id(int64_t ptr) {
5003         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5004         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
5005         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5006         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
5007         return node_id_arr;
5008 }
5009 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_msg(int64_t ptr) {
5010         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5011         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
5012         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
5013                         int64_t msg_ref = 0;
5014                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5015                         msg_ref = tag_ptr(msg_var.inner, false);
5016         return msg_ref;
5017 }
5018 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(int64_t ptr) {
5019         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5020         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
5021         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5022         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
5023         return node_id_arr;
5024 }
5025 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_msg(int64_t ptr) {
5026         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5027         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
5028         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
5029                         int64_t msg_ref = 0;
5030                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5031                         msg_ref = tag_ptr(msg_var.inner, false);
5032         return msg_ref;
5033 }
5034 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(int64_t ptr) {
5035         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5036         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
5037         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5038         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
5039         return node_id_arr;
5040 }
5041 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(int64_t ptr) {
5042         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5043         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
5044         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
5045                         int64_t msg_ref = 0;
5046                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5047                         msg_ref = tag_ptr(msg_var.inner, false);
5048         return msg_ref;
5049 }
5050 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxComplete_get_node_id(int64_t ptr) {
5051         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5052         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
5053         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5054         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
5055         return node_id_arr;
5056 }
5057 int64_t CS_LDK_LDKMessageSendEvent_SendTxComplete_get_msg(int64_t ptr) {
5058         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5059         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
5060         LDKTxComplete msg_var = obj->send_tx_complete.msg;
5061                         int64_t msg_ref = 0;
5062                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5063                         msg_ref = tag_ptr(msg_var.inner, false);
5064         return msg_ref;
5065 }
5066 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_node_id(int64_t ptr) {
5067         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5068         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
5069         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5070         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
5071         return node_id_arr;
5072 }
5073 int64_t CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_msg(int64_t ptr) {
5074         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5075         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
5076         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
5077                         int64_t msg_ref = 0;
5078                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5079                         msg_ref = tag_ptr(msg_var.inner, false);
5080         return msg_ref;
5081 }
5082 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_node_id(int64_t ptr) {
5083         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5084         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
5085         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5086         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
5087         return node_id_arr;
5088 }
5089 int64_t CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_msg(int64_t ptr) {
5090         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5091         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
5092         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
5093                         int64_t msg_ref = 0;
5094                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5095                         msg_ref = tag_ptr(msg_var.inner, false);
5096         return msg_ref;
5097 }
5098 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_node_id(int64_t ptr) {
5099         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5100         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
5101         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5102         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
5103         return node_id_arr;
5104 }
5105 int64_t CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_msg(int64_t ptr) {
5106         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5107         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
5108         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
5109                         int64_t msg_ref = 0;
5110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5111                         msg_ref = tag_ptr(msg_var.inner, false);
5112         return msg_ref;
5113 }
5114 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAbort_get_node_id(int64_t ptr) {
5115         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5116         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
5117         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5118         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
5119         return node_id_arr;
5120 }
5121 int64_t CS_LDK_LDKMessageSendEvent_SendTxAbort_get_msg(int64_t ptr) {
5122         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5123         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
5124         LDKTxAbort msg_var = obj->send_tx_abort.msg;
5125                         int64_t msg_ref = 0;
5126                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5127                         msg_ref = tag_ptr(msg_var.inner, false);
5128         return msg_ref;
5129 }
5130 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReady_get_node_id(int64_t ptr) {
5131         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5132         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
5133         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5134         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
5135         return node_id_arr;
5136 }
5137 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReady_get_msg(int64_t ptr) {
5138         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5139         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
5140         LDKChannelReady msg_var = obj->send_channel_ready.msg;
5141                         int64_t msg_ref = 0;
5142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5143                         msg_ref = tag_ptr(msg_var.inner, false);
5144         return msg_ref;
5145 }
5146 int8_tArray CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(int64_t ptr) {
5147         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5148         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
5149         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5150         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
5151         return node_id_arr;
5152 }
5153 int64_t CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(int64_t ptr) {
5154         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5155         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
5156         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
5157                         int64_t msg_ref = 0;
5158                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5159                         msg_ref = tag_ptr(msg_var.inner, false);
5160         return msg_ref;
5161 }
5162 int8_tArray CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_node_id(int64_t ptr) {
5163         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5164         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
5165         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5166         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
5167         return node_id_arr;
5168 }
5169 int64_t CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_updates(int64_t ptr) {
5170         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5171         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
5172         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
5173                         int64_t updates_ref = 0;
5174                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
5175                         updates_ref = tag_ptr(updates_var.inner, false);
5176         return updates_ref;
5177 }
5178 int8_tArray CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(int64_t ptr) {
5179         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5180         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
5181         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5182         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
5183         return node_id_arr;
5184 }
5185 int64_t CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_msg(int64_t ptr) {
5186         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5187         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
5188         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
5189                         int64_t msg_ref = 0;
5190                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5191                         msg_ref = tag_ptr(msg_var.inner, false);
5192         return msg_ref;
5193 }
5194 int8_tArray CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_node_id(int64_t ptr) {
5195         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5196         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
5197         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5198         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
5199         return node_id_arr;
5200 }
5201 int64_t CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_msg(int64_t ptr) {
5202         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5203         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
5204         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
5205                         int64_t msg_ref = 0;
5206                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5207                         msg_ref = tag_ptr(msg_var.inner, false);
5208         return msg_ref;
5209 }
5210 int8_tArray CS_LDK_LDKMessageSendEvent_SendShutdown_get_node_id(int64_t ptr) {
5211         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5212         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
5213         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5214         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
5215         return node_id_arr;
5216 }
5217 int64_t CS_LDK_LDKMessageSendEvent_SendShutdown_get_msg(int64_t ptr) {
5218         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5219         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
5220         LDKShutdown msg_var = obj->send_shutdown.msg;
5221                         int64_t msg_ref = 0;
5222                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5223                         msg_ref = tag_ptr(msg_var.inner, false);
5224         return msg_ref;
5225 }
5226 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_node_id(int64_t ptr) {
5227         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5228         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5229         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5230         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
5231         return node_id_arr;
5232 }
5233 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_msg(int64_t ptr) {
5234         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5235         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5236         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5237                         int64_t msg_ref = 0;
5238                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5239                         msg_ref = tag_ptr(msg_var.inner, false);
5240         return msg_ref;
5241 }
5242 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(int64_t ptr) {
5243         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5244         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5245         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5246         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
5247         return node_id_arr;
5248 }
5249 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(int64_t ptr) {
5250         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5251         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5252         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5253                         int64_t msg_ref = 0;
5254                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5255                         msg_ref = tag_ptr(msg_var.inner, false);
5256         return msg_ref;
5257 }
5258 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(int64_t ptr) {
5259         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5260         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5261         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
5262                         int64_t update_msg_ref = 0;
5263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5264                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5265         return update_msg_ref;
5266 }
5267 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(int64_t ptr) {
5268         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5269         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5270         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
5271                         int64_t msg_ref = 0;
5272                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5273                         msg_ref = tag_ptr(msg_var.inner, false);
5274         return msg_ref;
5275 }
5276 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(int64_t ptr) {
5277         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5278         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5279         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
5280                         int64_t update_msg_ref = 0;
5281                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5282                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5283         return update_msg_ref;
5284 }
5285 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(int64_t ptr) {
5286         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5287         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
5288         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
5289                         int64_t msg_ref = 0;
5290                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5291                         msg_ref = tag_ptr(msg_var.inner, false);
5292         return msg_ref;
5293 }
5294 int64_t CS_LDK_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(int64_t ptr) {
5295         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5296         CHECK(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
5297         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
5298                         int64_t msg_ref = 0;
5299                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5300                         msg_ref = tag_ptr(msg_var.inner, false);
5301         return msg_ref;
5302 }
5303 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_node_id(int64_t ptr) {
5304         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5305         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5306         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5307         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
5308         return node_id_arr;
5309 }
5310 int64_t CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_msg(int64_t ptr) {
5311         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5312         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5313         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
5314                         int64_t msg_ref = 0;
5315                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5316                         msg_ref = tag_ptr(msg_var.inner, false);
5317         return msg_ref;
5318 }
5319 int8_tArray CS_LDK_LDKMessageSendEvent_HandleError_get_node_id(int64_t ptr) {
5320         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5321         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
5322         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5323         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
5324         return node_id_arr;
5325 }
5326 int64_t CS_LDK_LDKMessageSendEvent_HandleError_get_action(int64_t ptr) {
5327         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5328         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
5329         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
5330         return action_ref;
5331 }
5332 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(int64_t ptr) {
5333         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5334         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5335         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5336         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
5337         return node_id_arr;
5338 }
5339 int64_t CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(int64_t ptr) {
5340         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5341         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5342         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
5343                         int64_t msg_ref = 0;
5344                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5345                         msg_ref = tag_ptr(msg_var.inner, false);
5346         return msg_ref;
5347 }
5348 int8_tArray CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(int64_t ptr) {
5349         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5350         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5351         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5352         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
5353         return node_id_arr;
5354 }
5355 int64_t CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_msg(int64_t ptr) {
5356         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5357         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5358         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
5359                         int64_t msg_ref = 0;
5360                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5361                         msg_ref = tag_ptr(msg_var.inner, false);
5362         return msg_ref;
5363 }
5364 int8_tArray CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(int64_t ptr) {
5365         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5366         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5367         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5368         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
5369         return node_id_arr;
5370 }
5371 int64_t CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_msg(int64_t ptr) {
5372         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5373         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5374         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
5375                         int64_t msg_ref = 0;
5376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5377                         msg_ref = tag_ptr(msg_var.inner, false);
5378         return msg_ref;
5379 }
5380 int8_tArray CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(int64_t ptr) {
5381         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5382         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5383         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5384         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
5385         return node_id_arr;
5386 }
5387 int64_t CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(int64_t ptr) {
5388         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5389         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5390         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
5391                         int64_t msg_ref = 0;
5392                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5393                         msg_ref = tag_ptr(msg_var.inner, false);
5394         return msg_ref;
5395 }
5396 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
5397         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
5398         for (size_t i = 0; i < ret.datalen; i++) {
5399                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
5400         }
5401         return ret;
5402 }
5403 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5404         LDKChannelUpdateInfo ret = *owner->contents.result;
5405         ret.is_owned = false;
5406         return ret;
5407 }
5408 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(int64_t owner) {
5409         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5410         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
5411         int64_t ret_ref = 0;
5412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5414         return ret_ref;
5415 }
5416
5417 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5418 CHECK(!owner->result_ok);
5419         return DecodeError_clone(&*owner->contents.err);
5420 }
5421 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(int64_t owner) {
5422         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5424         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
5425         int64_t ret_ref = tag_ptr(ret_copy, true);
5426         return ret_ref;
5427 }
5428
5429 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5430         LDKChannelInfo ret = *owner->contents.result;
5431         ret.is_owned = false;
5432         return ret;
5433 }
5434 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_ok(int64_t owner) {
5435         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5436         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5437         int64_t ret_ref = 0;
5438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5440         return ret_ref;
5441 }
5442
5443 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5444 CHECK(!owner->result_ok);
5445         return DecodeError_clone(&*owner->contents.err);
5446 }
5447 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_err(int64_t owner) {
5448         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5449         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5450         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5451         int64_t ret_ref = tag_ptr(ret_copy, true);
5452         return ret_ref;
5453 }
5454
5455 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5456         LDKRoutingFees ret = *owner->contents.result;
5457         ret.is_owned = false;
5458         return ret;
5459 }
5460 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_ok(int64_t owner) {
5461         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5462         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5463         int64_t ret_ref = 0;
5464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5466         return ret_ref;
5467 }
5468
5469 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5470 CHECK(!owner->result_ok);
5471         return DecodeError_clone(&*owner->contents.err);
5472 }
5473 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_err(int64_t owner) {
5474         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5475         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5476         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5477         int64_t ret_ref = tag_ptr(ret_copy, true);
5478         return ret_ref;
5479 }
5480
5481 uint32_t CS_LDK_LDKSocketAddress_ty_from_ptr(int64_t ptr) {
5482         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5483         switch(obj->tag) {
5484                 case LDKSocketAddress_TcpIpV4: return 0;
5485                 case LDKSocketAddress_TcpIpV6: return 1;
5486                 case LDKSocketAddress_OnionV2: return 2;
5487                 case LDKSocketAddress_OnionV3: return 3;
5488                 case LDKSocketAddress_Hostname: return 4;
5489                 default: abort();
5490         }
5491 }
5492 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV4_get_addr(int64_t ptr) {
5493         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5494         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5495         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5496         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
5497         return addr_arr;
5498 }
5499 int16_t CS_LDK_LDKSocketAddress_TcpIpV4_get_port(int64_t ptr) {
5500         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5501         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5502         int16_t port_conv = obj->tcp_ip_v4.port;
5503         return port_conv;
5504 }
5505 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV6_get_addr(int64_t ptr) {
5506         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5507         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5508         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5509         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
5510         return addr_arr;
5511 }
5512 int16_t CS_LDK_LDKSocketAddress_TcpIpV6_get_port(int64_t ptr) {
5513         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5514         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5515         int16_t port_conv = obj->tcp_ip_v6.port;
5516         return port_conv;
5517 }
5518 int8_tArray CS_LDK_LDKSocketAddress_OnionV2_get_onion_v2(int64_t ptr) {
5519         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5520         CHECK(obj->tag == LDKSocketAddress_OnionV2);
5521         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5522         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5523         return onion_v2_arr;
5524 }
5525 int8_tArray CS_LDK_LDKSocketAddress_OnionV3_get_ed25519_pubkey(int64_t ptr) {
5526         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5527         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5528         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5529         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5530         return ed25519_pubkey_arr;
5531 }
5532 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_checksum(int64_t ptr) {
5533         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5534         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5535         int16_t checksum_conv = obj->onion_v3.checksum;
5536         return checksum_conv;
5537 }
5538 int8_t CS_LDK_LDKSocketAddress_OnionV3_get_version(int64_t ptr) {
5539         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5540         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5541         int8_t version_conv = obj->onion_v3.version;
5542         return version_conv;
5543 }
5544 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_port(int64_t ptr) {
5545         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5546         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5547         int16_t port_conv = obj->onion_v3.port;
5548         return port_conv;
5549 }
5550 int64_t CS_LDK_LDKSocketAddress_Hostname_get_hostname(int64_t ptr) {
5551         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5552         CHECK(obj->tag == LDKSocketAddress_Hostname);
5553         LDKHostname hostname_var = obj->hostname.hostname;
5554                         int64_t hostname_ref = 0;
5555                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5556                         hostname_ref = tag_ptr(hostname_var.inner, false);
5557         return hostname_ref;
5558 }
5559 int16_t CS_LDK_LDKSocketAddress_Hostname_get_port(int64_t ptr) {
5560         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5561         CHECK(obj->tag == LDKSocketAddress_Hostname);
5562         int16_t port_conv = obj->hostname.port;
5563         return port_conv;
5564 }
5565 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
5566         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
5567         for (size_t i = 0; i < ret.datalen; i++) {
5568                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
5569         }
5570         return ret;
5571 }
5572 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5573         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5574         ret.is_owned = false;
5575         return ret;
5576 }
5577 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(int64_t owner) {
5578         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5579         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5580         int64_t ret_ref = 0;
5581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5583         return ret_ref;
5584 }
5585
5586 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5587 CHECK(!owner->result_ok);
5588         return DecodeError_clone(&*owner->contents.err);
5589 }
5590 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(int64_t owner) {
5591         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5593         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5594         int64_t ret_ref = tag_ptr(ret_copy, true);
5595         return ret_ref;
5596 }
5597
5598 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5599         LDKNodeAlias ret = *owner->contents.result;
5600         ret.is_owned = false;
5601         return ret;
5602 }
5603 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_ok(int64_t owner) {
5604         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5605         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5606         int64_t ret_ref = 0;
5607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5609         return ret_ref;
5610 }
5611
5612 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5613 CHECK(!owner->result_ok);
5614         return DecodeError_clone(&*owner->contents.err);
5615 }
5616 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_err(int64_t owner) {
5617         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5619         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5620         int64_t ret_ref = tag_ptr(ret_copy, true);
5621         return ret_ref;
5622 }
5623
5624 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5625         LDKNodeInfo ret = *owner->contents.result;
5626         ret.is_owned = false;
5627         return ret;
5628 }
5629 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_ok(int64_t owner) {
5630         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5631         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5632         int64_t ret_ref = 0;
5633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5635         return ret_ref;
5636 }
5637
5638 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5639 CHECK(!owner->result_ok);
5640         return DecodeError_clone(&*owner->contents.err);
5641 }
5642 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_err(int64_t owner) {
5643         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5645         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5646         int64_t ret_ref = tag_ptr(ret_copy, true);
5647         return ret_ref;
5648 }
5649
5650 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5651         LDKNetworkGraph ret = *owner->contents.result;
5652         ret.is_owned = false;
5653         return ret;
5654 }
5655 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_ok(int64_t owner) {
5656         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5657         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5658         int64_t ret_ref = 0;
5659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5661         return ret_ref;
5662 }
5663
5664 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5665 CHECK(!owner->result_ok);
5666         return DecodeError_clone(&*owner->contents.err);
5667 }
5668 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_err(int64_t owner) {
5669         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5670         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5671         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5672         int64_t ret_ref = tag_ptr(ret_copy, true);
5673         return ret_ref;
5674 }
5675
5676 uint32_t CS_LDK_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(int64_t ptr) {
5677         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5678         switch(obj->tag) {
5679                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5680                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5681                 default: abort();
5682         }
5683 }
5684 int64_tArray CS_LDK_LDKCOption_CVec_SocketAddressZZ_Some_get_some(int64_t ptr) {
5685         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5686         CHECK(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5687         LDKCVec_SocketAddressZ some_var = obj->some;
5688                         int64_tArray some_arr = NULL;
5689                         some_arr = init_int64_tArray(some_var.datalen, __LINE__);
5690                         int64_t *some_arr_ptr = (int64_t*)(((uint8_t*)some_arr) + 8);
5691                         for (size_t p = 0; p < some_var.datalen; p++) {
5692                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5693                                 some_arr_ptr[p] = some_conv_15_ref;
5694                         }
5695                         
5696         return some_arr;
5697 }
5698 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5699 CHECK(owner->result_ok);
5700         return *owner->contents.result;
5701 }
5702 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_get_ok(int64_t owner) {
5703         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5704         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
5705         return ret_conv;
5706 }
5707
5708 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5709 CHECK(!owner->result_ok);
5710         return ShortChannelIdError_clone(&*owner->contents.err);
5711 }
5712 int32_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_get_err(int64_t owner) {
5713         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5714         int32_t ret_conv = LDKShortChannelIdError_to_cs(CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
5715         return ret_conv;
5716 }
5717
5718 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5719         LDKPendingHTLCInfo ret = *owner->contents.result;
5720         ret.is_owned = false;
5721         return ret;
5722 }
5723 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(int64_t owner) {
5724         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5725         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5726         int64_t ret_ref = 0;
5727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5729         return ret_ref;
5730 }
5731
5732 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5733         LDKInboundHTLCErr ret = *owner->contents.err;
5734         ret.is_owned = false;
5735         return ret;
5736 }
5737 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(int64_t owner) {
5738         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5739         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5740         int64_t ret_ref = 0;
5741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5743         return ret_ref;
5744 }
5745
5746 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5747         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5748         for (size_t i = 0; i < ret.datalen; i++) {
5749                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5750         }
5751         return ret;
5752 }
5753 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5754         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5755         for (size_t i = 0; i < ret.datalen; i++) {
5756                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5757         }
5758         return ret;
5759 }
5760 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5761         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5762         for (size_t i = 0; i < ret.datalen; i++) {
5763                 ret.data[i] = Utxo_clone(&orig->data[i]);
5764         }
5765         return ret;
5766 }
5767 uint32_t CS_LDK_LDKCOption_TxOutZ_ty_from_ptr(int64_t ptr) {
5768         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5769         switch(obj->tag) {
5770                 case LDKCOption_TxOutZ_Some: return 0;
5771                 case LDKCOption_TxOutZ_None: return 1;
5772                 default: abort();
5773         }
5774 }
5775 int64_t CS_LDK_LDKCOption_TxOutZ_Some_get_some(int64_t ptr) {
5776         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5777         CHECK(obj->tag == LDKCOption_TxOutZ_Some);
5778         LDKTxOut* some_ref = &obj->some;
5779         return tag_ptr(some_ref, false);
5780 }
5781 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5782         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5783         for (size_t i = 0; i < ret.datalen; i++) {
5784                 ret.data[i] = Input_clone(&orig->data[i]);
5785         }
5786         return ret;
5787 }
5788 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5789         LDKCoinSelection ret = *owner->contents.result;
5790         ret.is_owned = false;
5791         return ret;
5792 }
5793 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_get_ok(int64_t owner) {
5794         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5795         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5796         int64_t ret_ref = 0;
5797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5799         return ret_ref;
5800 }
5801
5802 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5803 CHECK(!owner->result_ok);
5804         return *owner->contents.err;
5805 }
5806 void  CS_LDK_CResult_CoinSelectionNoneZ_get_err(int64_t owner) {
5807         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5808         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5809 }
5810
5811 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5812 CHECK(owner->result_ok);
5813         return CVec_UtxoZ_clone(&*owner->contents.result);
5814 }
5815 int64_tArray  CS_LDK_CResult_CVec_UtxoZNoneZ_get_ok(int64_t owner) {
5816         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5817         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5818         int64_tArray ret_arr = NULL;
5819         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5820         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5821         for (size_t g = 0; g < ret_var.datalen; g++) {
5822                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5823                 int64_t ret_conv_6_ref = 0;
5824                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5825                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5826                 ret_arr_ptr[g] = ret_conv_6_ref;
5827         }
5828         
5829         FREE(ret_var.data);
5830         return ret_arr;
5831 }
5832
5833 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5834 CHECK(!owner->result_ok);
5835         return *owner->contents.err;
5836 }
5837 void  CS_LDK_CResult_CVec_UtxoZNoneZ_get_err(int64_t owner) {
5838         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5839         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5840 }
5841
5842 uint32_t CS_LDK_LDKPaymentContext_ty_from_ptr(int64_t ptr) {
5843         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5844         switch(obj->tag) {
5845                 case LDKPaymentContext_Unknown: return 0;
5846                 case LDKPaymentContext_Bolt12Offer: return 1;
5847                 case LDKPaymentContext_Bolt12Refund: return 2;
5848                 default: abort();
5849         }
5850 }
5851 int64_t CS_LDK_LDKPaymentContext_Unknown_get_unknown(int64_t ptr) {
5852         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5853         CHECK(obj->tag == LDKPaymentContext_Unknown);
5854         LDKUnknownPaymentContext unknown_var = obj->unknown;
5855                         int64_t unknown_ref = 0;
5856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
5857                         unknown_ref = tag_ptr(unknown_var.inner, false);
5858         return unknown_ref;
5859 }
5860 int64_t CS_LDK_LDKPaymentContext_Bolt12Offer_get_bolt12_offer(int64_t ptr) {
5861         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5862         CHECK(obj->tag == LDKPaymentContext_Bolt12Offer);
5863         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
5864                         int64_t bolt12_offer_ref = 0;
5865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
5866                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
5867         return bolt12_offer_ref;
5868 }
5869 int64_t CS_LDK_LDKPaymentContext_Bolt12Refund_get_bolt12_refund(int64_t ptr) {
5870         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5871         CHECK(obj->tag == LDKPaymentContext_Bolt12Refund);
5872         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
5873                         int64_t bolt12_refund_ref = 0;
5874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
5875                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
5876         return bolt12_refund_ref;
5877 }
5878 uint32_t CS_LDK_LDKCOption_PaymentContextZ_ty_from_ptr(int64_t ptr) {
5879         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5880         switch(obj->tag) {
5881                 case LDKCOption_PaymentContextZ_Some: return 0;
5882                 case LDKCOption_PaymentContextZ_None: return 1;
5883                 default: abort();
5884         }
5885 }
5886 int64_t CS_LDK_LDKCOption_PaymentContextZ_Some_get_some(int64_t ptr) {
5887         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5888         CHECK(obj->tag == LDKCOption_PaymentContextZ_Some);
5889         int64_t some_ref = tag_ptr(&obj->some, false);
5890         return some_ref;
5891 }
5892 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5893         return owner->a;
5894 }
5895 int64_t  CS_LDK_C2Tuple_u64u16Z_get_a(int64_t owner) {
5896         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5897         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5898         return ret_conv;
5899 }
5900
5901 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5902         return owner->b;
5903 }
5904 int16_t  CS_LDK_C2Tuple_u64u16Z_get_b(int64_t owner) {
5905         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5906         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5907         return ret_conv;
5908 }
5909
5910 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(int64_t ptr) {
5911         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5912         switch(obj->tag) {
5913                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5914                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5915                 default: abort();
5916         }
5917 }
5918 int64_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(int64_t ptr) {
5919         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5920         CHECK(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5921         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5922         *some_conv = obj->some;
5923                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5924         return tag_ptr(some_conv, true);
5925 }
5926 uint32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(int64_t ptr) {
5927         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5928         switch(obj->tag) {
5929                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5930                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5931                 default: abort();
5932         }
5933 }
5934 int32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_Some_get_some(int64_t ptr) {
5935         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5936         CHECK(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5937         int32_t some_conv = LDKChannelShutdownState_to_cs(obj->some);
5938         return some_conv;
5939 }
5940 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5941         LDKChannelId ret = *owner->contents.result;
5942         ret.is_owned = false;
5943         return ret;
5944 }
5945 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_get_ok(int64_t owner) {
5946         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5947         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
5948         int64_t ret_ref = 0;
5949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5951         return ret_ref;
5952 }
5953
5954 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5955 CHECK(!owner->result_ok);
5956         return APIError_clone(&*owner->contents.err);
5957 }
5958 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_get_err(int64_t owner) {
5959         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5960         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5961         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
5962         int64_t ret_ref = tag_ptr(ret_copy, true);
5963         return ret_ref;
5964 }
5965
5966 uint32_t CS_LDK_LDKRecentPaymentDetails_ty_from_ptr(int64_t ptr) {
5967         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5968         switch(obj->tag) {
5969                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5970                 case LDKRecentPaymentDetails_Pending: return 1;
5971                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5972                 case LDKRecentPaymentDetails_Abandoned: return 3;
5973                 default: abort();
5974         }
5975 }
5976 int8_tArray CS_LDK_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(int64_t ptr) {
5977         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5978         CHECK(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5979         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5980         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5981         return payment_id_arr;
5982 }
5983 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_id(int64_t ptr) {
5984         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5985         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5986         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5987         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5988         return payment_id_arr;
5989 }
5990 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_hash(int64_t ptr) {
5991         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5992         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5993         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5994         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5995         return payment_hash_arr;
5996 }
5997 int64_t CS_LDK_LDKRecentPaymentDetails_Pending_get_total_msat(int64_t ptr) {
5998         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5999         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
6000         int64_t total_msat_conv = obj->pending.total_msat;
6001         return total_msat_conv;
6002 }
6003 int8_tArray CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_id(int64_t ptr) {
6004         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6005         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
6006         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6007         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
6008         return payment_id_arr;
6009 }
6010 int64_t CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(int64_t ptr) {
6011         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6012         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
6013         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
6014         return payment_hash_ref;
6015 }
6016 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_id(int64_t ptr) {
6017         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6018         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
6019         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6020         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
6021         return payment_id_arr;
6022 }
6023 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_hash(int64_t ptr) {
6024         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6025         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
6026         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6027         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
6028         return payment_hash_arr;
6029 }
6030 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
6031         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
6032         for (size_t i = 0; i < ret.datalen; i++) {
6033                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
6034         }
6035         return ret;
6036 }
6037 uint32_t CS_LDK_LDKPaymentSendFailure_ty_from_ptr(int64_t ptr) {
6038         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6039         switch(obj->tag) {
6040                 case LDKPaymentSendFailure_ParameterError: return 0;
6041                 case LDKPaymentSendFailure_PathParameterError: return 1;
6042                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
6043                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
6044                 case LDKPaymentSendFailure_PartialFailure: return 4;
6045                 default: abort();
6046         }
6047 }
6048 int64_t CS_LDK_LDKPaymentSendFailure_ParameterError_get_parameter_error(int64_t ptr) {
6049         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6050         CHECK(obj->tag == LDKPaymentSendFailure_ParameterError);
6051         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6052         return parameter_error_ref;
6053 }
6054 int64_tArray CS_LDK_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(int64_t ptr) {
6055         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6056         CHECK(obj->tag == LDKPaymentSendFailure_PathParameterError);
6057         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6058                         int64_tArray path_parameter_error_arr = NULL;
6059                         path_parameter_error_arr = init_int64_tArray(path_parameter_error_var.datalen, __LINE__);
6060                         int64_t *path_parameter_error_arr_ptr = (int64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
6061                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6062                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6063                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6064                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6065                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6066                         }
6067                         
6068         return path_parameter_error_arr;
6069 }
6070 int64_tArray CS_LDK_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(int64_t ptr) {
6071         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6072         CHECK(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
6073         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6074                         int64_tArray all_failed_resend_safe_arr = NULL;
6075                         all_failed_resend_safe_arr = init_int64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
6076                         int64_t *all_failed_resend_safe_arr_ptr = (int64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
6077                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6078                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6079                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6080                         }
6081                         
6082         return all_failed_resend_safe_arr;
6083 }
6084 int64_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_results(int64_t ptr) {
6085         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6086         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6087         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6088                         int64_tArray results_arr = NULL;
6089                         results_arr = init_int64_tArray(results_var.datalen, __LINE__);
6090                         int64_t *results_arr_ptr = (int64_t*)(((uint8_t*)results_arr) + 8);
6091                         for (size_t w = 0; w < results_var.datalen; w++) {
6092                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6093                                 *results_conv_22_conv = results_var.data[w];
6094                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6095                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6096                         }
6097                         
6098         return results_arr;
6099 }
6100 int64_t CS_LDK_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(int64_t ptr) {
6101         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6102         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6103         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6104                         int64_t failed_paths_retry_ref = 0;
6105                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6106                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6107         return failed_paths_retry_ref;
6108 }
6109 int8_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_payment_id(int64_t ptr) {
6110         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6111         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6112         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6113         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6114         return payment_id_arr;
6115 }
6116 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6117 CHECK(owner->result_ok);
6118         return *owner->contents.result;
6119 }
6120 void  CS_LDK_CResult_NonePaymentSendFailureZ_get_ok(int64_t owner) {
6121         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6122         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6123 }
6124
6125 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6126 CHECK(!owner->result_ok);
6127         return PaymentSendFailure_clone(&*owner->contents.err);
6128 }
6129 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_get_err(int64_t owner) {
6130         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6131         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6132         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6133         int64_t ret_ref = tag_ptr(ret_copy, true);
6134         return ret_ref;
6135 }
6136
6137 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6138 CHECK(owner->result_ok);
6139         return *owner->contents.result;
6140 }
6141 void  CS_LDK_CResult_NoneRetryableSendFailureZ_get_ok(int64_t owner) {
6142         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6143         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6144 }
6145
6146 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6147 CHECK(!owner->result_ok);
6148         return RetryableSendFailure_clone(&*owner->contents.err);
6149 }
6150 int32_t  CS_LDK_CResult_NoneRetryableSendFailureZ_get_err(int64_t owner) {
6151         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6152         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6153         return ret_conv;
6154 }
6155
6156 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
6157 CHECK(owner->result_ok);
6158         return ThirtyTwoBytes_clone(&*owner->contents.result);
6159 }
6160 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(int64_t owner) {
6161         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
6162         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6163         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6164         return ret_arr;
6165 }
6166
6167 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
6168 CHECK(!owner->result_ok);
6169         return PaymentSendFailure_clone(&*owner->contents.err);
6170 }
6171 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(int64_t owner) {
6172         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
6173         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6174         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
6175         int64_t ret_ref = tag_ptr(ret_copy, true);
6176         return ret_ref;
6177 }
6178
6179 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
6180 CHECK(owner->result_ok);
6181         return ThirtyTwoBytes_clone(&*owner->contents.result);
6182 }
6183 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(int64_t owner) {
6184         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
6185         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6186         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
6187         return ret_arr;
6188 }
6189
6190 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
6191 CHECK(!owner->result_ok);
6192         return RetryableSendFailure_clone(&*owner->contents.err);
6193 }
6194 int32_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(int64_t owner) {
6195         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
6196         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
6197         return ret_conv;
6198 }
6199
6200 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
6201         return ThirtyTwoBytes_clone(&owner->a);
6202 }
6203 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(int64_t owner) {
6204         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
6205         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6206         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
6207         return ret_arr;
6208 }
6209
6210 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
6211         return ThirtyTwoBytes_clone(&owner->b);
6212 }
6213 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(int64_t owner) {
6214         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
6215         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6216         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
6217         return ret_arr;
6218 }
6219
6220 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
6221 CHECK(owner->result_ok);
6222         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
6223 }
6224 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(int64_t owner) {
6225         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
6226         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6227         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
6228         return tag_ptr(ret_conv, true);
6229 }
6230
6231 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
6232 CHECK(!owner->result_ok);
6233         return PaymentSendFailure_clone(&*owner->contents.err);
6234 }
6235 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(int64_t owner) {
6236         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
6237         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6238         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
6239         int64_t ret_ref = tag_ptr(ret_copy, true);
6240         return ret_ref;
6241 }
6242
6243 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
6244         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
6245         for (size_t i = 0; i < ret.datalen; i++) {
6246                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
6247         }
6248         return ret;
6249 }
6250 uint32_t CS_LDK_LDKProbeSendFailure_ty_from_ptr(int64_t ptr) {
6251         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
6252         switch(obj->tag) {
6253                 case LDKProbeSendFailure_RouteNotFound: return 0;
6254                 case LDKProbeSendFailure_SendingFailed: return 1;
6255                 default: abort();
6256         }
6257 }
6258 int64_t CS_LDK_LDKProbeSendFailure_SendingFailed_get_sending_failed(int64_t ptr) {
6259         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
6260         CHECK(obj->tag == LDKProbeSendFailure_SendingFailed);
6261         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
6262         return sending_failed_ref;
6263 }
6264 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
6265 CHECK(owner->result_ok);
6266         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
6267 }
6268 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(int64_t owner) {
6269         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
6270         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
6271         int64_tArray ret_arr = NULL;
6272         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
6273         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
6274         for (size_t o = 0; o < ret_var.datalen; o++) {
6275                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6276                 *ret_conv_40_conv = ret_var.data[o];
6277                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
6278         }
6279         
6280         FREE(ret_var.data);
6281         return ret_arr;
6282 }
6283
6284 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
6285 CHECK(!owner->result_ok);
6286         return ProbeSendFailure_clone(&*owner->contents.err);
6287 }
6288 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(int64_t owner) {
6289         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
6290         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
6291         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
6292         int64_t ret_ref = tag_ptr(ret_copy, true);
6293         return ret_ref;
6294 }
6295
6296 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
6297         LDKChannelId ret = owner->a;
6298         ret.is_owned = false;
6299         return ret;
6300 }
6301 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_get_a(int64_t owner) {
6302         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
6303         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(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 LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
6311         return owner->b;
6312 }
6313 int8_tArray  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_get_b(int64_t owner) {
6314         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
6315         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6316         memcpy(ret_arr->elems, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form, 33);
6317         return ret_arr;
6318 }
6319
6320 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
6321         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
6322         for (size_t i = 0; i < ret.datalen; i++) {
6323                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
6324         }
6325         return ret;
6326 }
6327 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
6328         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
6329         for (size_t i = 0; i < ret.datalen; i++) {
6330                 ret.data[i] = ChannelId_clone(&orig->data[i]);
6331         }
6332         return ret;
6333 }
6334 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6335         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
6336         ret.is_owned = false;
6337         return ret;
6338 }
6339 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
6340         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6341         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6342         int64_t ret_ref = 0;
6343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6345         return ret_ref;
6346 }
6347
6348 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6349 CHECK(!owner->result_ok);
6350         return Bolt12SemanticError_clone(&*owner->contents.err);
6351 }
6352 int32_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
6353         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6354         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6355         return ret_conv;
6356 }
6357
6358 uint32_t CS_LDK_LDKCOption_StrZ_ty_from_ptr(int64_t ptr) {
6359         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
6360         switch(obj->tag) {
6361                 case LDKCOption_StrZ_Some: return 0;
6362                 case LDKCOption_StrZ_None: return 1;
6363                 default: abort();
6364         }
6365 }
6366 jstring CS_LDK_LDKCOption_StrZ_Some_get_some(int64_t ptr) {
6367         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
6368         CHECK(obj->tag == LDKCOption_StrZ_Some);
6369         LDKStr some_str = obj->some;
6370                         jstring some_conv = str_ref_to_cs(some_str.chars, some_str.len);
6371         return some_conv;
6372 }
6373 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
6374 CHECK(owner->result_ok);
6375         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
6376 }
6377 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(int64_t owner) {
6378         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
6379         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6380         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
6381         return tag_ptr(ret_conv, true);
6382 }
6383
6384 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
6385 CHECK(!owner->result_ok);
6386         return *owner->contents.err;
6387 }
6388 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(int64_t owner) {
6389         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
6390         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
6391 }
6392
6393 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6394 CHECK(owner->result_ok);
6395         return ThirtyTwoBytes_clone(&*owner->contents.result);
6396 }
6397 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(int64_t owner) {
6398         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6399         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6400         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
6401         return ret_arr;
6402 }
6403
6404 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6405 CHECK(!owner->result_ok);
6406         return APIError_clone(&*owner->contents.err);
6407 }
6408 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_err(int64_t owner) {
6409         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6410         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6411         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6412         int64_t ret_ref = tag_ptr(ret_copy, true);
6413         return ret_ref;
6414 }
6415
6416 uint32_t CS_LDK_LDKOffersMessage_ty_from_ptr(int64_t ptr) {
6417         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6418         switch(obj->tag) {
6419                 case LDKOffersMessage_InvoiceRequest: return 0;
6420                 case LDKOffersMessage_Invoice: return 1;
6421                 case LDKOffersMessage_InvoiceError: return 2;
6422                 default: abort();
6423         }
6424 }
6425 int64_t CS_LDK_LDKOffersMessage_InvoiceRequest_get_invoice_request(int64_t ptr) {
6426         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6427         CHECK(obj->tag == LDKOffersMessage_InvoiceRequest);
6428         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
6429                         int64_t invoice_request_ref = 0;
6430                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6431                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
6432         return invoice_request_ref;
6433 }
6434 int64_t CS_LDK_LDKOffersMessage_Invoice_get_invoice(int64_t ptr) {
6435         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6436         CHECK(obj->tag == LDKOffersMessage_Invoice);
6437         LDKBolt12Invoice invoice_var = obj->invoice;
6438                         int64_t invoice_ref = 0;
6439                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6440                         invoice_ref = tag_ptr(invoice_var.inner, false);
6441         return invoice_ref;
6442 }
6443 int64_t CS_LDK_LDKOffersMessage_InvoiceError_get_invoice_error(int64_t ptr) {
6444         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6445         CHECK(obj->tag == LDKOffersMessage_InvoiceError);
6446         LDKInvoiceError invoice_error_var = obj->invoice_error;
6447                         int64_t invoice_error_ref = 0;
6448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
6449                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
6450         return invoice_error_ref;
6451 }
6452 uint32_t CS_LDK_LDKCOption_OffersMessageZ_ty_from_ptr(int64_t ptr) {
6453         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6454         switch(obj->tag) {
6455                 case LDKCOption_OffersMessageZ_Some: return 0;
6456                 case LDKCOption_OffersMessageZ_None: return 1;
6457                 default: abort();
6458         }
6459 }
6460 int64_t CS_LDK_LDKCOption_OffersMessageZ_Some_get_some(int64_t ptr) {
6461         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6462         CHECK(obj->tag == LDKCOption_OffersMessageZ_Some);
6463         int64_t some_ref = tag_ptr(&obj->some, false);
6464         return some_ref;
6465 }
6466 uint32_t CS_LDK_LDKDestination_ty_from_ptr(int64_t ptr) {
6467         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6468         switch(obj->tag) {
6469                 case LDKDestination_Node: return 0;
6470                 case LDKDestination_BlindedPath: return 1;
6471                 default: abort();
6472         }
6473 }
6474 int8_tArray CS_LDK_LDKDestination_Node_get_node(int64_t ptr) {
6475         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6476         CHECK(obj->tag == LDKDestination_Node);
6477         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
6478         memcpy(node_arr->elems, obj->node.compressed_form, 33);
6479         return node_arr;
6480 }
6481 int64_t CS_LDK_LDKDestination_BlindedPath_get_blinded_path(int64_t ptr) {
6482         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6483         CHECK(obj->tag == LDKDestination_BlindedPath);
6484         LDKBlindedPath blinded_path_var = obj->blinded_path;
6485                         int64_t blinded_path_ref = 0;
6486                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
6487                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
6488         return blinded_path_ref;
6489 }
6490 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6491         return OffersMessage_clone(&owner->a);
6492 }
6493 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(int64_t owner) {
6494         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6495         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
6496         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
6497         int64_t ret_ref = tag_ptr(ret_copy, true);
6498         return ret_ref;
6499 }
6500
6501 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6502         return Destination_clone(&owner->b);
6503 }
6504 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(int64_t owner) {
6505         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6506         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
6507         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
6508         int64_t ret_ref = tag_ptr(ret_copy, true);
6509         return ret_ref;
6510 }
6511
6512 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6513         LDKBlindedPath ret = owner->c;
6514         ret.is_owned = false;
6515         return ret;
6516 }
6517 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(int64_t owner) {
6518         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6519         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
6520         int64_t ret_ref = 0;
6521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6523         return ret_ref;
6524 }
6525
6526 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
6527         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
6528         for (size_t i = 0; i < ret.datalen; i++) {
6529                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
6530         }
6531         return ret;
6532 }
6533 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6534         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
6535         ret.is_owned = false;
6536         return ret;
6537 }
6538 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(int64_t owner) {
6539         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6540         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6541         int64_t ret_ref = 0;
6542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6544         return ret_ref;
6545 }
6546
6547 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6548 CHECK(!owner->result_ok);
6549         return DecodeError_clone(&*owner->contents.err);
6550 }
6551 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(int64_t owner) {
6552         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6553         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6554         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6555         int64_t ret_ref = tag_ptr(ret_copy, true);
6556         return ret_ref;
6557 }
6558
6559 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6560         LDKChannelCounterparty ret = *owner->contents.result;
6561         ret.is_owned = false;
6562         return ret;
6563 }
6564 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(int64_t owner) {
6565         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6566         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6567         int64_t ret_ref = 0;
6568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6570         return ret_ref;
6571 }
6572
6573 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6574 CHECK(!owner->result_ok);
6575         return DecodeError_clone(&*owner->contents.err);
6576 }
6577 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_err(int64_t owner) {
6578         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6579         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6580         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6581         int64_t ret_ref = tag_ptr(ret_copy, true);
6582         return ret_ref;
6583 }
6584
6585 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6586         LDKChannelDetails ret = *owner->contents.result;
6587         ret.is_owned = false;
6588         return ret;
6589 }
6590 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_ok(int64_t owner) {
6591         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6592         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6593         int64_t ret_ref = 0;
6594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6596         return ret_ref;
6597 }
6598
6599 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6600 CHECK(!owner->result_ok);
6601         return DecodeError_clone(&*owner->contents.err);
6602 }
6603 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_err(int64_t owner) {
6604         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6605         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6606         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6607         int64_t ret_ref = tag_ptr(ret_copy, true);
6608         return ret_ref;
6609 }
6610
6611 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6612         LDKPhantomRouteHints ret = *owner->contents.result;
6613         ret.is_owned = false;
6614         return ret;
6615 }
6616 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(int64_t owner) {
6617         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6618         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6619         int64_t ret_ref = 0;
6620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6622         return ret_ref;
6623 }
6624
6625 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6626 CHECK(!owner->result_ok);
6627         return DecodeError_clone(&*owner->contents.err);
6628 }
6629 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_err(int64_t owner) {
6630         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6631         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6632         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6633         int64_t ret_ref = tag_ptr(ret_copy, true);
6634         return ret_ref;
6635 }
6636
6637 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6638         LDKBlindedForward ret = *owner->contents.result;
6639         ret.is_owned = false;
6640         return ret;
6641 }
6642 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_ok(int64_t owner) {
6643         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6644         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
6645         int64_t ret_ref = 0;
6646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6648         return ret_ref;
6649 }
6650
6651 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6652 CHECK(!owner->result_ok);
6653         return DecodeError_clone(&*owner->contents.err);
6654 }
6655 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_err(int64_t owner) {
6656         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6657         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6658         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6659         int64_t ret_ref = tag_ptr(ret_copy, true);
6660         return ret_ref;
6661 }
6662
6663 uint32_t CS_LDK_LDKPendingHTLCRouting_ty_from_ptr(int64_t ptr) {
6664         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6665         switch(obj->tag) {
6666                 case LDKPendingHTLCRouting_Forward: return 0;
6667                 case LDKPendingHTLCRouting_Receive: return 1;
6668                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6669                 default: abort();
6670         }
6671 }
6672 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_onion_packet(int64_t ptr) {
6673         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6674         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6675         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6676                         int64_t onion_packet_ref = 0;
6677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6678                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6679         return onion_packet_ref;
6680 }
6681 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_short_channel_id(int64_t ptr) {
6682         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6683         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6684         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6685         return short_channel_id_conv;
6686 }
6687 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_blinded(int64_t ptr) {
6688         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6689         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6690         LDKBlindedForward blinded_var = obj->forward.blinded;
6691                         int64_t blinded_ref = 0;
6692                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6693                         blinded_ref = tag_ptr(blinded_var.inner, false);
6694         return blinded_ref;
6695 }
6696 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_data(int64_t ptr) {
6697         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6698         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6699         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6700                         int64_t payment_data_ref = 0;
6701                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6702                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6703         return payment_data_ref;
6704 }
6705 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_metadata(int64_t ptr) {
6706         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6707         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6708         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6709         return payment_metadata_ref;
6710 }
6711 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_context(int64_t ptr) {
6712         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6713         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6714         int64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
6715         return payment_context_ref;
6716 }
6717 int32_t CS_LDK_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(int64_t ptr) {
6718         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6719         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6720         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6721         return incoming_cltv_expiry_conv;
6722 }
6723 int8_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(int64_t ptr) {
6724         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6725         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6726         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6727         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6728         return phantom_shared_secret_arr;
6729 }
6730 int64_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_custom_tlvs(int64_t ptr) {
6731         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6732         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6733         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6734                         int64_tArray custom_tlvs_arr = NULL;
6735                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6736                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6737                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6738                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6739                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6740                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6741                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6742                         }
6743                         
6744         return custom_tlvs_arr;
6745 }
6746 jboolean CS_LDK_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(int64_t ptr) {
6747         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6748         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6749         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6750         return requires_blinded_error_conv;
6751 }
6752 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(int64_t ptr) {
6753         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6754         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6755         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6756                         int64_t payment_data_ref = 0;
6757                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6758                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6759         return payment_data_ref;
6760 }
6761 int8_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(int64_t ptr) {
6762         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6763         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6764         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6765         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6766         return payment_preimage_arr;
6767 }
6768 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(int64_t ptr) {
6769         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6770         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6771         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6772         return payment_metadata_ref;
6773 }
6774 int32_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(int64_t ptr) {
6775         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6776         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6777         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6778         return incoming_cltv_expiry_conv;
6779 }
6780 int64_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(int64_t ptr) {
6781         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6782         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6783         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6784                         int64_tArray custom_tlvs_arr = NULL;
6785                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6786                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6787                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6788                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6789                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6790                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6791                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6792                         }
6793                         
6794         return custom_tlvs_arr;
6795 }
6796 jboolean CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error(int64_t ptr) {
6797         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6798         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6799         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
6800         return requires_blinded_error_conv;
6801 }
6802 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6803 CHECK(owner->result_ok);
6804         return PendingHTLCRouting_clone(&*owner->contents.result);
6805 }
6806 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(int64_t owner) {
6807         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6808         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6809         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6810         int64_t ret_ref = tag_ptr(ret_copy, true);
6811         return ret_ref;
6812 }
6813
6814 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6815 CHECK(!owner->result_ok);
6816         return DecodeError_clone(&*owner->contents.err);
6817 }
6818 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(int64_t owner) {
6819         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6820         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6821         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6822         int64_t ret_ref = tag_ptr(ret_copy, true);
6823         return ret_ref;
6824 }
6825
6826 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6827         LDKPendingHTLCInfo ret = *owner->contents.result;
6828         ret.is_owned = false;
6829         return ret;
6830 }
6831 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(int64_t owner) {
6832         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6833         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6834         int64_t ret_ref = 0;
6835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6837         return ret_ref;
6838 }
6839
6840 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6841 CHECK(!owner->result_ok);
6842         return DecodeError_clone(&*owner->contents.err);
6843 }
6844 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_err(int64_t owner) {
6845         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6846         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6847         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6848         int64_t ret_ref = tag_ptr(ret_copy, true);
6849         return ret_ref;
6850 }
6851
6852 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6853 CHECK(owner->result_ok);
6854         return BlindedFailure_clone(&*owner->contents.result);
6855 }
6856 int32_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_ok(int64_t owner) {
6857         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6858         int32_t ret_conv = LDKBlindedFailure_to_cs(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6859         return ret_conv;
6860 }
6861
6862 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6863 CHECK(!owner->result_ok);
6864         return DecodeError_clone(&*owner->contents.err);
6865 }
6866 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_err(int64_t owner) {
6867         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6869         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6870         int64_t ret_ref = tag_ptr(ret_copy, true);
6871         return ret_ref;
6872 }
6873
6874 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6875 CHECK(owner->result_ok);
6876         return ChannelShutdownState_clone(&*owner->contents.result);
6877 }
6878 int32_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(int64_t owner) {
6879         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6880         int32_t ret_conv = LDKChannelShutdownState_to_cs(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6881         return ret_conv;
6882 }
6883
6884 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6885 CHECK(!owner->result_ok);
6886         return DecodeError_clone(&*owner->contents.err);
6887 }
6888 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_err(int64_t owner) {
6889         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6890         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6891         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6892         int64_t ret_ref = tag_ptr(ret_copy, true);
6893         return ret_ref;
6894 }
6895
6896 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6897         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6898         for (size_t i = 0; i < ret.datalen; i++) {
6899                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6900         }
6901         return ret;
6902 }
6903 typedef struct LDKWatch_JCalls {
6904         atomic_size_t refcnt;
6905         uint32_t instance_ptr;
6906 } LDKWatch_JCalls;
6907 static void LDKWatch_JCalls_free(void* this_arg) {
6908         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6909         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6910                 FREE(j_calls);
6911         }
6912 }
6913 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6914         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6915         LDKOutPoint funding_txo_var = funding_txo;
6916         int64_t funding_txo_ref = 0;
6917         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6918         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6919         LDKChannelMonitor monitor_var = monitor;
6920         int64_t monitor_ref = 0;
6921         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6922         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6923         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 27, funding_txo_ref, monitor_ref);
6924         void* ret_ptr = untag_ptr(ret);
6925         CHECK_ACCESS(ret_ptr);
6926         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6927         FREE(untag_ptr(ret));
6928         return ret_conv;
6929 }
6930 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6931         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6932         LDKOutPoint funding_txo_var = funding_txo;
6933         int64_t funding_txo_ref = 0;
6934         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6935         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6936         LDKChannelMonitorUpdate update_var = *update;
6937         int64_t update_ref = 0;
6938         update_var = ChannelMonitorUpdate_clone(&update_var);
6939         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6940         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6941         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_ll(j_calls->instance_ptr, 28, funding_txo_ref, update_ref);
6942         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
6943         return ret_conv;
6944 }
6945 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6946         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6947         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 29);
6948         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
6949         ret_constr.datalen = ret->arr_len;
6950         if (ret_constr.datalen > 0)
6951                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
6952         else
6953                 ret_constr.data = NULL;
6954         int64_t* ret_vals = ret->elems;
6955         for (size_t f = 0; f < ret_constr.datalen; f++) {
6956                 int64_t ret_conv_57 = ret_vals[f];
6957                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
6958                 CHECK_ACCESS(ret_conv_57_ptr);
6959                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
6960                 FREE(untag_ptr(ret_conv_57));
6961                 ret_constr.data[f] = ret_conv_57_conv;
6962         }
6963         FREE(ret);
6964         return ret_constr;
6965 }
6966 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6967         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6968         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6969 }
6970 static inline LDKWatch LDKWatch_init (int64_t o) {
6971         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6972         atomic_init(&calls->refcnt, 1);
6973         calls->instance_ptr = o;
6974
6975         LDKWatch ret = {
6976                 .this_arg = (void*) calls,
6977                 .watch_channel = watch_channel_LDKWatch_jcall,
6978                 .update_channel = update_channel_LDKWatch_jcall,
6979                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6980                 .free = LDKWatch_JCalls_free,
6981         };
6982         return ret;
6983 }
6984 uint64_t  CS_LDK_LDKWatch_new(int32_t o) {
6985         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6986         *res_ptr = LDKWatch_init(o);
6987         return tag_ptr(res_ptr, true);
6988 }
6989 int64_t  CS_LDK_Watch_watch_channel(int64_t this_arg, int64_t funding_txo, int64_t monitor) {
6990         void* this_arg_ptr = untag_ptr(this_arg);
6991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6992         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6993         LDKOutPoint funding_txo_conv;
6994         funding_txo_conv.inner = untag_ptr(funding_txo);
6995         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6996         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6997         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6998         LDKChannelMonitor monitor_conv;
6999         monitor_conv.inner = untag_ptr(monitor);
7000         monitor_conv.is_owned = ptr_is_owned(monitor);
7001         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7002         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7003         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
7004         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
7005         return tag_ptr(ret_conv, true);
7006 }
7007
7008 int32_t  CS_LDK_Watch_update_channel(int64_t this_arg, int64_t funding_txo, int64_t update) {
7009         void* this_arg_ptr = untag_ptr(this_arg);
7010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7011         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7012         LDKOutPoint funding_txo_conv;
7013         funding_txo_conv.inner = untag_ptr(funding_txo);
7014         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7015         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7016         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7017         LDKChannelMonitorUpdate update_conv;
7018         update_conv.inner = untag_ptr(update);
7019         update_conv.is_owned = ptr_is_owned(update);
7020         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7021         update_conv.is_owned = false;
7022         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7023         return ret_conv;
7024 }
7025
7026 int64_tArray  CS_LDK_Watch_release_pending_monitor_events(int64_t this_arg) {
7027         void* this_arg_ptr = untag_ptr(this_arg);
7028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7029         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7030         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7031         int64_tArray ret_arr = NULL;
7032         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
7033         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
7034         for (size_t f = 0; f < ret_var.datalen; f++) {
7035                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
7036                 *ret_conv_57_conv = ret_var.data[f];
7037                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
7038         }
7039         
7040         FREE(ret_var.data);
7041         return ret_arr;
7042 }
7043
7044 typedef struct LDKBroadcasterInterface_JCalls {
7045         atomic_size_t refcnt;
7046         uint32_t instance_ptr;
7047 } LDKBroadcasterInterface_JCalls;
7048 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7049         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7050         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7051                 FREE(j_calls);
7052         }
7053 }
7054 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7055         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7056         LDKCVec_TransactionZ txs_var = txs;
7057         ptrArray txs_arr = NULL;
7058         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
7059         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
7060         for (size_t i = 0; i < txs_var.datalen; i++) {
7061                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7062                 int8_tArray txs_conv_8_arr = init_int8_tArray(txs_conv_8_var.datalen, __LINE__);
7063                 memcpy(txs_conv_8_arr->elems, txs_conv_8_var.data, txs_conv_8_var.datalen);
7064                 Transaction_free(txs_conv_8_var);
7065                 txs_arr_ptr[i] = txs_conv_8_arr;
7066         }
7067         
7068         FREE(txs_var.data);
7069         js_invoke_function_void_l(j_calls->instance_ptr, 30, (int64_t)txs_arr);
7070 }
7071 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7072         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7073         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7074 }
7075 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (int64_t o) {
7076         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7077         atomic_init(&calls->refcnt, 1);
7078         calls->instance_ptr = o;
7079
7080         LDKBroadcasterInterface ret = {
7081                 .this_arg = (void*) calls,
7082                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7083                 .free = LDKBroadcasterInterface_JCalls_free,
7084         };
7085         return ret;
7086 }
7087 uint64_t  CS_LDK_LDKBroadcasterInterface_new(int32_t o) {
7088         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7089         *res_ptr = LDKBroadcasterInterface_init(o);
7090         return tag_ptr(res_ptr, true);
7091 }
7092 void  CS_LDK_BroadcasterInterface_broadcast_transactions(int64_t this_arg, ptrArray txs) {
7093         void* this_arg_ptr = untag_ptr(this_arg);
7094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7095         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7096         LDKCVec_TransactionZ txs_constr;
7097         txs_constr.datalen = txs->arr_len;
7098         if (txs_constr.datalen > 0)
7099                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7100         else
7101                 txs_constr.data = NULL;
7102         int8_tArray* txs_vals = (void*) txs->elems;
7103         for (size_t i = 0; i < txs_constr.datalen; i++) {
7104                 int8_tArray txs_conv_8 = txs_vals[i];
7105                 LDKTransaction txs_conv_8_ref;
7106                 txs_conv_8_ref.datalen = txs_conv_8->arr_len;
7107                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7108                 memcpy(txs_conv_8_ref.data, txs_conv_8->elems, txs_conv_8_ref.datalen); FREE(txs_conv_8);
7109                 txs_conv_8_ref.data_is_owned = true;
7110                 txs_constr.data[i] = txs_conv_8_ref;
7111         }
7112         FREE(txs);
7113         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7114 }
7115
7116 typedef struct LDKEntropySource_JCalls {
7117         atomic_size_t refcnt;
7118         uint32_t instance_ptr;
7119 } LDKEntropySource_JCalls;
7120 static void LDKEntropySource_JCalls_free(void* this_arg) {
7121         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7122         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7123                 FREE(j_calls);
7124         }
7125 }
7126 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7127         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7128         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 31);
7129         LDKThirtyTwoBytes ret_ref;
7130         CHECK(ret->arr_len == 32);
7131         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7132         return ret_ref;
7133 }
7134 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7135         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7136         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7137 }
7138 static inline LDKEntropySource LDKEntropySource_init (int64_t o) {
7139         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7140         atomic_init(&calls->refcnt, 1);
7141         calls->instance_ptr = o;
7142
7143         LDKEntropySource ret = {
7144                 .this_arg = (void*) calls,
7145                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7146                 .free = LDKEntropySource_JCalls_free,
7147         };
7148         return ret;
7149 }
7150 uint64_t  CS_LDK_LDKEntropySource_new(int32_t o) {
7151         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7152         *res_ptr = LDKEntropySource_init(o);
7153         return tag_ptr(res_ptr, true);
7154 }
7155 int8_tArray  CS_LDK_EntropySource_get_secure_random_bytes(int64_t this_arg) {
7156         void* this_arg_ptr = untag_ptr(this_arg);
7157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7158         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7159         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7160         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
7161         return ret_arr;
7162 }
7163
7164 uint32_t CS_LDK_LDKUnsignedGossipMessage_ty_from_ptr(int64_t ptr) {
7165         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7166         switch(obj->tag) {
7167                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
7168                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
7169                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
7170                 default: abort();
7171         }
7172 }
7173 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(int64_t ptr) {
7174         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7175         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
7176         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7177                         int64_t channel_announcement_ref = 0;
7178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7179                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7180         return channel_announcement_ref;
7181 }
7182 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(int64_t ptr) {
7183         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7184         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
7185         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7186                         int64_t channel_update_ref = 0;
7187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7188                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7189         return channel_update_ref;
7190 }
7191 int64_t CS_LDK_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(int64_t ptr) {
7192         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7193         CHECK(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
7194         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7195                         int64_t node_announcement_ref = 0;
7196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7197                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7198         return node_announcement_ref;
7199 }
7200 typedef struct LDKNodeSigner_JCalls {
7201         atomic_size_t refcnt;
7202         uint32_t instance_ptr;
7203 } LDKNodeSigner_JCalls;
7204 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7205         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7206         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7207                 FREE(j_calls);
7208         }
7209 }
7210 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7211         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7212         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 32);
7213         LDKThirtyTwoBytes ret_ref;
7214         CHECK(ret->arr_len == 32);
7215         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7216         return ret_ref;
7217 }
7218 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7219         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7220         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7221         uint64_t ret = js_invoke_function_l_Recipient(j_calls->instance_ptr, 33, recipient_conv);
7222         void* ret_ptr = untag_ptr(ret);
7223         CHECK_ACCESS(ret_ptr);
7224         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
7225         FREE(untag_ptr(ret));
7226         return ret_conv;
7227 }
7228 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
7229         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7230         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7231         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
7232         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
7233         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
7234         *tweak_copy = tweak;
7235         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7236         uint64_t ret = js_invoke_function_l_Recipientll(j_calls->instance_ptr, 34, recipient_conv, (int64_t)other_key_arr, tweak_ref);
7237         void* ret_ptr = untag_ptr(ret);
7238         CHECK_ACCESS(ret_ptr);
7239         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
7240         FREE(untag_ptr(ret));
7241         return ret_conv;
7242 }
7243 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
7244         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7245         LDKu8slice hrp_bytes_var = hrp_bytes;
7246         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
7247         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
7248         LDKCVec_U5Z invoice_data_var = invoice_data;
7249         ptrArray invoice_data_arr = NULL;
7250         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
7251         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
7252         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7253                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7254                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7255         }
7256         
7257         FREE(invoice_data_var.data);
7258         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7259         uint64_t ret = js_invoke_function_l_llRecipient(j_calls->instance_ptr, 35, (int64_t)hrp_bytes_arr, (int64_t)invoice_data_arr, recipient_conv);
7260         void* ret_ptr = untag_ptr(ret);
7261         CHECK_ACCESS(ret_ptr);
7262         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7263         FREE(untag_ptr(ret));
7264         return ret_conv;
7265 }
7266 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
7267         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7268         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
7269         int64_t invoice_request_ref = 0;
7270         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
7271         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7272         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
7273         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 36, invoice_request_ref);
7274         void* ret_ptr = untag_ptr(ret);
7275         CHECK_ACCESS(ret_ptr);
7276         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
7277         FREE(untag_ptr(ret));
7278         return ret_conv;
7279 }
7280 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
7281         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7282         LDKUnsignedBolt12Invoice invoice_var = *invoice;
7283         int64_t invoice_ref = 0;
7284         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
7285         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7286         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
7287         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 37, invoice_ref);
7288         void* ret_ptr = untag_ptr(ret);
7289         CHECK_ACCESS(ret_ptr);
7290         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
7291         FREE(untag_ptr(ret));
7292         return ret_conv;
7293 }
7294 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
7295         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7296         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
7297         *msg_copy = msg;
7298         int64_t msg_ref = tag_ptr(msg_copy, true);
7299         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 38, msg_ref);
7300         void* ret_ptr = untag_ptr(ret);
7301         CHECK_ACCESS(ret_ptr);
7302         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
7303         FREE(untag_ptr(ret));
7304         return ret_conv;
7305 }
7306 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
7307         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
7308         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7309 }
7310 static inline LDKNodeSigner LDKNodeSigner_init (int64_t o) {
7311         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
7312         atomic_init(&calls->refcnt, 1);
7313         calls->instance_ptr = o;
7314
7315         LDKNodeSigner ret = {
7316                 .this_arg = (void*) calls,
7317                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
7318                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
7319                 .ecdh = ecdh_LDKNodeSigner_jcall,
7320                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
7321                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
7322                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
7323                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
7324                 .free = LDKNodeSigner_JCalls_free,
7325         };
7326         return ret;
7327 }
7328 uint64_t  CS_LDK_LDKNodeSigner_new(int32_t o) {
7329         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
7330         *res_ptr = LDKNodeSigner_init(o);
7331         return tag_ptr(res_ptr, true);
7332 }
7333 int8_tArray  CS_LDK_NodeSigner_get_inbound_payment_key_material(int64_t this_arg) {
7334         void* this_arg_ptr = untag_ptr(this_arg);
7335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7336         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7337         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7338         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
7339         return ret_arr;
7340 }
7341
7342 int64_t  CS_LDK_NodeSigner_get_node_id(int64_t this_arg, int32_t recipient) {
7343         void* this_arg_ptr = untag_ptr(this_arg);
7344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7345         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7346         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7347         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
7348         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
7349         return tag_ptr(ret_conv, true);
7350 }
7351
7352 int64_t  CS_LDK_NodeSigner_ecdh(int64_t this_arg, int32_t recipient, int8_tArray other_key, int64_t tweak) {
7353         void* this_arg_ptr = untag_ptr(this_arg);
7354         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7355         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7356         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7357         LDKPublicKey other_key_ref;
7358         CHECK(other_key->arr_len == 33);
7359         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
7360         void* tweak_ptr = untag_ptr(tweak);
7361         CHECK_ACCESS(tweak_ptr);
7362         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
7363         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
7364         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
7365         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7366         return tag_ptr(ret_conv, true);
7367 }
7368
7369 int64_t  CS_LDK_NodeSigner_sign_invoice(int64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, int32_t recipient) {
7370         void* this_arg_ptr = untag_ptr(this_arg);
7371         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7372         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7373         LDKu8slice hrp_bytes_ref;
7374         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
7375         hrp_bytes_ref.data = hrp_bytes->elems;
7376         LDKCVec_U5Z invoice_data_constr;
7377         invoice_data_constr.datalen = invoice_data->arr_len;
7378         if (invoice_data_constr.datalen > 0)
7379                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
7380         else
7381                 invoice_data_constr.data = NULL;
7382         int8_t* invoice_data_vals = (void*) invoice_data->elems;
7383         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7384                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7385                 
7386                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
7387         }
7388         FREE(invoice_data);
7389         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7390         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7391         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
7392         FREE(hrp_bytes);
7393         return tag_ptr(ret_conv, true);
7394 }
7395
7396 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice_request(int64_t this_arg, int64_t invoice_request) {
7397         void* this_arg_ptr = untag_ptr(this_arg);
7398         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7399         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7400         LDKUnsignedInvoiceRequest invoice_request_conv;
7401         invoice_request_conv.inner = untag_ptr(invoice_request);
7402         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
7403         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
7404         invoice_request_conv.is_owned = false;
7405         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
7406         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
7407         return tag_ptr(ret_conv, true);
7408 }
7409
7410 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice(int64_t this_arg, int64_t invoice) {
7411         void* this_arg_ptr = untag_ptr(this_arg);
7412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7413         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7414         LDKUnsignedBolt12Invoice invoice_conv;
7415         invoice_conv.inner = untag_ptr(invoice);
7416         invoice_conv.is_owned = ptr_is_owned(invoice);
7417         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
7418         invoice_conv.is_owned = false;
7419         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
7420         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
7421         return tag_ptr(ret_conv, true);
7422 }
7423
7424 int64_t  CS_LDK_NodeSigner_sign_gossip_message(int64_t this_arg, int64_t msg) {
7425         void* this_arg_ptr = untag_ptr(this_arg);
7426         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7427         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7428         void* msg_ptr = untag_ptr(msg);
7429         CHECK_ACCESS(msg_ptr);
7430         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
7431         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
7432         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
7433         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
7434         return tag_ptr(ret_conv, true);
7435 }
7436
7437 typedef struct LDKSignerProvider_JCalls {
7438         atomic_size_t refcnt;
7439         uint32_t instance_ptr;
7440 } LDKSignerProvider_JCalls;
7441 static void LDKSignerProvider_JCalls_free(void* this_arg) {
7442         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7443         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7444                 FREE(j_calls);
7445         }
7446 }
7447 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
7448         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7449         jboolean inbound_conv = inbound;
7450         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7451         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
7452         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
7453         int8_tArray ret = (int8_tArray)js_invoke_function_l_bll(j_calls->instance_ptr, 39, inbound_conv, channel_value_satoshis_conv, (int64_t)user_channel_id_arr);
7454         LDKThirtyTwoBytes ret_ref;
7455         CHECK(ret->arr_len == 32);
7456         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7457         return ret_ref;
7458 }
7459 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
7460         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7461         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7462         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
7463         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
7464         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 40, channel_value_satoshis_conv, (int64_t)channel_keys_id_arr);
7465         void* ret_ptr = untag_ptr(ret);
7466         CHECK_ACCESS(ret_ptr);
7467         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
7468         FREE(untag_ptr(ret));
7469         return ret_conv;
7470 }
7471 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
7472         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7473         LDKu8slice reader_var = reader;
7474         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
7475         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
7476         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 41, (int64_t)reader_arr);
7477         void* ret_ptr = untag_ptr(ret);
7478         CHECK_ACCESS(ret_ptr);
7479         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
7480         FREE(untag_ptr(ret));
7481         return ret_conv;
7482 }
7483 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
7484         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7485         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
7486         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
7487         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 42, (int64_t)channel_keys_id_arr);
7488         void* ret_ptr = untag_ptr(ret);
7489         CHECK_ACCESS(ret_ptr);
7490         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
7491         FREE(untag_ptr(ret));
7492         return ret_conv;
7493 }
7494 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
7495         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7496         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 43);
7497         void* ret_ptr = untag_ptr(ret);
7498         CHECK_ACCESS(ret_ptr);
7499         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
7500         FREE(untag_ptr(ret));
7501         return ret_conv;
7502 }
7503 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
7504         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
7505         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7506 }
7507 static inline LDKSignerProvider LDKSignerProvider_init (int64_t o) {
7508         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
7509         atomic_init(&calls->refcnt, 1);
7510         calls->instance_ptr = o;
7511
7512         LDKSignerProvider ret = {
7513                 .this_arg = (void*) calls,
7514                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
7515                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
7516                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
7517                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
7518                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
7519                 .free = LDKSignerProvider_JCalls_free,
7520         };
7521         return ret;
7522 }
7523 uint64_t  CS_LDK_LDKSignerProvider_new(int32_t o) {
7524         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
7525         *res_ptr = LDKSignerProvider_init(o);
7526         return tag_ptr(res_ptr, true);
7527 }
7528 int8_tArray  CS_LDK_SignerProvider_generate_channel_keys_id(int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
7529         void* this_arg_ptr = untag_ptr(this_arg);
7530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7531         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7532         LDKU128 user_channel_id_ref;
7533         CHECK(user_channel_id->arr_len == 16);
7534         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
7535         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7536         memcpy(ret_arr->elems, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data, 32);
7537         return ret_arr;
7538 }
7539
7540 int64_t  CS_LDK_SignerProvider_derive_channel_signer(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
7541         void* this_arg_ptr = untag_ptr(this_arg);
7542         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7543         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7544         LDKThirtyTwoBytes channel_keys_id_ref;
7545         CHECK(channel_keys_id->arr_len == 32);
7546         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7547         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
7548         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
7549         return tag_ptr(ret_ret, true);
7550 }
7551
7552 int64_t  CS_LDK_SignerProvider_read_chan_signer(int64_t this_arg, int8_tArray reader) {
7553         void* this_arg_ptr = untag_ptr(this_arg);
7554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7555         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7556         LDKu8slice reader_ref;
7557         reader_ref.datalen = reader->arr_len;
7558         reader_ref.data = reader->elems;
7559         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
7560         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7561         FREE(reader);
7562         return tag_ptr(ret_conv, true);
7563 }
7564
7565 int64_t  CS_LDK_SignerProvider_get_destination_script(int64_t this_arg, int8_tArray channel_keys_id) {
7566         void* this_arg_ptr = untag_ptr(this_arg);
7567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7568         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7569         LDKThirtyTwoBytes channel_keys_id_ref;
7570         CHECK(channel_keys_id->arr_len == 32);
7571         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7572         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
7573         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
7574         return tag_ptr(ret_conv, true);
7575 }
7576
7577 int64_t  CS_LDK_SignerProvider_get_shutdown_scriptpubkey(int64_t this_arg) {
7578         void* this_arg_ptr = untag_ptr(this_arg);
7579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7580         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7581         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7582         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7583         return tag_ptr(ret_conv, true);
7584 }
7585
7586 typedef struct LDKFeeEstimator_JCalls {
7587         atomic_size_t refcnt;
7588         uint32_t instance_ptr;
7589 } LDKFeeEstimator_JCalls;
7590 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7591         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7592         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7593                 FREE(j_calls);
7594         }
7595 }
7596 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7597         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7598         int32_t confirmation_target_conv = LDKConfirmationTarget_to_cs(confirmation_target);
7599         return js_invoke_function_i_ConfirmationTarget(j_calls->instance_ptr, 44, confirmation_target_conv);
7600 }
7601 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7602         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7603         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7604 }
7605 static inline LDKFeeEstimator LDKFeeEstimator_init (int64_t o) {
7606         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7607         atomic_init(&calls->refcnt, 1);
7608         calls->instance_ptr = o;
7609
7610         LDKFeeEstimator ret = {
7611                 .this_arg = (void*) calls,
7612                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7613                 .free = LDKFeeEstimator_JCalls_free,
7614         };
7615         return ret;
7616 }
7617 uint64_t  CS_LDK_LDKFeeEstimator_new(int32_t o) {
7618         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7619         *res_ptr = LDKFeeEstimator_init(o);
7620         return tag_ptr(res_ptr, true);
7621 }
7622 int32_t  CS_LDK_FeeEstimator_get_est_sat_per_1000_weight(int64_t this_arg, int32_t confirmation_target) {
7623         void* this_arg_ptr = untag_ptr(this_arg);
7624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7625         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7626         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_cs(confirmation_target);
7627         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7628         return ret_conv;
7629 }
7630
7631 typedef struct LDKMessageRouter_JCalls {
7632         atomic_size_t refcnt;
7633         uint32_t instance_ptr;
7634 } LDKMessageRouter_JCalls;
7635 static void LDKMessageRouter_JCalls_free(void* this_arg) {
7636         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7637         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7638                 FREE(j_calls);
7639         }
7640 }
7641 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
7642         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7643         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
7644         memcpy(sender_arr->elems, sender.compressed_form, 33);
7645         LDKCVec_PublicKeyZ peers_var = peers;
7646         ptrArray peers_arr = NULL;
7647         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7648         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7649         for (size_t i = 0; i < peers_var.datalen; i++) {
7650                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7651                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7652                 peers_arr_ptr[i] = peers_conv_8_arr;
7653         }
7654         
7655         FREE(peers_var.data);
7656         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7657         *destination_copy = destination;
7658         int64_t destination_ref = tag_ptr(destination_copy, true);
7659         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 45, (int64_t)sender_arr, (int64_t)peers_arr, destination_ref);
7660         void* ret_ptr = untag_ptr(ret);
7661         CHECK_ACCESS(ret_ptr);
7662         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7663         FREE(untag_ptr(ret));
7664         return ret_conv;
7665 }
7666 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7667         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7668         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7669         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7670         LDKCVec_PublicKeyZ peers_var = peers;
7671         ptrArray peers_arr = NULL;
7672         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7673         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7674         for (size_t i = 0; i < peers_var.datalen; i++) {
7675                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7676                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7677                 peers_arr_ptr[i] = peers_conv_8_arr;
7678         }
7679         
7680         FREE(peers_var.data);
7681         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 46, (int64_t)recipient_arr, (int64_t)peers_arr);
7682         void* ret_ptr = untag_ptr(ret);
7683         CHECK_ACCESS(ret_ptr);
7684         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7685         FREE(untag_ptr(ret));
7686         return ret_conv;
7687 }
7688 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7689         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7690         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7691 }
7692 static inline LDKMessageRouter LDKMessageRouter_init (int64_t o) {
7693         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7694         atomic_init(&calls->refcnt, 1);
7695         calls->instance_ptr = o;
7696
7697         LDKMessageRouter ret = {
7698                 .this_arg = (void*) calls,
7699                 .find_path = find_path_LDKMessageRouter_jcall,
7700                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7701                 .free = LDKMessageRouter_JCalls_free,
7702         };
7703         return ret;
7704 }
7705 uint64_t  CS_LDK_LDKMessageRouter_new(int32_t o) {
7706         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7707         *res_ptr = LDKMessageRouter_init(o);
7708         return tag_ptr(res_ptr, true);
7709 }
7710 int64_t  CS_LDK_MessageRouter_find_path(int64_t this_arg, int8_tArray sender, ptrArray peers, int64_t destination) {
7711         void* this_arg_ptr = untag_ptr(this_arg);
7712         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7713         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7714         LDKPublicKey sender_ref;
7715         CHECK(sender->arr_len == 33);
7716         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7717         LDKCVec_PublicKeyZ peers_constr;
7718         peers_constr.datalen = peers->arr_len;
7719         if (peers_constr.datalen > 0)
7720                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7721         else
7722                 peers_constr.data = NULL;
7723         int8_tArray* peers_vals = (void*) peers->elems;
7724         for (size_t i = 0; i < peers_constr.datalen; i++) {
7725                 int8_tArray peers_conv_8 = peers_vals[i];
7726                 LDKPublicKey peers_conv_8_ref;
7727                 CHECK(peers_conv_8->arr_len == 33);
7728                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7729                 peers_constr.data[i] = peers_conv_8_ref;
7730         }
7731         FREE(peers);
7732         void* destination_ptr = untag_ptr(destination);
7733         CHECK_ACCESS(destination_ptr);
7734         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7735         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7736         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7737         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7738         return tag_ptr(ret_conv, true);
7739 }
7740
7741 int64_t  CS_LDK_MessageRouter_create_blinded_paths(int64_t this_arg, int8_tArray recipient, ptrArray peers) {
7742         void* this_arg_ptr = untag_ptr(this_arg);
7743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7744         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7745         LDKPublicKey recipient_ref;
7746         CHECK(recipient->arr_len == 33);
7747         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7748         LDKCVec_PublicKeyZ peers_constr;
7749         peers_constr.datalen = peers->arr_len;
7750         if (peers_constr.datalen > 0)
7751                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7752         else
7753                 peers_constr.data = NULL;
7754         int8_tArray* peers_vals = (void*) peers->elems;
7755         for (size_t i = 0; i < peers_constr.datalen; i++) {
7756                 int8_tArray peers_conv_8 = peers_vals[i];
7757                 LDKPublicKey peers_conv_8_ref;
7758                 CHECK(peers_conv_8->arr_len == 33);
7759                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7760                 peers_constr.data[i] = peers_conv_8_ref;
7761         }
7762         FREE(peers);
7763         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7764         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7765         return tag_ptr(ret_conv, true);
7766 }
7767
7768 typedef struct LDKRouter_JCalls {
7769         atomic_size_t refcnt;
7770         uint32_t instance_ptr;
7771         LDKMessageRouter_JCalls* MessageRouter;
7772 } LDKRouter_JCalls;
7773 static void LDKRouter_JCalls_free(void* this_arg) {
7774         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7775         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7776                 FREE(j_calls);
7777         }
7778 }
7779 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7780         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7781         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7782         memcpy(payer_arr->elems, payer.compressed_form, 33);
7783         LDKRouteParameters route_params_var = *route_params;
7784         int64_t route_params_ref = 0;
7785         route_params_var = RouteParameters_clone(&route_params_var);
7786         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7787         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7788         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7789         int64_tArray first_hops_arr = NULL;
7790         if (first_hops != NULL) {
7791                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7792                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7793                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7794                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7795                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7796                         int64_t first_hops_conv_16_ref = 0;
7797                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7798                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7799                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7800                 }
7801         
7802         }
7803         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7804         int64_t inflight_htlcs_ref = 0;
7805         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7806         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7807         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 47, (int64_t)payer_arr, route_params_ref, (int64_t)first_hops_arr, inflight_htlcs_ref);
7808         void* ret_ptr = untag_ptr(ret);
7809         CHECK_ACCESS(ret_ptr);
7810         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7811         FREE(untag_ptr(ret));
7812         return ret_conv;
7813 }
7814 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) {
7815         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7816         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7817         memcpy(payer_arr->elems, payer.compressed_form, 33);
7818         LDKRouteParameters route_params_var = *route_params;
7819         int64_t route_params_ref = 0;
7820         route_params_var = RouteParameters_clone(&route_params_var);
7821         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7822         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7823         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7824         int64_tArray first_hops_arr = NULL;
7825         if (first_hops != NULL) {
7826                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7827                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7828                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7829                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7830                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7831                         int64_t first_hops_conv_16_ref = 0;
7832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7833                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7834                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7835                 }
7836         
7837         }
7838         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7839         int64_t inflight_htlcs_ref = 0;
7840         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7841         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7842         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7843         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7844         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7845         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7846         uint64_t ret = js_invoke_function_l_llllll(j_calls->instance_ptr, 48, (int64_t)payer_arr, route_params_ref, (int64_t)first_hops_arr, inflight_htlcs_ref, (int64_t)_payment_hash_arr, (int64_t)_payment_id_arr);
7847         void* ret_ptr = untag_ptr(ret);
7848         CHECK_ACCESS(ret_ptr);
7849         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7850         FREE(untag_ptr(ret));
7851         return ret_conv;
7852 }
7853 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) {
7854         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7855         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7856         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7857         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7858         int64_tArray first_hops_arr = NULL;
7859         first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7860         int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7861         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7862                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7863                 int64_t first_hops_conv_16_ref = 0;
7864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7865                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7866                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7867         }
7868         
7869         FREE(first_hops_var.data);
7870         LDKReceiveTlvs tlvs_var = tlvs;
7871         int64_t tlvs_ref = 0;
7872         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7873         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7874         int64_t amount_msats_conv = amount_msats;
7875         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 49, (int64_t)recipient_arr, (int64_t)first_hops_arr, tlvs_ref, amount_msats_conv);
7876         void* ret_ptr = untag_ptr(ret);
7877         CHECK_ACCESS(ret_ptr);
7878         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7879         FREE(untag_ptr(ret));
7880         return ret_conv;
7881 }
7882 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7883         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7884         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7885         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7886 }
7887 static inline LDKRouter LDKRouter_init (int64_t o, int64_t MessageRouter) {
7888         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7889         atomic_init(&calls->refcnt, 1);
7890         calls->instance_ptr = o;
7891
7892         LDKRouter ret = {
7893                 .this_arg = (void*) calls,
7894                 .find_route = find_route_LDKRouter_jcall,
7895                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7896                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7897                 .free = LDKRouter_JCalls_free,
7898                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7899         };
7900         calls->MessageRouter = ret.MessageRouter.this_arg;
7901         return ret;
7902 }
7903 uint64_t  CS_LDK_LDKRouter_new(int32_t o, int32_t MessageRouter) {
7904         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7905         *res_ptr = LDKRouter_init(o, MessageRouter);
7906         return tag_ptr(res_ptr, true);
7907 }
7908 int64_t  CS_LDK_Router_find_route(int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) {
7909         void* this_arg_ptr = untag_ptr(this_arg);
7910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7911         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7912         LDKPublicKey payer_ref;
7913         CHECK(payer->arr_len == 33);
7914         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7915         LDKRouteParameters route_params_conv;
7916         route_params_conv.inner = untag_ptr(route_params);
7917         route_params_conv.is_owned = ptr_is_owned(route_params);
7918         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7919         route_params_conv.is_owned = false;
7920         LDKCVec_ChannelDetailsZ first_hops_constr;
7921         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7922         if (first_hops != NULL) {
7923                 first_hops_constr.datalen = first_hops->arr_len;
7924                 if (first_hops_constr.datalen > 0)
7925                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7926                 else
7927                         first_hops_constr.data = NULL;
7928                 int64_t* first_hops_vals = first_hops->elems;
7929                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7930                         int64_t first_hops_conv_16 = first_hops_vals[q];
7931                         LDKChannelDetails first_hops_conv_16_conv;
7932                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7933                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7934                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7935                         first_hops_conv_16_conv.is_owned = false;
7936                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7937                 }
7938                 FREE(first_hops);
7939                 first_hops_ptr = &first_hops_constr;
7940         }
7941         LDKInFlightHtlcs inflight_htlcs_conv;
7942         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7943         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7944         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7945         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7946         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7947         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7948         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7949         return tag_ptr(ret_conv, true);
7950 }
7951
7952 int64_t  CS_LDK_Router_find_route_with_id(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) {
7953         void* this_arg_ptr = untag_ptr(this_arg);
7954         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7955         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7956         LDKPublicKey payer_ref;
7957         CHECK(payer->arr_len == 33);
7958         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7959         LDKRouteParameters route_params_conv;
7960         route_params_conv.inner = untag_ptr(route_params);
7961         route_params_conv.is_owned = ptr_is_owned(route_params);
7962         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7963         route_params_conv.is_owned = false;
7964         LDKCVec_ChannelDetailsZ first_hops_constr;
7965         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7966         if (first_hops != NULL) {
7967                 first_hops_constr.datalen = first_hops->arr_len;
7968                 if (first_hops_constr.datalen > 0)
7969                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7970                 else
7971                         first_hops_constr.data = NULL;
7972                 int64_t* first_hops_vals = first_hops->elems;
7973                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7974                         int64_t first_hops_conv_16 = first_hops_vals[q];
7975                         LDKChannelDetails first_hops_conv_16_conv;
7976                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7977                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7978                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7979                         first_hops_conv_16_conv.is_owned = false;
7980                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7981                 }
7982                 FREE(first_hops);
7983                 first_hops_ptr = &first_hops_constr;
7984         }
7985         LDKInFlightHtlcs inflight_htlcs_conv;
7986         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7987         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7988         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7989         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7990         LDKThirtyTwoBytes _payment_hash_ref;
7991         CHECK(_payment_hash->arr_len == 32);
7992         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7993         LDKThirtyTwoBytes _payment_id_ref;
7994         CHECK(_payment_id->arr_len == 32);
7995         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7996         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7997         *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);
7998         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7999         return tag_ptr(ret_conv, true);
8000 }
8001
8002 int64_t  CS_LDK_Router_create_blinded_payment_paths(int64_t this_arg, int8_tArray recipient, int64_tArray first_hops, int64_t tlvs, int64_t amount_msats) {
8003         void* this_arg_ptr = untag_ptr(this_arg);
8004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8005         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8006         LDKPublicKey recipient_ref;
8007         CHECK(recipient->arr_len == 33);
8008         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
8009         LDKCVec_ChannelDetailsZ first_hops_constr;
8010         first_hops_constr.datalen = first_hops->arr_len;
8011         if (first_hops_constr.datalen > 0)
8012                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8013         else
8014                 first_hops_constr.data = NULL;
8015         int64_t* first_hops_vals = first_hops->elems;
8016         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8017                 int64_t first_hops_conv_16 = first_hops_vals[q];
8018                 LDKChannelDetails first_hops_conv_16_conv;
8019                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8020                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8021                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8022                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
8023                 first_hops_constr.data[q] = first_hops_conv_16_conv;
8024         }
8025         FREE(first_hops);
8026         LDKReceiveTlvs tlvs_conv;
8027         tlvs_conv.inner = untag_ptr(tlvs);
8028         tlvs_conv.is_owned = ptr_is_owned(tlvs);
8029         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
8030         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
8031         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
8032         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
8033         return tag_ptr(ret_conv, true);
8034 }
8035
8036 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8037         return ThirtyTwoBytes_clone(&owner->a);
8038 }
8039 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(int64_t owner) {
8040         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8041         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8042         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
8043         return ret_arr;
8044 }
8045
8046 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
8047         LDKChannelManager ret = owner->b;
8048         ret.is_owned = false;
8049         return ret;
8050 }
8051 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(int64_t owner) {
8052         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
8053         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
8054         int64_t ret_ref = 0;
8055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8057         return ret_ref;
8058 }
8059
8060 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8061 CHECK(owner->result_ok);
8062         return &*owner->contents.result;
8063 }
8064 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(int64_t owner) {
8065         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8066         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8067         return ret_ret;
8068 }
8069
8070 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8071 CHECK(!owner->result_ok);
8072         return DecodeError_clone(&*owner->contents.err);
8073 }
8074 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(int64_t owner) {
8075         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8076         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8077         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
8078         int64_t ret_ref = tag_ptr(ret_copy, true);
8079         return ret_ref;
8080 }
8081
8082 uint32_t CS_LDK_LDKMaxDustHTLCExposure_ty_from_ptr(int64_t ptr) {
8083         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8084         switch(obj->tag) {
8085                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
8086                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
8087                 default: abort();
8088         }
8089 }
8090 int64_t CS_LDK_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(int64_t ptr) {
8091         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8092         CHECK(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
8093         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8094         return fixed_limit_msat_conv;
8095 }
8096 int64_t CS_LDK_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(int64_t ptr) {
8097         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8098         CHECK(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
8099         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8100         return fee_rate_multiplier_conv;
8101 }
8102 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8103 CHECK(owner->result_ok);
8104         return MaxDustHTLCExposure_clone(&*owner->contents.result);
8105 }
8106 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(int64_t owner) {
8107         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8108         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
8109         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
8110         int64_t ret_ref = tag_ptr(ret_copy, true);
8111         return ret_ref;
8112 }
8113
8114 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8115 CHECK(!owner->result_ok);
8116         return DecodeError_clone(&*owner->contents.err);
8117 }
8118 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(int64_t owner) {
8119         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8121         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
8122         int64_t ret_ref = tag_ptr(ret_copy, true);
8123         return ret_ref;
8124 }
8125
8126 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8127         LDKChannelConfig ret = *owner->contents.result;
8128         ret.is_owned = false;
8129         return ret;
8130 }
8131 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_ok(int64_t owner) {
8132         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8133         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
8134         int64_t ret_ref = 0;
8135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8137         return ret_ref;
8138 }
8139
8140 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8141 CHECK(!owner->result_ok);
8142         return DecodeError_clone(&*owner->contents.err);
8143 }
8144 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_err(int64_t owner) {
8145         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8147         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
8148         int64_t ret_ref = tag_ptr(ret_copy, true);
8149         return ret_ref;
8150 }
8151
8152 uint32_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(int64_t ptr) {
8153         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8154         switch(obj->tag) {
8155                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
8156                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
8157                 default: abort();
8158         }
8159 }
8160 int64_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(int64_t ptr) {
8161         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8162         CHECK(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
8163         int64_t some_ref = tag_ptr(&obj->some, false);
8164         return some_ref;
8165 }
8166 uint32_t CS_LDK_LDKCOption_APIErrorZ_ty_from_ptr(int64_t ptr) {
8167         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8168         switch(obj->tag) {
8169                 case LDKCOption_APIErrorZ_Some: return 0;
8170                 case LDKCOption_APIErrorZ_None: return 1;
8171                 default: abort();
8172         }
8173 }
8174 int64_t CS_LDK_LDKCOption_APIErrorZ_Some_get_some(int64_t ptr) {
8175         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8176         CHECK(obj->tag == LDKCOption_APIErrorZ_Some);
8177         int64_t some_ref = tag_ptr(&obj->some, false);
8178         return some_ref;
8179 }
8180 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8181 CHECK(owner->result_ok);
8182         return COption_APIErrorZ_clone(&*owner->contents.result);
8183 }
8184 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_ok(int64_t owner) {
8185         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8186         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
8187         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
8188         int64_t ret_ref = tag_ptr(ret_copy, true);
8189         return ret_ref;
8190 }
8191
8192 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8193 CHECK(!owner->result_ok);
8194         return DecodeError_clone(&*owner->contents.err);
8195 }
8196 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_err(int64_t owner) {
8197         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8198         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8199         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
8200         int64_t ret_ref = tag_ptr(ret_copy, true);
8201         return ret_ref;
8202 }
8203
8204 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8205         LDKChannelMonitorUpdate ret = *owner->contents.result;
8206         ret.is_owned = false;
8207         return ret;
8208 }
8209 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(int64_t owner) {
8210         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8211         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8212         int64_t ret_ref = 0;
8213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8215         return ret_ref;
8216 }
8217
8218 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8219 CHECK(!owner->result_ok);
8220         return DecodeError_clone(&*owner->contents.err);
8221 }
8222 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(int64_t owner) {
8223         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8224         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8225         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8226         int64_t ret_ref = tag_ptr(ret_copy, true);
8227         return ret_ref;
8228 }
8229
8230 uint32_t CS_LDK_LDKCOption_MonitorEventZ_ty_from_ptr(int64_t ptr) {
8231         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8232         switch(obj->tag) {
8233                 case LDKCOption_MonitorEventZ_Some: return 0;
8234                 case LDKCOption_MonitorEventZ_None: return 1;
8235                 default: abort();
8236         }
8237 }
8238 int64_t CS_LDK_LDKCOption_MonitorEventZ_Some_get_some(int64_t ptr) {
8239         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8240         CHECK(obj->tag == LDKCOption_MonitorEventZ_Some);
8241         int64_t some_ref = tag_ptr(&obj->some, false);
8242         return some_ref;
8243 }
8244 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8245 CHECK(owner->result_ok);
8246         return COption_MonitorEventZ_clone(&*owner->contents.result);
8247 }
8248 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(int64_t owner) {
8249         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8250         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8251         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8252         int64_t ret_ref = tag_ptr(ret_copy, true);
8253         return ret_ref;
8254 }
8255
8256 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8257 CHECK(!owner->result_ok);
8258         return DecodeError_clone(&*owner->contents.err);
8259 }
8260 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_err(int64_t owner) {
8261         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8263         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8264         int64_t ret_ref = tag_ptr(ret_copy, true);
8265         return ret_ref;
8266 }
8267
8268 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8269         LDKHTLCUpdate ret = *owner->contents.result;
8270         ret.is_owned = false;
8271         return ret;
8272 }
8273 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_ok(int64_t owner) {
8274         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8275         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8276         int64_t ret_ref = 0;
8277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8279         return ret_ref;
8280 }
8281
8282 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8283 CHECK(!owner->result_ok);
8284         return DecodeError_clone(&*owner->contents.err);
8285 }
8286 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_err(int64_t owner) {
8287         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8289         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8290         int64_t ret_ref = tag_ptr(ret_copy, true);
8291         return ret_ref;
8292 }
8293
8294 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
8295         LDKOutPoint ret = owner->a;
8296         ret.is_owned = false;
8297         return ret;
8298 }
8299 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_a(int64_t owner) {
8300         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
8301         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
8302         int64_t ret_ref = 0;
8303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8305         return ret_ref;
8306 }
8307
8308 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
8309         return CVec_u8Z_clone(&owner->b);
8310 }
8311 int8_tArray  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_b(int64_t owner) {
8312         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
8313         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
8314         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8315         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8316         CVec_u8Z_free(ret_var);
8317         return ret_arr;
8318 }
8319
8320 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
8321         return owner->a;
8322 }
8323 int32_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_a(int64_t owner) {
8324         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
8325         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
8326         return ret_conv;
8327 }
8328
8329 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
8330         return CVec_u8Z_clone(&owner->b);
8331 }
8332 int8_tArray  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_b(int64_t owner) {
8333         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
8334         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
8335         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8336         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8337         CVec_u8Z_free(ret_var);
8338         return ret_arr;
8339 }
8340
8341 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
8342         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
8343         for (size_t i = 0; i < ret.datalen; i++) {
8344                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
8345         }
8346         return ret;
8347 }
8348 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
8349         return ThirtyTwoBytes_clone(&owner->a);
8350 }
8351 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(int64_t owner) {
8352         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
8353         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8354         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
8355         return ret_arr;
8356 }
8357
8358 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
8359         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
8360 }
8361 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(int64_t owner) {
8362         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
8363         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
8364         int64_tArray ret_arr = NULL;
8365         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8366         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8367         for (size_t x = 0; x < ret_var.datalen; x++) {
8368                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
8369                 *ret_conv_23_conv = ret_var.data[x];
8370                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
8371         }
8372         
8373         FREE(ret_var.data);
8374         return ret_arr;
8375 }
8376
8377 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
8378         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 };
8379         for (size_t i = 0; i < ret.datalen; i++) {
8380                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
8381         }
8382         return ret;
8383 }
8384 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
8385         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
8386         for (size_t i = 0; i < ret.datalen; i++) {
8387                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
8388         }
8389         return ret;
8390 }
8391 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8392         return owner->a;
8393 }
8394 int32_t  CS_LDK_C2Tuple_u32TxOutZ_get_a(int64_t owner) {
8395         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8396         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8397         return ret_conv;
8398 }
8399
8400 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8401         return TxOut_clone(&owner->b);
8402 }
8403 int64_t  CS_LDK_C2Tuple_u32TxOutZ_get_b(int64_t owner) {
8404         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8405         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8406         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8407         return tag_ptr(ret_ref, true);
8408 }
8409
8410 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8411         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8412         for (size_t i = 0; i < ret.datalen; i++) {
8413                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8414         }
8415         return ret;
8416 }
8417 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8418         return ThirtyTwoBytes_clone(&owner->a);
8419 }
8420 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(int64_t owner) {
8421         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8422         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8423         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
8424         return ret_arr;
8425 }
8426
8427 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8428         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8429 }
8430 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(int64_t owner) {
8431         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8432         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8433         int64_tArray ret_arr = NULL;
8434         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8435         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8436         for (size_t u = 0; u < ret_var.datalen; u++) {
8437                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8438                 *ret_conv_20_conv = ret_var.data[u];
8439                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8440         }
8441         
8442         FREE(ret_var.data);
8443         return ret_arr;
8444 }
8445
8446 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
8447         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 };
8448         for (size_t i = 0; i < ret.datalen; i++) {
8449                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8450         }
8451         return ret;
8452 }
8453 uint32_t CS_LDK_LDKBalance_ty_from_ptr(int64_t ptr) {
8454         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8455         switch(obj->tag) {
8456                 case LDKBalance_ClaimableOnChannelClose: return 0;
8457                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
8458                 case LDKBalance_ContentiousClaimable: return 2;
8459                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
8460                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
8461                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
8462                 default: abort();
8463         }
8464 }
8465 int64_t CS_LDK_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(int64_t ptr) {
8466         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8467         CHECK(obj->tag == LDKBalance_ClaimableOnChannelClose);
8468         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
8469         return amount_satoshis_conv;
8470 }
8471 int64_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(int64_t ptr) {
8472         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8473         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8474         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
8475         return amount_satoshis_conv;
8476 }
8477 int32_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(int64_t ptr) {
8478         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8479         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8480         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8481         return confirmation_height_conv;
8482 }
8483 int64_t CS_LDK_LDKBalance_ContentiousClaimable_get_amount_satoshis(int64_t ptr) {
8484         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8485         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8486         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
8487         return amount_satoshis_conv;
8488 }
8489 int32_t CS_LDK_LDKBalance_ContentiousClaimable_get_timeout_height(int64_t ptr) {
8490         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8491         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8492         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8493         return timeout_height_conv;
8494 }
8495 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_hash(int64_t ptr) {
8496         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8497         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8498         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8499         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
8500         return payment_hash_arr;
8501 }
8502 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_preimage(int64_t ptr) {
8503         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8504         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8505         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
8506         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
8507         return payment_preimage_arr;
8508 }
8509 int64_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(int64_t ptr) {
8510         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8511         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8512         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
8513         return amount_satoshis_conv;
8514 }
8515 int32_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(int64_t ptr) {
8516         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8517         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8518         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
8519         return claimable_height_conv;
8520 }
8521 int8_tArray CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(int64_t ptr) {
8522         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8523         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8524         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8525         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
8526         return payment_hash_arr;
8527 }
8528 int64_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(int64_t ptr) {
8529         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8530         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8531         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
8532         return amount_satoshis_conv;
8533 }
8534 int32_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(int64_t ptr) {
8535         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8536         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8537         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
8538         return expiry_height_conv;
8539 }
8540 int8_tArray CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(int64_t ptr) {
8541         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8542         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8543         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8544         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
8545         return payment_hash_arr;
8546 }
8547 int64_t CS_LDK_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(int64_t ptr) {
8548         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8549         CHECK(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
8550         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
8551         return amount_satoshis_conv;
8552 }
8553 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8554         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8555         for (size_t i = 0; i < ret.datalen; i++) {
8556                 ret.data[i] = Balance_clone(&orig->data[i]);
8557         }
8558         return ret;
8559 }
8560 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8561         return ThirtyTwoBytes_clone(&owner->a);
8562 }
8563 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(int64_t owner) {
8564         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8565         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8566         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
8567         return ret_arr;
8568 }
8569
8570 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8571         LDKChannelMonitor ret = owner->b;
8572         ret.is_owned = false;
8573         return ret;
8574 }
8575 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(int64_t owner) {
8576         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8577         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
8578         int64_t ret_ref = 0;
8579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8581         return ret_ref;
8582 }
8583
8584 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8585 CHECK(owner->result_ok);
8586         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8587 }
8588 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(int64_t owner) {
8589         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8590         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8591         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8592         return tag_ptr(ret_conv, true);
8593 }
8594
8595 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8596 CHECK(!owner->result_ok);
8597         return DecodeError_clone(&*owner->contents.err);
8598 }
8599 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(int64_t owner) {
8600         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8602         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8603         int64_t ret_ref = tag_ptr(ret_copy, true);
8604         return ret_ref;
8605 }
8606
8607 typedef struct LDKType_JCalls {
8608         atomic_size_t refcnt;
8609         uint32_t instance_ptr;
8610 } LDKType_JCalls;
8611 static void LDKType_JCalls_free(void* this_arg) {
8612         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8613         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8614                 FREE(j_calls);
8615         }
8616 }
8617 uint16_t type_id_LDKType_jcall(const void* this_arg) {
8618         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8619         return js_invoke_function_s_(j_calls->instance_ptr, 50);
8620 }
8621 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
8622         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8623         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 51);
8624         LDKStr ret_conv = str_ref_to_owned_c(ret);
8625         return ret_conv;
8626 }
8627 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
8628         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8629         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 52);
8630         LDKCVec_u8Z ret_ref;
8631         ret_ref.datalen = ret->arr_len;
8632         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8633         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8634         return ret_ref;
8635 }
8636 static void LDKType_JCalls_cloned(LDKType* new_obj) {
8637         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
8638         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8639 }
8640 static inline LDKType LDKType_init (int64_t o) {
8641         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
8642         atomic_init(&calls->refcnt, 1);
8643         calls->instance_ptr = o;
8644
8645         LDKType ret = {
8646                 .this_arg = (void*) calls,
8647                 .type_id = type_id_LDKType_jcall,
8648                 .debug_str = debug_str_LDKType_jcall,
8649                 .write = write_LDKType_jcall,
8650                 .cloned = LDKType_JCalls_cloned,
8651                 .free = LDKType_JCalls_free,
8652         };
8653         return ret;
8654 }
8655 uint64_t  CS_LDK_LDKType_new(int32_t o) {
8656         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8657         *res_ptr = LDKType_init(o);
8658         return tag_ptr(res_ptr, true);
8659 }
8660 int16_t  CS_LDK_Type_type_id(int64_t this_arg) {
8661         void* this_arg_ptr = untag_ptr(this_arg);
8662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8663         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8664         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8665         return ret_conv;
8666 }
8667
8668 jstring  CS_LDK_Type_debug_str(int64_t this_arg) {
8669         void* this_arg_ptr = untag_ptr(this_arg);
8670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8671         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8672         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8673         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8674         Str_free(ret_str);
8675         return ret_conv;
8676 }
8677
8678 int8_tArray  CS_LDK_Type_write(int64_t this_arg) {
8679         void* this_arg_ptr = untag_ptr(this_arg);
8680         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8681         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8682         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8685         CVec_u8Z_free(ret_var);
8686         return ret_arr;
8687 }
8688
8689 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8690         return owner->a;
8691 }
8692 int8_tArray  CS_LDK_C2Tuple_PublicKeyTypeZ_get_a(int64_t owner) {
8693         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8694         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8695         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8696         return ret_arr;
8697 }
8698
8699 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8700         return Type_clone(&owner->b);
8701 }
8702 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_get_b(int64_t owner) {
8703         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8704         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8705         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8706         return tag_ptr(ret_ret, true);
8707 }
8708
8709 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8710         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8711         for (size_t i = 0; i < ret.datalen; i++) {
8712                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8713         }
8714         return ret;
8715 }
8716 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8717         return owner->a;
8718 }
8719 int8_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(int64_t owner) {
8720         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8721         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8722         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8723         return ret_arr;
8724 }
8725
8726 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8727         return CVec_SocketAddressZ_clone(&owner->b);
8728 }
8729 int64_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(int64_t owner) {
8730         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8731         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8732         int64_tArray ret_arr = NULL;
8733         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8734         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8735         for (size_t p = 0; p < ret_var.datalen; p++) {
8736                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8737                 *ret_conv_15_copy = ret_var.data[p];
8738                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8739                 ret_arr_ptr[p] = ret_conv_15_ref;
8740         }
8741         
8742         FREE(ret_var.data);
8743         return ret_arr;
8744 }
8745
8746 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8747         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8748         for (size_t i = 0; i < ret.datalen; i++) {
8749                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8750         }
8751         return ret;
8752 }
8753 typedef struct LDKOnionMessageContents_JCalls {
8754         atomic_size_t refcnt;
8755         uint32_t instance_ptr;
8756 } LDKOnionMessageContents_JCalls;
8757 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8758         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8759         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8760                 FREE(j_calls);
8761         }
8762 }
8763 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8764         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8765         return js_invoke_function_l_(j_calls->instance_ptr, 53);
8766 }
8767 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8768         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8769         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 54);
8770         LDKCVec_u8Z ret_ref;
8771         ret_ref.datalen = ret->arr_len;
8772         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8773         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8774         return ret_ref;
8775 }
8776 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8777         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8778         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 55);
8779         LDKStr ret_conv = str_ref_to_owned_c(ret);
8780         return ret_conv;
8781 }
8782 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8783         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8784         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8785 }
8786 static inline LDKOnionMessageContents LDKOnionMessageContents_init (int64_t o) {
8787         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8788         atomic_init(&calls->refcnt, 1);
8789         calls->instance_ptr = o;
8790
8791         LDKOnionMessageContents ret = {
8792                 .this_arg = (void*) calls,
8793                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8794                 .write = write_LDKOnionMessageContents_jcall,
8795                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8796                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8797                 .free = LDKOnionMessageContents_JCalls_free,
8798         };
8799         return ret;
8800 }
8801 uint64_t  CS_LDK_LDKOnionMessageContents_new(int32_t o) {
8802         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8803         *res_ptr = LDKOnionMessageContents_init(o);
8804         return tag_ptr(res_ptr, true);
8805 }
8806 int64_t  CS_LDK_OnionMessageContents_tlv_type(int64_t this_arg) {
8807         void* this_arg_ptr = untag_ptr(this_arg);
8808         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8809         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8810         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8811         return ret_conv;
8812 }
8813
8814 int8_tArray  CS_LDK_OnionMessageContents_write(int64_t this_arg) {
8815         void* this_arg_ptr = untag_ptr(this_arg);
8816         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8817         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8818         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8821         CVec_u8Z_free(ret_var);
8822         return ret_arr;
8823 }
8824
8825 jstring  CS_LDK_OnionMessageContents_debug_str(int64_t this_arg) {
8826         void* this_arg_ptr = untag_ptr(this_arg);
8827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8828         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8829         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8830         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8831         Str_free(ret_str);
8832         return ret_conv;
8833 }
8834
8835 uint32_t CS_LDK_LDKCOption_OnionMessageContentsZ_ty_from_ptr(int64_t ptr) {
8836         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8837         switch(obj->tag) {
8838                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8839                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8840                 default: abort();
8841         }
8842 }
8843 int64_t CS_LDK_LDKCOption_OnionMessageContentsZ_Some_get_some(int64_t ptr) {
8844         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8845         CHECK(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8846         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8847         *some_ret = OnionMessageContents_clone(&obj->some);
8848         return tag_ptr(some_ret, true);
8849 }
8850 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8851 CHECK(owner->result_ok);
8852         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8853 }
8854 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(int64_t owner) {
8855         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8856         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8857         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8858         int64_t ret_ref = tag_ptr(ret_copy, true);
8859         return ret_ref;
8860 }
8861
8862 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8863 CHECK(!owner->result_ok);
8864         return DecodeError_clone(&*owner->contents.err);
8865 }
8866 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(int64_t owner) {
8867         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8869         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8870         int64_t ret_ref = tag_ptr(ret_copy, true);
8871         return ret_ref;
8872 }
8873
8874 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8875         return OnionMessageContents_clone(&owner->a);
8876 }
8877 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(int64_t owner) {
8878         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8879         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8880         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8881         return tag_ptr(ret_ret, true);
8882 }
8883
8884 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8885         return Destination_clone(&owner->b);
8886 }
8887 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(int64_t owner) {
8888         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8889         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8890         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8891         int64_t ret_ref = tag_ptr(ret_copy, true);
8892         return ret_ref;
8893 }
8894
8895 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8896         LDKBlindedPath ret = owner->c;
8897         ret.is_owned = false;
8898         return ret;
8899 }
8900 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(int64_t owner) {
8901         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8902         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8903         int64_t ret_ref = 0;
8904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8906         return ret_ref;
8907 }
8908
8909 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8910         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8911         for (size_t i = 0; i < ret.datalen; i++) {
8912                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8913         }
8914         return ret;
8915 }
8916 uint32_t CS_LDK_LDKCOption_TypeZ_ty_from_ptr(int64_t ptr) {
8917         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8918         switch(obj->tag) {
8919                 case LDKCOption_TypeZ_Some: return 0;
8920                 case LDKCOption_TypeZ_None: return 1;
8921                 default: abort();
8922         }
8923 }
8924 int64_t CS_LDK_LDKCOption_TypeZ_Some_get_some(int64_t ptr) {
8925         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8926         CHECK(obj->tag == LDKCOption_TypeZ_Some);
8927         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8928         *some_ret = Type_clone(&obj->some);
8929         return tag_ptr(some_ret, true);
8930 }
8931 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8932 CHECK(owner->result_ok);
8933         return COption_TypeZ_clone(&*owner->contents.result);
8934 }
8935 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_ok(int64_t owner) {
8936         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8937         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8938         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8939         int64_t ret_ref = tag_ptr(ret_copy, true);
8940         return ret_ref;
8941 }
8942
8943 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8944 CHECK(!owner->result_ok);
8945         return DecodeError_clone(&*owner->contents.err);
8946 }
8947 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_err(int64_t owner) {
8948         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8950         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8951         int64_t ret_ref = tag_ptr(ret_copy, true);
8952         return ret_ref;
8953 }
8954
8955 uint32_t CS_LDK_LDKCOption_SocketAddressZ_ty_from_ptr(int64_t ptr) {
8956         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8957         switch(obj->tag) {
8958                 case LDKCOption_SocketAddressZ_Some: return 0;
8959                 case LDKCOption_SocketAddressZ_None: return 1;
8960                 default: abort();
8961         }
8962 }
8963 int64_t CS_LDK_LDKCOption_SocketAddressZ_Some_get_some(int64_t ptr) {
8964         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8965         CHECK(obj->tag == LDKCOption_SocketAddressZ_Some);
8966         int64_t some_ref = tag_ptr(&obj->some, false);
8967         return some_ref;
8968 }
8969 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8970 CHECK(owner->result_ok);
8971         return CVec_u8Z_clone(&*owner->contents.result);
8972 }
8973 int8_tArray  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(int64_t owner) {
8974         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8975         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8978         CVec_u8Z_free(ret_var);
8979         return ret_arr;
8980 }
8981
8982 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8983         LDKPeerHandleError ret = *owner->contents.err;
8984         ret.is_owned = false;
8985         return ret;
8986 }
8987 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_err(int64_t owner) {
8988         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8989         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8990         int64_t ret_ref = 0;
8991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8993         return ret_ref;
8994 }
8995
8996 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8997 CHECK(owner->result_ok);
8998         return *owner->contents.result;
8999 }
9000 void  CS_LDK_CResult_NonePeerHandleErrorZ_get_ok(int64_t owner) {
9001         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9002         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
9003 }
9004
9005 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9006         LDKPeerHandleError ret = *owner->contents.err;
9007         ret.is_owned = false;
9008         return ret;
9009 }
9010 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_get_err(int64_t owner) {
9011         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9012         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
9013         int64_t ret_ref = 0;
9014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9016         return ret_ref;
9017 }
9018
9019 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9020 CHECK(owner->result_ok);
9021         return *owner->contents.result;
9022 }
9023 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_get_ok(int64_t owner) {
9024         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9025         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
9026         return ret_conv;
9027 }
9028
9029 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9030         LDKPeerHandleError ret = *owner->contents.err;
9031         ret.is_owned = false;
9032         return ret;
9033 }
9034 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_get_err(int64_t owner) {
9035         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9036         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
9037         int64_t ret_ref = 0;
9038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9040         return ret_ref;
9041 }
9042
9043 uint32_t CS_LDK_LDKGraphSyncError_ty_from_ptr(int64_t ptr) {
9044         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9045         switch(obj->tag) {
9046                 case LDKGraphSyncError_DecodeError: return 0;
9047                 case LDKGraphSyncError_LightningError: return 1;
9048                 default: abort();
9049         }
9050 }
9051 int64_t CS_LDK_LDKGraphSyncError_DecodeError_get_decode_error(int64_t ptr) {
9052         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9053         CHECK(obj->tag == LDKGraphSyncError_DecodeError);
9054         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
9055         return decode_error_ref;
9056 }
9057 int64_t CS_LDK_LDKGraphSyncError_LightningError_get_lightning_error(int64_t ptr) {
9058         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9059         CHECK(obj->tag == LDKGraphSyncError_LightningError);
9060         LDKLightningError lightning_error_var = obj->lightning_error;
9061                         int64_t lightning_error_ref = 0;
9062                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
9063                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
9064         return lightning_error_ref;
9065 }
9066 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9067 CHECK(owner->result_ok);
9068         return *owner->contents.result;
9069 }
9070 int32_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_ok(int64_t owner) {
9071         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9072         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
9073         return ret_conv;
9074 }
9075
9076 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9077 CHECK(!owner->result_ok);
9078         return GraphSyncError_clone(&*owner->contents.err);
9079 }
9080 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_err(int64_t owner) {
9081         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9082         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
9083         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
9084         int64_t ret_ref = tag_ptr(ret_copy, true);
9085         return ret_ref;
9086 }
9087
9088 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
9089 CHECK(owner->result_ok);
9090         return CVec_u8Z_clone(&*owner->contents.result);
9091 }
9092 int8_tArray  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_ok(int64_t owner) {
9093         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
9094         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
9095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9097         CVec_u8Z_free(ret_var);
9098         return ret_arr;
9099 }
9100
9101 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
9102 CHECK(!owner->result_ok);
9103         return *owner->contents.err;
9104 }
9105 int32_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_err(int64_t owner) {
9106         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
9107         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
9108         return ret_conv;
9109 }
9110
9111 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
9112 CHECK(owner->result_ok);
9113         return *owner->contents.result;
9114 }
9115 ptrArray  CS_LDK_CResult_CVec_StrZIOErrorZ_get_ok(int64_t owner) {
9116         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
9117         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
9118         ptrArray ret_arr = NULL;
9119         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9120         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
9121         for (size_t i = 0; i < ret_var.datalen; i++) {
9122                 LDKStr ret_conv_8_str = ret_var.data[i];
9123                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
9124                 ret_arr_ptr[i] = ret_conv_8_conv;
9125         }
9126         
9127         return ret_arr;
9128 }
9129
9130 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
9131 CHECK(!owner->result_ok);
9132         return *owner->contents.err;
9133 }
9134 int32_t  CS_LDK_CResult_CVec_StrZIOErrorZ_get_err(int64_t owner) {
9135         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
9136         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
9137         return ret_conv;
9138 }
9139
9140 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
9141         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
9142         for (size_t i = 0; i < ret.datalen; i++) {
9143                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
9144         }
9145         return ret;
9146 }
9147 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
9148 CHECK(owner->result_ok);
9149         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
9150 }
9151 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(int64_t owner) {
9152         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
9153         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
9154         int64_tArray ret_arr = NULL;
9155         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
9156         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
9157         for (size_t o = 0; o < ret_var.datalen; o++) {
9158                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9159                 *ret_conv_40_conv = ret_var.data[o];
9160                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
9161         }
9162         
9163         FREE(ret_var.data);
9164         return ret_arr;
9165 }
9166
9167 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
9168 CHECK(!owner->result_ok);
9169         return *owner->contents.err;
9170 }
9171 int32_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(int64_t owner) {
9172         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
9173         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
9174         return ret_conv;
9175 }
9176
9177 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
9178 CHECK(owner->result_ok);
9179         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9180 }
9181 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(int64_t owner) {
9182         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
9183         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9184         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
9185         return tag_ptr(ret_conv, true);
9186 }
9187
9188 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
9189 CHECK(!owner->result_ok);
9190         return *owner->contents.err;
9191 }
9192 int32_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(int64_t owner) {
9193         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
9194         int32_t ret_conv = LDKIOError_to_cs(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
9195         return ret_conv;
9196 }
9197
9198 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9199         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
9200         ret.is_owned = false;
9201         return ret;
9202 }
9203 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(int64_t owner) {
9204         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9205         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
9206         int64_t ret_ref = 0;
9207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9209         return ret_ref;
9210 }
9211
9212 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9213 CHECK(!owner->result_ok);
9214         return Bolt12SemanticError_clone(&*owner->contents.err);
9215 }
9216 int32_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(int64_t owner) {
9217         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9218         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
9219         return ret_conv;
9220 }
9221
9222 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9223         LDKInvoiceRequest ret = *owner->contents.result;
9224         ret.is_owned = false;
9225         return ret;
9226 }
9227 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(int64_t owner) {
9228         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9229         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
9230         int64_t ret_ref = 0;
9231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9233         return ret_ref;
9234 }
9235
9236 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9237 CHECK(!owner->result_ok);
9238         return Bolt12SemanticError_clone(&*owner->contents.err);
9239 }
9240 int32_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(int64_t owner) {
9241         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9242         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
9243         return ret_conv;
9244 }
9245
9246 uint32_t CS_LDK_LDKCOption_SecretKeyZ_ty_from_ptr(int64_t ptr) {
9247         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
9248         switch(obj->tag) {
9249                 case LDKCOption_SecretKeyZ_Some: return 0;
9250                 case LDKCOption_SecretKeyZ_None: return 1;
9251                 default: abort();
9252         }
9253 }
9254 int8_tArray CS_LDK_LDKCOption_SecretKeyZ_Some_get_some(int64_t ptr) {
9255         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
9256         CHECK(obj->tag == LDKCOption_SecretKeyZ_Some);
9257         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
9258         memcpy(some_arr->elems, obj->some.bytes, 32);
9259         return some_arr;
9260 }
9261 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9262         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
9263         ret.is_owned = false;
9264         return ret;
9265 }
9266 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
9267         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9268         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
9269         int64_t ret_ref = 0;
9270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9272         return ret_ref;
9273 }
9274
9275 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9276 CHECK(!owner->result_ok);
9277         return Bolt12SemanticError_clone(&*owner->contents.err);
9278 }
9279 int32_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
9280         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9281         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
9282         return ret_conv;
9283 }
9284
9285 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
9286         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
9287         ret.is_owned = false;
9288         return ret;
9289 }
9290 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_ok(int64_t owner) {
9291         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
9292         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
9293         int64_t ret_ref = 0;
9294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9296         return ret_ref;
9297 }
9298
9299 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
9300 CHECK(!owner->result_ok);
9301         return *owner->contents.err;
9302 }
9303 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_err(int64_t owner) {
9304         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
9305         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
9306 }
9307
9308 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9309         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
9310         ret.is_owned = false;
9311         return ret;
9312 }
9313 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
9314         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9315         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
9316         int64_t ret_ref = 0;
9317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9319         return ret_ref;
9320 }
9321
9322 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9323 CHECK(!owner->result_ok);
9324         return Bolt12SemanticError_clone(&*owner->contents.err);
9325 }
9326 int32_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
9327         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9328         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
9329         return ret_conv;
9330 }
9331
9332 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
9333         LDKInvoiceRequestFields ret = *owner->contents.result;
9334         ret.is_owned = false;
9335         return ret;
9336 }
9337 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(int64_t owner) {
9338         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
9339         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
9340         int64_t ret_ref = 0;
9341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9343         return ret_ref;
9344 }
9345
9346 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
9347 CHECK(!owner->result_ok);
9348         return DecodeError_clone(&*owner->contents.err);
9349 }
9350 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(int64_t owner) {
9351         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
9352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9353         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
9354         int64_t ret_ref = tag_ptr(ret_copy, true);
9355         return ret_ref;
9356 }
9357
9358 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
9359         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
9360         for (size_t i = 0; i < ret.datalen; i++) {
9361                 ret.data[i] = Witness_clone(&orig->data[i]);
9362         }
9363         return ret;
9364 }
9365 uint32_t CS_LDK_LDKCOption_ECDSASignatureZ_ty_from_ptr(int64_t ptr) {
9366         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
9367         switch(obj->tag) {
9368                 case LDKCOption_ECDSASignatureZ_Some: return 0;
9369                 case LDKCOption_ECDSASignatureZ_None: return 1;
9370                 default: abort();
9371         }
9372 }
9373 int8_tArray CS_LDK_LDKCOption_ECDSASignatureZ_Some_get_some(int64_t ptr) {
9374         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
9375         CHECK(obj->tag == LDKCOption_ECDSASignatureZ_Some);
9376         int8_tArray some_arr = init_int8_tArray(64, __LINE__);
9377         memcpy(some_arr->elems, obj->some.compact_form, 64);
9378         return some_arr;
9379 }
9380 uint32_t CS_LDK_LDKCOption_i64Z_ty_from_ptr(int64_t ptr) {
9381         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9382         switch(obj->tag) {
9383                 case LDKCOption_i64Z_Some: return 0;
9384                 case LDKCOption_i64Z_None: return 1;
9385                 default: abort();
9386         }
9387 }
9388 int64_t CS_LDK_LDKCOption_i64Z_Some_get_some(int64_t ptr) {
9389         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9390         CHECK(obj->tag == LDKCOption_i64Z_Some);
9391         int64_t some_conv = obj->some;
9392         return some_conv;
9393 }
9394 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
9395 CHECK(owner->result_ok);
9396         return SocketAddress_clone(&*owner->contents.result);
9397 }
9398 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_ok(int64_t owner) {
9399         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
9400         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
9401         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
9402         int64_t ret_ref = tag_ptr(ret_copy, true);
9403         return ret_ref;
9404 }
9405
9406 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
9407 CHECK(!owner->result_ok);
9408         return DecodeError_clone(&*owner->contents.err);
9409 }
9410 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_err(int64_t owner) {
9411         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
9412         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9413         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
9414         int64_t ret_ref = tag_ptr(ret_copy, true);
9415         return ret_ref;
9416 }
9417
9418 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
9419 CHECK(owner->result_ok);
9420         return SocketAddress_clone(&*owner->contents.result);
9421 }
9422 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(int64_t owner) {
9423         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
9424         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
9425         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
9426         int64_t ret_ref = tag_ptr(ret_copy, true);
9427         return ret_ref;
9428 }
9429
9430 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
9431 CHECK(!owner->result_ok);
9432         return SocketAddressParseError_clone(&*owner->contents.err);
9433 }
9434 int32_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_err(int64_t owner) {
9435         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
9436         int32_t ret_conv = LDKSocketAddressParseError_to_cs(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
9437         return ret_conv;
9438 }
9439
9440 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
9441         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
9442         for (size_t i = 0; i < ret.datalen; i++) {
9443                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
9444         }
9445         return ret;
9446 }
9447 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
9448         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
9449         for (size_t i = 0; i < ret.datalen; i++) {
9450                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
9451         }
9452         return ret;
9453 }
9454 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
9455         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
9456         for (size_t i = 0; i < ret.datalen; i++) {
9457                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
9458         }
9459         return ret;
9460 }
9461 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
9462         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
9463         for (size_t i = 0; i < ret.datalen; i++) {
9464                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
9465         }
9466         return ret;
9467 }
9468 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9469         LDKAcceptChannel ret = *owner->contents.result;
9470         ret.is_owned = false;
9471         return ret;
9472 }
9473 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_ok(int64_t owner) {
9474         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9475         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
9476         int64_t ret_ref = 0;
9477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9479         return ret_ref;
9480 }
9481
9482 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9483 CHECK(!owner->result_ok);
9484         return DecodeError_clone(&*owner->contents.err);
9485 }
9486 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_err(int64_t owner) {
9487         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9488         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9489         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
9490         int64_t ret_ref = tag_ptr(ret_copy, true);
9491         return ret_ref;
9492 }
9493
9494 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
9495         LDKAcceptChannelV2 ret = *owner->contents.result;
9496         ret.is_owned = false;
9497         return ret;
9498 }
9499 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_ok(int64_t owner) {
9500         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
9501         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
9502         int64_t ret_ref = 0;
9503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9505         return ret_ref;
9506 }
9507
9508 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
9509 CHECK(!owner->result_ok);
9510         return DecodeError_clone(&*owner->contents.err);
9511 }
9512 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_err(int64_t owner) {
9513         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
9514         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9515         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
9516         int64_t ret_ref = tag_ptr(ret_copy, true);
9517         return ret_ref;
9518 }
9519
9520 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
9521         LDKStfu ret = *owner->contents.result;
9522         ret.is_owned = false;
9523         return ret;
9524 }
9525 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_ok(int64_t owner) {
9526         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
9527         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
9528         int64_t ret_ref = 0;
9529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9531         return ret_ref;
9532 }
9533
9534 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
9535 CHECK(!owner->result_ok);
9536         return DecodeError_clone(&*owner->contents.err);
9537 }
9538 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_err(int64_t owner) {
9539         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
9540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9541         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
9542         int64_t ret_ref = tag_ptr(ret_copy, true);
9543         return ret_ref;
9544 }
9545
9546 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
9547         LDKSplice ret = *owner->contents.result;
9548         ret.is_owned = false;
9549         return ret;
9550 }
9551 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_ok(int64_t owner) {
9552         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
9553         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
9554         int64_t ret_ref = 0;
9555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9557         return ret_ref;
9558 }
9559
9560 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
9561 CHECK(!owner->result_ok);
9562         return DecodeError_clone(&*owner->contents.err);
9563 }
9564 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_err(int64_t owner) {
9565         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
9566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9567         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
9568         int64_t ret_ref = tag_ptr(ret_copy, true);
9569         return ret_ref;
9570 }
9571
9572 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
9573         LDKSpliceAck ret = *owner->contents.result;
9574         ret.is_owned = false;
9575         return ret;
9576 }
9577 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_ok(int64_t owner) {
9578         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
9579         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
9580         int64_t ret_ref = 0;
9581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9583         return ret_ref;
9584 }
9585
9586 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
9587 CHECK(!owner->result_ok);
9588         return DecodeError_clone(&*owner->contents.err);
9589 }
9590 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_err(int64_t owner) {
9591         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
9592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9593         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
9594         int64_t ret_ref = tag_ptr(ret_copy, true);
9595         return ret_ref;
9596 }
9597
9598 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
9599         LDKSpliceLocked ret = *owner->contents.result;
9600         ret.is_owned = false;
9601         return ret;
9602 }
9603 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_ok(int64_t owner) {
9604         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
9605         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
9606         int64_t ret_ref = 0;
9607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9609         return ret_ref;
9610 }
9611
9612 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
9613 CHECK(!owner->result_ok);
9614         return DecodeError_clone(&*owner->contents.err);
9615 }
9616 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_err(int64_t owner) {
9617         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
9618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9619         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
9620         int64_t ret_ref = tag_ptr(ret_copy, true);
9621         return ret_ref;
9622 }
9623
9624 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9625         LDKTxAddInput ret = *owner->contents.result;
9626         ret.is_owned = false;
9627         return ret;
9628 }
9629 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_ok(int64_t owner) {
9630         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9631         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
9632         int64_t ret_ref = 0;
9633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9635         return ret_ref;
9636 }
9637
9638 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9639 CHECK(!owner->result_ok);
9640         return DecodeError_clone(&*owner->contents.err);
9641 }
9642 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_err(int64_t owner) {
9643         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9645         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
9646         int64_t ret_ref = tag_ptr(ret_copy, true);
9647         return ret_ref;
9648 }
9649
9650 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9651         LDKTxAddOutput ret = *owner->contents.result;
9652         ret.is_owned = false;
9653         return ret;
9654 }
9655 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_ok(int64_t owner) {
9656         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9657         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
9658         int64_t ret_ref = 0;
9659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9661         return ret_ref;
9662 }
9663
9664 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9665 CHECK(!owner->result_ok);
9666         return DecodeError_clone(&*owner->contents.err);
9667 }
9668 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_err(int64_t owner) {
9669         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9670         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9671         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9672         int64_t ret_ref = tag_ptr(ret_copy, true);
9673         return ret_ref;
9674 }
9675
9676 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9677         LDKTxRemoveInput ret = *owner->contents.result;
9678         ret.is_owned = false;
9679         return ret;
9680 }
9681 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_ok(int64_t owner) {
9682         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9683         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
9684         int64_t ret_ref = 0;
9685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9687         return ret_ref;
9688 }
9689
9690 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9691 CHECK(!owner->result_ok);
9692         return DecodeError_clone(&*owner->contents.err);
9693 }
9694 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_err(int64_t owner) {
9695         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9696         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9697         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9698         int64_t ret_ref = tag_ptr(ret_copy, true);
9699         return ret_ref;
9700 }
9701
9702 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9703         LDKTxRemoveOutput ret = *owner->contents.result;
9704         ret.is_owned = false;
9705         return ret;
9706 }
9707 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_ok(int64_t owner) {
9708         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9709         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9710         int64_t ret_ref = 0;
9711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9713         return ret_ref;
9714 }
9715
9716 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9717 CHECK(!owner->result_ok);
9718         return DecodeError_clone(&*owner->contents.err);
9719 }
9720 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_err(int64_t owner) {
9721         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9722         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9723         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9724         int64_t ret_ref = tag_ptr(ret_copy, true);
9725         return ret_ref;
9726 }
9727
9728 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9729         LDKTxComplete ret = *owner->contents.result;
9730         ret.is_owned = false;
9731         return ret;
9732 }
9733 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_ok(int64_t owner) {
9734         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9735         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9736         int64_t ret_ref = 0;
9737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9739         return ret_ref;
9740 }
9741
9742 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9743 CHECK(!owner->result_ok);
9744         return DecodeError_clone(&*owner->contents.err);
9745 }
9746 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_err(int64_t owner) {
9747         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9748         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9749         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9750         int64_t ret_ref = tag_ptr(ret_copy, true);
9751         return ret_ref;
9752 }
9753
9754 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9755         LDKTxSignatures ret = *owner->contents.result;
9756         ret.is_owned = false;
9757         return ret;
9758 }
9759 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9760         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9761         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9762         int64_t ret_ref = 0;
9763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9765         return ret_ref;
9766 }
9767
9768 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9769 CHECK(!owner->result_ok);
9770         return DecodeError_clone(&*owner->contents.err);
9771 }
9772 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_err(int64_t owner) {
9773         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9775         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9776         int64_t ret_ref = tag_ptr(ret_copy, true);
9777         return ret_ref;
9778 }
9779
9780 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9781         LDKTxInitRbf ret = *owner->contents.result;
9782         ret.is_owned = false;
9783         return ret;
9784 }
9785 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_ok(int64_t owner) {
9786         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9787         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9788         int64_t ret_ref = 0;
9789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9791         return ret_ref;
9792 }
9793
9794 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9795 CHECK(!owner->result_ok);
9796         return DecodeError_clone(&*owner->contents.err);
9797 }
9798 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_err(int64_t owner) {
9799         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9801         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9802         int64_t ret_ref = tag_ptr(ret_copy, true);
9803         return ret_ref;
9804 }
9805
9806 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9807         LDKTxAckRbf ret = *owner->contents.result;
9808         ret.is_owned = false;
9809         return ret;
9810 }
9811 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_ok(int64_t owner) {
9812         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9813         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9814         int64_t ret_ref = 0;
9815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9817         return ret_ref;
9818 }
9819
9820 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9821 CHECK(!owner->result_ok);
9822         return DecodeError_clone(&*owner->contents.err);
9823 }
9824 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_err(int64_t owner) {
9825         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9827         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9828         int64_t ret_ref = tag_ptr(ret_copy, true);
9829         return ret_ref;
9830 }
9831
9832 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9833         LDKTxAbort ret = *owner->contents.result;
9834         ret.is_owned = false;
9835         return ret;
9836 }
9837 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_ok(int64_t owner) {
9838         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9839         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9840         int64_t ret_ref = 0;
9841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9843         return ret_ref;
9844 }
9845
9846 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9847 CHECK(!owner->result_ok);
9848         return DecodeError_clone(&*owner->contents.err);
9849 }
9850 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_err(int64_t owner) {
9851         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9852         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9853         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9854         int64_t ret_ref = tag_ptr(ret_copy, true);
9855         return ret_ref;
9856 }
9857
9858 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9859         LDKAnnouncementSignatures ret = *owner->contents.result;
9860         ret.is_owned = false;
9861         return ret;
9862 }
9863 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9864         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9865         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9866         int64_t ret_ref = 0;
9867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9869         return ret_ref;
9870 }
9871
9872 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9873 CHECK(!owner->result_ok);
9874         return DecodeError_clone(&*owner->contents.err);
9875 }
9876 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(int64_t owner) {
9877         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9879         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9880         int64_t ret_ref = tag_ptr(ret_copy, true);
9881         return ret_ref;
9882 }
9883
9884 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9885         LDKChannelReestablish ret = *owner->contents.result;
9886         ret.is_owned = false;
9887         return ret;
9888 }
9889 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_ok(int64_t owner) {
9890         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9891         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9892         int64_t ret_ref = 0;
9893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9895         return ret_ref;
9896 }
9897
9898 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9899 CHECK(!owner->result_ok);
9900         return DecodeError_clone(&*owner->contents.err);
9901 }
9902 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_err(int64_t owner) {
9903         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9905         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9906         int64_t ret_ref = tag_ptr(ret_copy, true);
9907         return ret_ref;
9908 }
9909
9910 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9911         LDKClosingSigned ret = *owner->contents.result;
9912         ret.is_owned = false;
9913         return ret;
9914 }
9915 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_ok(int64_t owner) {
9916         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9917         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9918         int64_t ret_ref = 0;
9919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9921         return ret_ref;
9922 }
9923
9924 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9925 CHECK(!owner->result_ok);
9926         return DecodeError_clone(&*owner->contents.err);
9927 }
9928 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_err(int64_t owner) {
9929         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9931         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9932         int64_t ret_ref = tag_ptr(ret_copy, true);
9933         return ret_ref;
9934 }
9935
9936 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9937         LDKClosingSignedFeeRange ret = *owner->contents.result;
9938         ret.is_owned = false;
9939         return ret;
9940 }
9941 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(int64_t owner) {
9942         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9943         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9944         int64_t ret_ref = 0;
9945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9947         return ret_ref;
9948 }
9949
9950 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9951 CHECK(!owner->result_ok);
9952         return DecodeError_clone(&*owner->contents.err);
9953 }
9954 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(int64_t owner) {
9955         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9957         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9958         int64_t ret_ref = tag_ptr(ret_copy, true);
9959         return ret_ref;
9960 }
9961
9962 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9963         LDKCommitmentSigned ret = *owner->contents.result;
9964         ret.is_owned = false;
9965         return ret;
9966 }
9967 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_ok(int64_t owner) {
9968         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9969         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9970         int64_t ret_ref = 0;
9971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9973         return ret_ref;
9974 }
9975
9976 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9977 CHECK(!owner->result_ok);
9978         return DecodeError_clone(&*owner->contents.err);
9979 }
9980 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_err(int64_t owner) {
9981         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9983         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9984         int64_t ret_ref = tag_ptr(ret_copy, true);
9985         return ret_ref;
9986 }
9987
9988 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9989         LDKFundingCreated ret = *owner->contents.result;
9990         ret.is_owned = false;
9991         return ret;
9992 }
9993 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_ok(int64_t owner) {
9994         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9995         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9996         int64_t ret_ref = 0;
9997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9999         return ret_ref;
10000 }
10001
10002 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10003 CHECK(!owner->result_ok);
10004         return DecodeError_clone(&*owner->contents.err);
10005 }
10006 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_err(int64_t owner) {
10007         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10008         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10009         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10010         int64_t ret_ref = tag_ptr(ret_copy, true);
10011         return ret_ref;
10012 }
10013
10014 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10015         LDKFundingSigned ret = *owner->contents.result;
10016         ret.is_owned = false;
10017         return ret;
10018 }
10019 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_ok(int64_t owner) {
10020         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10021         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10022         int64_t ret_ref = 0;
10023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10025         return ret_ref;
10026 }
10027
10028 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10029 CHECK(!owner->result_ok);
10030         return DecodeError_clone(&*owner->contents.err);
10031 }
10032 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_err(int64_t owner) {
10033         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10034         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10035         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10036         int64_t ret_ref = tag_ptr(ret_copy, true);
10037         return ret_ref;
10038 }
10039
10040 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10041         LDKChannelReady ret = *owner->contents.result;
10042         ret.is_owned = false;
10043         return ret;
10044 }
10045 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_ok(int64_t owner) {
10046         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10047         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10048         int64_t ret_ref = 0;
10049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10051         return ret_ref;
10052 }
10053
10054 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10055 CHECK(!owner->result_ok);
10056         return DecodeError_clone(&*owner->contents.err);
10057 }
10058 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_err(int64_t owner) {
10059         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10061         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10062         int64_t ret_ref = tag_ptr(ret_copy, true);
10063         return ret_ref;
10064 }
10065
10066 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10067         LDKInit ret = *owner->contents.result;
10068         ret.is_owned = false;
10069         return ret;
10070 }
10071 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_ok(int64_t owner) {
10072         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10073         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10074         int64_t ret_ref = 0;
10075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10077         return ret_ref;
10078 }
10079
10080 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10081 CHECK(!owner->result_ok);
10082         return DecodeError_clone(&*owner->contents.err);
10083 }
10084 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_err(int64_t owner) {
10085         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10086         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10087         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10088         int64_t ret_ref = tag_ptr(ret_copy, true);
10089         return ret_ref;
10090 }
10091
10092 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10093         LDKOpenChannel ret = *owner->contents.result;
10094         ret.is_owned = false;
10095         return ret;
10096 }
10097 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_ok(int64_t owner) {
10098         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10099         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
10100         int64_t ret_ref = 0;
10101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10103         return ret_ref;
10104 }
10105
10106 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10107 CHECK(!owner->result_ok);
10108         return DecodeError_clone(&*owner->contents.err);
10109 }
10110 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_err(int64_t owner) {
10111         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10113         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
10114         int64_t ret_ref = tag_ptr(ret_copy, true);
10115         return ret_ref;
10116 }
10117
10118 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10119         LDKOpenChannelV2 ret = *owner->contents.result;
10120         ret.is_owned = false;
10121         return ret;
10122 }
10123 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_ok(int64_t owner) {
10124         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10125         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
10126         int64_t ret_ref = 0;
10127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10129         return ret_ref;
10130 }
10131
10132 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10133 CHECK(!owner->result_ok);
10134         return DecodeError_clone(&*owner->contents.err);
10135 }
10136 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_err(int64_t owner) {
10137         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10139         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
10140         int64_t ret_ref = tag_ptr(ret_copy, true);
10141         return ret_ref;
10142 }
10143
10144 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10145         LDKRevokeAndACK ret = *owner->contents.result;
10146         ret.is_owned = false;
10147         return ret;
10148 }
10149 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_ok(int64_t owner) {
10150         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10151         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
10152         int64_t ret_ref = 0;
10153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10155         return ret_ref;
10156 }
10157
10158 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10159 CHECK(!owner->result_ok);
10160         return DecodeError_clone(&*owner->contents.err);
10161 }
10162 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_err(int64_t owner) {
10163         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10165         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
10166         int64_t ret_ref = tag_ptr(ret_copy, true);
10167         return ret_ref;
10168 }
10169
10170 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10171         LDKShutdown ret = *owner->contents.result;
10172         ret.is_owned = false;
10173         return ret;
10174 }
10175 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_ok(int64_t owner) {
10176         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10177         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
10178         int64_t ret_ref = 0;
10179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10181         return ret_ref;
10182 }
10183
10184 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10185 CHECK(!owner->result_ok);
10186         return DecodeError_clone(&*owner->contents.err);
10187 }
10188 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_err(int64_t owner) {
10189         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10191         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
10192         int64_t ret_ref = tag_ptr(ret_copy, true);
10193         return ret_ref;
10194 }
10195
10196 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10197         LDKUpdateFailHTLC ret = *owner->contents.result;
10198         ret.is_owned = false;
10199         return ret;
10200 }
10201 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(int64_t owner) {
10202         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10203         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
10204         int64_t ret_ref = 0;
10205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10207         return ret_ref;
10208 }
10209
10210 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10211 CHECK(!owner->result_ok);
10212         return DecodeError_clone(&*owner->contents.err);
10213 }
10214 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_err(int64_t owner) {
10215         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10217         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
10218         int64_t ret_ref = tag_ptr(ret_copy, true);
10219         return ret_ref;
10220 }
10221
10222 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10223         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
10224         ret.is_owned = false;
10225         return ret;
10226 }
10227 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(int64_t owner) {
10228         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10229         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
10230         int64_t ret_ref = 0;
10231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10233         return ret_ref;
10234 }
10235
10236 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10237 CHECK(!owner->result_ok);
10238         return DecodeError_clone(&*owner->contents.err);
10239 }
10240 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(int64_t owner) {
10241         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10243         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
10244         int64_t ret_ref = tag_ptr(ret_copy, true);
10245         return ret_ref;
10246 }
10247
10248 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10249         LDKUpdateFee ret = *owner->contents.result;
10250         ret.is_owned = false;
10251         return ret;
10252 }
10253 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_ok(int64_t owner) {
10254         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10255         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
10256         int64_t ret_ref = 0;
10257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10259         return ret_ref;
10260 }
10261
10262 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10263 CHECK(!owner->result_ok);
10264         return DecodeError_clone(&*owner->contents.err);
10265 }
10266 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_err(int64_t owner) {
10267         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10268         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10269         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
10270         int64_t ret_ref = tag_ptr(ret_copy, true);
10271         return ret_ref;
10272 }
10273
10274 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10275         LDKUpdateFulfillHTLC ret = *owner->contents.result;
10276         ret.is_owned = false;
10277         return ret;
10278 }
10279 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(int64_t owner) {
10280         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10281         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
10282         int64_t ret_ref = 0;
10283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10285         return ret_ref;
10286 }
10287
10288 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10289 CHECK(!owner->result_ok);
10290         return DecodeError_clone(&*owner->contents.err);
10291 }
10292 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(int64_t owner) {
10293         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10295         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
10296         int64_t ret_ref = tag_ptr(ret_copy, true);
10297         return ret_ref;
10298 }
10299
10300 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
10301         LDKOnionPacket ret = *owner->contents.result;
10302         ret.is_owned = false;
10303         return ret;
10304 }
10305 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_ok(int64_t owner) {
10306         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
10307         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
10308         int64_t ret_ref = 0;
10309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10311         return ret_ref;
10312 }
10313
10314 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
10315 CHECK(!owner->result_ok);
10316         return DecodeError_clone(&*owner->contents.err);
10317 }
10318 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_err(int64_t owner) {
10319         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
10320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10321         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
10322         int64_t ret_ref = tag_ptr(ret_copy, true);
10323         return ret_ref;
10324 }
10325
10326 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10327         LDKUpdateAddHTLC ret = *owner->contents.result;
10328         ret.is_owned = false;
10329         return ret;
10330 }
10331 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(int64_t owner) {
10332         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10333         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
10334         int64_t ret_ref = 0;
10335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10337         return ret_ref;
10338 }
10339
10340 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10341 CHECK(!owner->result_ok);
10342         return DecodeError_clone(&*owner->contents.err);
10343 }
10344 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_err(int64_t owner) {
10345         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10347         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
10348         int64_t ret_ref = tag_ptr(ret_copy, true);
10349         return ret_ref;
10350 }
10351
10352 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10353         LDKOnionMessage ret = *owner->contents.result;
10354         ret.is_owned = false;
10355         return ret;
10356 }
10357 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_ok(int64_t owner) {
10358         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10359         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
10360         int64_t ret_ref = 0;
10361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10363         return ret_ref;
10364 }
10365
10366 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10367 CHECK(!owner->result_ok);
10368         return DecodeError_clone(&*owner->contents.err);
10369 }
10370 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_err(int64_t owner) {
10371         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10373         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
10374         int64_t ret_ref = tag_ptr(ret_copy, true);
10375         return ret_ref;
10376 }
10377
10378 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
10379         LDKFinalOnionHopData ret = *owner->contents.result;
10380         ret.is_owned = false;
10381         return ret;
10382 }
10383 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(int64_t owner) {
10384         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
10385         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
10386         int64_t ret_ref = 0;
10387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10389         return ret_ref;
10390 }
10391
10392 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
10393 CHECK(!owner->result_ok);
10394         return DecodeError_clone(&*owner->contents.err);
10395 }
10396 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_err(int64_t owner) {
10397         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
10398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10399         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
10400         int64_t ret_ref = tag_ptr(ret_copy, true);
10401         return ret_ref;
10402 }
10403
10404 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10405         LDKPing ret = *owner->contents.result;
10406         ret.is_owned = false;
10407         return ret;
10408 }
10409 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_ok(int64_t owner) {
10410         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10411         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
10412         int64_t ret_ref = 0;
10413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10415         return ret_ref;
10416 }
10417
10418 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10419 CHECK(!owner->result_ok);
10420         return DecodeError_clone(&*owner->contents.err);
10421 }
10422 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_err(int64_t owner) {
10423         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10425         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
10426         int64_t ret_ref = tag_ptr(ret_copy, true);
10427         return ret_ref;
10428 }
10429
10430 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10431         LDKPong ret = *owner->contents.result;
10432         ret.is_owned = false;
10433         return ret;
10434 }
10435 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_ok(int64_t owner) {
10436         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10437         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
10438         int64_t ret_ref = 0;
10439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10441         return ret_ref;
10442 }
10443
10444 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10445 CHECK(!owner->result_ok);
10446         return DecodeError_clone(&*owner->contents.err);
10447 }
10448 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_err(int64_t owner) {
10449         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10450         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10451         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
10452         int64_t ret_ref = tag_ptr(ret_copy, true);
10453         return ret_ref;
10454 }
10455
10456 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10457         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
10458         ret.is_owned = false;
10459         return ret;
10460 }
10461 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10462         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10463         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10464         int64_t ret_ref = 0;
10465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10467         return ret_ref;
10468 }
10469
10470 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10471 CHECK(!owner->result_ok);
10472         return DecodeError_clone(&*owner->contents.err);
10473 }
10474 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10475         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10476         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10477         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10478         int64_t ret_ref = tag_ptr(ret_copy, true);
10479         return ret_ref;
10480 }
10481
10482 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10483         LDKChannelAnnouncement ret = *owner->contents.result;
10484         ret.is_owned = false;
10485         return ret;
10486 }
10487 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10488         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10489         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10490         int64_t ret_ref = 0;
10491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10493         return ret_ref;
10494 }
10495
10496 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10497 CHECK(!owner->result_ok);
10498         return DecodeError_clone(&*owner->contents.err);
10499 }
10500 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10501         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10502         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10503         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10504         int64_t ret_ref = tag_ptr(ret_copy, true);
10505         return ret_ref;
10506 }
10507
10508 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10509         LDKUnsignedChannelUpdate ret = *owner->contents.result;
10510         ret.is_owned = false;
10511         return ret;
10512 }
10513 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
10514         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10515         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10516         int64_t ret_ref = 0;
10517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10519         return ret_ref;
10520 }
10521
10522 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10523 CHECK(!owner->result_ok);
10524         return DecodeError_clone(&*owner->contents.err);
10525 }
10526 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
10527         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10529         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
10530         int64_t ret_ref = tag_ptr(ret_copy, true);
10531         return ret_ref;
10532 }
10533
10534 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10535         LDKChannelUpdate ret = *owner->contents.result;
10536         ret.is_owned = false;
10537         return ret;
10538 }
10539 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
10540         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10541         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10542         int64_t ret_ref = 0;
10543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10545         return ret_ref;
10546 }
10547
10548 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10549 CHECK(!owner->result_ok);
10550         return DecodeError_clone(&*owner->contents.err);
10551 }
10552 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
10553         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10555         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
10556         int64_t ret_ref = tag_ptr(ret_copy, true);
10557         return ret_ref;
10558 }
10559
10560 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10561         LDKErrorMessage ret = *owner->contents.result;
10562         ret.is_owned = false;
10563         return ret;
10564 }
10565 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_ok(int64_t owner) {
10566         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10567         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
10568         int64_t ret_ref = 0;
10569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10571         return ret_ref;
10572 }
10573
10574 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10575 CHECK(!owner->result_ok);
10576         return DecodeError_clone(&*owner->contents.err);
10577 }
10578 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_err(int64_t owner) {
10579         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10581         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
10582         int64_t ret_ref = tag_ptr(ret_copy, true);
10583         return ret_ref;
10584 }
10585
10586 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10587         LDKWarningMessage ret = *owner->contents.result;
10588         ret.is_owned = false;
10589         return ret;
10590 }
10591 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_ok(int64_t owner) {
10592         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10593         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
10594         int64_t ret_ref = 0;
10595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10597         return ret_ref;
10598 }
10599
10600 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10601 CHECK(!owner->result_ok);
10602         return DecodeError_clone(&*owner->contents.err);
10603 }
10604 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_err(int64_t owner) {
10605         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10607         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
10608         int64_t ret_ref = tag_ptr(ret_copy, true);
10609         return ret_ref;
10610 }
10611
10612 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10613         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
10614         ret.is_owned = false;
10615         return ret;
10616 }
10617 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10618         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10619         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10620         int64_t ret_ref = 0;
10621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10623         return ret_ref;
10624 }
10625
10626 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10627 CHECK(!owner->result_ok);
10628         return DecodeError_clone(&*owner->contents.err);
10629 }
10630 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10631         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10633         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10634         int64_t ret_ref = tag_ptr(ret_copy, true);
10635         return ret_ref;
10636 }
10637
10638 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10639         LDKNodeAnnouncement ret = *owner->contents.result;
10640         ret.is_owned = false;
10641         return ret;
10642 }
10643 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10644         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10645         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10646         int64_t ret_ref = 0;
10647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10649         return ret_ref;
10650 }
10651
10652 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10653 CHECK(!owner->result_ok);
10654         return DecodeError_clone(&*owner->contents.err);
10655 }
10656 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10657         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10659         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10660         int64_t ret_ref = tag_ptr(ret_copy, true);
10661         return ret_ref;
10662 }
10663
10664 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10665         LDKQueryShortChannelIds ret = *owner->contents.result;
10666         ret.is_owned = false;
10667         return ret;
10668 }
10669 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(int64_t owner) {
10670         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10671         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10672         int64_t ret_ref = 0;
10673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10675         return ret_ref;
10676 }
10677
10678 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10679 CHECK(!owner->result_ok);
10680         return DecodeError_clone(&*owner->contents.err);
10681 }
10682 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(int64_t owner) {
10683         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10685         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10686         int64_t ret_ref = tag_ptr(ret_copy, true);
10687         return ret_ref;
10688 }
10689
10690 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10691         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10692         ret.is_owned = false;
10693         return ret;
10694 }
10695 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(int64_t owner) {
10696         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10697         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10698         int64_t ret_ref = 0;
10699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10701         return ret_ref;
10702 }
10703
10704 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10705 CHECK(!owner->result_ok);
10706         return DecodeError_clone(&*owner->contents.err);
10707 }
10708 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(int64_t owner) {
10709         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10711         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10712         int64_t ret_ref = tag_ptr(ret_copy, true);
10713         return ret_ref;
10714 }
10715
10716 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10717         LDKQueryChannelRange ret = *owner->contents.result;
10718         ret.is_owned = false;
10719         return ret;
10720 }
10721 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10722         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10723         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10724         int64_t ret_ref = 0;
10725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10727         return ret_ref;
10728 }
10729
10730 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10731 CHECK(!owner->result_ok);
10732         return DecodeError_clone(&*owner->contents.err);
10733 }
10734 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10735         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10737         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10738         int64_t ret_ref = tag_ptr(ret_copy, true);
10739         return ret_ref;
10740 }
10741
10742 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10743         LDKReplyChannelRange ret = *owner->contents.result;
10744         ret.is_owned = false;
10745         return ret;
10746 }
10747 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10748         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10749         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10750         int64_t ret_ref = 0;
10751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10753         return ret_ref;
10754 }
10755
10756 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10757 CHECK(!owner->result_ok);
10758         return DecodeError_clone(&*owner->contents.err);
10759 }
10760 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10761         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10762         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10763         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10764         int64_t ret_ref = tag_ptr(ret_copy, true);
10765         return ret_ref;
10766 }
10767
10768 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10769         LDKGossipTimestampFilter ret = *owner->contents.result;
10770         ret.is_owned = false;
10771         return ret;
10772 }
10773 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(int64_t owner) {
10774         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10775         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10776         int64_t ret_ref = 0;
10777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10779         return ret_ref;
10780 }
10781
10782 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10783 CHECK(!owner->result_ok);
10784         return DecodeError_clone(&*owner->contents.err);
10785 }
10786 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_err(int64_t owner) {
10787         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10788         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10789         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10790         int64_t ret_ref = tag_ptr(ret_copy, true);
10791         return ret_ref;
10792 }
10793
10794 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10795         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10796         for (size_t i = 0; i < ret.datalen; i++) {
10797                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10798         }
10799         return ret;
10800 }
10801 uint32_t CS_LDK_LDKSignOrCreationError_ty_from_ptr(int64_t ptr) {
10802         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10803         switch(obj->tag) {
10804                 case LDKSignOrCreationError_SignError: return 0;
10805                 case LDKSignOrCreationError_CreationError: return 1;
10806                 default: abort();
10807         }
10808 }
10809 int32_t CS_LDK_LDKSignOrCreationError_CreationError_get_creation_error(int64_t ptr) {
10810         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10811         CHECK(obj->tag == LDKSignOrCreationError_CreationError);
10812         int32_t creation_error_conv = LDKCreationError_to_cs(obj->creation_error);
10813         return creation_error_conv;
10814 }
10815 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10816         LDKBolt11Invoice ret = *owner->contents.result;
10817         ret.is_owned = false;
10818         return ret;
10819 }
10820 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(int64_t owner) {
10821         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10822         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10823         int64_t ret_ref = 0;
10824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10826         return ret_ref;
10827 }
10828
10829 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10830 CHECK(!owner->result_ok);
10831         return SignOrCreationError_clone(&*owner->contents.err);
10832 }
10833 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(int64_t owner) {
10834         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10835         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10836         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10837         int64_t ret_ref = tag_ptr(ret_copy, true);
10838         return ret_ref;
10839 }
10840
10841 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10842 CHECK(owner->result_ok);
10843         return OffersMessage_clone(&*owner->contents.result);
10844 }
10845 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_ok(int64_t owner) {
10846         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10847         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10848         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10849         int64_t ret_ref = tag_ptr(ret_copy, true);
10850         return ret_ref;
10851 }
10852
10853 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10854 CHECK(!owner->result_ok);
10855         return DecodeError_clone(&*owner->contents.err);
10856 }
10857 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_err(int64_t owner) {
10858         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10860         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10861         int64_t ret_ref = tag_ptr(ret_copy, true);
10862         return ret_ref;
10863 }
10864
10865 uint32_t CS_LDK_LDKCOption_HTLCClaimZ_ty_from_ptr(int64_t ptr) {
10866         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10867         switch(obj->tag) {
10868                 case LDKCOption_HTLCClaimZ_Some: return 0;
10869                 case LDKCOption_HTLCClaimZ_None: return 1;
10870                 default: abort();
10871         }
10872 }
10873 int32_t CS_LDK_LDKCOption_HTLCClaimZ_Some_get_some(int64_t ptr) {
10874         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10875         CHECK(obj->tag == LDKCOption_HTLCClaimZ_Some);
10876         int32_t some_conv = LDKHTLCClaim_to_cs(obj->some);
10877         return some_conv;
10878 }
10879 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10880         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10881         ret.is_owned = false;
10882         return ret;
10883 }
10884 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(int64_t owner) {
10885         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10886         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10887         int64_t ret_ref = 0;
10888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10890         return ret_ref;
10891 }
10892
10893 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10894 CHECK(!owner->result_ok);
10895         return DecodeError_clone(&*owner->contents.err);
10896 }
10897 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(int64_t owner) {
10898         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10900         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10901         int64_t ret_ref = tag_ptr(ret_copy, true);
10902         return ret_ref;
10903 }
10904
10905 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10906         LDKTxCreationKeys ret = *owner->contents.result;
10907         ret.is_owned = false;
10908         return ret;
10909 }
10910 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_ok(int64_t owner) {
10911         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10912         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10913         int64_t ret_ref = 0;
10914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10916         return ret_ref;
10917 }
10918
10919 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10920 CHECK(!owner->result_ok);
10921         return DecodeError_clone(&*owner->contents.err);
10922 }
10923 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_err(int64_t owner) {
10924         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10925         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10926         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10927         int64_t ret_ref = tag_ptr(ret_copy, true);
10928         return ret_ref;
10929 }
10930
10931 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10932         LDKChannelPublicKeys ret = *owner->contents.result;
10933         ret.is_owned = false;
10934         return ret;
10935 }
10936 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(int64_t owner) {
10937         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10938         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10939         int64_t ret_ref = 0;
10940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10942         return ret_ref;
10943 }
10944
10945 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10946 CHECK(!owner->result_ok);
10947         return DecodeError_clone(&*owner->contents.err);
10948 }
10949 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_err(int64_t owner) {
10950         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10951         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10952         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10953         int64_t ret_ref = tag_ptr(ret_copy, true);
10954         return ret_ref;
10955 }
10956
10957 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10958         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10959         ret.is_owned = false;
10960         return ret;
10961 }
10962 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(int64_t owner) {
10963         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10964         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10965         int64_t ret_ref = 0;
10966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10968         return ret_ref;
10969 }
10970
10971 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10972 CHECK(!owner->result_ok);
10973         return DecodeError_clone(&*owner->contents.err);
10974 }
10975 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(int64_t owner) {
10976         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10977         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10978         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10979         int64_t ret_ref = tag_ptr(ret_copy, true);
10980         return ret_ref;
10981 }
10982
10983 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10984         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10985         ret.is_owned = false;
10986         return ret;
10987 }
10988 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
10989         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10990         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10991         int64_t ret_ref = 0;
10992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10994         return ret_ref;
10995 }
10996
10997 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10998 CHECK(!owner->result_ok);
10999         return DecodeError_clone(&*owner->contents.err);
11000 }
11001 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
11002         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11004         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11005         int64_t ret_ref = tag_ptr(ret_copy, true);
11006         return ret_ref;
11007 }
11008
11009 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11010         LDKChannelTransactionParameters ret = *owner->contents.result;
11011         ret.is_owned = false;
11012         return ret;
11013 }
11014 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
11015         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11016         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11017         int64_t ret_ref = 0;
11018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11020         return ret_ref;
11021 }
11022
11023 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11024 CHECK(!owner->result_ok);
11025         return DecodeError_clone(&*owner->contents.err);
11026 }
11027 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
11028         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11030         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11031         int64_t ret_ref = tag_ptr(ret_copy, true);
11032         return ret_ref;
11033 }
11034
11035 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11036         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11037         ret.is_owned = false;
11038         return ret;
11039 }
11040 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11041         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11042         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11043         int64_t ret_ref = 0;
11044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11046         return ret_ref;
11047 }
11048
11049 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11050 CHECK(!owner->result_ok);
11051         return DecodeError_clone(&*owner->contents.err);
11052 }
11053 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11054         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11056         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11057         int64_t ret_ref = tag_ptr(ret_copy, true);
11058         return ret_ref;
11059 }
11060
11061 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11062         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11063         ret.is_owned = false;
11064         return ret;
11065 }
11066 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11067         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11068         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11069         int64_t ret_ref = 0;
11070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11072         return ret_ref;
11073 }
11074
11075 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11076 CHECK(!owner->result_ok);
11077         return DecodeError_clone(&*owner->contents.err);
11078 }
11079 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11080         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11082         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11083         int64_t ret_ref = tag_ptr(ret_copy, true);
11084         return ret_ref;
11085 }
11086
11087 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11088         LDKTrustedClosingTransaction ret = *owner->contents.result;
11089         ret.is_owned = false;
11090         return ret;
11091 }
11092 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_ok(int64_t owner) {
11093         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11094         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11095         int64_t ret_ref = 0;
11096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11098         return ret_ref;
11099 }
11100
11101 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11102 CHECK(!owner->result_ok);
11103         return *owner->contents.err;
11104 }
11105 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_err(int64_t owner) {
11106         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11107         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
11108 }
11109
11110 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11111         LDKCommitmentTransaction ret = *owner->contents.result;
11112         ret.is_owned = false;
11113         return ret;
11114 }
11115 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11116         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11117         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11118         int64_t ret_ref = 0;
11119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11121         return ret_ref;
11122 }
11123
11124 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11125 CHECK(!owner->result_ok);
11126         return DecodeError_clone(&*owner->contents.err);
11127 }
11128 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11129         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11130         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11131         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11132         int64_t ret_ref = tag_ptr(ret_copy, true);
11133         return ret_ref;
11134 }
11135
11136 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11137         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
11138         ret.is_owned = false;
11139         return ret;
11140 }
11141 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_ok(int64_t owner) {
11142         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11143         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
11144         int64_t ret_ref = 0;
11145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11147         return ret_ref;
11148 }
11149
11150 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11151 CHECK(!owner->result_ok);
11152         return *owner->contents.err;
11153 }
11154 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_err(int64_t owner) {
11155         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11156         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
11157 }
11158
11159 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
11160 CHECK(owner->result_ok);
11161         return *owner->contents.result;
11162 }
11163 ptrArray  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_ok(int64_t owner) {
11164         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
11165         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
11166         ptrArray ret_arr = NULL;
11167         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
11168         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
11169         for (size_t i = 0; i < ret_var.datalen; i++) {
11170                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
11171                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
11172                 ret_arr_ptr[i] = ret_conv_8_arr;
11173         }
11174         
11175         return ret_arr;
11176 }
11177
11178 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
11179 CHECK(!owner->result_ok);
11180         return *owner->contents.err;
11181 }
11182 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_err(int64_t owner) {
11183         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
11184         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
11185 }
11186
11187 uint32_t CS_LDK_LDKCOption_usizeZ_ty_from_ptr(int64_t ptr) {
11188         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
11189         switch(obj->tag) {
11190                 case LDKCOption_usizeZ_Some: return 0;
11191                 case LDKCOption_usizeZ_None: return 1;
11192                 default: abort();
11193         }
11194 }
11195 int64_t CS_LDK_LDKCOption_usizeZ_Some_get_some(int64_t ptr) {
11196         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
11197         CHECK(obj->tag == LDKCOption_usizeZ_Some);
11198         int64_t some_conv = obj->some;
11199         return some_conv;
11200 }
11201 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11202         LDKShutdownScript ret = *owner->contents.result;
11203         ret.is_owned = false;
11204         return ret;
11205 }
11206 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_ok(int64_t owner) {
11207         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11208         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
11209         int64_t ret_ref = 0;
11210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11212         return ret_ref;
11213 }
11214
11215 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11216 CHECK(!owner->result_ok);
11217         return DecodeError_clone(&*owner->contents.err);
11218 }
11219 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_err(int64_t owner) {
11220         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11222         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
11223         int64_t ret_ref = tag_ptr(ret_copy, true);
11224         return ret_ref;
11225 }
11226
11227 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11228         LDKShutdownScript ret = *owner->contents.result;
11229         ret.is_owned = false;
11230         return ret;
11231 }
11232 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(int64_t owner) {
11233         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11234         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
11235         int64_t ret_ref = 0;
11236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11238         return ret_ref;
11239 }
11240
11241 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11242         LDKInvalidShutdownScript ret = *owner->contents.err;
11243         ret.is_owned = false;
11244         return ret;
11245 }
11246 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(int64_t owner) {
11247         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11248         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
11249         int64_t ret_ref = 0;
11250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11252         return ret_ref;
11253 }
11254
11255 uint32_t CS_LDK_LDKPaymentPurpose_ty_from_ptr(int64_t ptr) {
11256         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11257         switch(obj->tag) {
11258                 case LDKPaymentPurpose_Bolt11InvoicePayment: return 0;
11259                 case LDKPaymentPurpose_Bolt12OfferPayment: return 1;
11260                 case LDKPaymentPurpose_Bolt12RefundPayment: return 2;
11261                 case LDKPaymentPurpose_SpontaneousPayment: return 3;
11262                 default: abort();
11263         }
11264 }
11265 int64_t CS_LDK_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage(int64_t ptr) {
11266         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11267         CHECK(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
11268         int64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
11269         return payment_preimage_ref;
11270 }
11271 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret(int64_t ptr) {
11272         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11273         CHECK(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
11274         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11275         memcpy(payment_secret_arr->elems, obj->bolt11_invoice_payment.payment_secret.data, 32);
11276         return payment_secret_arr;
11277 }
11278 int64_t CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage(int64_t ptr) {
11279         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11280         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11281         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
11282         return payment_preimage_ref;
11283 }
11284 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret(int64_t ptr) {
11285         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11286         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11287         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11288         memcpy(payment_secret_arr->elems, obj->bolt12_offer_payment.payment_secret.data, 32);
11289         return payment_secret_arr;
11290 }
11291 int64_t CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context(int64_t ptr) {
11292         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11293         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11294         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
11295                         int64_t payment_context_ref = 0;
11296                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
11297                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
11298         return payment_context_ref;
11299 }
11300 int64_t CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage(int64_t ptr) {
11301         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11302         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11303         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
11304         return payment_preimage_ref;
11305 }
11306 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret(int64_t ptr) {
11307         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11308         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11309         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11310         memcpy(payment_secret_arr->elems, obj->bolt12_refund_payment.payment_secret.data, 32);
11311         return payment_secret_arr;
11312 }
11313 int64_t CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context(int64_t ptr) {
11314         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11315         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11316         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
11317                         int64_t payment_context_ref = 0;
11318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
11319                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
11320         return payment_context_ref;
11321 }
11322 int8_tArray CS_LDK_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(int64_t ptr) {
11323         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11324         CHECK(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
11325         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
11326         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
11327         return spontaneous_payment_arr;
11328 }
11329 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11330 CHECK(owner->result_ok);
11331         return PaymentPurpose_clone(&*owner->contents.result);
11332 }
11333 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_ok(int64_t owner) {
11334         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11335         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11336         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
11337         int64_t ret_ref = tag_ptr(ret_copy, true);
11338         return ret_ref;
11339 }
11340
11341 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11342 CHECK(!owner->result_ok);
11343         return DecodeError_clone(&*owner->contents.err);
11344 }
11345 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_err(int64_t owner) {
11346         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11348         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
11349         int64_t ret_ref = tag_ptr(ret_copy, true);
11350         return ret_ref;
11351 }
11352
11353 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
11354         LDKClaimedHTLC ret = *owner->contents.result;
11355         ret.is_owned = false;
11356         return ret;
11357 }
11358 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_ok(int64_t owner) {
11359         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
11360         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
11361         int64_t ret_ref = 0;
11362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11364         return ret_ref;
11365 }
11366
11367 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
11368 CHECK(!owner->result_ok);
11369         return DecodeError_clone(&*owner->contents.err);
11370 }
11371 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_err(int64_t owner) {
11372         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
11373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11374         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
11375         int64_t ret_ref = tag_ptr(ret_copy, true);
11376         return ret_ref;
11377 }
11378
11379 uint32_t CS_LDK_LDKPathFailure_ty_from_ptr(int64_t ptr) {
11380         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11381         switch(obj->tag) {
11382                 case LDKPathFailure_InitialSend: return 0;
11383                 case LDKPathFailure_OnPath: return 1;
11384                 default: abort();
11385         }
11386 }
11387 int64_t CS_LDK_LDKPathFailure_InitialSend_get_err(int64_t ptr) {
11388         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11389         CHECK(obj->tag == LDKPathFailure_InitialSend);
11390         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
11391         return err_ref;
11392 }
11393 int64_t CS_LDK_LDKPathFailure_OnPath_get_network_update(int64_t ptr) {
11394         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11395         CHECK(obj->tag == LDKPathFailure_OnPath);
11396         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
11397         return network_update_ref;
11398 }
11399 uint32_t CS_LDK_LDKCOption_PathFailureZ_ty_from_ptr(int64_t ptr) {
11400         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11401         switch(obj->tag) {
11402                 case LDKCOption_PathFailureZ_Some: return 0;
11403                 case LDKCOption_PathFailureZ_None: return 1;
11404                 default: abort();
11405         }
11406 }
11407 int64_t CS_LDK_LDKCOption_PathFailureZ_Some_get_some(int64_t ptr) {
11408         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11409         CHECK(obj->tag == LDKCOption_PathFailureZ_Some);
11410         int64_t some_ref = tag_ptr(&obj->some, false);
11411         return some_ref;
11412 }
11413 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11414 CHECK(owner->result_ok);
11415         return COption_PathFailureZ_clone(&*owner->contents.result);
11416 }
11417 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_ok(int64_t owner) {
11418         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11419         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
11420         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
11421         int64_t ret_ref = tag_ptr(ret_copy, true);
11422         return ret_ref;
11423 }
11424
11425 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11426 CHECK(!owner->result_ok);
11427         return DecodeError_clone(&*owner->contents.err);
11428 }
11429 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_err(int64_t owner) {
11430         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11432         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
11433         int64_t ret_ref = tag_ptr(ret_copy, true);
11434         return ret_ref;
11435 }
11436
11437 uint32_t CS_LDK_LDKCOption_ClosureReasonZ_ty_from_ptr(int64_t ptr) {
11438         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11439         switch(obj->tag) {
11440                 case LDKCOption_ClosureReasonZ_Some: return 0;
11441                 case LDKCOption_ClosureReasonZ_None: return 1;
11442                 default: abort();
11443         }
11444 }
11445 int64_t CS_LDK_LDKCOption_ClosureReasonZ_Some_get_some(int64_t ptr) {
11446         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11447         CHECK(obj->tag == LDKCOption_ClosureReasonZ_Some);
11448         int64_t some_ref = tag_ptr(&obj->some, false);
11449         return some_ref;
11450 }
11451 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11452 CHECK(owner->result_ok);
11453         return COption_ClosureReasonZ_clone(&*owner->contents.result);
11454 }
11455 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(int64_t owner) {
11456         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11457         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11458         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
11459         int64_t ret_ref = tag_ptr(ret_copy, true);
11460         return ret_ref;
11461 }
11462
11463 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11464 CHECK(!owner->result_ok);
11465         return DecodeError_clone(&*owner->contents.err);
11466 }
11467 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(int64_t owner) {
11468         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11470         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
11471         int64_t ret_ref = tag_ptr(ret_copy, true);
11472         return ret_ref;
11473 }
11474
11475 uint32_t CS_LDK_LDKHTLCDestination_ty_from_ptr(int64_t ptr) {
11476         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11477         switch(obj->tag) {
11478                 case LDKHTLCDestination_NextHopChannel: return 0;
11479                 case LDKHTLCDestination_UnknownNextHop: return 1;
11480                 case LDKHTLCDestination_InvalidForward: return 2;
11481                 case LDKHTLCDestination_InvalidOnion: return 3;
11482                 case LDKHTLCDestination_FailedPayment: return 4;
11483                 default: abort();
11484         }
11485 }
11486 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_node_id(int64_t ptr) {
11487         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11488         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
11489         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11490         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
11491         return node_id_arr;
11492 }
11493 int64_t CS_LDK_LDKHTLCDestination_NextHopChannel_get_channel_id(int64_t ptr) {
11494         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11495         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
11496         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
11497                         int64_t channel_id_ref = 0;
11498                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11499                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11500         return channel_id_ref;
11501 }
11502 int64_t CS_LDK_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(int64_t ptr) {
11503         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11504         CHECK(obj->tag == LDKHTLCDestination_UnknownNextHop);
11505         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
11506         return requested_forward_scid_conv;
11507 }
11508 int64_t CS_LDK_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(int64_t ptr) {
11509         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11510         CHECK(obj->tag == LDKHTLCDestination_InvalidForward);
11511         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
11512         return requested_forward_scid_conv;
11513 }
11514 int8_tArray CS_LDK_LDKHTLCDestination_FailedPayment_get_payment_hash(int64_t ptr) {
11515         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11516         CHECK(obj->tag == LDKHTLCDestination_FailedPayment);
11517         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11518         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
11519         return payment_hash_arr;
11520 }
11521 uint32_t CS_LDK_LDKCOption_HTLCDestinationZ_ty_from_ptr(int64_t ptr) {
11522         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11523         switch(obj->tag) {
11524                 case LDKCOption_HTLCDestinationZ_Some: return 0;
11525                 case LDKCOption_HTLCDestinationZ_None: return 1;
11526                 default: abort();
11527         }
11528 }
11529 int64_t CS_LDK_LDKCOption_HTLCDestinationZ_Some_get_some(int64_t ptr) {
11530         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11531         CHECK(obj->tag == LDKCOption_HTLCDestinationZ_Some);
11532         int64_t some_ref = tag_ptr(&obj->some, false);
11533         return some_ref;
11534 }
11535 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11536 CHECK(owner->result_ok);
11537         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
11538 }
11539 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(int64_t owner) {
11540         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11541         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11542         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
11543         int64_t ret_ref = tag_ptr(ret_copy, true);
11544         return ret_ref;
11545 }
11546
11547 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11548 CHECK(!owner->result_ok);
11549         return DecodeError_clone(&*owner->contents.err);
11550 }
11551 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(int64_t owner) {
11552         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11553         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11554         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
11555         int64_t ret_ref = tag_ptr(ret_copy, true);
11556         return ret_ref;
11557 }
11558
11559 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11560 CHECK(owner->result_ok);
11561         return PaymentFailureReason_clone(&*owner->contents.result);
11562 }
11563 int32_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(int64_t owner) {
11564         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11565         int32_t ret_conv = LDKPaymentFailureReason_to_cs(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
11566         return ret_conv;
11567 }
11568
11569 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11570 CHECK(!owner->result_ok);
11571         return DecodeError_clone(&*owner->contents.err);
11572 }
11573 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_err(int64_t owner) {
11574         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11576         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
11577         int64_t ret_ref = tag_ptr(ret_copy, true);
11578         return ret_ref;
11579 }
11580
11581 uint32_t CS_LDK_LDKCOption_U128Z_ty_from_ptr(int64_t ptr) {
11582         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11583         switch(obj->tag) {
11584                 case LDKCOption_U128Z_Some: return 0;
11585                 case LDKCOption_U128Z_None: return 1;
11586                 default: abort();
11587         }
11588 }
11589 int8_tArray CS_LDK_LDKCOption_U128Z_Some_get_some(int64_t ptr) {
11590         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11591         CHECK(obj->tag == LDKCOption_U128Z_Some);
11592         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
11593         memcpy(some_arr->elems, obj->some.le_bytes, 16);
11594         return some_arr;
11595 }
11596 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
11597         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
11598         for (size_t i = 0; i < ret.datalen; i++) {
11599                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
11600         }
11601         return ret;
11602 }
11603 uint32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(int64_t ptr) {
11604         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11605         switch(obj->tag) {
11606                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
11607                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
11608                 default: abort();
11609         }
11610 }
11611 int32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_Some_get_some(int64_t ptr) {
11612         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11613         CHECK(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
11614         int32_t some_conv = LDKPaymentFailureReason_to_cs(obj->some);
11615         return some_conv;
11616 }
11617 uint32_t CS_LDK_LDKBumpTransactionEvent_ty_from_ptr(int64_t ptr) {
11618         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11619         switch(obj->tag) {
11620                 case LDKBumpTransactionEvent_ChannelClose: return 0;
11621                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
11622                 default: abort();
11623         }
11624 }
11625 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_channel_id(int64_t ptr) {
11626         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11627         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11628         LDKChannelId channel_id_var = obj->channel_close.channel_id;
11629                         int64_t channel_id_ref = 0;
11630                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11631                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11632         return channel_id_ref;
11633 }
11634 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id(int64_t ptr) {
11635         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11636         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11637         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11638         memcpy(counterparty_node_id_arr->elems, obj->channel_close.counterparty_node_id.compressed_form, 33);
11639         return counterparty_node_id_arr;
11640 }
11641 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_claim_id(int64_t ptr) {
11642         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11643         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11644         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11645         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
11646         return claim_id_arr;
11647 }
11648 int32_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(int64_t ptr) {
11649         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11650         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11651         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
11652         return package_target_feerate_sat_per_1000_weight_conv;
11653 }
11654 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(int64_t ptr) {
11655         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11656         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11657         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
11658                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
11659                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
11660         return commitment_tx_arr;
11661 }
11662 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(int64_t ptr) {
11663         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11664         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11665         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
11666         return commitment_tx_fee_satoshis_conv;
11667 }
11668 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(int64_t ptr) {
11669         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11670         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11671         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
11672                         int64_t anchor_descriptor_ref = 0;
11673                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
11674                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
11675         return anchor_descriptor_ref;
11676 }
11677 int64_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(int64_t ptr) {
11678         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11679         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11680         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
11681                         int64_tArray pending_htlcs_arr = NULL;
11682                         pending_htlcs_arr = init_int64_tArray(pending_htlcs_var.datalen, __LINE__);
11683                         int64_t *pending_htlcs_arr_ptr = (int64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
11684                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
11685                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
11686                                 int64_t pending_htlcs_conv_24_ref = 0;
11687                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
11688                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
11689                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
11690                         }
11691                         
11692         return pending_htlcs_arr;
11693 }
11694 int64_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_channel_id(int64_t ptr) {
11695         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11696         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11697         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
11698                         int64_t channel_id_ref = 0;
11699                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11700                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11701         return channel_id_ref;
11702 }
11703 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id(int64_t ptr) {
11704         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11705         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11706         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11707         memcpy(counterparty_node_id_arr->elems, obj->htlc_resolution.counterparty_node_id.compressed_form, 33);
11708         return counterparty_node_id_arr;
11709 }
11710 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(int64_t ptr) {
11711         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11712         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11713         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11714         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11715         return claim_id_arr;
11716 }
11717 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(int64_t ptr) {
11718         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11719         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11720         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11721         return target_feerate_sat_per_1000_weight_conv;
11722 }
11723 int64_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(int64_t ptr) {
11724         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11725         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11726         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11727                         int64_tArray htlc_descriptors_arr = NULL;
11728                         htlc_descriptors_arr = init_int64_tArray(htlc_descriptors_var.datalen, __LINE__);
11729                         int64_t *htlc_descriptors_arr_ptr = (int64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11730                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11731                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11732                                 int64_t htlc_descriptors_conv_16_ref = 0;
11733                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11734                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11735                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11736                         }
11737                         
11738         return htlc_descriptors_arr;
11739 }
11740 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(int64_t ptr) {
11741         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11742         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11743         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11744         return tx_lock_time_conv;
11745 }
11746 uint32_t CS_LDK_LDKEvent_ty_from_ptr(int64_t ptr) {
11747         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11748         switch(obj->tag) {
11749                 case LDKEvent_FundingGenerationReady: return 0;
11750                 case LDKEvent_PaymentClaimable: return 1;
11751                 case LDKEvent_PaymentClaimed: return 2;
11752                 case LDKEvent_ConnectionNeeded: return 3;
11753                 case LDKEvent_InvoiceRequestFailed: return 4;
11754                 case LDKEvent_PaymentSent: return 5;
11755                 case LDKEvent_PaymentFailed: return 6;
11756                 case LDKEvent_PaymentPathSuccessful: return 7;
11757                 case LDKEvent_PaymentPathFailed: return 8;
11758                 case LDKEvent_ProbeSuccessful: return 9;
11759                 case LDKEvent_ProbeFailed: return 10;
11760                 case LDKEvent_PendingHTLCsForwardable: return 11;
11761                 case LDKEvent_HTLCIntercepted: return 12;
11762                 case LDKEvent_SpendableOutputs: return 13;
11763                 case LDKEvent_PaymentForwarded: return 14;
11764                 case LDKEvent_ChannelPending: return 15;
11765                 case LDKEvent_ChannelReady: return 16;
11766                 case LDKEvent_ChannelClosed: return 17;
11767                 case LDKEvent_DiscardFunding: return 18;
11768                 case LDKEvent_OpenChannelRequest: return 19;
11769                 case LDKEvent_HTLCHandlingFailed: return 20;
11770                 case LDKEvent_BumpTransaction: return 21;
11771                 default: abort();
11772         }
11773 }
11774 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_temporary_channel_id(int64_t ptr) {
11775         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11776         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11777         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
11778                         int64_t temporary_channel_id_ref = 0;
11779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11780                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11781         return temporary_channel_id_ref;
11782 }
11783 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_counterparty_node_id(int64_t ptr) {
11784         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11785         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11786         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11787         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11788         return counterparty_node_id_arr;
11789 }
11790 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(int64_t ptr) {
11791         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11792         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11793         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11794         return channel_value_satoshis_conv;
11795 }
11796 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_output_script(int64_t ptr) {
11797         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11798         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11799         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11800                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11801                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11802         return output_script_arr;
11803 }
11804 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_user_channel_id(int64_t ptr) {
11805         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11806         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11807         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11808         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11809         return user_channel_id_arr;
11810 }
11811 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_receiver_node_id(int64_t ptr) {
11812         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11813         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11814         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11815         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11816         return receiver_node_id_arr;
11817 }
11818 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_payment_hash(int64_t ptr) {
11819         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11820         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11821         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11822         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11823         return payment_hash_arr;
11824 }
11825 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_onion_fields(int64_t ptr) {
11826         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11827         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11828         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11829                         int64_t onion_fields_ref = 0;
11830                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11831                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11832         return onion_fields_ref;
11833 }
11834 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_amount_msat(int64_t ptr) {
11835         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11836         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11837         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11838         return amount_msat_conv;
11839 }
11840 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(int64_t ptr) {
11841         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11842         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11843         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11844         return counterparty_skimmed_fee_msat_conv;
11845 }
11846 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_purpose(int64_t ptr) {
11847         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11848         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11849         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11850         return purpose_ref;
11851 }
11852 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_channel_id(int64_t ptr) {
11853         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11854         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11855         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
11856                         int64_t via_channel_id_ref = 0;
11857                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
11858                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
11859         return via_channel_id_ref;
11860 }
11861 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_user_channel_id(int64_t ptr) {
11862         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11863         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11864         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11865         return via_user_channel_id_ref;
11866 }
11867 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_claim_deadline(int64_t ptr) {
11868         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11869         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11870         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11871         return claim_deadline_ref;
11872 }
11873 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_receiver_node_id(int64_t ptr) {
11874         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11875         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11876         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11877         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11878         return receiver_node_id_arr;
11879 }
11880 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_payment_hash(int64_t ptr) {
11881         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11882         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11883         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11884         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11885         return payment_hash_arr;
11886 }
11887 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_amount_msat(int64_t ptr) {
11888         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11889         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11890         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11891         return amount_msat_conv;
11892 }
11893 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_purpose(int64_t ptr) {
11894         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11895         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11896         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11897         return purpose_ref;
11898 }
11899 int64_tArray CS_LDK_LDKEvent_PaymentClaimed_get_htlcs(int64_t ptr) {
11900         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11901         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11902         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11903                         int64_tArray htlcs_arr = NULL;
11904                         htlcs_arr = init_int64_tArray(htlcs_var.datalen, __LINE__);
11905                         int64_t *htlcs_arr_ptr = (int64_t*)(((uint8_t*)htlcs_arr) + 8);
11906                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11907                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11908                                 int64_t htlcs_conv_13_ref = 0;
11909                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11910                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11911                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11912                         }
11913                         
11914         return htlcs_arr;
11915 }
11916 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(int64_t ptr) {
11917         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11918         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11919         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11920         return sender_intended_total_msat_ref;
11921 }
11922 int8_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_node_id(int64_t ptr) {
11923         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11924         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11925         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11926         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11927         return node_id_arr;
11928 }
11929 int64_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_addresses(int64_t ptr) {
11930         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11931         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11932         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11933                         int64_tArray addresses_arr = NULL;
11934                         addresses_arr = init_int64_tArray(addresses_var.datalen, __LINE__);
11935                         int64_t *addresses_arr_ptr = (int64_t*)(((uint8_t*)addresses_arr) + 8);
11936                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11937                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11938                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11939                         }
11940                         
11941         return addresses_arr;
11942 }
11943 int8_tArray CS_LDK_LDKEvent_InvoiceRequestFailed_get_payment_id(int64_t ptr) {
11944         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11945         CHECK(obj->tag == LDKEvent_InvoiceRequestFailed);
11946         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11947         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11948         return payment_id_arr;
11949 }
11950 int64_t CS_LDK_LDKEvent_PaymentSent_get_payment_id(int64_t ptr) {
11951         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11952         CHECK(obj->tag == LDKEvent_PaymentSent);
11953         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11954         return payment_id_ref;
11955 }
11956 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_preimage(int64_t ptr) {
11957         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11958         CHECK(obj->tag == LDKEvent_PaymentSent);
11959         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11960         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11961         return payment_preimage_arr;
11962 }
11963 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_hash(int64_t ptr) {
11964         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11965         CHECK(obj->tag == LDKEvent_PaymentSent);
11966         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11967         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11968         return payment_hash_arr;
11969 }
11970 int64_t CS_LDK_LDKEvent_PaymentSent_get_fee_paid_msat(int64_t ptr) {
11971         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11972         CHECK(obj->tag == LDKEvent_PaymentSent);
11973         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11974         return fee_paid_msat_ref;
11975 }
11976 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_id(int64_t ptr) {
11977         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11978         CHECK(obj->tag == LDKEvent_PaymentFailed);
11979         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11980         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11981         return payment_id_arr;
11982 }
11983 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_hash(int64_t ptr) {
11984         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11985         CHECK(obj->tag == LDKEvent_PaymentFailed);
11986         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11987         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11988         return payment_hash_arr;
11989 }
11990 int64_t CS_LDK_LDKEvent_PaymentFailed_get_reason(int64_t ptr) {
11991         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11992         CHECK(obj->tag == LDKEvent_PaymentFailed);
11993         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11994         return reason_ref;
11995 }
11996 int8_tArray CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_id(int64_t ptr) {
11997         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11998         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11999         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12000         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
12001         return payment_id_arr;
12002 }
12003 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_hash(int64_t ptr) {
12004         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12005         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
12006         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12007         return payment_hash_ref;
12008 }
12009 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_path(int64_t ptr) {
12010         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12011         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
12012         LDKPath path_var = obj->payment_path_successful.path;
12013                         int64_t path_ref = 0;
12014                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12015                         path_ref = tag_ptr(path_var.inner, false);
12016         return path_ref;
12017 }
12018 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_payment_id(int64_t ptr) {
12019         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12020         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12021         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12022         return payment_id_ref;
12023 }
12024 int8_tArray CS_LDK_LDKEvent_PaymentPathFailed_get_payment_hash(int64_t ptr) {
12025         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12026         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12027         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12028         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
12029         return payment_hash_arr;
12030 }
12031 jboolean CS_LDK_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(int64_t ptr) {
12032         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12033         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12034         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12035         return payment_failed_permanently_conv;
12036 }
12037 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_failure(int64_t ptr) {
12038         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12039         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12040         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12041         return failure_ref;
12042 }
12043 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_path(int64_t ptr) {
12044         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12045         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12046         LDKPath path_var = obj->payment_path_failed.path;
12047                         int64_t path_ref = 0;
12048                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12049                         path_ref = tag_ptr(path_var.inner, false);
12050         return path_ref;
12051 }
12052 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_short_channel_id(int64_t ptr) {
12053         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12054         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12055         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12056         return short_channel_id_ref;
12057 }
12058 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_id(int64_t ptr) {
12059         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12060         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12061         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12062         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
12063         return payment_id_arr;
12064 }
12065 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_hash(int64_t ptr) {
12066         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12067         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12068         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12069         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
12070         return payment_hash_arr;
12071 }
12072 int64_t CS_LDK_LDKEvent_ProbeSuccessful_get_path(int64_t ptr) {
12073         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12074         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12075         LDKPath path_var = obj->probe_successful.path;
12076                         int64_t path_ref = 0;
12077                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12078                         path_ref = tag_ptr(path_var.inner, false);
12079         return path_ref;
12080 }
12081 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_id(int64_t ptr) {
12082         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12083         CHECK(obj->tag == LDKEvent_ProbeFailed);
12084         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12085         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
12086         return payment_id_arr;
12087 }
12088 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_hash(int64_t ptr) {
12089         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12090         CHECK(obj->tag == LDKEvent_ProbeFailed);
12091         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12092         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
12093         return payment_hash_arr;
12094 }
12095 int64_t CS_LDK_LDKEvent_ProbeFailed_get_path(int64_t ptr) {
12096         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12097         CHECK(obj->tag == LDKEvent_ProbeFailed);
12098         LDKPath path_var = obj->probe_failed.path;
12099                         int64_t path_ref = 0;
12100                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12101                         path_ref = tag_ptr(path_var.inner, false);
12102         return path_ref;
12103 }
12104 int64_t CS_LDK_LDKEvent_ProbeFailed_get_short_channel_id(int64_t ptr) {
12105         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12106         CHECK(obj->tag == LDKEvent_ProbeFailed);
12107         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
12108         return short_channel_id_ref;
12109 }
12110 int64_t CS_LDK_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(int64_t ptr) {
12111         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12112         CHECK(obj->tag == LDKEvent_PendingHTLCsForwardable);
12113         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
12114         return time_forwardable_conv;
12115 }
12116 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_intercept_id(int64_t ptr) {
12117         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12118         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12119         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
12120         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
12121         return intercept_id_arr;
12122 }
12123 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(int64_t ptr) {
12124         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12125         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12126         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
12127         return requested_next_hop_scid_conv;
12128 }
12129 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_payment_hash(int64_t ptr) {
12130         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12131         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12132         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12133         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
12134         return payment_hash_arr;
12135 }
12136 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(int64_t ptr) {
12137         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12138         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12139         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
12140         return inbound_amount_msat_conv;
12141 }
12142 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(int64_t ptr) {
12143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12144         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12145         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
12146         return expected_outbound_amount_msat_conv;
12147 }
12148 int64_tArray CS_LDK_LDKEvent_SpendableOutputs_get_outputs(int64_t ptr) {
12149         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12150         CHECK(obj->tag == LDKEvent_SpendableOutputs);
12151         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
12152                         int64_tArray outputs_arr = NULL;
12153                         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
12154                         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
12155                         for (size_t b = 0; b < outputs_var.datalen; b++) {
12156                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
12157                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
12158                         }
12159                         
12160         return outputs_arr;
12161 }
12162 int64_t CS_LDK_LDKEvent_SpendableOutputs_get_channel_id(int64_t ptr) {
12163         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12164         CHECK(obj->tag == LDKEvent_SpendableOutputs);
12165         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
12166                         int64_t channel_id_ref = 0;
12167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12168                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12169         return channel_id_ref;
12170 }
12171 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_channel_id(int64_t ptr) {
12172         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12173         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12174         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
12175                         int64_t prev_channel_id_ref = 0;
12176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
12177                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
12178         return prev_channel_id_ref;
12179 }
12180 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_channel_id(int64_t ptr) {
12181         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12182         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12183         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
12184                         int64_t next_channel_id_ref = 0;
12185                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
12186                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
12187         return next_channel_id_ref;
12188 }
12189 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_user_channel_id(int64_t ptr) {
12190         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12191         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12192         int64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
12193         return prev_user_channel_id_ref;
12194 }
12195 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_user_channel_id(int64_t ptr) {
12196         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12197         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12198         int64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
12199         return next_user_channel_id_ref;
12200 }
12201 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_total_fee_earned_msat(int64_t ptr) {
12202         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12203         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12204         int64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
12205         return total_fee_earned_msat_ref;
12206 }
12207 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_skimmed_fee_msat(int64_t ptr) {
12208         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12209         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12210         int64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
12211         return skimmed_fee_msat_ref;
12212 }
12213 jboolean CS_LDK_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(int64_t ptr) {
12214         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12215         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12216         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
12217         return claim_from_onchain_tx_conv;
12218 }
12219 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(int64_t ptr) {
12220         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12221         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12222         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
12223         return outbound_amount_forwarded_msat_ref;
12224 }
12225 int64_t CS_LDK_LDKEvent_ChannelPending_get_channel_id(int64_t ptr) {
12226         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12227         CHECK(obj->tag == LDKEvent_ChannelPending);
12228         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
12229                         int64_t channel_id_ref = 0;
12230                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12231                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12232         return channel_id_ref;
12233 }
12234 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_user_channel_id(int64_t ptr) {
12235         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12236         CHECK(obj->tag == LDKEvent_ChannelPending);
12237         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12238         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
12239         return user_channel_id_arr;
12240 }
12241 int64_t CS_LDK_LDKEvent_ChannelPending_get_former_temporary_channel_id(int64_t ptr) {
12242         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12243         CHECK(obj->tag == LDKEvent_ChannelPending);
12244         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
12245                         int64_t former_temporary_channel_id_ref = 0;
12246                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
12247                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
12248         return former_temporary_channel_id_ref;
12249 }
12250 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_counterparty_node_id(int64_t ptr) {
12251         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12252         CHECK(obj->tag == LDKEvent_ChannelPending);
12253         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12254         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
12255         return counterparty_node_id_arr;
12256 }
12257 int64_t CS_LDK_LDKEvent_ChannelPending_get_funding_txo(int64_t ptr) {
12258         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12259         CHECK(obj->tag == LDKEvent_ChannelPending);
12260         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
12261                         int64_t funding_txo_ref = 0;
12262                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
12263                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
12264         return funding_txo_ref;
12265 }
12266 int64_t CS_LDK_LDKEvent_ChannelPending_get_channel_type(int64_t ptr) {
12267         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12268         CHECK(obj->tag == LDKEvent_ChannelPending);
12269         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
12270                         int64_t channel_type_ref = 0;
12271                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12272                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12273         return channel_type_ref;
12274 }
12275 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_id(int64_t ptr) {
12276         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12277         CHECK(obj->tag == LDKEvent_ChannelReady);
12278         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
12279                         int64_t channel_id_ref = 0;
12280                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12281                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12282         return channel_id_ref;
12283 }
12284 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_user_channel_id(int64_t ptr) {
12285         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12286         CHECK(obj->tag == LDKEvent_ChannelReady);
12287         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12288         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
12289         return user_channel_id_arr;
12290 }
12291 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_counterparty_node_id(int64_t ptr) {
12292         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12293         CHECK(obj->tag == LDKEvent_ChannelReady);
12294         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12295         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
12296         return counterparty_node_id_arr;
12297 }
12298 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_type(int64_t ptr) {
12299         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12300         CHECK(obj->tag == LDKEvent_ChannelReady);
12301         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
12302                         int64_t channel_type_ref = 0;
12303                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12304                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12305         return channel_type_ref;
12306 }
12307 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_id(int64_t ptr) {
12308         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12309         CHECK(obj->tag == LDKEvent_ChannelClosed);
12310         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
12311                         int64_t channel_id_ref = 0;
12312                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12313                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12314         return channel_id_ref;
12315 }
12316 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_user_channel_id(int64_t ptr) {
12317         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12318         CHECK(obj->tag == LDKEvent_ChannelClosed);
12319         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12320         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
12321         return user_channel_id_arr;
12322 }
12323 int64_t CS_LDK_LDKEvent_ChannelClosed_get_reason(int64_t ptr) {
12324         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12325         CHECK(obj->tag == LDKEvent_ChannelClosed);
12326         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
12327         return reason_ref;
12328 }
12329 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_counterparty_node_id(int64_t ptr) {
12330         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12331         CHECK(obj->tag == LDKEvent_ChannelClosed);
12332         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12333         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
12334         return counterparty_node_id_arr;
12335 }
12336 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_capacity_sats(int64_t ptr) {
12337         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12338         CHECK(obj->tag == LDKEvent_ChannelClosed);
12339         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
12340         return channel_capacity_sats_ref;
12341 }
12342 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_funding_txo(int64_t ptr) {
12343         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12344         CHECK(obj->tag == LDKEvent_ChannelClosed);
12345         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
12346                         int64_t channel_funding_txo_ref = 0;
12347                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
12348                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
12349         return channel_funding_txo_ref;
12350 }
12351 int64_t CS_LDK_LDKEvent_DiscardFunding_get_channel_id(int64_t ptr) {
12352         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12353         CHECK(obj->tag == LDKEvent_DiscardFunding);
12354         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
12355                         int64_t channel_id_ref = 0;
12356                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12357                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12358         return channel_id_ref;
12359 }
12360 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_transaction(int64_t ptr) {
12361         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12362         CHECK(obj->tag == LDKEvent_DiscardFunding);
12363         LDKTransaction transaction_var = obj->discard_funding.transaction;
12364                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
12365                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
12366         return transaction_arr;
12367 }
12368 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_temporary_channel_id(int64_t ptr) {
12369         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12370         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12371         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
12372                         int64_t temporary_channel_id_ref = 0;
12373                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
12374                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
12375         return temporary_channel_id_ref;
12376 }
12377 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_counterparty_node_id(int64_t ptr) {
12378         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12379         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12380         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12381         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
12382         return counterparty_node_id_arr;
12383 }
12384 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_funding_satoshis(int64_t ptr) {
12385         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12386         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12387         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
12388         return funding_satoshis_conv;
12389 }
12390 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_push_msat(int64_t ptr) {
12391         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12392         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12393         int64_t push_msat_conv = obj->open_channel_request.push_msat;
12394         return push_msat_conv;
12395 }
12396 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_channel_type(int64_t ptr) {
12397         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12398         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12399         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
12400                         int64_t channel_type_ref = 0;
12401                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12402                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12403         return channel_type_ref;
12404 }
12405 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(int64_t ptr) {
12406         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12407         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
12408         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
12409                         int64_t prev_channel_id_ref = 0;
12410                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
12411                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
12412         return prev_channel_id_ref;
12413 }
12414 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(int64_t ptr) {
12415         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12416         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
12417         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
12418         return failed_next_destination_ref;
12419 }
12420 int64_t CS_LDK_LDKEvent_BumpTransaction_get_bump_transaction(int64_t ptr) {
12421         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12422         CHECK(obj->tag == LDKEvent_BumpTransaction);
12423         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
12424         return bump_transaction_ref;
12425 }
12426 uint32_t CS_LDK_LDKCOption_EventZ_ty_from_ptr(int64_t ptr) {
12427         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12428         switch(obj->tag) {
12429                 case LDKCOption_EventZ_Some: return 0;
12430                 case LDKCOption_EventZ_None: return 1;
12431                 default: abort();
12432         }
12433 }
12434 int64_t CS_LDK_LDKCOption_EventZ_Some_get_some(int64_t ptr) {
12435         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12436         CHECK(obj->tag == LDKCOption_EventZ_Some);
12437         int64_t some_ref = tag_ptr(&obj->some, false);
12438         return some_ref;
12439 }
12440 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12441 CHECK(owner->result_ok);
12442         return COption_EventZ_clone(&*owner->contents.result);
12443 }
12444 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_ok(int64_t owner) {
12445         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12446         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12447         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
12448         int64_t ret_ref = tag_ptr(ret_copy, true);
12449         return ret_ref;
12450 }
12451
12452 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12453 CHECK(!owner->result_ok);
12454         return DecodeError_clone(&*owner->contents.err);
12455 }
12456 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_err(int64_t owner) {
12457         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12459         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
12460         int64_t ret_ref = tag_ptr(ret_copy, true);
12461         return ret_ref;
12462 }
12463
12464 uint32_t CS_LDK_LDKBolt11ParseError_ty_from_ptr(int64_t ptr) {
12465         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12466         switch(obj->tag) {
12467                 case LDKBolt11ParseError_Bech32Error: return 0;
12468                 case LDKBolt11ParseError_ParseAmountError: return 1;
12469                 case LDKBolt11ParseError_MalformedSignature: return 2;
12470                 case LDKBolt11ParseError_BadPrefix: return 3;
12471                 case LDKBolt11ParseError_UnknownCurrency: return 4;
12472                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
12473                 case LDKBolt11ParseError_MalformedHRP: return 6;
12474                 case LDKBolt11ParseError_TooShortDataPart: return 7;
12475                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
12476                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
12477                 case LDKBolt11ParseError_PaddingError: return 10;
12478                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
12479                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
12480                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
12481                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
12482                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
12483                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
12484                 case LDKBolt11ParseError_Skip: return 17;
12485                 default: abort();
12486         }
12487 }
12488 int64_t CS_LDK_LDKBolt11ParseError_Bech32Error_get_bech32_error(int64_t ptr) {
12489         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12490         CHECK(obj->tag == LDKBolt11ParseError_Bech32Error);
12491         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
12492         return bech32_error_ref;
12493 }
12494 int32_t CS_LDK_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(int64_t ptr) {
12495         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12496         CHECK(obj->tag == LDKBolt11ParseError_ParseAmountError);
12497         /*obj->parse_amount_error*/
12498         return 0;
12499 }
12500 int32_t CS_LDK_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(int64_t ptr) {
12501         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12502         CHECK(obj->tag == LDKBolt11ParseError_MalformedSignature);
12503         int32_t malformed_signature_conv = LDKSecp256k1Error_to_cs(obj->malformed_signature);
12504         return malformed_signature_conv;
12505 }
12506 int32_t CS_LDK_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(int64_t ptr) {
12507         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12508         CHECK(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
12509         /*obj->description_decode_error*/
12510         return 0;
12511 }
12512 jstring CS_LDK_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(int64_t ptr) {
12513         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12514         CHECK(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
12515         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
12516                         jstring invalid_slice_length_conv = str_ref_to_cs(invalid_slice_length_str.chars, invalid_slice_length_str.len);
12517         return invalid_slice_length_conv;
12518 }
12519 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12520 CHECK(owner->result_ok);
12521         return SiPrefix_clone(&*owner->contents.result);
12522 }
12523 int32_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_ok(int64_t owner) {
12524         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12525         int32_t ret_conv = LDKSiPrefix_to_cs(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
12526         return ret_conv;
12527 }
12528
12529 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12530 CHECK(!owner->result_ok);
12531         return Bolt11ParseError_clone(&*owner->contents.err);
12532 }
12533 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_err(int64_t owner) {
12534         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12535         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12536         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
12537         int64_t ret_ref = tag_ptr(ret_copy, true);
12538         return ret_ref;
12539 }
12540
12541 uint32_t CS_LDK_LDKParseOrSemanticError_ty_from_ptr(int64_t ptr) {
12542         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12543         switch(obj->tag) {
12544                 case LDKParseOrSemanticError_ParseError: return 0;
12545                 case LDKParseOrSemanticError_SemanticError: return 1;
12546                 default: abort();
12547         }
12548 }
12549 int64_t CS_LDK_LDKParseOrSemanticError_ParseError_get_parse_error(int64_t ptr) {
12550         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12551         CHECK(obj->tag == LDKParseOrSemanticError_ParseError);
12552         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
12553         return parse_error_ref;
12554 }
12555 int32_t CS_LDK_LDKParseOrSemanticError_SemanticError_get_semantic_error(int64_t ptr) {
12556         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12557         CHECK(obj->tag == LDKParseOrSemanticError_SemanticError);
12558         int32_t semantic_error_conv = LDKBolt11SemanticError_to_cs(obj->semantic_error);
12559         return semantic_error_conv;
12560 }
12561 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12562         LDKBolt11Invoice ret = *owner->contents.result;
12563         ret.is_owned = false;
12564         return ret;
12565 }
12566 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(int64_t owner) {
12567         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12568         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_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 LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12576 CHECK(!owner->result_ok);
12577         return ParseOrSemanticError_clone(&*owner->contents.err);
12578 }
12579 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(int64_t owner) {
12580         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12581         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
12582         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
12583         int64_t ret_ref = tag_ptr(ret_copy, true);
12584         return ret_ref;
12585 }
12586
12587 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12588         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
12589         ret.is_owned = false;
12590         return ret;
12591 }
12592 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(int64_t owner) {
12593         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12594         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_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 LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12602 CHECK(!owner->result_ok);
12603         return Bolt11ParseError_clone(&*owner->contents.err);
12604 }
12605 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(int64_t owner) {
12606         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12607         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12608         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
12609         int64_t ret_ref = tag_ptr(ret_copy, true);
12610         return ret_ref;
12611 }
12612
12613 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12614         LDKRawBolt11Invoice ret = owner->a;
12615         ret.is_owned = false;
12616         return ret;
12617 }
12618 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(int64_t owner) {
12619         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12620         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(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 LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12628         return ThirtyTwoBytes_clone(&owner->b);
12629 }
12630 int8_tArray  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(int64_t owner) {
12631         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12633         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
12634         return ret_arr;
12635 }
12636
12637 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12638         LDKBolt11InvoiceSignature ret = owner->c;
12639         ret.is_owned = false;
12640         return ret;
12641 }
12642 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(int64_t owner) {
12643         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12644         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12645         int64_t ret_ref = 0;
12646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12648         return ret_ref;
12649 }
12650
12651 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12652         LDKPayeePubKey ret = *owner->contents.result;
12653         ret.is_owned = false;
12654         return ret;
12655 }
12656 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(int64_t owner) {
12657         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12658         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
12659         int64_t ret_ref = 0;
12660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12662         return ret_ref;
12663 }
12664
12665 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12666 CHECK(!owner->result_ok);
12667         return *owner->contents.err;
12668 }
12669 int32_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_err(int64_t owner) {
12670         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12671         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
12672         return ret_conv;
12673 }
12674
12675 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
12676         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
12677         for (size_t i = 0; i < ret.datalen; i++) {
12678                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
12679         }
12680         return ret;
12681 }
12682 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12683         LDKPositiveTimestamp ret = *owner->contents.result;
12684         ret.is_owned = false;
12685         return ret;
12686 }
12687 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_ok(int64_t owner) {
12688         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12689         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
12690         int64_t ret_ref = 0;
12691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12693         return ret_ref;
12694 }
12695
12696 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12697 CHECK(!owner->result_ok);
12698         return CreationError_clone(&*owner->contents.err);
12699 }
12700 int32_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_err(int64_t owner) {
12701         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12702         int32_t ret_conv = LDKCreationError_to_cs(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
12703         return ret_conv;
12704 }
12705
12706 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12707 CHECK(owner->result_ok);
12708         return *owner->contents.result;
12709 }
12710 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_ok(int64_t owner) {
12711         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12712         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
12713 }
12714
12715 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12716 CHECK(!owner->result_ok);
12717         return Bolt11SemanticError_clone(&*owner->contents.err);
12718 }
12719 int32_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_err(int64_t owner) {
12720         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12721         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
12722         return ret_conv;
12723 }
12724
12725 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12726         LDKBolt11Invoice ret = *owner->contents.result;
12727         ret.is_owned = false;
12728         return ret;
12729 }
12730 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(int64_t owner) {
12731         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12732         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
12733         int64_t ret_ref = 0;
12734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12736         return ret_ref;
12737 }
12738
12739 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12740 CHECK(!owner->result_ok);
12741         return Bolt11SemanticError_clone(&*owner->contents.err);
12742 }
12743 int32_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(int64_t owner) {
12744         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12745         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
12746         return ret_conv;
12747 }
12748
12749 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12750         LDKDescription ret = *owner->contents.result;
12751         ret.is_owned = false;
12752         return ret;
12753 }
12754 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_ok(int64_t owner) {
12755         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12756         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
12757         int64_t ret_ref = 0;
12758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12760         return ret_ref;
12761 }
12762
12763 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12764 CHECK(!owner->result_ok);
12765         return CreationError_clone(&*owner->contents.err);
12766 }
12767 int32_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_err(int64_t owner) {
12768         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12769         int32_t ret_conv = LDKCreationError_to_cs(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12770         return ret_conv;
12771 }
12772
12773 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12774         LDKPrivateRoute ret = *owner->contents.result;
12775         ret.is_owned = false;
12776         return ret;
12777 }
12778 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_ok(int64_t owner) {
12779         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12780         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12781         int64_t ret_ref = 0;
12782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12784         return ret_ref;
12785 }
12786
12787 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12788 CHECK(!owner->result_ok);
12789         return CreationError_clone(&*owner->contents.err);
12790 }
12791 int32_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_err(int64_t owner) {
12792         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12793         int32_t ret_conv = LDKCreationError_to_cs(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12794         return ret_conv;
12795 }
12796
12797 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12798         LDKOutPoint ret = *owner->contents.result;
12799         ret.is_owned = false;
12800         return ret;
12801 }
12802 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_ok(int64_t owner) {
12803         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12804         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12805         int64_t ret_ref = 0;
12806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12808         return ret_ref;
12809 }
12810
12811 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12812 CHECK(!owner->result_ok);
12813         return DecodeError_clone(&*owner->contents.err);
12814 }
12815 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_err(int64_t owner) {
12816         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12817         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12818         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12819         int64_t ret_ref = tag_ptr(ret_copy, true);
12820         return ret_ref;
12821 }
12822
12823 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12824         LDKBigSize ret = *owner->contents.result;
12825         ret.is_owned = false;
12826         return ret;
12827 }
12828 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_ok(int64_t owner) {
12829         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12830         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12831         int64_t ret_ref = 0;
12832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12834         return ret_ref;
12835 }
12836
12837 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12838 CHECK(!owner->result_ok);
12839         return DecodeError_clone(&*owner->contents.err);
12840 }
12841 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_err(int64_t owner) {
12842         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12843         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12844         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12845         int64_t ret_ref = tag_ptr(ret_copy, true);
12846         return ret_ref;
12847 }
12848
12849 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12850         LDKHostname ret = *owner->contents.result;
12851         ret.is_owned = false;
12852         return ret;
12853 }
12854 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_ok(int64_t owner) {
12855         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12856         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12857         int64_t ret_ref = 0;
12858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12860         return ret_ref;
12861 }
12862
12863 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12864 CHECK(!owner->result_ok);
12865         return DecodeError_clone(&*owner->contents.err);
12866 }
12867 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_err(int64_t owner) {
12868         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12870         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12871         int64_t ret_ref = tag_ptr(ret_copy, true);
12872         return ret_ref;
12873 }
12874
12875 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12876         LDKTransactionU16LenLimited ret = *owner->contents.result;
12877         ret.is_owned = false;
12878         return ret;
12879 }
12880 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_ok(int64_t owner) {
12881         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12882         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12883         int64_t ret_ref = 0;
12884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12886         return ret_ref;
12887 }
12888
12889 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12890 CHECK(!owner->result_ok);
12891         return *owner->contents.err;
12892 }
12893 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_err(int64_t owner) {
12894         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12895         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12896 }
12897
12898 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12899         LDKTransactionU16LenLimited ret = *owner->contents.result;
12900         ret.is_owned = false;
12901         return ret;
12902 }
12903 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(int64_t owner) {
12904         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12905         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12906         int64_t ret_ref = 0;
12907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12909         return ret_ref;
12910 }
12911
12912 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12913 CHECK(!owner->result_ok);
12914         return DecodeError_clone(&*owner->contents.err);
12915 }
12916 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(int64_t owner) {
12917         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12919         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12920         int64_t ret_ref = tag_ptr(ret_copy, true);
12921         return ret_ref;
12922 }
12923
12924 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12925         LDKUntrustedString ret = *owner->contents.result;
12926         ret.is_owned = false;
12927         return ret;
12928 }
12929 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_ok(int64_t owner) {
12930         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12931         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12932         int64_t ret_ref = 0;
12933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12935         return ret_ref;
12936 }
12937
12938 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12939 CHECK(!owner->result_ok);
12940         return DecodeError_clone(&*owner->contents.err);
12941 }
12942 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_err(int64_t owner) {
12943         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12944         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12945         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12946         int64_t ret_ref = tag_ptr(ret_copy, true);
12947         return ret_ref;
12948 }
12949
12950 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12951         LDKChannelId ret = *owner->contents.result;
12952         ret.is_owned = false;
12953         return ret;
12954 }
12955 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_get_ok(int64_t owner) {
12956         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12957         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
12958         int64_t ret_ref = 0;
12959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12961         return ret_ref;
12962 }
12963
12964 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
12965 CHECK(!owner->result_ok);
12966         return DecodeError_clone(&*owner->contents.err);
12967 }
12968 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_get_err(int64_t owner) {
12969         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
12970         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12971         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
12972         int64_t ret_ref = tag_ptr(ret_copy, true);
12973         return ret_ref;
12974 }
12975
12976 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12977         return ThirtyTwoBytes_clone(&owner->a);
12978 }
12979 int8_tArray  CS_LDK_C2Tuple__u832u16Z_get_a(int64_t owner) {
12980         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12981         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12982         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12983         return ret_arr;
12984 }
12985
12986 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12987         return owner->b;
12988 }
12989 int16_t  CS_LDK_C2Tuple__u832u16Z_get_b(int64_t owner) {
12990         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12991         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12992         return ret_conv;
12993 }
12994
12995 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12996         LDKPaymentRelay ret = *owner->contents.result;
12997         ret.is_owned = false;
12998         return ret;
12999 }
13000 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_ok(int64_t owner) {
13001         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13002         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
13003         int64_t ret_ref = 0;
13004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13006         return ret_ref;
13007 }
13008
13009 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13010 CHECK(!owner->result_ok);
13011         return DecodeError_clone(&*owner->contents.err);
13012 }
13013 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_err(int64_t owner) {
13014         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13016         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
13017         int64_t ret_ref = tag_ptr(ret_copy, true);
13018         return ret_ref;
13019 }
13020
13021 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13022         LDKPaymentConstraints ret = *owner->contents.result;
13023         ret.is_owned = false;
13024         return ret;
13025 }
13026 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_ok(int64_t owner) {
13027         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13028         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
13029         int64_t ret_ref = 0;
13030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13032         return ret_ref;
13033 }
13034
13035 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13036 CHECK(!owner->result_ok);
13037         return DecodeError_clone(&*owner->contents.err);
13038 }
13039 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_err(int64_t owner) {
13040         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13042         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
13043         int64_t ret_ref = tag_ptr(ret_copy, true);
13044         return ret_ref;
13045 }
13046
13047 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
13048 CHECK(owner->result_ok);
13049         return PaymentContext_clone(&*owner->contents.result);
13050 }
13051 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_get_ok(int64_t owner) {
13052         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
13053         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
13054         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
13055         int64_t ret_ref = tag_ptr(ret_copy, true);
13056         return ret_ref;
13057 }
13058
13059 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
13060 CHECK(!owner->result_ok);
13061         return DecodeError_clone(&*owner->contents.err);
13062 }
13063 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_get_err(int64_t owner) {
13064         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
13065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13066         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
13067         int64_t ret_ref = tag_ptr(ret_copy, true);
13068         return ret_ref;
13069 }
13070
13071 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
13072         LDKUnknownPaymentContext ret = *owner->contents.result;
13073         ret.is_owned = false;
13074         return ret;
13075 }
13076 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_get_ok(int64_t owner) {
13077         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
13078         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
13079         int64_t ret_ref = 0;
13080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13082         return ret_ref;
13083 }
13084
13085 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
13086 CHECK(!owner->result_ok);
13087         return DecodeError_clone(&*owner->contents.err);
13088 }
13089 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_get_err(int64_t owner) {
13090         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
13091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13092         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
13093         int64_t ret_ref = tag_ptr(ret_copy, true);
13094         return ret_ref;
13095 }
13096
13097 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
13098         LDKBolt12OfferContext ret = *owner->contents.result;
13099         ret.is_owned = false;
13100         return ret;
13101 }
13102 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_get_ok(int64_t owner) {
13103         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
13104         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
13105         int64_t ret_ref = 0;
13106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13108         return ret_ref;
13109 }
13110
13111 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
13112 CHECK(!owner->result_ok);
13113         return DecodeError_clone(&*owner->contents.err);
13114 }
13115 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_get_err(int64_t owner) {
13116         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
13117         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13118         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
13119         int64_t ret_ref = tag_ptr(ret_copy, true);
13120         return ret_ref;
13121 }
13122
13123 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
13124         LDKBolt12RefundContext ret = *owner->contents.result;
13125         ret.is_owned = false;
13126         return ret;
13127 }
13128 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_get_ok(int64_t owner) {
13129         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
13130         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
13131         int64_t ret_ref = 0;
13132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13134         return ret_ref;
13135 }
13136
13137 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
13138 CHECK(!owner->result_ok);
13139         return DecodeError_clone(&*owner->contents.err);
13140 }
13141 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_get_err(int64_t owner) {
13142         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
13143         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13144         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
13145         int64_t ret_ref = tag_ptr(ret_copy, true);
13146         return ret_ref;
13147 }
13148
13149 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
13150 CHECK(owner->result_ok);
13151         return *owner->contents.result;
13152 }
13153 jstring  CS_LDK_CResult_StrSecp256k1ErrorZ_get_ok(int64_t owner) {
13154         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
13155         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
13156         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
13157         return ret_conv;
13158 }
13159
13160 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
13161 CHECK(!owner->result_ok);
13162         return *owner->contents.err;
13163 }
13164 int32_t  CS_LDK_CResult_StrSecp256k1ErrorZ_get_err(int64_t owner) {
13165         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
13166         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
13167         return ret_conv;
13168 }
13169
13170 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13171         return ThirtyTwoBytes_clone(&owner->a);
13172 }
13173 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(int64_t owner) {
13174         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13175         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
13176         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
13177         return ret_arr;
13178 }
13179
13180 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13181         LDKRecipientOnionFields ret = owner->b;
13182         ret.is_owned = false;
13183         return ret;
13184 }
13185 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(int64_t owner) {
13186         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13187         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
13188         int64_t ret_ref = 0;
13189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13191         return ret_ref;
13192 }
13193
13194 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13195         LDKRouteParameters ret = owner->c;
13196         ret.is_owned = false;
13197         return ret;
13198 }
13199 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(int64_t owner) {
13200         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13201         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
13202         int64_t ret_ref = 0;
13203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13205         return ret_ref;
13206 }
13207
13208 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
13209 CHECK(owner->result_ok);
13210         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
13211 }
13212 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(int64_t owner) {
13213         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
13214         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
13215         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
13216         return tag_ptr(ret_conv, true);
13217 }
13218
13219 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
13220 CHECK(!owner->result_ok);
13221         return *owner->contents.err;
13222 }
13223 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(int64_t owner) {
13224         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
13225         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
13226 }
13227
13228 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13229         return owner->a;
13230 }
13231 int8_tArray  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(int64_t owner) {
13232         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13233         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
13234         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
13235         return ret_arr;
13236 }
13237
13238 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13239         LDKOnionMessage ret = owner->b;
13240         ret.is_owned = false;
13241         return ret;
13242 }
13243 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(int64_t owner) {
13244         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13245         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
13246         int64_t ret_ref = 0;
13247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13249         return ret_ref;
13250 }
13251
13252 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13253         return COption_CVec_SocketAddressZZ_clone(&owner->c);
13254 }
13255 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(int64_t owner) {
13256         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13257         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
13258         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
13259         int64_t ret_ref = tag_ptr(ret_copy, true);
13260         return ret_ref;
13261 }
13262
13263 uint32_t CS_LDK_LDKSendError_ty_from_ptr(int64_t ptr) {
13264         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13265         switch(obj->tag) {
13266                 case LDKSendError_Secp256k1: return 0;
13267                 case LDKSendError_TooBigPacket: return 1;
13268                 case LDKSendError_TooFewBlindedHops: return 2;
13269                 case LDKSendError_InvalidFirstHop: return 3;
13270                 case LDKSendError_PathNotFound: return 4;
13271                 case LDKSendError_InvalidMessage: return 5;
13272                 case LDKSendError_BufferFull: return 6;
13273                 case LDKSendError_GetNodeIdFailed: return 7;
13274                 case LDKSendError_UnresolvedIntroductionNode: return 8;
13275                 case LDKSendError_BlindedPathAdvanceFailed: return 9;
13276                 default: abort();
13277         }
13278 }
13279 int32_t CS_LDK_LDKSendError_Secp256k1_get_secp256k1(int64_t ptr) {
13280         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13281         CHECK(obj->tag == LDKSendError_Secp256k1);
13282         int32_t secp256k1_conv = LDKSecp256k1Error_to_cs(obj->secp256k1);
13283         return secp256k1_conv;
13284 }
13285 int8_tArray CS_LDK_LDKSendError_InvalidFirstHop_get_invalid_first_hop(int64_t ptr) {
13286         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13287         CHECK(obj->tag == LDKSendError_InvalidFirstHop);
13288         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
13289         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
13290         return invalid_first_hop_arr;
13291 }
13292 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
13293 CHECK(owner->result_ok);
13294         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
13295 }
13296 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(int64_t owner) {
13297         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
13298         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
13299         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
13300         return tag_ptr(ret_conv, true);
13301 }
13302
13303 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
13304 CHECK(!owner->result_ok);
13305         return SendError_clone(&*owner->contents.err);
13306 }
13307 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(int64_t owner) {
13308         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
13309         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13310         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
13311         int64_t ret_ref = tag_ptr(ret_copy, true);
13312         return ret_ref;
13313 }
13314
13315 uint32_t CS_LDK_LDKNextMessageHop_ty_from_ptr(int64_t ptr) {
13316         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13317         switch(obj->tag) {
13318                 case LDKNextMessageHop_NodeId: return 0;
13319                 case LDKNextMessageHop_ShortChannelId: return 1;
13320                 default: abort();
13321         }
13322 }
13323 int8_tArray CS_LDK_LDKNextMessageHop_NodeId_get_node_id(int64_t ptr) {
13324         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13325         CHECK(obj->tag == LDKNextMessageHop_NodeId);
13326         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
13327         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
13328         return node_id_arr;
13329 }
13330 int64_t CS_LDK_LDKNextMessageHop_ShortChannelId_get_short_channel_id(int64_t ptr) {
13331         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13332         CHECK(obj->tag == LDKNextMessageHop_ShortChannelId);
13333         int64_t short_channel_id_conv = obj->short_channel_id;
13334         return short_channel_id_conv;
13335 }
13336 uint32_t CS_LDK_LDKParsedOnionMessageContents_ty_from_ptr(int64_t ptr) {
13337         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13338         switch(obj->tag) {
13339                 case LDKParsedOnionMessageContents_Offers: return 0;
13340                 case LDKParsedOnionMessageContents_Custom: return 1;
13341                 default: abort();
13342         }
13343 }
13344 int64_t CS_LDK_LDKParsedOnionMessageContents_Offers_get_offers(int64_t ptr) {
13345         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13346         CHECK(obj->tag == LDKParsedOnionMessageContents_Offers);
13347         int64_t offers_ref = tag_ptr(&obj->offers, false);
13348         return offers_ref;
13349 }
13350 int64_t CS_LDK_LDKParsedOnionMessageContents_Custom_get_custom(int64_t ptr) {
13351         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13352         CHECK(obj->tag == LDKParsedOnionMessageContents_Custom);
13353         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
13354         *custom_ret = OnionMessageContents_clone(&obj->custom);
13355         return tag_ptr(custom_ret, true);
13356 }
13357 uint32_t CS_LDK_LDKPeeledOnion_ty_from_ptr(int64_t ptr) {
13358         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13359         switch(obj->tag) {
13360                 case LDKPeeledOnion_Forward: return 0;
13361                 case LDKPeeledOnion_Receive: return 1;
13362                 default: abort();
13363         }
13364 }
13365 int64_t CS_LDK_LDKPeeledOnion_Forward_get__0(int64_t ptr) {
13366         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13367         CHECK(obj->tag == LDKPeeledOnion_Forward);
13368         int64_t _0_ref = tag_ptr(&obj->forward._0, false);
13369         return _0_ref;
13370 }
13371 int64_t CS_LDK_LDKPeeledOnion_Forward_get__1(int64_t ptr) {
13372         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13373         CHECK(obj->tag == LDKPeeledOnion_Forward);
13374         LDKOnionMessage _1_var = obj->forward._1;
13375                         int64_t _1_ref = 0;
13376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
13377                         _1_ref = tag_ptr(_1_var.inner, false);
13378         return _1_ref;
13379 }
13380 int64_t CS_LDK_LDKPeeledOnion_Receive_get__0(int64_t ptr) {
13381         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13382         CHECK(obj->tag == LDKPeeledOnion_Receive);
13383         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
13384         return _0_ref;
13385 }
13386 int8_tArray CS_LDK_LDKPeeledOnion_Receive_get__1(int64_t ptr) {
13387         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13388         CHECK(obj->tag == LDKPeeledOnion_Receive);
13389         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
13390         memcpy(_1_arr->elems, obj->receive._1.data, 32);
13391         return _1_arr;
13392 }
13393 int64_t CS_LDK_LDKPeeledOnion_Receive_get__2(int64_t ptr) {
13394         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13395         CHECK(obj->tag == LDKPeeledOnion_Receive);
13396         LDKBlindedPath _2_var = obj->receive._2;
13397                         int64_t _2_ref = 0;
13398                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
13399                         _2_ref = tag_ptr(_2_var.inner, false);
13400         return _2_ref;
13401 }
13402 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
13403 CHECK(owner->result_ok);
13404         return PeeledOnion_clone(&*owner->contents.result);
13405 }
13406 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_get_ok(int64_t owner) {
13407         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
13408         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
13409         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
13410         int64_t ret_ref = tag_ptr(ret_copy, true);
13411         return ret_ref;
13412 }
13413
13414 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
13415 CHECK(!owner->result_ok);
13416         return *owner->contents.err;
13417 }
13418 void  CS_LDK_CResult_PeeledOnionNoneZ_get_err(int64_t owner) {
13419         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
13420         CResult_PeeledOnionNoneZ_get_err(owner_conv);
13421 }
13422
13423 uint32_t CS_LDK_LDKSendSuccess_ty_from_ptr(int64_t ptr) {
13424         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
13425         switch(obj->tag) {
13426                 case LDKSendSuccess_Buffered: return 0;
13427                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
13428                 default: abort();
13429         }
13430 }
13431 int8_tArray CS_LDK_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(int64_t ptr) {
13432         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
13433         CHECK(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
13434         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
13435         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
13436         return buffered_awaiting_connection_arr;
13437 }
13438 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
13439 CHECK(owner->result_ok);
13440         return SendSuccess_clone(&*owner->contents.result);
13441 }
13442 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_ok(int64_t owner) {
13443         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
13444         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
13445         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
13446         int64_t ret_ref = tag_ptr(ret_copy, true);
13447         return ret_ref;
13448 }
13449
13450 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
13451 CHECK(!owner->result_ok);
13452         return SendError_clone(&*owner->contents.err);
13453 }
13454 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_err(int64_t owner) {
13455         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
13456         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13457         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
13458         int64_t ret_ref = tag_ptr(ret_copy, true);
13459         return ret_ref;
13460 }
13461
13462 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13463         LDKBlindedPath ret = *owner->contents.result;
13464         ret.is_owned = false;
13465         return ret;
13466 }
13467 int64_t  CS_LDK_CResult_BlindedPathNoneZ_get_ok(int64_t owner) {
13468         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13469         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
13470         int64_t ret_ref = 0;
13471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13473         return ret_ref;
13474 }
13475
13476 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13477 CHECK(!owner->result_ok);
13478         return *owner->contents.err;
13479 }
13480 void  CS_LDK_CResult_BlindedPathNoneZ_get_err(int64_t owner) {
13481         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13482         CResult_BlindedPathNoneZ_get_err(owner_conv);
13483 }
13484
13485 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13486 CHECK(owner->result_ok);
13487         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
13488 }
13489 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(int64_t owner) {
13490         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13491         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13492         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
13493         return tag_ptr(ret_conv, true);
13494 }
13495
13496 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13497 CHECK(!owner->result_ok);
13498         return *owner->contents.err;
13499 }
13500 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(int64_t owner) {
13501         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13502         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
13503 }
13504
13505 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
13506         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
13507         for (size_t i = 0; i < ret.datalen; i++) {
13508                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
13509         }
13510         return ret;
13511 }
13512 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13513         LDKBlindedPath ret = *owner->contents.result;
13514         ret.is_owned = false;
13515         return ret;
13516 }
13517 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_ok(int64_t owner) {
13518         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13519         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
13520         int64_t ret_ref = 0;
13521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13523         return ret_ref;
13524 }
13525
13526 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13527 CHECK(!owner->result_ok);
13528         return DecodeError_clone(&*owner->contents.err);
13529 }
13530 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_err(int64_t owner) {
13531         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13533         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
13534         int64_t ret_ref = tag_ptr(ret_copy, true);
13535         return ret_ref;
13536 }
13537
13538 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13539         LDKBlindedHop ret = *owner->contents.result;
13540         ret.is_owned = false;
13541         return ret;
13542 }
13543 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_ok(int64_t owner) {
13544         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13545         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
13546         int64_t ret_ref = 0;
13547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13549         return ret_ref;
13550 }
13551
13552 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13553 CHECK(!owner->result_ok);
13554         return DecodeError_clone(&*owner->contents.err);
13555 }
13556 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_err(int64_t owner) {
13557         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13558         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13559         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
13560         int64_t ret_ref = tag_ptr(ret_copy, true);
13561         return ret_ref;
13562 }
13563
13564 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13565         LDKInvoiceError ret = *owner->contents.result;
13566         ret.is_owned = false;
13567         return ret;
13568 }
13569 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_ok(int64_t owner) {
13570         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13571         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
13572         int64_t ret_ref = 0;
13573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13575         return ret_ref;
13576 }
13577
13578 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13579 CHECK(!owner->result_ok);
13580         return DecodeError_clone(&*owner->contents.err);
13581 }
13582 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_err(int64_t owner) {
13583         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13584         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13585         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
13586         int64_t ret_ref = tag_ptr(ret_copy, true);
13587         return ret_ref;
13588 }
13589
13590 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13591         LDKTrackedSpendableOutput ret = *owner->contents.result;
13592         ret.is_owned = false;
13593         return ret;
13594 }
13595 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(int64_t owner) {
13596         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13597         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
13598         int64_t ret_ref = 0;
13599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13601         return ret_ref;
13602 }
13603
13604 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13605 CHECK(!owner->result_ok);
13606         return DecodeError_clone(&*owner->contents.err);
13607 }
13608 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_get_err(int64_t owner) {
13609         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13611         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
13612         int64_t ret_ref = tag_ptr(ret_copy, true);
13613         return ret_ref;
13614 }
13615
13616 uint32_t CS_LDK_LDKOutputSpendStatus_ty_from_ptr(int64_t ptr) {
13617         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13618         switch(obj->tag) {
13619                 case LDKOutputSpendStatus_PendingInitialBroadcast: return 0;
13620                 case LDKOutputSpendStatus_PendingFirstConfirmation: return 1;
13621                 case LDKOutputSpendStatus_PendingThresholdConfirmations: return 2;
13622                 default: abort();
13623         }
13624 }
13625 int64_t CS_LDK_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(int64_t ptr) {
13626         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13627         CHECK(obj->tag == LDKOutputSpendStatus_PendingInitialBroadcast);
13628         int64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
13629         return delayed_until_height_ref;
13630 }
13631 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(int64_t ptr) {
13632         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13633         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13634         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13635         memcpy(first_broadcast_hash_arr->elems, obj->pending_first_confirmation.first_broadcast_hash.data, 32);
13636         return first_broadcast_hash_arr;
13637 }
13638 int32_t CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(int64_t ptr) {
13639         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13640         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13641         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
13642         return latest_broadcast_height_conv;
13643 }
13644 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(int64_t ptr) {
13645         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13646         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13647         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
13648                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13649                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13650         return latest_spending_tx_arr;
13651 }
13652 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(int64_t ptr) {
13653         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13654         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13655         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13656         memcpy(first_broadcast_hash_arr->elems, obj->pending_threshold_confirmations.first_broadcast_hash.data, 32);
13657         return first_broadcast_hash_arr;
13658 }
13659 int32_t CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(int64_t ptr) {
13660         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13661         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13662         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
13663         return latest_broadcast_height_conv;
13664 }
13665 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(int64_t ptr) {
13666         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13667         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13668         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
13669                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13670                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13671         return latest_spending_tx_arr;
13672 }
13673 int32_t CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(int64_t ptr) {
13674         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13675         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13676         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
13677         return confirmation_height_conv;
13678 }
13679 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(int64_t ptr) {
13680         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13681         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13682         int8_tArray confirmation_hash_arr = init_int8_tArray(32, __LINE__);
13683         memcpy(confirmation_hash_arr->elems, obj->pending_threshold_confirmations.confirmation_hash.data, 32);
13684         return confirmation_hash_arr;
13685 }
13686 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13687 CHECK(owner->result_ok);
13688         return OutputSpendStatus_clone(&*owner->contents.result);
13689 }
13690 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_get_ok(int64_t owner) {
13691         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13692         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
13693         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
13694         int64_t ret_ref = tag_ptr(ret_copy, true);
13695         return ret_ref;
13696 }
13697
13698 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13699 CHECK(!owner->result_ok);
13700         return DecodeError_clone(&*owner->contents.err);
13701 }
13702 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_get_err(int64_t owner) {
13703         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13705         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
13706         int64_t ret_ref = tag_ptr(ret_copy, true);
13707         return ret_ref;
13708 }
13709
13710 typedef struct LDKFilter_JCalls {
13711         atomic_size_t refcnt;
13712         uint32_t instance_ptr;
13713 } LDKFilter_JCalls;
13714 static void LDKFilter_JCalls_free(void* this_arg) {
13715         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13716         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13717                 FREE(j_calls);
13718         }
13719 }
13720 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13721         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13722         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13723         memcpy(txid_arr->elems, *txid, 32);
13724         LDKu8slice script_pubkey_var = script_pubkey;
13725         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
13726         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
13727         js_invoke_function_void_ll(j_calls->instance_ptr, 56, (int64_t)txid_arr, (int64_t)script_pubkey_arr);
13728 }
13729 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13730         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13731         LDKWatchedOutput output_var = output;
13732         int64_t output_ref = 0;
13733         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13734         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13735         js_invoke_function_void_l(j_calls->instance_ptr, 57, output_ref);
13736 }
13737 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13738         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13739         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13740 }
13741 static inline LDKFilter LDKFilter_init (int64_t o) {
13742         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13743         atomic_init(&calls->refcnt, 1);
13744         calls->instance_ptr = o;
13745
13746         LDKFilter ret = {
13747                 .this_arg = (void*) calls,
13748                 .register_tx = register_tx_LDKFilter_jcall,
13749                 .register_output = register_output_LDKFilter_jcall,
13750                 .free = LDKFilter_JCalls_free,
13751         };
13752         return ret;
13753 }
13754 uint64_t  CS_LDK_LDKFilter_new(int32_t o) {
13755         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13756         *res_ptr = LDKFilter_init(o);
13757         return tag_ptr(res_ptr, true);
13758 }
13759 void  CS_LDK_Filter_register_tx(int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
13760         void* this_arg_ptr = untag_ptr(this_arg);
13761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13762         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13763         uint8_t txid_arr[32];
13764         CHECK(txid->arr_len == 32);
13765         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13766         uint8_t (*txid_ref)[32] = &txid_arr;
13767         LDKu8slice script_pubkey_ref;
13768         script_pubkey_ref.datalen = script_pubkey->arr_len;
13769         script_pubkey_ref.data = script_pubkey->elems;
13770         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13771         FREE(script_pubkey);
13772 }
13773
13774 void  CS_LDK_Filter_register_output(int64_t this_arg, int64_t output) {
13775         void* this_arg_ptr = untag_ptr(this_arg);
13776         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13777         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13778         LDKWatchedOutput output_conv;
13779         output_conv.inner = untag_ptr(output);
13780         output_conv.is_owned = ptr_is_owned(output);
13781         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13782         output_conv = WatchedOutput_clone(&output_conv);
13783         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13784 }
13785
13786 uint32_t CS_LDK_LDKCOption_FilterZ_ty_from_ptr(int64_t ptr) {
13787         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13788         switch(obj->tag) {
13789                 case LDKCOption_FilterZ_Some: return 0;
13790                 case LDKCOption_FilterZ_None: return 1;
13791                 default: abort();
13792         }
13793 }
13794 int64_t CS_LDK_LDKCOption_FilterZ_Some_get_some(int64_t ptr) {
13795         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13796         CHECK(obj->tag == LDKCOption_FilterZ_Some);
13797         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13798         *some_ret = obj->some;
13799                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13800                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13801                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13802                                 LDKFilter_JCalls_cloned(&(*some_ret));
13803                         }
13804         return tag_ptr(some_ret, true);
13805 }
13806 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
13807         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
13808         for (size_t i = 0; i < ret.datalen; i++) {
13809                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
13810         }
13811         return ret;
13812 }
13813 typedef struct LDKChangeDestinationSource_JCalls {
13814         atomic_size_t refcnt;
13815         uint32_t instance_ptr;
13816 } LDKChangeDestinationSource_JCalls;
13817 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
13818         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13819         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13820                 FREE(j_calls);
13821         }
13822 }
13823 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
13824         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13825         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 58);
13826         void* ret_ptr = untag_ptr(ret);
13827         CHECK_ACCESS(ret_ptr);
13828         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
13829         FREE(untag_ptr(ret));
13830         return ret_conv;
13831 }
13832 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
13833         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
13834         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13835 }
13836 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (int64_t o) {
13837         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
13838         atomic_init(&calls->refcnt, 1);
13839         calls->instance_ptr = o;
13840
13841         LDKChangeDestinationSource ret = {
13842                 .this_arg = (void*) calls,
13843                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
13844                 .free = LDKChangeDestinationSource_JCalls_free,
13845         };
13846         return ret;
13847 }
13848 uint64_t  CS_LDK_LDKChangeDestinationSource_new(int32_t o) {
13849         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
13850         *res_ptr = LDKChangeDestinationSource_init(o);
13851         return tag_ptr(res_ptr, true);
13852 }
13853 int64_t  CS_LDK_ChangeDestinationSource_get_change_destination_script(int64_t this_arg) {
13854         void* this_arg_ptr = untag_ptr(this_arg);
13855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13856         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
13857         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
13858         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
13859         return tag_ptr(ret_conv, true);
13860 }
13861
13862 typedef struct LDKKVStore_JCalls {
13863         atomic_size_t refcnt;
13864         uint32_t instance_ptr;
13865 } LDKKVStore_JCalls;
13866 static void LDKKVStore_JCalls_free(void* this_arg) {
13867         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13868         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13869                 FREE(j_calls);
13870         }
13871 }
13872 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13873         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13874         LDKStr primary_namespace_str = primary_namespace;
13875         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13876         Str_free(primary_namespace_str);
13877         LDKStr secondary_namespace_str = secondary_namespace;
13878         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13879         Str_free(secondary_namespace_str);
13880         LDKStr key_str = key;
13881         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13882         Str_free(key_str);
13883         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 59, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
13884         void* ret_ptr = untag_ptr(ret);
13885         CHECK_ACCESS(ret_ptr);
13886         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13887         FREE(untag_ptr(ret));
13888         return ret_conv;
13889 }
13890 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13891         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13892         LDKStr primary_namespace_str = primary_namespace;
13893         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13894         Str_free(primary_namespace_str);
13895         LDKStr secondary_namespace_str = secondary_namespace;
13896         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13897         Str_free(secondary_namespace_str);
13898         LDKStr key_str = key;
13899         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13900         Str_free(key_str);
13901         LDKu8slice buf_var = buf;
13902         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13903         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13904         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 60, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
13905         void* ret_ptr = untag_ptr(ret);
13906         CHECK_ACCESS(ret_ptr);
13907         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13908         FREE(untag_ptr(ret));
13909         return ret_conv;
13910 }
13911 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13912         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13913         LDKStr primary_namespace_str = primary_namespace;
13914         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13915         Str_free(primary_namespace_str);
13916         LDKStr secondary_namespace_str = secondary_namespace;
13917         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13918         Str_free(secondary_namespace_str);
13919         LDKStr key_str = key;
13920         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13921         Str_free(key_str);
13922         jboolean lazy_conv = lazy;
13923         uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 61, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
13924         void* ret_ptr = untag_ptr(ret);
13925         CHECK_ACCESS(ret_ptr);
13926         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13927         FREE(untag_ptr(ret));
13928         return ret_conv;
13929 }
13930 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13931         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13932         LDKStr primary_namespace_str = primary_namespace;
13933         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13934         Str_free(primary_namespace_str);
13935         LDKStr secondary_namespace_str = secondary_namespace;
13936         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13937         Str_free(secondary_namespace_str);
13938         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 62, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
13939         void* ret_ptr = untag_ptr(ret);
13940         CHECK_ACCESS(ret_ptr);
13941         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13942         FREE(untag_ptr(ret));
13943         return ret_conv;
13944 }
13945 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13946         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13947         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13948 }
13949 static inline LDKKVStore LDKKVStore_init (int64_t o) {
13950         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13951         atomic_init(&calls->refcnt, 1);
13952         calls->instance_ptr = o;
13953
13954         LDKKVStore ret = {
13955                 .this_arg = (void*) calls,
13956                 .read = read_LDKKVStore_jcall,
13957                 .write = write_LDKKVStore_jcall,
13958                 .remove = remove_LDKKVStore_jcall,
13959                 .list = list_LDKKVStore_jcall,
13960                 .free = LDKKVStore_JCalls_free,
13961         };
13962         return ret;
13963 }
13964 uint64_t  CS_LDK_LDKKVStore_new(int32_t o) {
13965         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13966         *res_ptr = LDKKVStore_init(o);
13967         return tag_ptr(res_ptr, true);
13968 }
13969 int64_t  CS_LDK_KVStore_read(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13970         void* this_arg_ptr = untag_ptr(this_arg);
13971         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13972         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13973         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13974         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13975         LDKStr key_conv = str_ref_to_owned_c(key);
13976         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13977         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13978         return tag_ptr(ret_conv, true);
13979 }
13980
13981 int64_t  CS_LDK_KVStore_write(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
13982         void* this_arg_ptr = untag_ptr(this_arg);
13983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13984         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13985         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13986         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13987         LDKStr key_conv = str_ref_to_owned_c(key);
13988         LDKu8slice buf_ref;
13989         buf_ref.datalen = buf->arr_len;
13990         buf_ref.data = buf->elems;
13991         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13992         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13993         FREE(buf);
13994         return tag_ptr(ret_conv, true);
13995 }
13996
13997 int64_t  CS_LDK_KVStore_remove(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
13998         void* this_arg_ptr = untag_ptr(this_arg);
13999         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14000         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14001         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14002         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14003         LDKStr key_conv = str_ref_to_owned_c(key);
14004         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14005         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
14006         return tag_ptr(ret_conv, true);
14007 }
14008
14009 int64_t  CS_LDK_KVStore_list(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
14010         void* this_arg_ptr = untag_ptr(this_arg);
14011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14012         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14013         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14014         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14015         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
14016         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
14017         return tag_ptr(ret_conv, true);
14018 }
14019
14020 typedef struct LDKOutputSpender_JCalls {
14021         atomic_size_t refcnt;
14022         uint32_t instance_ptr;
14023 } LDKOutputSpender_JCalls;
14024 static void LDKOutputSpender_JCalls_free(void* this_arg) {
14025         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
14026         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14027                 FREE(j_calls);
14028         }
14029 }
14030 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) {
14031         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
14032         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
14033         int64_tArray descriptors_arr = NULL;
14034         descriptors_arr = init_int64_tArray(descriptors_var.datalen, __LINE__);
14035         int64_t *descriptors_arr_ptr = (int64_t*)(((uint8_t*)descriptors_arr) + 8);
14036         for (size_t b = 0; b < descriptors_var.datalen; b++) {
14037                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14038                 *descriptors_conv_27_copy = descriptors_var.data[b];
14039                 int64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
14040                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
14041         }
14042         
14043         FREE(descriptors_var.data);
14044         LDKCVec_TxOutZ outputs_var = outputs;
14045         int64_tArray outputs_arr = NULL;
14046         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
14047         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
14048         for (size_t h = 0; h < outputs_var.datalen; h++) {
14049                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14050                 *outputs_conv_7_ref = outputs_var.data[h];
14051                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
14052         }
14053         
14054         FREE(outputs_var.data);
14055         LDKCVec_u8Z change_destination_script_var = change_destination_script;
14056         int8_tArray change_destination_script_arr = init_int8_tArray(change_destination_script_var.datalen, __LINE__);
14057         memcpy(change_destination_script_arr->elems, change_destination_script_var.data, change_destination_script_var.datalen);
14058         CVec_u8Z_free(change_destination_script_var);
14059         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
14060         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14061         *locktime_copy = locktime;
14062         int64_t locktime_ref = tag_ptr(locktime_copy, true);
14063         uint64_t ret = js_invoke_function_l_lllil(j_calls->instance_ptr, 63, (int64_t)descriptors_arr, (int64_t)outputs_arr, (int64_t)change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref);
14064         void* ret_ptr = untag_ptr(ret);
14065         CHECK_ACCESS(ret_ptr);
14066         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14067         FREE(untag_ptr(ret));
14068         return ret_conv;
14069 }
14070 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
14071         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
14072         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14073 }
14074 static inline LDKOutputSpender LDKOutputSpender_init (int64_t o) {
14075         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
14076         atomic_init(&calls->refcnt, 1);
14077         calls->instance_ptr = o;
14078
14079         LDKOutputSpender ret = {
14080                 .this_arg = (void*) calls,
14081                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
14082                 .free = LDKOutputSpender_JCalls_free,
14083         };
14084         return ret;
14085 }
14086 uint64_t  CS_LDK_LDKOutputSpender_new(int32_t o) {
14087         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
14088         *res_ptr = LDKOutputSpender_init(o);
14089         return tag_ptr(res_ptr, true);
14090 }
14091 int64_t  CS_LDK_OutputSpender_spend_spendable_outputs(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) {
14092         void* this_arg_ptr = untag_ptr(this_arg);
14093         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14094         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
14095         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
14096         descriptors_constr.datalen = descriptors->arr_len;
14097         if (descriptors_constr.datalen > 0)
14098                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14099         else
14100                 descriptors_constr.data = NULL;
14101         int64_t* descriptors_vals = descriptors->elems;
14102         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
14103                 int64_t descriptors_conv_27 = descriptors_vals[b];
14104                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
14105                 CHECK_ACCESS(descriptors_conv_27_ptr);
14106                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
14107                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
14108                 descriptors_constr.data[b] = descriptors_conv_27_conv;
14109         }
14110         FREE(descriptors);
14111         LDKCVec_TxOutZ outputs_constr;
14112         outputs_constr.datalen = outputs->arr_len;
14113         if (outputs_constr.datalen > 0)
14114                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14115         else
14116                 outputs_constr.data = NULL;
14117         int64_t* outputs_vals = outputs->elems;
14118         for (size_t h = 0; h < outputs_constr.datalen; h++) {
14119                 int64_t outputs_conv_7 = outputs_vals[h];
14120                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
14121                 CHECK_ACCESS(outputs_conv_7_ptr);
14122                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
14123                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
14124                 outputs_constr.data[h] = outputs_conv_7_conv;
14125         }
14126         FREE(outputs);
14127         LDKCVec_u8Z change_destination_script_ref;
14128         change_destination_script_ref.datalen = change_destination_script->arr_len;
14129         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
14130         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
14131         void* locktime_ptr = untag_ptr(locktime);
14132         CHECK_ACCESS(locktime_ptr);
14133         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
14134         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
14135         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14136         *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);
14137         return tag_ptr(ret_conv, true);
14138 }
14139
14140 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
14141         LDKOutputSweeper ret = *owner->contents.result;
14142         ret.is_owned = false;
14143         return ret;
14144 }
14145 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_get_ok(int64_t owner) {
14146         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
14147         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
14148         int64_t ret_ref = 0;
14149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14151         return ret_ref;
14152 }
14153
14154 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
14155 CHECK(!owner->result_ok);
14156         return DecodeError_clone(&*owner->contents.err);
14157 }
14158 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_get_err(int64_t owner) {
14159         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
14160         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14161         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
14162         int64_t ret_ref = tag_ptr(ret_copy, true);
14163         return ret_ref;
14164 }
14165
14166 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
14167         LDKBestBlock ret = owner->a;
14168         ret.is_owned = false;
14169         return ret;
14170 }
14171 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_get_a(int64_t owner) {
14172         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
14173         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
14174         int64_t ret_ref = 0;
14175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14177         return ret_ref;
14178 }
14179
14180 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
14181         LDKOutputSweeper ret = owner->b;
14182         ret.is_owned = false;
14183         return ret;
14184 }
14185 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_get_b(int64_t owner) {
14186         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
14187         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
14188         int64_t ret_ref = 0;
14189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14191         return ret_ref;
14192 }
14193
14194 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
14195 CHECK(owner->result_ok);
14196         return &*owner->contents.result;
14197 }
14198 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(int64_t owner) {
14199         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
14200         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
14201         return ret_ret;
14202 }
14203
14204 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
14205 CHECK(!owner->result_ok);
14206         return DecodeError_clone(&*owner->contents.err);
14207 }
14208 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(int64_t owner) {
14209         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
14210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14211         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
14212         int64_t ret_ref = tag_ptr(ret_copy, true);
14213         return ret_ref;
14214 }
14215
14216 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
14217         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
14218         ret.is_owned = false;
14219         return ret;
14220 }
14221 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(int64_t owner) {
14222         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
14223         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
14224         int64_t ret_ref = 0;
14225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14227         return ret_ref;
14228 }
14229
14230 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
14231 CHECK(!owner->result_ok);
14232         return DecodeError_clone(&*owner->contents.err);
14233 }
14234 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(int64_t owner) {
14235         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
14236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14237         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
14238         int64_t ret_ref = tag_ptr(ret_copy, true);
14239         return ret_ref;
14240 }
14241
14242 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
14243         LDKDelayedPaymentKey ret = *owner->contents.result;
14244         ret.is_owned = false;
14245         return ret;
14246 }
14247 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(int64_t owner) {
14248         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
14249         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
14250         int64_t ret_ref = 0;
14251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14253         return ret_ref;
14254 }
14255
14256 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
14257 CHECK(!owner->result_ok);
14258         return DecodeError_clone(&*owner->contents.err);
14259 }
14260 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(int64_t owner) {
14261         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
14262         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14263         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
14264         int64_t ret_ref = tag_ptr(ret_copy, true);
14265         return ret_ref;
14266 }
14267
14268 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
14269         LDKHtlcBasepoint ret = *owner->contents.result;
14270         ret.is_owned = false;
14271         return ret;
14272 }
14273 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_ok(int64_t owner) {
14274         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
14275         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
14276         int64_t ret_ref = 0;
14277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14279         return ret_ref;
14280 }
14281
14282 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
14283 CHECK(!owner->result_ok);
14284         return DecodeError_clone(&*owner->contents.err);
14285 }
14286 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_err(int64_t owner) {
14287         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
14288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14289         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
14290         int64_t ret_ref = tag_ptr(ret_copy, true);
14291         return ret_ref;
14292 }
14293
14294 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
14295         LDKHtlcKey ret = *owner->contents.result;
14296         ret.is_owned = false;
14297         return ret;
14298 }
14299 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_ok(int64_t owner) {
14300         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
14301         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
14302         int64_t ret_ref = 0;
14303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14305         return ret_ref;
14306 }
14307
14308 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
14309 CHECK(!owner->result_ok);
14310         return DecodeError_clone(&*owner->contents.err);
14311 }
14312 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_err(int64_t owner) {
14313         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
14314         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14315         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
14316         int64_t ret_ref = tag_ptr(ret_copy, true);
14317         return ret_ref;
14318 }
14319
14320 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
14321         LDKRevocationBasepoint ret = *owner->contents.result;
14322         ret.is_owned = false;
14323         return ret;
14324 }
14325 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_ok(int64_t owner) {
14326         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
14327         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
14328         int64_t ret_ref = 0;
14329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14331         return ret_ref;
14332 }
14333
14334 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
14335 CHECK(!owner->result_ok);
14336         return DecodeError_clone(&*owner->contents.err);
14337 }
14338 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_err(int64_t owner) {
14339         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
14340         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14341         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
14342         int64_t ret_ref = tag_ptr(ret_copy, true);
14343         return ret_ref;
14344 }
14345
14346 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
14347         LDKRevocationKey ret = *owner->contents.result;
14348         ret.is_owned = false;
14349         return ret;
14350 }
14351 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_ok(int64_t owner) {
14352         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
14353         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
14354         int64_t ret_ref = 0;
14355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14357         return ret_ref;
14358 }
14359
14360 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
14361 CHECK(!owner->result_ok);
14362         return DecodeError_clone(&*owner->contents.err);
14363 }
14364 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_err(int64_t owner) {
14365         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
14366         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14367         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
14368         int64_t ret_ref = tag_ptr(ret_copy, true);
14369         return ret_ref;
14370 }
14371
14372 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14373         LDKLockedChannelMonitor ret = *owner->contents.result;
14374         ret.is_owned = false;
14375         return ret;
14376 }
14377 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_ok(int64_t owner) {
14378         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14379         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14380         int64_t ret_ref = 0;
14381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14383         return ret_ref;
14384 }
14385
14386 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14387 CHECK(!owner->result_ok);
14388         return *owner->contents.err;
14389 }
14390 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_err(int64_t owner) {
14391         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14392         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14393 }
14394
14395 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
14396         LDKOutPoint ret = owner->a;
14397         ret.is_owned = false;
14398         return ret;
14399 }
14400 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_get_a(int64_t owner) {
14401         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
14402         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
14403         int64_t ret_ref = 0;
14404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14406         return ret_ref;
14407 }
14408
14409 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
14410         LDKChannelId ret = owner->b;
14411         ret.is_owned = false;
14412         return ret;
14413 }
14414 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_get_b(int64_t owner) {
14415         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
14416         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
14417         int64_t ret_ref = 0;
14418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14420         return ret_ref;
14421 }
14422
14423 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
14424         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
14425         for (size_t i = 0; i < ret.datalen; i++) {
14426                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
14427         }
14428         return ret;
14429 }
14430 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14431         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14432         for (size_t i = 0; i < ret.datalen; i++) {
14433                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14434         }
14435         return ret;
14436 }
14437 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14438         LDKOutPoint ret = owner->a;
14439         ret.is_owned = false;
14440         return ret;
14441 }
14442 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(int64_t owner) {
14443         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14444         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14445         int64_t ret_ref = 0;
14446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14448         return ret_ref;
14449 }
14450
14451 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14452         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14453 }
14454 int64_tArray  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(int64_t owner) {
14455         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14456         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14457         int64_tArray ret_arr = NULL;
14458         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
14459         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
14460         for (size_t r = 0; r < ret_var.datalen; r++) {
14461                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14462                 int64_t ret_conv_17_ref = 0;
14463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14464                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14465                 ret_arr_ptr[r] = ret_conv_17_ref;
14466         }
14467         
14468         FREE(ret_var.data);
14469         return ret_arr;
14470 }
14471
14472 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14473         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14474         for (size_t i = 0; i < ret.datalen; i++) {
14475                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14476         }
14477         return ret;
14478 }
14479 typedef struct LDKPersister_JCalls {
14480         atomic_size_t refcnt;
14481         uint32_t instance_ptr;
14482 } LDKPersister_JCalls;
14483 static void LDKPersister_JCalls_free(void* this_arg) {
14484         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14485         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14486                 FREE(j_calls);
14487         }
14488 }
14489 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14490         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14491         LDKChannelManager channel_manager_var = *channel_manager;
14492         int64_t channel_manager_ref = 0;
14493         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14494         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14495         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14496         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 64, channel_manager_ref);
14497         void* ret_ptr = untag_ptr(ret);
14498         CHECK_ACCESS(ret_ptr);
14499         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14500         FREE(untag_ptr(ret));
14501         return ret_conv;
14502 }
14503 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14504         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14505         LDKNetworkGraph network_graph_var = *network_graph;
14506         int64_t network_graph_ref = 0;
14507         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14508         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14509         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14510         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 65, network_graph_ref);
14511         void* ret_ptr = untag_ptr(ret);
14512         CHECK_ACCESS(ret_ptr);
14513         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14514         FREE(untag_ptr(ret));
14515         return ret_conv;
14516 }
14517 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14518         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14519         // WARNING: This object doesn't live past this scope, needs clone!
14520         int64_t ret_scorer = tag_ptr(scorer, false);
14521         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 66, ret_scorer);
14522         void* ret_ptr = untag_ptr(ret);
14523         CHECK_ACCESS(ret_ptr);
14524         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14525         FREE(untag_ptr(ret));
14526         return ret_conv;
14527 }
14528 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14529         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14530         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14531 }
14532 static inline LDKPersister LDKPersister_init (int64_t o) {
14533         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14534         atomic_init(&calls->refcnt, 1);
14535         calls->instance_ptr = o;
14536
14537         LDKPersister ret = {
14538                 .this_arg = (void*) calls,
14539                 .persist_manager = persist_manager_LDKPersister_jcall,
14540                 .persist_graph = persist_graph_LDKPersister_jcall,
14541                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14542                 .free = LDKPersister_JCalls_free,
14543         };
14544         return ret;
14545 }
14546 uint64_t  CS_LDK_LDKPersister_new(int32_t o) {
14547         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14548         *res_ptr = LDKPersister_init(o);
14549         return tag_ptr(res_ptr, true);
14550 }
14551 int64_t  CS_LDK_Persister_persist_manager(int64_t this_arg, int64_t channel_manager) {
14552         void* this_arg_ptr = untag_ptr(this_arg);
14553         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14554         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14555         LDKChannelManager channel_manager_conv;
14556         channel_manager_conv.inner = untag_ptr(channel_manager);
14557         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14558         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14559         channel_manager_conv.is_owned = false;
14560         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14561         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14562         return tag_ptr(ret_conv, true);
14563 }
14564
14565 int64_t  CS_LDK_Persister_persist_graph(int64_t this_arg, int64_t network_graph) {
14566         void* this_arg_ptr = untag_ptr(this_arg);
14567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14568         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14569         LDKNetworkGraph network_graph_conv;
14570         network_graph_conv.inner = untag_ptr(network_graph);
14571         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14572         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14573         network_graph_conv.is_owned = false;
14574         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14575         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14576         return tag_ptr(ret_conv, true);
14577 }
14578
14579 int64_t  CS_LDK_Persister_persist_scorer(int64_t this_arg, int64_t scorer) {
14580         void* this_arg_ptr = untag_ptr(this_arg);
14581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14582         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14583         void* scorer_ptr = untag_ptr(scorer);
14584         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14585         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14586         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14587         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14588         return tag_ptr(ret_conv, true);
14589 }
14590
14591 typedef struct LDKPersist_JCalls {
14592         atomic_size_t refcnt;
14593         uint32_t instance_ptr;
14594 } LDKPersist_JCalls;
14595 static void LDKPersist_JCalls_free(void* this_arg) {
14596         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14597         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14598                 FREE(j_calls);
14599         }
14600 }
14601 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14602         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14603         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14604         int64_t channel_funding_outpoint_ref = 0;
14605         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14606         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14607         LDKChannelMonitor data_var = *data;
14608         int64_t data_ref = 0;
14609         data_var = ChannelMonitor_clone(&data_var);
14610         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14611         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14612         LDKMonitorUpdateId update_id_var = update_id;
14613         int64_t update_id_ref = 0;
14614         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14615         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14616         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_lll(j_calls->instance_ptr, 67, channel_funding_outpoint_ref, data_ref, update_id_ref);
14617         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
14618         return ret_conv;
14619 }
14620 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14621         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14622         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14623         int64_t channel_funding_outpoint_ref = 0;
14624         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14625         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14626         LDKChannelMonitorUpdate update_var = update;
14627         int64_t update_ref = 0;
14628         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14629         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14630         LDKChannelMonitor data_var = *data;
14631         int64_t data_ref = 0;
14632         data_var = ChannelMonitor_clone(&data_var);
14633         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14634         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14635         LDKMonitorUpdateId update_id_var = update_id;
14636         int64_t update_id_ref = 0;
14637         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14638         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14639         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_llll(j_calls->instance_ptr, 68, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref);
14640         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
14641         return ret_conv;
14642 }
14643 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
14644         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14645         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14646         int64_t channel_funding_outpoint_ref = 0;
14647         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14648         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14649         js_invoke_function_void_l(j_calls->instance_ptr, 69, channel_funding_outpoint_ref);
14650 }
14651 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14652         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14653         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14654 }
14655 static inline LDKPersist LDKPersist_init (int64_t o) {
14656         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14657         atomic_init(&calls->refcnt, 1);
14658         calls->instance_ptr = o;
14659
14660         LDKPersist ret = {
14661                 .this_arg = (void*) calls,
14662                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14663                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14664                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
14665                 .free = LDKPersist_JCalls_free,
14666         };
14667         return ret;
14668 }
14669 uint64_t  CS_LDK_LDKPersist_new(int32_t o) {
14670         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14671         *res_ptr = LDKPersist_init(o);
14672         return tag_ptr(res_ptr, true);
14673 }
14674 int32_t  CS_LDK_Persist_persist_new_channel(int64_t this_arg, int64_t channel_funding_outpoint, int64_t data, int64_t update_id) {
14675         void* this_arg_ptr = untag_ptr(this_arg);
14676         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14677         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14678         LDKOutPoint channel_funding_outpoint_conv;
14679         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14680         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14681         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14682         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14683         LDKChannelMonitor data_conv;
14684         data_conv.inner = untag_ptr(data);
14685         data_conv.is_owned = ptr_is_owned(data);
14686         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14687         data_conv.is_owned = false;
14688         LDKMonitorUpdateId update_id_conv;
14689         update_id_conv.inner = untag_ptr(update_id);
14690         update_id_conv.is_owned = ptr_is_owned(update_id);
14691         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14692         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14693         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
14694         return ret_conv;
14695 }
14696
14697 int32_t  CS_LDK_Persist_update_persisted_channel(int64_t this_arg, int64_t channel_funding_outpoint, int64_t update, int64_t data, int64_t update_id) {
14698         void* this_arg_ptr = untag_ptr(this_arg);
14699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14700         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14701         LDKOutPoint channel_funding_outpoint_conv;
14702         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14703         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14704         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14705         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14706         LDKChannelMonitorUpdate update_conv;
14707         update_conv.inner = untag_ptr(update);
14708         update_conv.is_owned = ptr_is_owned(update);
14709         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14710         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14711         LDKChannelMonitor data_conv;
14712         data_conv.inner = untag_ptr(data);
14713         data_conv.is_owned = ptr_is_owned(data);
14714         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14715         data_conv.is_owned = false;
14716         LDKMonitorUpdateId update_id_conv;
14717         update_id_conv.inner = untag_ptr(update_id);
14718         update_id_conv.is_owned = ptr_is_owned(update_id);
14719         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14720         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14721         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
14722         return ret_conv;
14723 }
14724
14725 void  CS_LDK_Persist_archive_persisted_channel(int64_t this_arg, int64_t channel_funding_outpoint) {
14726         void* this_arg_ptr = untag_ptr(this_arg);
14727         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14728         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14729         LDKOutPoint channel_funding_outpoint_conv;
14730         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14731         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14732         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14733         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14734         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
14735 }
14736
14737 typedef struct LDKListen_JCalls {
14738         atomic_size_t refcnt;
14739         uint32_t instance_ptr;
14740 } LDKListen_JCalls;
14741 static void LDKListen_JCalls_free(void* this_arg) {
14742         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14743         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14744                 FREE(j_calls);
14745         }
14746 }
14747 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14748         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14749         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14750         memcpy(header_arr->elems, *header, 80);
14751         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14752         int64_tArray txdata_arr = NULL;
14753         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
14754         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
14755         for (size_t c = 0; c < txdata_var.datalen; c++) {
14756                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14757                 *txdata_conv_28_conv = txdata_var.data[c];
14758                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14759         }
14760         
14761         FREE(txdata_var.data);
14762         int32_t height_conv = height;
14763         js_invoke_function_void_lli(j_calls->instance_ptr, 70, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
14764 }
14765 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14766         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14767         LDKu8slice block_var = block;
14768         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
14769         memcpy(block_arr->elems, block_var.data, block_var.datalen);
14770         int32_t height_conv = height;
14771         js_invoke_function_void_li(j_calls->instance_ptr, 71, (int64_t)block_arr, height_conv);
14772 }
14773 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14774         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14775         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14776         memcpy(header_arr->elems, *header, 80);
14777         int32_t height_conv = height;
14778         js_invoke_function_void_li(j_calls->instance_ptr, 72, (int64_t)header_arr, height_conv);
14779 }
14780 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14781         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14782         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14783 }
14784 static inline LDKListen LDKListen_init (int64_t o) {
14785         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14786         atomic_init(&calls->refcnt, 1);
14787         calls->instance_ptr = o;
14788
14789         LDKListen ret = {
14790                 .this_arg = (void*) calls,
14791                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14792                 .block_connected = block_connected_LDKListen_jcall,
14793                 .block_disconnected = block_disconnected_LDKListen_jcall,
14794                 .free = LDKListen_JCalls_free,
14795         };
14796         return ret;
14797 }
14798 uint64_t  CS_LDK_LDKListen_new(int32_t o) {
14799         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14800         *res_ptr = LDKListen_init(o);
14801         return tag_ptr(res_ptr, true);
14802 }
14803 void  CS_LDK_Listen_filtered_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
14804         void* this_arg_ptr = untag_ptr(this_arg);
14805         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14806         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14807         uint8_t header_arr[80];
14808         CHECK(header->arr_len == 80);
14809         memcpy(header_arr, header->elems, 80); FREE(header);
14810         uint8_t (*header_ref)[80] = &header_arr;
14811         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14812         txdata_constr.datalen = txdata->arr_len;
14813         if (txdata_constr.datalen > 0)
14814                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14815         else
14816                 txdata_constr.data = NULL;
14817         int64_t* txdata_vals = txdata->elems;
14818         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14819                 int64_t txdata_conv_28 = txdata_vals[c];
14820                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14821                 CHECK_ACCESS(txdata_conv_28_ptr);
14822                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14823                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14824                 txdata_constr.data[c] = txdata_conv_28_conv;
14825         }
14826         FREE(txdata);
14827         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14828 }
14829
14830 void  CS_LDK_Listen_block_connected(int64_t this_arg, int8_tArray block, int32_t height) {
14831         void* this_arg_ptr = untag_ptr(this_arg);
14832         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14833         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14834         LDKu8slice block_ref;
14835         block_ref.datalen = block->arr_len;
14836         block_ref.data = block->elems;
14837         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14838         FREE(block);
14839 }
14840
14841 void  CS_LDK_Listen_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height) {
14842         void* this_arg_ptr = untag_ptr(this_arg);
14843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14844         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14845         uint8_t header_arr[80];
14846         CHECK(header->arr_len == 80);
14847         memcpy(header_arr, header->elems, 80); FREE(header);
14848         uint8_t (*header_ref)[80] = &header_arr;
14849         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14850 }
14851
14852 typedef struct LDKConfirm_JCalls {
14853         atomic_size_t refcnt;
14854         uint32_t instance_ptr;
14855 } LDKConfirm_JCalls;
14856 static void LDKConfirm_JCalls_free(void* this_arg) {
14857         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14858         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14859                 FREE(j_calls);
14860         }
14861 }
14862 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14863         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14864         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14865         memcpy(header_arr->elems, *header, 80);
14866         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14867         int64_tArray txdata_arr = NULL;
14868         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
14869         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
14870         for (size_t c = 0; c < txdata_var.datalen; c++) {
14871                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14872                 *txdata_conv_28_conv = txdata_var.data[c];
14873                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14874         }
14875         
14876         FREE(txdata_var.data);
14877         int32_t height_conv = height;
14878         js_invoke_function_void_lli(j_calls->instance_ptr, 73, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
14879 }
14880 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14881         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14882         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
14883         memcpy(txid_arr->elems, *txid, 32);
14884         js_invoke_function_void_l(j_calls->instance_ptr, 74, (int64_t)txid_arr);
14885 }
14886 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14887         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14888         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14889         memcpy(header_arr->elems, *header, 80);
14890         int32_t height_conv = height;
14891         js_invoke_function_void_li(j_calls->instance_ptr, 75, (int64_t)header_arr, height_conv);
14892 }
14893 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14894         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14895         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 76);
14896         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
14897         ret_constr.datalen = ret->arr_len;
14898         if (ret_constr.datalen > 0)
14899                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
14900         else
14901                 ret_constr.data = NULL;
14902         int64_t* ret_vals = ret->elems;
14903         for (size_t c = 0; c < ret_constr.datalen; c++) {
14904                 int64_t ret_conv_54 = ret_vals[c];
14905                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
14906                 CHECK_ACCESS(ret_conv_54_ptr);
14907                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
14908                 FREE(untag_ptr(ret_conv_54));
14909                 ret_constr.data[c] = ret_conv_54_conv;
14910         }
14911         FREE(ret);
14912         return ret_constr;
14913 }
14914 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14915         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14916         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14917 }
14918 static inline LDKConfirm LDKConfirm_init (int64_t o) {
14919         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14920         atomic_init(&calls->refcnt, 1);
14921         calls->instance_ptr = o;
14922
14923         LDKConfirm ret = {
14924                 .this_arg = (void*) calls,
14925                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14926                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14927                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14928                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14929                 .free = LDKConfirm_JCalls_free,
14930         };
14931         return ret;
14932 }
14933 uint64_t  CS_LDK_LDKConfirm_new(int32_t o) {
14934         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14935         *res_ptr = LDKConfirm_init(o);
14936         return tag_ptr(res_ptr, true);
14937 }
14938 void  CS_LDK_Confirm_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
14939         void* this_arg_ptr = untag_ptr(this_arg);
14940         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14941         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14942         uint8_t header_arr[80];
14943         CHECK(header->arr_len == 80);
14944         memcpy(header_arr, header->elems, 80); FREE(header);
14945         uint8_t (*header_ref)[80] = &header_arr;
14946         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14947         txdata_constr.datalen = txdata->arr_len;
14948         if (txdata_constr.datalen > 0)
14949                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14950         else
14951                 txdata_constr.data = NULL;
14952         int64_t* txdata_vals = txdata->elems;
14953         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14954                 int64_t txdata_conv_28 = txdata_vals[c];
14955                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14956                 CHECK_ACCESS(txdata_conv_28_ptr);
14957                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14958                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14959                 txdata_constr.data[c] = txdata_conv_28_conv;
14960         }
14961         FREE(txdata);
14962         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14963 }
14964
14965 void  CS_LDK_Confirm_transaction_unconfirmed(int64_t this_arg, int8_tArray txid) {
14966         void* this_arg_ptr = untag_ptr(this_arg);
14967         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14968         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14969         uint8_t txid_arr[32];
14970         CHECK(txid->arr_len == 32);
14971         memcpy(txid_arr, txid->elems, 32); FREE(txid);
14972         uint8_t (*txid_ref)[32] = &txid_arr;
14973         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14974 }
14975
14976 void  CS_LDK_Confirm_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height) {
14977         void* this_arg_ptr = untag_ptr(this_arg);
14978         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14979         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14980         uint8_t header_arr[80];
14981         CHECK(header->arr_len == 80);
14982         memcpy(header_arr, header->elems, 80); FREE(header);
14983         uint8_t (*header_ref)[80] = &header_arr;
14984         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14985 }
14986
14987 int64_tArray  CS_LDK_Confirm_get_relevant_txids(int64_t this_arg) {
14988         void* this_arg_ptr = untag_ptr(this_arg);
14989         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14990         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14991         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14992         int64_tArray ret_arr = NULL;
14993         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
14994         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
14995         for (size_t c = 0; c < ret_var.datalen; c++) {
14996                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
14997                 *ret_conv_54_conv = ret_var.data[c];
14998                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
14999         }
15000         
15001         FREE(ret_var.data);
15002         return ret_arr;
15003 }
15004
15005 uint32_t CS_LDK_LDKSpendingDelay_ty_from_ptr(int64_t ptr) {
15006         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15007         switch(obj->tag) {
15008                 case LDKSpendingDelay_Relative: return 0;
15009                 case LDKSpendingDelay_Absolute: return 1;
15010                 default: abort();
15011         }
15012 }
15013 int32_t CS_LDK_LDKSpendingDelay_Relative_get_num_blocks(int64_t ptr) {
15014         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15015         CHECK(obj->tag == LDKSpendingDelay_Relative);
15016         int32_t num_blocks_conv = obj->relative.num_blocks;
15017         return num_blocks_conv;
15018 }
15019 int32_t CS_LDK_LDKSpendingDelay_Absolute_get_height(int64_t ptr) {
15020         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15021         CHECK(obj->tag == LDKSpendingDelay_Absolute);
15022         int32_t height_conv = obj->absolute.height;
15023         return height_conv;
15024 }
15025 typedef struct LDKFutureCallback_JCalls {
15026         atomic_size_t refcnt;
15027         uint32_t instance_ptr;
15028 } LDKFutureCallback_JCalls;
15029 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15030         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15031         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15032                 FREE(j_calls);
15033         }
15034 }
15035 void call_LDKFutureCallback_jcall(const void* this_arg) {
15036         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15037         js_invoke_function_void_(j_calls->instance_ptr, 77);
15038 }
15039 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15040         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15041         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15042 }
15043 static inline LDKFutureCallback LDKFutureCallback_init (int64_t o) {
15044         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15045         atomic_init(&calls->refcnt, 1);
15046         calls->instance_ptr = o;
15047
15048         LDKFutureCallback ret = {
15049                 .this_arg = (void*) calls,
15050                 .call = call_LDKFutureCallback_jcall,
15051                 .free = LDKFutureCallback_JCalls_free,
15052         };
15053         return ret;
15054 }
15055 uint64_t  CS_LDK_LDKFutureCallback_new(int32_t o) {
15056         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15057         *res_ptr = LDKFutureCallback_init(o);
15058         return tag_ptr(res_ptr, true);
15059 }
15060 void  CS_LDK_FutureCallback_call(int64_t this_arg) {
15061         void* this_arg_ptr = untag_ptr(this_arg);
15062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15063         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15064         (this_arg_conv->call)(this_arg_conv->this_arg);
15065 }
15066
15067 typedef struct LDKEventHandler_JCalls {
15068         atomic_size_t refcnt;
15069         uint32_t instance_ptr;
15070 } LDKEventHandler_JCalls;
15071 static void LDKEventHandler_JCalls_free(void* this_arg) {
15072         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15073         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15074                 FREE(j_calls);
15075         }
15076 }
15077 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
15078         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15079         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15080         *event_copy = event;
15081         int64_t event_ref = tag_ptr(event_copy, true);
15082         js_invoke_function_void_l(j_calls->instance_ptr, 78, event_ref);
15083 }
15084 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
15085         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
15086         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15087 }
15088 static inline LDKEventHandler LDKEventHandler_init (int64_t o) {
15089         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
15090         atomic_init(&calls->refcnt, 1);
15091         calls->instance_ptr = o;
15092
15093         LDKEventHandler ret = {
15094                 .this_arg = (void*) calls,
15095                 .handle_event = handle_event_LDKEventHandler_jcall,
15096                 .free = LDKEventHandler_JCalls_free,
15097         };
15098         return ret;
15099 }
15100 uint64_t  CS_LDK_LDKEventHandler_new(int32_t o) {
15101         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15102         *res_ptr = LDKEventHandler_init(o);
15103         return tag_ptr(res_ptr, true);
15104 }
15105 void  CS_LDK_EventHandler_handle_event(int64_t this_arg, int64_t event) {
15106         void* this_arg_ptr = untag_ptr(this_arg);
15107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15108         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
15109         void* event_ptr = untag_ptr(event);
15110         CHECK_ACCESS(event_ptr);
15111         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
15112         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
15113         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
15114 }
15115
15116 typedef struct LDKEventsProvider_JCalls {
15117         atomic_size_t refcnt;
15118         uint32_t instance_ptr;
15119 } LDKEventsProvider_JCalls;
15120 static void LDKEventsProvider_JCalls_free(void* this_arg) {
15121         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15122         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15123                 FREE(j_calls);
15124         }
15125 }
15126 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
15127         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15128         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15129         *handler_ret = handler;
15130         js_invoke_function_void_l(j_calls->instance_ptr, 79, tag_ptr(handler_ret, true));
15131 }
15132 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
15133         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
15134         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15135 }
15136 static inline LDKEventsProvider LDKEventsProvider_init (int64_t o) {
15137         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
15138         atomic_init(&calls->refcnt, 1);
15139         calls->instance_ptr = o;
15140
15141         LDKEventsProvider ret = {
15142                 .this_arg = (void*) calls,
15143                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
15144                 .free = LDKEventsProvider_JCalls_free,
15145         };
15146         return ret;
15147 }
15148 uint64_t  CS_LDK_LDKEventsProvider_new(int32_t o) {
15149         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15150         *res_ptr = LDKEventsProvider_init(o);
15151         return tag_ptr(res_ptr, true);
15152 }
15153 void  CS_LDK_EventsProvider_process_pending_events(int64_t this_arg, int64_t handler) {
15154         void* this_arg_ptr = untag_ptr(this_arg);
15155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15156         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
15157         void* handler_ptr = untag_ptr(handler);
15158         CHECK_ACCESS(handler_ptr);
15159         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
15160         if (handler_conv.free == LDKEventHandler_JCalls_free) {
15161                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15162                 LDKEventHandler_JCalls_cloned(&handler_conv);
15163         }
15164         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
15165 }
15166
15167 uint32_t CS_LDK_LDKFailureCode_ty_from_ptr(int64_t ptr) {
15168         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15169         switch(obj->tag) {
15170                 case LDKFailureCode_TemporaryNodeFailure: return 0;
15171                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
15172                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
15173                 case LDKFailureCode_InvalidOnionPayload: return 3;
15174                 default: abort();
15175         }
15176 }
15177 int64_t CS_LDK_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(int64_t ptr) {
15178         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15179         CHECK(obj->tag == LDKFailureCode_InvalidOnionPayload);
15180         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
15181         return invalid_onion_payload_ref;
15182 }
15183 typedef struct LDKMessageSendEventsProvider_JCalls {
15184         atomic_size_t refcnt;
15185         uint32_t instance_ptr;
15186 } LDKMessageSendEventsProvider_JCalls;
15187 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
15188         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15189         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15190                 FREE(j_calls);
15191         }
15192 }
15193 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
15194         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15195         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 80);
15196         LDKCVec_MessageSendEventZ ret_constr;
15197         ret_constr.datalen = ret->arr_len;
15198         if (ret_constr.datalen > 0)
15199                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15200         else
15201                 ret_constr.data = NULL;
15202         int64_t* ret_vals = ret->elems;
15203         for (size_t s = 0; s < ret_constr.datalen; s++) {
15204                 int64_t ret_conv_18 = ret_vals[s];
15205                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
15206                 CHECK_ACCESS(ret_conv_18_ptr);
15207                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
15208                 FREE(untag_ptr(ret_conv_18));
15209                 ret_constr.data[s] = ret_conv_18_conv;
15210         }
15211         FREE(ret);
15212         return ret_constr;
15213 }
15214 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15215         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15216         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15217 }
15218 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (int64_t o) {
15219         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15220         atomic_init(&calls->refcnt, 1);
15221         calls->instance_ptr = o;
15222
15223         LDKMessageSendEventsProvider ret = {
15224                 .this_arg = (void*) calls,
15225                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
15226                 .free = LDKMessageSendEventsProvider_JCalls_free,
15227         };
15228         return ret;
15229 }
15230 uint64_t  CS_LDK_LDKMessageSendEventsProvider_new(int32_t o) {
15231         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15232         *res_ptr = LDKMessageSendEventsProvider_init(o);
15233         return tag_ptr(res_ptr, true);
15234 }
15235 int64_tArray  CS_LDK_MessageSendEventsProvider_get_and_clear_pending_msg_events(int64_t this_arg) {
15236         void* this_arg_ptr = untag_ptr(this_arg);
15237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15238         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
15239         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15240         int64_tArray ret_arr = NULL;
15241         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15242         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15243         for (size_t s = 0; s < ret_var.datalen; s++) {
15244                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15245                 *ret_conv_18_copy = ret_var.data[s];
15246                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15247                 ret_arr_ptr[s] = ret_conv_18_ref;
15248         }
15249         
15250         FREE(ret_var.data);
15251         return ret_arr;
15252 }
15253
15254 typedef struct LDKChannelMessageHandler_JCalls {
15255         atomic_size_t refcnt;
15256         uint32_t instance_ptr;
15257         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15258 } LDKChannelMessageHandler_JCalls;
15259 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15260         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15261         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15262                 FREE(j_calls);
15263         }
15264 }
15265 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15266         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15267         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15268         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15269         LDKOpenChannel msg_var = *msg;
15270         int64_t msg_ref = 0;
15271         msg_var = OpenChannel_clone(&msg_var);
15272         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15273         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15274         js_invoke_function_void_ll(j_calls->instance_ptr, 81, (int64_t)their_node_id_arr, msg_ref);
15275 }
15276 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15277         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15278         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15279         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15280         LDKOpenChannelV2 msg_var = *msg;
15281         int64_t msg_ref = 0;
15282         msg_var = OpenChannelV2_clone(&msg_var);
15283         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15284         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15285         js_invoke_function_void_ll(j_calls->instance_ptr, 82, (int64_t)their_node_id_arr, msg_ref);
15286 }
15287 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15288         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15289         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15290         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15291         LDKAcceptChannel msg_var = *msg;
15292         int64_t msg_ref = 0;
15293         msg_var = AcceptChannel_clone(&msg_var);
15294         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15295         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15296         js_invoke_function_void_ll(j_calls->instance_ptr, 83, (int64_t)their_node_id_arr, msg_ref);
15297 }
15298 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15299         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15300         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15301         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15302         LDKAcceptChannelV2 msg_var = *msg;
15303         int64_t msg_ref = 0;
15304         msg_var = AcceptChannelV2_clone(&msg_var);
15305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15306         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15307         js_invoke_function_void_ll(j_calls->instance_ptr, 84, (int64_t)their_node_id_arr, msg_ref);
15308 }
15309 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15310         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15311         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15312         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15313         LDKFundingCreated msg_var = *msg;
15314         int64_t msg_ref = 0;
15315         msg_var = FundingCreated_clone(&msg_var);
15316         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15317         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15318         js_invoke_function_void_ll(j_calls->instance_ptr, 85, (int64_t)their_node_id_arr, msg_ref);
15319 }
15320 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15321         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15322         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15323         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15324         LDKFundingSigned msg_var = *msg;
15325         int64_t msg_ref = 0;
15326         msg_var = FundingSigned_clone(&msg_var);
15327         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15328         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15329         js_invoke_function_void_ll(j_calls->instance_ptr, 86, (int64_t)their_node_id_arr, msg_ref);
15330 }
15331 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15332         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15333         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15334         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15335         LDKChannelReady msg_var = *msg;
15336         int64_t msg_ref = 0;
15337         msg_var = ChannelReady_clone(&msg_var);
15338         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15339         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15340         js_invoke_function_void_ll(j_calls->instance_ptr, 87, (int64_t)their_node_id_arr, msg_ref);
15341 }
15342 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15343         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15344         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15345         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15346         LDKShutdown msg_var = *msg;
15347         int64_t msg_ref = 0;
15348         msg_var = Shutdown_clone(&msg_var);
15349         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15350         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15351         js_invoke_function_void_ll(j_calls->instance_ptr, 88, (int64_t)their_node_id_arr, msg_ref);
15352 }
15353 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15354         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15355         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15356         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15357         LDKClosingSigned msg_var = *msg;
15358         int64_t msg_ref = 0;
15359         msg_var = ClosingSigned_clone(&msg_var);
15360         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15361         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15362         js_invoke_function_void_ll(j_calls->instance_ptr, 89, (int64_t)their_node_id_arr, msg_ref);
15363 }
15364 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
15365         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15366         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15367         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15368         LDKStfu msg_var = *msg;
15369         int64_t msg_ref = 0;
15370         msg_var = Stfu_clone(&msg_var);
15371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15372         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15373         js_invoke_function_void_ll(j_calls->instance_ptr, 90, (int64_t)their_node_id_arr, msg_ref);
15374 }
15375 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15376         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15377         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15378         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15379         LDKTxAddInput msg_var = *msg;
15380         int64_t msg_ref = 0;
15381         msg_var = TxAddInput_clone(&msg_var);
15382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15383         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15384         js_invoke_function_void_ll(j_calls->instance_ptr, 91, (int64_t)their_node_id_arr, msg_ref);
15385 }
15386 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15387         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15388         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15389         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15390         LDKTxAddOutput msg_var = *msg;
15391         int64_t msg_ref = 0;
15392         msg_var = TxAddOutput_clone(&msg_var);
15393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15394         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15395         js_invoke_function_void_ll(j_calls->instance_ptr, 92, (int64_t)their_node_id_arr, msg_ref);
15396 }
15397 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15398         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15399         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15400         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15401         LDKTxRemoveInput msg_var = *msg;
15402         int64_t msg_ref = 0;
15403         msg_var = TxRemoveInput_clone(&msg_var);
15404         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15405         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15406         js_invoke_function_void_ll(j_calls->instance_ptr, 93, (int64_t)their_node_id_arr, msg_ref);
15407 }
15408 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15409         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15410         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15411         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15412         LDKTxRemoveOutput msg_var = *msg;
15413         int64_t msg_ref = 0;
15414         msg_var = TxRemoveOutput_clone(&msg_var);
15415         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15416         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15417         js_invoke_function_void_ll(j_calls->instance_ptr, 94, (int64_t)their_node_id_arr, msg_ref);
15418 }
15419 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15420         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15421         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15422         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15423         LDKTxComplete msg_var = *msg;
15424         int64_t msg_ref = 0;
15425         msg_var = TxComplete_clone(&msg_var);
15426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15427         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15428         js_invoke_function_void_ll(j_calls->instance_ptr, 95, (int64_t)their_node_id_arr, msg_ref);
15429 }
15430 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15431         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15432         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15433         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15434         LDKTxSignatures msg_var = *msg;
15435         int64_t msg_ref = 0;
15436         msg_var = TxSignatures_clone(&msg_var);
15437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15438         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15439         js_invoke_function_void_ll(j_calls->instance_ptr, 96, (int64_t)their_node_id_arr, msg_ref);
15440 }
15441 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15442         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15443         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15444         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15445         LDKTxInitRbf msg_var = *msg;
15446         int64_t msg_ref = 0;
15447         msg_var = TxInitRbf_clone(&msg_var);
15448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15449         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15450         js_invoke_function_void_ll(j_calls->instance_ptr, 97, (int64_t)their_node_id_arr, msg_ref);
15451 }
15452 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15453         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15454         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15455         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15456         LDKTxAckRbf msg_var = *msg;
15457         int64_t msg_ref = 0;
15458         msg_var = TxAckRbf_clone(&msg_var);
15459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15460         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15461         js_invoke_function_void_ll(j_calls->instance_ptr, 98, (int64_t)their_node_id_arr, msg_ref);
15462 }
15463 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15464         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15465         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15466         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15467         LDKTxAbort msg_var = *msg;
15468         int64_t msg_ref = 0;
15469         msg_var = TxAbort_clone(&msg_var);
15470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15471         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15472         js_invoke_function_void_ll(j_calls->instance_ptr, 99, (int64_t)their_node_id_arr, msg_ref);
15473 }
15474 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15475         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15476         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15477         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15478         LDKUpdateAddHTLC msg_var = *msg;
15479         int64_t msg_ref = 0;
15480         msg_var = UpdateAddHTLC_clone(&msg_var);
15481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15482         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15483         js_invoke_function_void_ll(j_calls->instance_ptr, 100, (int64_t)their_node_id_arr, msg_ref);
15484 }
15485 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15486         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15487         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15488         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15489         LDKUpdateFulfillHTLC msg_var = *msg;
15490         int64_t msg_ref = 0;
15491         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15493         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15494         js_invoke_function_void_ll(j_calls->instance_ptr, 101, (int64_t)their_node_id_arr, msg_ref);
15495 }
15496 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15497         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15498         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15499         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15500         LDKUpdateFailHTLC msg_var = *msg;
15501         int64_t msg_ref = 0;
15502         msg_var = UpdateFailHTLC_clone(&msg_var);
15503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15504         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15505         js_invoke_function_void_ll(j_calls->instance_ptr, 102, (int64_t)their_node_id_arr, msg_ref);
15506 }
15507 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15508         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15509         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15510         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15511         LDKUpdateFailMalformedHTLC msg_var = *msg;
15512         int64_t msg_ref = 0;
15513         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15514         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15515         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15516         js_invoke_function_void_ll(j_calls->instance_ptr, 103, (int64_t)their_node_id_arr, msg_ref);
15517 }
15518 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15519         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15520         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15521         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15522         LDKCommitmentSigned msg_var = *msg;
15523         int64_t msg_ref = 0;
15524         msg_var = CommitmentSigned_clone(&msg_var);
15525         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15526         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15527         js_invoke_function_void_ll(j_calls->instance_ptr, 104, (int64_t)their_node_id_arr, msg_ref);
15528 }
15529 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15530         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15531         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15532         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15533         LDKRevokeAndACK msg_var = *msg;
15534         int64_t msg_ref = 0;
15535         msg_var = RevokeAndACK_clone(&msg_var);
15536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15537         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15538         js_invoke_function_void_ll(j_calls->instance_ptr, 105, (int64_t)their_node_id_arr, msg_ref);
15539 }
15540 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15541         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15542         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15543         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15544         LDKUpdateFee msg_var = *msg;
15545         int64_t msg_ref = 0;
15546         msg_var = UpdateFee_clone(&msg_var);
15547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15548         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15549         js_invoke_function_void_ll(j_calls->instance_ptr, 106, (int64_t)their_node_id_arr, msg_ref);
15550 }
15551 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15552         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15553         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15554         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15555         LDKAnnouncementSignatures msg_var = *msg;
15556         int64_t msg_ref = 0;
15557         msg_var = AnnouncementSignatures_clone(&msg_var);
15558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15560         js_invoke_function_void_ll(j_calls->instance_ptr, 107, (int64_t)their_node_id_arr, msg_ref);
15561 }
15562 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15563         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15564         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15565         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15566         js_invoke_function_void_l(j_calls->instance_ptr, 108, (int64_t)their_node_id_arr);
15567 }
15568 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15569         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15570         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15571         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15572         LDKInit msg_var = *msg;
15573         int64_t msg_ref = 0;
15574         msg_var = Init_clone(&msg_var);
15575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15576         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15577         jboolean inbound_conv = inbound;
15578         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 109, (int64_t)their_node_id_arr, msg_ref, inbound_conv);
15579         void* ret_ptr = untag_ptr(ret);
15580         CHECK_ACCESS(ret_ptr);
15581         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15582         FREE(untag_ptr(ret));
15583         return ret_conv;
15584 }
15585 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15586         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15587         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15588         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15589         LDKChannelReestablish msg_var = *msg;
15590         int64_t msg_ref = 0;
15591         msg_var = ChannelReestablish_clone(&msg_var);
15592         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15593         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15594         js_invoke_function_void_ll(j_calls->instance_ptr, 110, (int64_t)their_node_id_arr, msg_ref);
15595 }
15596 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15597         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15598         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15599         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15600         LDKChannelUpdate msg_var = *msg;
15601         int64_t msg_ref = 0;
15602         msg_var = ChannelUpdate_clone(&msg_var);
15603         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15604         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15605         js_invoke_function_void_ll(j_calls->instance_ptr, 111, (int64_t)their_node_id_arr, msg_ref);
15606 }
15607 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15608         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15609         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15610         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15611         LDKErrorMessage msg_var = *msg;
15612         int64_t msg_ref = 0;
15613         msg_var = ErrorMessage_clone(&msg_var);
15614         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15615         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15616         js_invoke_function_void_ll(j_calls->instance_ptr, 112, (int64_t)their_node_id_arr, msg_ref);
15617 }
15618 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15619         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15620         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 113);
15621         LDKNodeFeatures ret_conv;
15622         ret_conv.inner = untag_ptr(ret);
15623         ret_conv.is_owned = ptr_is_owned(ret);
15624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15625         return ret_conv;
15626 }
15627 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15628         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15629         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15630         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15631         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 114, (int64_t)their_node_id_arr);
15632         LDKInitFeatures ret_conv;
15633         ret_conv.inner = untag_ptr(ret);
15634         ret_conv.is_owned = ptr_is_owned(ret);
15635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15636         return ret_conv;
15637 }
15638 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15639         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15640         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 115);
15641         void* ret_ptr = untag_ptr(ret);
15642         CHECK_ACCESS(ret_ptr);
15643         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
15644         FREE(untag_ptr(ret));
15645         return ret_conv;
15646 }
15647 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
15648         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
15649         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15650         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15651 }
15652 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
15653         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
15654         atomic_init(&calls->refcnt, 1);
15655         calls->instance_ptr = o;
15656
15657         LDKChannelMessageHandler ret = {
15658                 .this_arg = (void*) calls,
15659                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
15660                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
15661                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
15662                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
15663                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
15664                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
15665                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
15666                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
15667                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
15668                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
15669                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
15670                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
15671                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
15672                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
15673                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
15674                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
15675                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
15676                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
15677                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
15678                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
15679                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
15680                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
15681                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
15682                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
15683                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
15684                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
15685                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
15686                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
15687                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
15688                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
15689                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
15690                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
15691                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
15692                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
15693                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
15694                 .free = LDKChannelMessageHandler_JCalls_free,
15695                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15696         };
15697         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15698         return ret;
15699 }
15700 uint64_t  CS_LDK_LDKChannelMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
15701         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15702         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
15703         return tag_ptr(res_ptr, true);
15704 }
15705 void  CS_LDK_ChannelMessageHandler_handle_open_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15706         void* this_arg_ptr = untag_ptr(this_arg);
15707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15708         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15709         LDKPublicKey their_node_id_ref;
15710         CHECK(their_node_id->arr_len == 33);
15711         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15712         LDKOpenChannel msg_conv;
15713         msg_conv.inner = untag_ptr(msg);
15714         msg_conv.is_owned = ptr_is_owned(msg);
15715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15716         msg_conv.is_owned = false;
15717         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15718 }
15719
15720 void  CS_LDK_ChannelMessageHandler_handle_open_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15721         void* this_arg_ptr = untag_ptr(this_arg);
15722         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15723         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15724         LDKPublicKey their_node_id_ref;
15725         CHECK(their_node_id->arr_len == 33);
15726         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15727         LDKOpenChannelV2 msg_conv;
15728         msg_conv.inner = untag_ptr(msg);
15729         msg_conv.is_owned = ptr_is_owned(msg);
15730         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15731         msg_conv.is_owned = false;
15732         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15733 }
15734
15735 void  CS_LDK_ChannelMessageHandler_handle_accept_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15736         void* this_arg_ptr = untag_ptr(this_arg);
15737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15738         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15739         LDKPublicKey their_node_id_ref;
15740         CHECK(their_node_id->arr_len == 33);
15741         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15742         LDKAcceptChannel msg_conv;
15743         msg_conv.inner = untag_ptr(msg);
15744         msg_conv.is_owned = ptr_is_owned(msg);
15745         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15746         msg_conv.is_owned = false;
15747         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15748 }
15749
15750 void  CS_LDK_ChannelMessageHandler_handle_accept_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15751         void* this_arg_ptr = untag_ptr(this_arg);
15752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15753         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15754         LDKPublicKey their_node_id_ref;
15755         CHECK(their_node_id->arr_len == 33);
15756         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15757         LDKAcceptChannelV2 msg_conv;
15758         msg_conv.inner = untag_ptr(msg);
15759         msg_conv.is_owned = ptr_is_owned(msg);
15760         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15761         msg_conv.is_owned = false;
15762         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15763 }
15764
15765 void  CS_LDK_ChannelMessageHandler_handle_funding_created(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15766         void* this_arg_ptr = untag_ptr(this_arg);
15767         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15768         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15769         LDKPublicKey their_node_id_ref;
15770         CHECK(their_node_id->arr_len == 33);
15771         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15772         LDKFundingCreated msg_conv;
15773         msg_conv.inner = untag_ptr(msg);
15774         msg_conv.is_owned = ptr_is_owned(msg);
15775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15776         msg_conv.is_owned = false;
15777         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15778 }
15779
15780 void  CS_LDK_ChannelMessageHandler_handle_funding_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15781         void* this_arg_ptr = untag_ptr(this_arg);
15782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15783         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15784         LDKPublicKey their_node_id_ref;
15785         CHECK(their_node_id->arr_len == 33);
15786         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15787         LDKFundingSigned msg_conv;
15788         msg_conv.inner = untag_ptr(msg);
15789         msg_conv.is_owned = ptr_is_owned(msg);
15790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15791         msg_conv.is_owned = false;
15792         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15793 }
15794
15795 void  CS_LDK_ChannelMessageHandler_handle_channel_ready(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15796         void* this_arg_ptr = untag_ptr(this_arg);
15797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15798         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15799         LDKPublicKey their_node_id_ref;
15800         CHECK(their_node_id->arr_len == 33);
15801         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15802         LDKChannelReady msg_conv;
15803         msg_conv.inner = untag_ptr(msg);
15804         msg_conv.is_owned = ptr_is_owned(msg);
15805         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15806         msg_conv.is_owned = false;
15807         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15808 }
15809
15810 void  CS_LDK_ChannelMessageHandler_handle_shutdown(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15811         void* this_arg_ptr = untag_ptr(this_arg);
15812         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15813         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15814         LDKPublicKey their_node_id_ref;
15815         CHECK(their_node_id->arr_len == 33);
15816         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15817         LDKShutdown msg_conv;
15818         msg_conv.inner = untag_ptr(msg);
15819         msg_conv.is_owned = ptr_is_owned(msg);
15820         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15821         msg_conv.is_owned = false;
15822         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15823 }
15824
15825 void  CS_LDK_ChannelMessageHandler_handle_closing_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15826         void* this_arg_ptr = untag_ptr(this_arg);
15827         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15828         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15829         LDKPublicKey their_node_id_ref;
15830         CHECK(their_node_id->arr_len == 33);
15831         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15832         LDKClosingSigned msg_conv;
15833         msg_conv.inner = untag_ptr(msg);
15834         msg_conv.is_owned = ptr_is_owned(msg);
15835         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15836         msg_conv.is_owned = false;
15837         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15838 }
15839
15840 void  CS_LDK_ChannelMessageHandler_handle_stfu(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15841         void* this_arg_ptr = untag_ptr(this_arg);
15842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15843         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15844         LDKPublicKey their_node_id_ref;
15845         CHECK(their_node_id->arr_len == 33);
15846         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15847         LDKStfu msg_conv;
15848         msg_conv.inner = untag_ptr(msg);
15849         msg_conv.is_owned = ptr_is_owned(msg);
15850         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15851         msg_conv.is_owned = false;
15852         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15853 }
15854
15855 void  CS_LDK_ChannelMessageHandler_handle_tx_add_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15856         void* this_arg_ptr = untag_ptr(this_arg);
15857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15858         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15859         LDKPublicKey their_node_id_ref;
15860         CHECK(their_node_id->arr_len == 33);
15861         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15862         LDKTxAddInput msg_conv;
15863         msg_conv.inner = untag_ptr(msg);
15864         msg_conv.is_owned = ptr_is_owned(msg);
15865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15866         msg_conv.is_owned = false;
15867         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15868 }
15869
15870 void  CS_LDK_ChannelMessageHandler_handle_tx_add_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15871         void* this_arg_ptr = untag_ptr(this_arg);
15872         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15873         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15874         LDKPublicKey their_node_id_ref;
15875         CHECK(their_node_id->arr_len == 33);
15876         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15877         LDKTxAddOutput msg_conv;
15878         msg_conv.inner = untag_ptr(msg);
15879         msg_conv.is_owned = ptr_is_owned(msg);
15880         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15881         msg_conv.is_owned = false;
15882         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15883 }
15884
15885 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15886         void* this_arg_ptr = untag_ptr(this_arg);
15887         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15888         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15889         LDKPublicKey their_node_id_ref;
15890         CHECK(their_node_id->arr_len == 33);
15891         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15892         LDKTxRemoveInput msg_conv;
15893         msg_conv.inner = untag_ptr(msg);
15894         msg_conv.is_owned = ptr_is_owned(msg);
15895         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15896         msg_conv.is_owned = false;
15897         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15898 }
15899
15900 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15901         void* this_arg_ptr = untag_ptr(this_arg);
15902         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15903         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15904         LDKPublicKey their_node_id_ref;
15905         CHECK(their_node_id->arr_len == 33);
15906         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15907         LDKTxRemoveOutput msg_conv;
15908         msg_conv.inner = untag_ptr(msg);
15909         msg_conv.is_owned = ptr_is_owned(msg);
15910         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15911         msg_conv.is_owned = false;
15912         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15913 }
15914
15915 void  CS_LDK_ChannelMessageHandler_handle_tx_complete(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15916         void* this_arg_ptr = untag_ptr(this_arg);
15917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15918         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15919         LDKPublicKey their_node_id_ref;
15920         CHECK(their_node_id->arr_len == 33);
15921         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15922         LDKTxComplete msg_conv;
15923         msg_conv.inner = untag_ptr(msg);
15924         msg_conv.is_owned = ptr_is_owned(msg);
15925         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15926         msg_conv.is_owned = false;
15927         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15928 }
15929
15930 void  CS_LDK_ChannelMessageHandler_handle_tx_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15931         void* this_arg_ptr = untag_ptr(this_arg);
15932         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15933         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15934         LDKPublicKey their_node_id_ref;
15935         CHECK(their_node_id->arr_len == 33);
15936         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15937         LDKTxSignatures msg_conv;
15938         msg_conv.inner = untag_ptr(msg);
15939         msg_conv.is_owned = ptr_is_owned(msg);
15940         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15941         msg_conv.is_owned = false;
15942         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15943 }
15944
15945 void  CS_LDK_ChannelMessageHandler_handle_tx_init_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15946         void* this_arg_ptr = untag_ptr(this_arg);
15947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15948         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15949         LDKPublicKey their_node_id_ref;
15950         CHECK(their_node_id->arr_len == 33);
15951         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15952         LDKTxInitRbf msg_conv;
15953         msg_conv.inner = untag_ptr(msg);
15954         msg_conv.is_owned = ptr_is_owned(msg);
15955         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15956         msg_conv.is_owned = false;
15957         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15958 }
15959
15960 void  CS_LDK_ChannelMessageHandler_handle_tx_ack_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15961         void* this_arg_ptr = untag_ptr(this_arg);
15962         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15963         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15964         LDKPublicKey their_node_id_ref;
15965         CHECK(their_node_id->arr_len == 33);
15966         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15967         LDKTxAckRbf msg_conv;
15968         msg_conv.inner = untag_ptr(msg);
15969         msg_conv.is_owned = ptr_is_owned(msg);
15970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15971         msg_conv.is_owned = false;
15972         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15973 }
15974
15975 void  CS_LDK_ChannelMessageHandler_handle_tx_abort(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15976         void* this_arg_ptr = untag_ptr(this_arg);
15977         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15978         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15979         LDKPublicKey their_node_id_ref;
15980         CHECK(their_node_id->arr_len == 33);
15981         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15982         LDKTxAbort msg_conv;
15983         msg_conv.inner = untag_ptr(msg);
15984         msg_conv.is_owned = ptr_is_owned(msg);
15985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15986         msg_conv.is_owned = false;
15987         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15988 }
15989
15990 void  CS_LDK_ChannelMessageHandler_handle_update_add_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15991         void* this_arg_ptr = untag_ptr(this_arg);
15992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15993         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15994         LDKPublicKey their_node_id_ref;
15995         CHECK(their_node_id->arr_len == 33);
15996         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15997         LDKUpdateAddHTLC msg_conv;
15998         msg_conv.inner = untag_ptr(msg);
15999         msg_conv.is_owned = ptr_is_owned(msg);
16000         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16001         msg_conv.is_owned = false;
16002         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16003 }
16004
16005 void  CS_LDK_ChannelMessageHandler_handle_update_fulfill_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16006         void* this_arg_ptr = untag_ptr(this_arg);
16007         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16008         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16009         LDKPublicKey their_node_id_ref;
16010         CHECK(their_node_id->arr_len == 33);
16011         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16012         LDKUpdateFulfillHTLC msg_conv;
16013         msg_conv.inner = untag_ptr(msg);
16014         msg_conv.is_owned = ptr_is_owned(msg);
16015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16016         msg_conv.is_owned = false;
16017         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16018 }
16019
16020 void  CS_LDK_ChannelMessageHandler_handle_update_fail_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16021         void* this_arg_ptr = untag_ptr(this_arg);
16022         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16023         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16024         LDKPublicKey their_node_id_ref;
16025         CHECK(their_node_id->arr_len == 33);
16026         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16027         LDKUpdateFailHTLC msg_conv;
16028         msg_conv.inner = untag_ptr(msg);
16029         msg_conv.is_owned = ptr_is_owned(msg);
16030         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16031         msg_conv.is_owned = false;
16032         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16033 }
16034
16035 void  CS_LDK_ChannelMessageHandler_handle_update_fail_malformed_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16036         void* this_arg_ptr = untag_ptr(this_arg);
16037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16038         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16039         LDKPublicKey their_node_id_ref;
16040         CHECK(their_node_id->arr_len == 33);
16041         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16042         LDKUpdateFailMalformedHTLC msg_conv;
16043         msg_conv.inner = untag_ptr(msg);
16044         msg_conv.is_owned = ptr_is_owned(msg);
16045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16046         msg_conv.is_owned = false;
16047         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16048 }
16049
16050 void  CS_LDK_ChannelMessageHandler_handle_commitment_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16051         void* this_arg_ptr = untag_ptr(this_arg);
16052         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16053         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16054         LDKPublicKey their_node_id_ref;
16055         CHECK(their_node_id->arr_len == 33);
16056         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16057         LDKCommitmentSigned msg_conv;
16058         msg_conv.inner = untag_ptr(msg);
16059         msg_conv.is_owned = ptr_is_owned(msg);
16060         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16061         msg_conv.is_owned = false;
16062         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16063 }
16064
16065 void  CS_LDK_ChannelMessageHandler_handle_revoke_and_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16066         void* this_arg_ptr = untag_ptr(this_arg);
16067         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16068         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16069         LDKPublicKey their_node_id_ref;
16070         CHECK(their_node_id->arr_len == 33);
16071         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16072         LDKRevokeAndACK msg_conv;
16073         msg_conv.inner = untag_ptr(msg);
16074         msg_conv.is_owned = ptr_is_owned(msg);
16075         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16076         msg_conv.is_owned = false;
16077         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16078 }
16079
16080 void  CS_LDK_ChannelMessageHandler_handle_update_fee(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16081         void* this_arg_ptr = untag_ptr(this_arg);
16082         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16083         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16084         LDKPublicKey their_node_id_ref;
16085         CHECK(their_node_id->arr_len == 33);
16086         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16087         LDKUpdateFee msg_conv;
16088         msg_conv.inner = untag_ptr(msg);
16089         msg_conv.is_owned = ptr_is_owned(msg);
16090         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16091         msg_conv.is_owned = false;
16092         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16093 }
16094
16095 void  CS_LDK_ChannelMessageHandler_handle_announcement_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16096         void* this_arg_ptr = untag_ptr(this_arg);
16097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16098         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16099         LDKPublicKey their_node_id_ref;
16100         CHECK(their_node_id->arr_len == 33);
16101         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16102         LDKAnnouncementSignatures msg_conv;
16103         msg_conv.inner = untag_ptr(msg);
16104         msg_conv.is_owned = ptr_is_owned(msg);
16105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16106         msg_conv.is_owned = false;
16107         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16108 }
16109
16110 void  CS_LDK_ChannelMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
16111         void* this_arg_ptr = untag_ptr(this_arg);
16112         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16113         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16114         LDKPublicKey their_node_id_ref;
16115         CHECK(their_node_id->arr_len == 33);
16116         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16117         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16118 }
16119
16120 int64_t  CS_LDK_ChannelMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) {
16121         void* this_arg_ptr = untag_ptr(this_arg);
16122         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16123         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16124         LDKPublicKey their_node_id_ref;
16125         CHECK(their_node_id->arr_len == 33);
16126         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16127         LDKInit msg_conv;
16128         msg_conv.inner = untag_ptr(msg);
16129         msg_conv.is_owned = ptr_is_owned(msg);
16130         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16131         msg_conv.is_owned = false;
16132         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16133         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
16134         return tag_ptr(ret_conv, true);
16135 }
16136
16137 void  CS_LDK_ChannelMessageHandler_handle_channel_reestablish(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16138         void* this_arg_ptr = untag_ptr(this_arg);
16139         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16140         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16141         LDKPublicKey their_node_id_ref;
16142         CHECK(their_node_id->arr_len == 33);
16143         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16144         LDKChannelReestablish msg_conv;
16145         msg_conv.inner = untag_ptr(msg);
16146         msg_conv.is_owned = ptr_is_owned(msg);
16147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16148         msg_conv.is_owned = false;
16149         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16150 }
16151
16152 void  CS_LDK_ChannelMessageHandler_handle_channel_update(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16153         void* this_arg_ptr = untag_ptr(this_arg);
16154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16155         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16156         LDKPublicKey their_node_id_ref;
16157         CHECK(their_node_id->arr_len == 33);
16158         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16159         LDKChannelUpdate msg_conv;
16160         msg_conv.inner = untag_ptr(msg);
16161         msg_conv.is_owned = ptr_is_owned(msg);
16162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16163         msg_conv.is_owned = false;
16164         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16165 }
16166
16167 void  CS_LDK_ChannelMessageHandler_handle_error(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16168         void* this_arg_ptr = untag_ptr(this_arg);
16169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16170         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16171         LDKPublicKey their_node_id_ref;
16172         CHECK(their_node_id->arr_len == 33);
16173         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16174         LDKErrorMessage msg_conv;
16175         msg_conv.inner = untag_ptr(msg);
16176         msg_conv.is_owned = ptr_is_owned(msg);
16177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16178         msg_conv.is_owned = false;
16179         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16180 }
16181
16182 int64_t  CS_LDK_ChannelMessageHandler_provided_node_features(int64_t this_arg) {
16183         void* this_arg_ptr = untag_ptr(this_arg);
16184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16185         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16186         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16187         int64_t ret_ref = 0;
16188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16190         return ret_ref;
16191 }
16192
16193 int64_t  CS_LDK_ChannelMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
16194         void* this_arg_ptr = untag_ptr(this_arg);
16195         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16196         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16197         LDKPublicKey their_node_id_ref;
16198         CHECK(their_node_id->arr_len == 33);
16199         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16200         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16201         int64_t ret_ref = 0;
16202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16204         return ret_ref;
16205 }
16206
16207 int64_t  CS_LDK_ChannelMessageHandler_get_chain_hashes(int64_t this_arg) {
16208         void* this_arg_ptr = untag_ptr(this_arg);
16209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16210         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16211         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
16212         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
16213         int64_t ret_ref = tag_ptr(ret_copy, true);
16214         return ret_ref;
16215 }
16216
16217 typedef struct LDKOffersMessageHandler_JCalls {
16218         atomic_size_t refcnt;
16219         uint32_t instance_ptr;
16220 } LDKOffersMessageHandler_JCalls;
16221 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
16222         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16223         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16224                 FREE(j_calls);
16225         }
16226 }
16227 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
16228         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16229         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
16230         *message_copy = message;
16231         int64_t message_ref = tag_ptr(message_copy, true);
16232         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 116, message_ref);
16233         void* ret_ptr = untag_ptr(ret);
16234         CHECK_ACCESS(ret_ptr);
16235         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
16236         FREE(untag_ptr(ret));
16237         return ret_conv;
16238 }
16239 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
16240         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16241         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 117);
16242         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
16243         ret_constr.datalen = ret->arr_len;
16244         if (ret_constr.datalen > 0)
16245                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
16246         else
16247                 ret_constr.data = NULL;
16248         int64_t* ret_vals = ret->elems;
16249         for (size_t x = 0; x < ret_constr.datalen; x++) {
16250                 int64_t ret_conv_49 = ret_vals[x];
16251                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
16252                 CHECK_ACCESS(ret_conv_49_ptr);
16253                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
16254                 FREE(untag_ptr(ret_conv_49));
16255                 ret_constr.data[x] = ret_conv_49_conv;
16256         }
16257         FREE(ret);
16258         return ret_constr;
16259 }
16260 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
16261         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
16262         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16263 }
16264 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (int64_t o) {
16265         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
16266         atomic_init(&calls->refcnt, 1);
16267         calls->instance_ptr = o;
16268
16269         LDKOffersMessageHandler ret = {
16270                 .this_arg = (void*) calls,
16271                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
16272                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
16273                 .free = LDKOffersMessageHandler_JCalls_free,
16274         };
16275         return ret;
16276 }
16277 uint64_t  CS_LDK_LDKOffersMessageHandler_new(int32_t o) {
16278         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
16279         *res_ptr = LDKOffersMessageHandler_init(o);
16280         return tag_ptr(res_ptr, true);
16281 }
16282 int64_t  CS_LDK_OffersMessageHandler_handle_message(int64_t this_arg, int64_t message) {
16283         void* this_arg_ptr = untag_ptr(this_arg);
16284         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16285         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16286         void* message_ptr = untag_ptr(message);
16287         CHECK_ACCESS(message_ptr);
16288         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
16289         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
16290         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
16291         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
16292         int64_t ret_ref = tag_ptr(ret_copy, true);
16293         return ret_ref;
16294 }
16295
16296 int64_tArray  CS_LDK_OffersMessageHandler_release_pending_messages(int64_t this_arg) {
16297         void* this_arg_ptr = untag_ptr(this_arg);
16298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16299         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16300         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
16301         int64_tArray ret_arr = NULL;
16302         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
16303         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
16304         for (size_t x = 0; x < ret_var.datalen; x++) {
16305                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
16306                 *ret_conv_49_conv = ret_var.data[x];
16307                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16308         }
16309         
16310         FREE(ret_var.data);
16311         return ret_arr;
16312 }
16313
16314 typedef struct LDKNodeIdLookUp_JCalls {
16315         atomic_size_t refcnt;
16316         uint32_t instance_ptr;
16317 } LDKNodeIdLookUp_JCalls;
16318 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
16319         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16320         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16321                 FREE(j_calls);
16322         }
16323 }
16324 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
16325         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16326         int64_t short_channel_id_conv = short_channel_id;
16327         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 118, short_channel_id_conv);
16328         LDKPublicKey ret_ref;
16329         CHECK(ret->arr_len == 33);
16330         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
16331         return ret_ref;
16332 }
16333 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
16334         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
16335         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16336 }
16337 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (int64_t o) {
16338         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
16339         atomic_init(&calls->refcnt, 1);
16340         calls->instance_ptr = o;
16341
16342         LDKNodeIdLookUp ret = {
16343                 .this_arg = (void*) calls,
16344                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
16345                 .free = LDKNodeIdLookUp_JCalls_free,
16346         };
16347         return ret;
16348 }
16349 uint64_t  CS_LDK_LDKNodeIdLookUp_new(int32_t o) {
16350         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
16351         *res_ptr = LDKNodeIdLookUp_init(o);
16352         return tag_ptr(res_ptr, true);
16353 }
16354 int8_tArray  CS_LDK_NodeIdLookUp_next_node_id(int64_t this_arg, int64_t short_channel_id) {
16355         void* this_arg_ptr = untag_ptr(this_arg);
16356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16357         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
16358         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
16359         memcpy(ret_arr->elems, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form, 33);
16360         return ret_arr;
16361 }
16362
16363 typedef struct LDKRoutingMessageHandler_JCalls {
16364         atomic_size_t refcnt;
16365         uint32_t instance_ptr;
16366         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16367 } LDKRoutingMessageHandler_JCalls;
16368 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16369         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16370         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16371                 FREE(j_calls);
16372         }
16373 }
16374 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16375         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16376         LDKNodeAnnouncement msg_var = *msg;
16377         int64_t msg_ref = 0;
16378         msg_var = NodeAnnouncement_clone(&msg_var);
16379         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16380         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16381         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 119, msg_ref);
16382         void* ret_ptr = untag_ptr(ret);
16383         CHECK_ACCESS(ret_ptr);
16384         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16385         FREE(untag_ptr(ret));
16386         return ret_conv;
16387 }
16388 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16389         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16390         LDKChannelAnnouncement msg_var = *msg;
16391         int64_t msg_ref = 0;
16392         msg_var = ChannelAnnouncement_clone(&msg_var);
16393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16394         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16395         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 120, msg_ref);
16396         void* ret_ptr = untag_ptr(ret);
16397         CHECK_ACCESS(ret_ptr);
16398         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16399         FREE(untag_ptr(ret));
16400         return ret_conv;
16401 }
16402 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16403         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16404         LDKChannelUpdate msg_var = *msg;
16405         int64_t msg_ref = 0;
16406         msg_var = ChannelUpdate_clone(&msg_var);
16407         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16408         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16409         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 121, msg_ref);
16410         void* ret_ptr = untag_ptr(ret);
16411         CHECK_ACCESS(ret_ptr);
16412         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16413         FREE(untag_ptr(ret));
16414         return ret_conv;
16415 }
16416 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16417         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16418         int64_t starting_point_conv = starting_point;
16419         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 122, starting_point_conv);
16420         void* ret_ptr = untag_ptr(ret);
16421         CHECK_ACCESS(ret_ptr);
16422         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16423         FREE(untag_ptr(ret));
16424         return ret_conv;
16425 }
16426 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16427         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16428         LDKNodeId starting_point_var = starting_point;
16429         int64_t starting_point_ref = 0;
16430         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16431         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16432         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 123, starting_point_ref);
16433         LDKNodeAnnouncement ret_conv;
16434         ret_conv.inner = untag_ptr(ret);
16435         ret_conv.is_owned = ptr_is_owned(ret);
16436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16437         return ret_conv;
16438 }
16439 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16440         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16441         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16442         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16443         LDKInit init_var = *init;
16444         int64_t init_ref = 0;
16445         init_var = Init_clone(&init_var);
16446         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16447         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16448         jboolean inbound_conv = inbound;
16449         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 124, (int64_t)their_node_id_arr, init_ref, inbound_conv);
16450         void* ret_ptr = untag_ptr(ret);
16451         CHECK_ACCESS(ret_ptr);
16452         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16453         FREE(untag_ptr(ret));
16454         return ret_conv;
16455 }
16456 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16457         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16458         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16459         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16460         LDKReplyChannelRange msg_var = msg;
16461         int64_t msg_ref = 0;
16462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16463         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16464         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 125, (int64_t)their_node_id_arr, msg_ref);
16465         void* ret_ptr = untag_ptr(ret);
16466         CHECK_ACCESS(ret_ptr);
16467         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16468         FREE(untag_ptr(ret));
16469         return ret_conv;
16470 }
16471 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16472         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16473         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16474         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16475         LDKReplyShortChannelIdsEnd msg_var = msg;
16476         int64_t msg_ref = 0;
16477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16478         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16479         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 126, (int64_t)their_node_id_arr, msg_ref);
16480         void* ret_ptr = untag_ptr(ret);
16481         CHECK_ACCESS(ret_ptr);
16482         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16483         FREE(untag_ptr(ret));
16484         return ret_conv;
16485 }
16486 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16487         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16488         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16489         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16490         LDKQueryChannelRange msg_var = msg;
16491         int64_t msg_ref = 0;
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16493         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16494         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 127, (int64_t)their_node_id_arr, msg_ref);
16495         void* ret_ptr = untag_ptr(ret);
16496         CHECK_ACCESS(ret_ptr);
16497         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16498         FREE(untag_ptr(ret));
16499         return ret_conv;
16500 }
16501 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16502         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16503         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16504         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16505         LDKQueryShortChannelIds msg_var = msg;
16506         int64_t msg_ref = 0;
16507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16508         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16509         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 128, (int64_t)their_node_id_arr, msg_ref);
16510         void* ret_ptr = untag_ptr(ret);
16511         CHECK_ACCESS(ret_ptr);
16512         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16513         FREE(untag_ptr(ret));
16514         return ret_conv;
16515 }
16516 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16517         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16518         return js_invoke_function_b_(j_calls->instance_ptr, 129);
16519 }
16520 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16521         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16522         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 130);
16523         LDKNodeFeatures ret_conv;
16524         ret_conv.inner = untag_ptr(ret);
16525         ret_conv.is_owned = ptr_is_owned(ret);
16526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16527         return ret_conv;
16528 }
16529 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16530         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16531         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16532         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16533         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 131, (int64_t)their_node_id_arr);
16534         LDKInitFeatures ret_conv;
16535         ret_conv.inner = untag_ptr(ret);
16536         ret_conv.is_owned = ptr_is_owned(ret);
16537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16538         return ret_conv;
16539 }
16540 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
16541         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
16542         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16543         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16544 }
16545 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
16546         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
16547         atomic_init(&calls->refcnt, 1);
16548         calls->instance_ptr = o;
16549
16550         LDKRoutingMessageHandler ret = {
16551                 .this_arg = (void*) calls,
16552                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
16553                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
16554                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
16555                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
16556                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
16557                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
16558                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
16559                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
16560                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
16561                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
16562                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
16563                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
16564                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
16565                 .free = LDKRoutingMessageHandler_JCalls_free,
16566                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
16567         };
16568         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16569         return ret;
16570 }
16571 uint64_t  CS_LDK_LDKRoutingMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
16572         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16573         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
16574         return tag_ptr(res_ptr, true);
16575 }
16576 int64_t  CS_LDK_RoutingMessageHandler_handle_node_announcement(int64_t this_arg, int64_t msg) {
16577         void* this_arg_ptr = untag_ptr(this_arg);
16578         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16579         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16580         LDKNodeAnnouncement msg_conv;
16581         msg_conv.inner = untag_ptr(msg);
16582         msg_conv.is_owned = ptr_is_owned(msg);
16583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16584         msg_conv.is_owned = false;
16585         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16586         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
16587         return tag_ptr(ret_conv, true);
16588 }
16589
16590 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_announcement(int64_t this_arg, int64_t msg) {
16591         void* this_arg_ptr = untag_ptr(this_arg);
16592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16593         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16594         LDKChannelAnnouncement msg_conv;
16595         msg_conv.inner = untag_ptr(msg);
16596         msg_conv.is_owned = ptr_is_owned(msg);
16597         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16598         msg_conv.is_owned = false;
16599         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16600         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
16601         return tag_ptr(ret_conv, true);
16602 }
16603
16604 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_update(int64_t this_arg, int64_t msg) {
16605         void* this_arg_ptr = untag_ptr(this_arg);
16606         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16607         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16608         LDKChannelUpdate msg_conv;
16609         msg_conv.inner = untag_ptr(msg);
16610         msg_conv.is_owned = ptr_is_owned(msg);
16611         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16612         msg_conv.is_owned = false;
16613         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16614         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
16615         return tag_ptr(ret_conv, true);
16616 }
16617
16618 int64_t  CS_LDK_RoutingMessageHandler_get_next_channel_announcement(int64_t this_arg, int64_t starting_point) {
16619         void* this_arg_ptr = untag_ptr(this_arg);
16620         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16621         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16622         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
16623         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
16624         int64_t ret_ref = tag_ptr(ret_copy, true);
16625         return ret_ref;
16626 }
16627
16628 int64_t  CS_LDK_RoutingMessageHandler_get_next_node_announcement(int64_t this_arg, int64_t starting_point) {
16629         void* this_arg_ptr = untag_ptr(this_arg);
16630         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16631         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16632         LDKNodeId starting_point_conv;
16633         starting_point_conv.inner = untag_ptr(starting_point);
16634         starting_point_conv.is_owned = ptr_is_owned(starting_point);
16635         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
16636         starting_point_conv = NodeId_clone(&starting_point_conv);
16637         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
16638         int64_t ret_ref = 0;
16639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16641         return ret_ref;
16642 }
16643
16644 int64_t  CS_LDK_RoutingMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
16645         void* this_arg_ptr = untag_ptr(this_arg);
16646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16647         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16648         LDKPublicKey their_node_id_ref;
16649         CHECK(their_node_id->arr_len == 33);
16650         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16651         LDKInit init_conv;
16652         init_conv.inner = untag_ptr(init);
16653         init_conv.is_owned = ptr_is_owned(init);
16654         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16655         init_conv.is_owned = false;
16656         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16657         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16658         return tag_ptr(ret_conv, true);
16659 }
16660
16661 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16662         void* this_arg_ptr = untag_ptr(this_arg);
16663         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16664         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16665         LDKPublicKey their_node_id_ref;
16666         CHECK(their_node_id->arr_len == 33);
16667         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16668         LDKReplyChannelRange msg_conv;
16669         msg_conv.inner = untag_ptr(msg);
16670         msg_conv.is_owned = ptr_is_owned(msg);
16671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16672         msg_conv = ReplyChannelRange_clone(&msg_conv);
16673         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16674         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16675         return tag_ptr(ret_conv, true);
16676 }
16677
16678 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_short_channel_ids_end(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16679         void* this_arg_ptr = untag_ptr(this_arg);
16680         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16681         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16682         LDKPublicKey their_node_id_ref;
16683         CHECK(their_node_id->arr_len == 33);
16684         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16685         LDKReplyShortChannelIdsEnd msg_conv;
16686         msg_conv.inner = untag_ptr(msg);
16687         msg_conv.is_owned = ptr_is_owned(msg);
16688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16689         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
16690         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16691         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16692         return tag_ptr(ret_conv, true);
16693 }
16694
16695 int64_t  CS_LDK_RoutingMessageHandler_handle_query_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16696         void* this_arg_ptr = untag_ptr(this_arg);
16697         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16698         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16699         LDKPublicKey their_node_id_ref;
16700         CHECK(their_node_id->arr_len == 33);
16701         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16702         LDKQueryChannelRange msg_conv;
16703         msg_conv.inner = untag_ptr(msg);
16704         msg_conv.is_owned = ptr_is_owned(msg);
16705         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16706         msg_conv = QueryChannelRange_clone(&msg_conv);
16707         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16708         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16709         return tag_ptr(ret_conv, true);
16710 }
16711
16712 int64_t  CS_LDK_RoutingMessageHandler_handle_query_short_channel_ids(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16713         void* this_arg_ptr = untag_ptr(this_arg);
16714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16715         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16716         LDKPublicKey their_node_id_ref;
16717         CHECK(their_node_id->arr_len == 33);
16718         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16719         LDKQueryShortChannelIds msg_conv;
16720         msg_conv.inner = untag_ptr(msg);
16721         msg_conv.is_owned = ptr_is_owned(msg);
16722         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16723         msg_conv = QueryShortChannelIds_clone(&msg_conv);
16724         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16725         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16726         return tag_ptr(ret_conv, true);
16727 }
16728
16729 jboolean  CS_LDK_RoutingMessageHandler_processing_queue_high(int64_t this_arg) {
16730         void* this_arg_ptr = untag_ptr(this_arg);
16731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16732         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16733         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
16734         return ret_conv;
16735 }
16736
16737 int64_t  CS_LDK_RoutingMessageHandler_provided_node_features(int64_t this_arg) {
16738         void* this_arg_ptr = untag_ptr(this_arg);
16739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16740         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16741         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16742         int64_t ret_ref = 0;
16743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16745         return ret_ref;
16746 }
16747
16748 int64_t  CS_LDK_RoutingMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
16749         void* this_arg_ptr = untag_ptr(this_arg);
16750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16751         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16752         LDKPublicKey their_node_id_ref;
16753         CHECK(their_node_id->arr_len == 33);
16754         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16755         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16756         int64_t ret_ref = 0;
16757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16759         return ret_ref;
16760 }
16761
16762 typedef struct LDKOnionMessageHandler_JCalls {
16763         atomic_size_t refcnt;
16764         uint32_t instance_ptr;
16765 } LDKOnionMessageHandler_JCalls;
16766 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
16767         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16769                 FREE(j_calls);
16770         }
16771 }
16772 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
16773         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16774         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 132);
16775         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
16776         ret_constr.datalen = ret->arr_len;
16777         if (ret_constr.datalen > 0)
16778                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
16779         else
16780                 ret_constr.data = NULL;
16781         int64_t* ret_vals = ret->elems;
16782         for (size_t o = 0; o < ret_constr.datalen; o++) {
16783                 int64_t ret_conv_40 = ret_vals[o];
16784                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
16785                 CHECK_ACCESS(ret_conv_40_ptr);
16786                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
16787                 FREE(untag_ptr(ret_conv_40));
16788                 ret_constr.data[o] = ret_conv_40_conv;
16789         }
16790         FREE(ret);
16791         return ret_constr;
16792 }
16793 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
16794         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16795         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16796         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16797         LDKOnionMessage msg_var = *msg;
16798         int64_t msg_ref = 0;
16799         msg_var = OnionMessage_clone(&msg_var);
16800         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16801         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16802         js_invoke_function_void_ll(j_calls->instance_ptr, 133, (int64_t)peer_node_id_arr, msg_ref);
16803 }
16804 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
16805         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16806         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16807         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16808         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 134, (int64_t)peer_node_id_arr);
16809         LDKOnionMessage ret_conv;
16810         ret_conv.inner = untag_ptr(ret);
16811         ret_conv.is_owned = ptr_is_owned(ret);
16812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16813         return ret_conv;
16814 }
16815 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16816         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16817         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16818         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16819         LDKInit init_var = *init;
16820         int64_t init_ref = 0;
16821         init_var = Init_clone(&init_var);
16822         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16823         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16824         jboolean inbound_conv = inbound;
16825         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 135, (int64_t)their_node_id_arr, init_ref, inbound_conv);
16826         void* ret_ptr = untag_ptr(ret);
16827         CHECK_ACCESS(ret_ptr);
16828         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16829         FREE(untag_ptr(ret));
16830         return ret_conv;
16831 }
16832 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16833         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16834         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16835         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16836         js_invoke_function_void_l(j_calls->instance_ptr, 136, (int64_t)their_node_id_arr);
16837 }
16838 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
16839         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16840         js_invoke_function_void_(j_calls->instance_ptr, 137);
16841 }
16842 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
16843         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16844         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 138);
16845         LDKNodeFeatures ret_conv;
16846         ret_conv.inner = untag_ptr(ret);
16847         ret_conv.is_owned = ptr_is_owned(ret);
16848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16849         return ret_conv;
16850 }
16851 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16852         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16853         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16854         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16855         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 139, (int64_t)their_node_id_arr);
16856         LDKInitFeatures ret_conv;
16857         ret_conv.inner = untag_ptr(ret);
16858         ret_conv.is_owned = ptr_is_owned(ret);
16859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16860         return ret_conv;
16861 }
16862 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
16863         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
16864         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16865 }
16866 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (int64_t o) {
16867         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
16868         atomic_init(&calls->refcnt, 1);
16869         calls->instance_ptr = o;
16870
16871         LDKOnionMessageHandler ret = {
16872                 .this_arg = (void*) calls,
16873                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
16874                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
16875                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
16876                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
16877                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
16878                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
16879                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
16880                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
16881                 .free = LDKOnionMessageHandler_JCalls_free,
16882         };
16883         return ret;
16884 }
16885 uint64_t  CS_LDK_LDKOnionMessageHandler_new(int32_t o) {
16886         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
16887         *res_ptr = LDKOnionMessageHandler_init(o);
16888         return tag_ptr(res_ptr, true);
16889 }
16890 int64_tArray  CS_LDK_OnionMessageHandler_get_and_clear_connections_needed(int64_t this_arg) {
16891         void* this_arg_ptr = untag_ptr(this_arg);
16892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16893         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16894         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
16895         int64_tArray ret_arr = NULL;
16896         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
16897         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
16898         for (size_t o = 0; o < ret_var.datalen; o++) {
16899                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
16900                 *ret_conv_40_conv = ret_var.data[o];
16901                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
16902         }
16903         
16904         FREE(ret_var.data);
16905         return ret_arr;
16906 }
16907
16908 void  CS_LDK_OnionMessageHandler_handle_onion_message(int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
16909         void* this_arg_ptr = untag_ptr(this_arg);
16910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16911         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16912         LDKPublicKey peer_node_id_ref;
16913         CHECK(peer_node_id->arr_len == 33);
16914         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16915         LDKOnionMessage msg_conv;
16916         msg_conv.inner = untag_ptr(msg);
16917         msg_conv.is_owned = ptr_is_owned(msg);
16918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16919         msg_conv.is_owned = false;
16920         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
16921 }
16922
16923 int64_t  CS_LDK_OnionMessageHandler_next_onion_message_for_peer(int64_t this_arg, int8_tArray peer_node_id) {
16924         void* this_arg_ptr = untag_ptr(this_arg);
16925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16926         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16927         LDKPublicKey peer_node_id_ref;
16928         CHECK(peer_node_id->arr_len == 33);
16929         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
16930         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
16931         int64_t ret_ref = 0;
16932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16934         return ret_ref;
16935 }
16936
16937 int64_t  CS_LDK_OnionMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
16938         void* this_arg_ptr = untag_ptr(this_arg);
16939         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16940         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16941         LDKPublicKey their_node_id_ref;
16942         CHECK(their_node_id->arr_len == 33);
16943         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16944         LDKInit init_conv;
16945         init_conv.inner = untag_ptr(init);
16946         init_conv.is_owned = ptr_is_owned(init);
16947         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16948         init_conv.is_owned = false;
16949         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16950         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16951         return tag_ptr(ret_conv, true);
16952 }
16953
16954 void  CS_LDK_OnionMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
16955         void* this_arg_ptr = untag_ptr(this_arg);
16956         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16957         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16958         LDKPublicKey their_node_id_ref;
16959         CHECK(their_node_id->arr_len == 33);
16960         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16961         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16962 }
16963
16964 void  CS_LDK_OnionMessageHandler_timer_tick_occurred(int64_t this_arg) {
16965         void* this_arg_ptr = untag_ptr(this_arg);
16966         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16967         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16968         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
16969 }
16970
16971 int64_t  CS_LDK_OnionMessageHandler_provided_node_features(int64_t this_arg) {
16972         void* this_arg_ptr = untag_ptr(this_arg);
16973         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16974         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16975         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16976         int64_t ret_ref = 0;
16977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16979         return ret_ref;
16980 }
16981
16982 int64_t  CS_LDK_OnionMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
16983         void* this_arg_ptr = untag_ptr(this_arg);
16984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16985         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
16986         LDKPublicKey their_node_id_ref;
16987         CHECK(their_node_id->arr_len == 33);
16988         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16989         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16990         int64_t ret_ref = 0;
16991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16993         return ret_ref;
16994 }
16995
16996 typedef struct LDKCustomMessageReader_JCalls {
16997         atomic_size_t refcnt;
16998         uint32_t instance_ptr;
16999 } LDKCustomMessageReader_JCalls;
17000 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
17001         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17002         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17003                 FREE(j_calls);
17004         }
17005 }
17006 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
17007         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17008         int16_t message_type_conv = message_type;
17009         LDKu8slice buffer_var = buffer;
17010         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
17011         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
17012         uint64_t ret = js_invoke_function_l_sl(j_calls->instance_ptr, 140, message_type_conv, (int64_t)buffer_arr);
17013         void* ret_ptr = untag_ptr(ret);
17014         CHECK_ACCESS(ret_ptr);
17015         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
17016         FREE(untag_ptr(ret));
17017         return ret_conv;
17018 }
17019 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
17020         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
17021         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17022 }
17023 static inline LDKCustomMessageReader LDKCustomMessageReader_init (int64_t o) {
17024         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
17025         atomic_init(&calls->refcnt, 1);
17026         calls->instance_ptr = o;
17027
17028         LDKCustomMessageReader ret = {
17029                 .this_arg = (void*) calls,
17030                 .read = read_LDKCustomMessageReader_jcall,
17031                 .free = LDKCustomMessageReader_JCalls_free,
17032         };
17033         return ret;
17034 }
17035 uint64_t  CS_LDK_LDKCustomMessageReader_new(int32_t o) {
17036         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
17037         *res_ptr = LDKCustomMessageReader_init(o);
17038         return tag_ptr(res_ptr, true);
17039 }
17040 int64_t  CS_LDK_CustomMessageReader_read(int64_t this_arg, int16_t message_type, int8_tArray buffer) {
17041         void* this_arg_ptr = untag_ptr(this_arg);
17042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17043         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
17044         LDKu8slice buffer_ref;
17045         buffer_ref.datalen = buffer->arr_len;
17046         buffer_ref.data = buffer->elems;
17047         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17048         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
17049         FREE(buffer);
17050         return tag_ptr(ret_conv, true);
17051 }
17052
17053 typedef struct LDKCustomMessageHandler_JCalls {
17054         atomic_size_t refcnt;
17055         uint32_t instance_ptr;
17056         LDKCustomMessageReader_JCalls* CustomMessageReader;
17057 } LDKCustomMessageHandler_JCalls;
17058 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
17059         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17060         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17061                 FREE(j_calls);
17062         }
17063 }
17064 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
17065         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17066         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
17067         *msg_ret = msg;
17068         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
17069         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
17070         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 141, tag_ptr(msg_ret, true), (int64_t)sender_node_id_arr);
17071         void* ret_ptr = untag_ptr(ret);
17072         CHECK_ACCESS(ret_ptr);
17073         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17074         FREE(untag_ptr(ret));
17075         return ret_conv;
17076 }
17077 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
17078         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17079         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 142);
17080         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
17081         ret_constr.datalen = ret->arr_len;
17082         if (ret_constr.datalen > 0)
17083                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17084         else
17085                 ret_constr.data = NULL;
17086         int64_t* ret_vals = ret->elems;
17087         for (size_t z = 0; z < ret_constr.datalen; z++) {
17088                 int64_t ret_conv_25 = ret_vals[z];
17089                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
17090                 CHECK_ACCESS(ret_conv_25_ptr);
17091                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
17092                 FREE(untag_ptr(ret_conv_25));
17093                 ret_constr.data[z] = ret_conv_25_conv;
17094         }
17095         FREE(ret);
17096         return ret_constr;
17097 }
17098 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
17099         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17100         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 143);
17101         LDKNodeFeatures ret_conv;
17102         ret_conv.inner = untag_ptr(ret);
17103         ret_conv.is_owned = ptr_is_owned(ret);
17104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17105         return ret_conv;
17106 }
17107 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17108         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17109         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
17110         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
17111         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 144, (int64_t)their_node_id_arr);
17112         LDKInitFeatures ret_conv;
17113         ret_conv.inner = untag_ptr(ret);
17114         ret_conv.is_owned = ptr_is_owned(ret);
17115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17116         return ret_conv;
17117 }
17118 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
17119         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
17120         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17121         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
17122 }
17123 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (int64_t o, int64_t CustomMessageReader) {
17124         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
17125         atomic_init(&calls->refcnt, 1);
17126         calls->instance_ptr = o;
17127
17128         LDKCustomMessageHandler ret = {
17129                 .this_arg = (void*) calls,
17130                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
17131                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
17132                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
17133                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
17134                 .free = LDKCustomMessageHandler_JCalls_free,
17135                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
17136         };
17137         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
17138         return ret;
17139 }
17140 uint64_t  CS_LDK_LDKCustomMessageHandler_new(int32_t o, int32_t CustomMessageReader) {
17141         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
17142         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
17143         return tag_ptr(res_ptr, true);
17144 }
17145 int64_t  CS_LDK_CustomMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
17146         void* this_arg_ptr = untag_ptr(this_arg);
17147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17148         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17149         void* msg_ptr = untag_ptr(msg);
17150         CHECK_ACCESS(msg_ptr);
17151         LDKType msg_conv = *(LDKType*)(msg_ptr);
17152         if (msg_conv.free == LDKType_JCalls_free) {
17153                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17154                 LDKType_JCalls_cloned(&msg_conv);
17155         }
17156         LDKPublicKey sender_node_id_ref;
17157         CHECK(sender_node_id->arr_len == 33);
17158         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
17159         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17160         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
17161         return tag_ptr(ret_conv, true);
17162 }
17163
17164 int64_tArray  CS_LDK_CustomMessageHandler_get_and_clear_pending_msg(int64_t this_arg) {
17165         void* this_arg_ptr = untag_ptr(this_arg);
17166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17167         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17168         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
17169         int64_tArray ret_arr = NULL;
17170         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
17171         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
17172         for (size_t z = 0; z < ret_var.datalen; z++) {
17173                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17174                 *ret_conv_25_conv = ret_var.data[z];
17175                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
17176         }
17177         
17178         FREE(ret_var.data);
17179         return ret_arr;
17180 }
17181
17182 int64_t  CS_LDK_CustomMessageHandler_provided_node_features(int64_t this_arg) {
17183         void* this_arg_ptr = untag_ptr(this_arg);
17184         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17185         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17186         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17187         int64_t ret_ref = 0;
17188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17190         return ret_ref;
17191 }
17192
17193 int64_t  CS_LDK_CustomMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
17194         void* this_arg_ptr = untag_ptr(this_arg);
17195         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17196         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17197         LDKPublicKey their_node_id_ref;
17198         CHECK(their_node_id->arr_len == 33);
17199         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17200         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17201         int64_t ret_ref = 0;
17202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17204         return ret_ref;
17205 }
17206
17207 typedef struct LDKCustomOnionMessageHandler_JCalls {
17208         atomic_size_t refcnt;
17209         uint32_t instance_ptr;
17210 } LDKCustomOnionMessageHandler_JCalls;
17211 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
17212         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17213         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17214                 FREE(j_calls);
17215         }
17216 }
17217 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
17218         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17219         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
17220         *msg_ret = msg;
17221         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 145, tag_ptr(msg_ret, true));
17222         void* ret_ptr = untag_ptr(ret);
17223         CHECK_ACCESS(ret_ptr);
17224         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
17225         FREE(untag_ptr(ret));
17226         return ret_conv;
17227 }
17228 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
17229         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17230         int64_t message_type_conv = message_type;
17231         LDKu8slice buffer_var = buffer;
17232         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
17233         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
17234         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 146, message_type_conv, (int64_t)buffer_arr);
17235         void* ret_ptr = untag_ptr(ret);
17236         CHECK_ACCESS(ret_ptr);
17237         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
17238         FREE(untag_ptr(ret));
17239         return ret_conv;
17240 }
17241 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
17242         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17243         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 147);
17244         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
17245         ret_constr.datalen = ret->arr_len;
17246         if (ret_constr.datalen > 0)
17247                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
17248         else
17249                 ret_constr.data = NULL;
17250         int64_t* ret_vals = ret->elems;
17251         for (size_t e = 0; e < ret_constr.datalen; e++) {
17252                 int64_t ret_conv_56 = ret_vals[e];
17253                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
17254                 CHECK_ACCESS(ret_conv_56_ptr);
17255                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
17256                 FREE(untag_ptr(ret_conv_56));
17257                 ret_constr.data[e] = ret_conv_56_conv;
17258         }
17259         FREE(ret);
17260         return ret_constr;
17261 }
17262 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
17263         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
17264         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17265 }
17266 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (int64_t o) {
17267         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
17268         atomic_init(&calls->refcnt, 1);
17269         calls->instance_ptr = o;
17270
17271         LDKCustomOnionMessageHandler ret = {
17272                 .this_arg = (void*) calls,
17273                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
17274                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
17275                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
17276                 .free = LDKCustomOnionMessageHandler_JCalls_free,
17277         };
17278         return ret;
17279 }
17280 uint64_t  CS_LDK_LDKCustomOnionMessageHandler_new(int32_t o) {
17281         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
17282         *res_ptr = LDKCustomOnionMessageHandler_init(o);
17283         return tag_ptr(res_ptr, true);
17284 }
17285 int64_t  CS_LDK_CustomOnionMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg) {
17286         void* this_arg_ptr = untag_ptr(this_arg);
17287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17288         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17289         void* msg_ptr = untag_ptr(msg);
17290         CHECK_ACCESS(msg_ptr);
17291         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
17292         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
17293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17294                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
17295         }
17296         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
17297         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
17298         int64_t ret_ref = tag_ptr(ret_copy, true);
17299         return ret_ref;
17300 }
17301
17302 int64_t  CS_LDK_CustomOnionMessageHandler_read_custom_message(int64_t this_arg, int64_t message_type, int8_tArray buffer) {
17303         void* this_arg_ptr = untag_ptr(this_arg);
17304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17305         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17306         LDKu8slice buffer_ref;
17307         buffer_ref.datalen = buffer->arr_len;
17308         buffer_ref.data = buffer->elems;
17309         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
17310         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
17311         FREE(buffer);
17312         return tag_ptr(ret_conv, true);
17313 }
17314
17315 int64_tArray  CS_LDK_CustomOnionMessageHandler_release_pending_custom_messages(int64_t this_arg) {
17316         void* this_arg_ptr = untag_ptr(this_arg);
17317         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17318         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17319         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
17320         int64_tArray ret_arr = NULL;
17321         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
17322         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
17323         for (size_t e = 0; e < ret_var.datalen; e++) {
17324                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
17325                 *ret_conv_56_conv = ret_var.data[e];
17326                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
17327         }
17328         
17329         FREE(ret_var.data);
17330         return ret_arr;
17331 }
17332
17333 typedef struct LDKSocketDescriptor_JCalls {
17334         atomic_size_t refcnt;
17335         uint32_t instance_ptr;
17336 } LDKSocketDescriptor_JCalls;
17337 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
17338         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17339         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17340                 FREE(j_calls);
17341         }
17342 }
17343 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
17344         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17345         LDKu8slice data_var = data;
17346         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
17347         memcpy(data_arr->elems, data_var.data, data_var.datalen);
17348         jboolean resume_read_conv = resume_read;
17349         return js_invoke_function_l_lb(j_calls->instance_ptr, 148, (int64_t)data_arr, resume_read_conv);
17350 }
17351 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
17352         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17353         js_invoke_function_void_(j_calls->instance_ptr, 149);
17354 }
17355 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
17356         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17357         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17358         *other_arg_clone = SocketDescriptor_clone(other_arg);
17359         return js_invoke_function_b_l(j_calls->instance_ptr, 150, tag_ptr(other_arg_clone, true));
17360 }
17361 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
17362         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17363         return js_invoke_function_l_(j_calls->instance_ptr, 151);
17364 }
17365 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
17366         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
17367         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17368 }
17369 static inline LDKSocketDescriptor LDKSocketDescriptor_init (int64_t o) {
17370         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
17371         atomic_init(&calls->refcnt, 1);
17372         calls->instance_ptr = o;
17373
17374         LDKSocketDescriptor ret = {
17375                 .this_arg = (void*) calls,
17376                 .send_data = send_data_LDKSocketDescriptor_jcall,
17377                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
17378                 .eq = eq_LDKSocketDescriptor_jcall,
17379                 .hash = hash_LDKSocketDescriptor_jcall,
17380                 .cloned = LDKSocketDescriptor_JCalls_cloned,
17381                 .free = LDKSocketDescriptor_JCalls_free,
17382         };
17383         return ret;
17384 }
17385 uint64_t  CS_LDK_LDKSocketDescriptor_new(int32_t o) {
17386         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17387         *res_ptr = LDKSocketDescriptor_init(o);
17388         return tag_ptr(res_ptr, true);
17389 }
17390 int64_t  CS_LDK_SocketDescriptor_send_data(int64_t this_arg, int8_tArray data, jboolean resume_read) {
17391         void* this_arg_ptr = untag_ptr(this_arg);
17392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17393         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17394         LDKu8slice data_ref;
17395         data_ref.datalen = data->arr_len;
17396         data_ref.data = data->elems;
17397         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
17398         FREE(data);
17399         return ret_conv;
17400 }
17401
17402 void  CS_LDK_SocketDescriptor_disconnect_socket(int64_t this_arg) {
17403         void* this_arg_ptr = untag_ptr(this_arg);
17404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17405         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17406         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
17407 }
17408
17409 int64_t  CS_LDK_SocketDescriptor_hash(int64_t this_arg) {
17410         void* this_arg_ptr = untag_ptr(this_arg);
17411         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17412         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17413         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
17414         return ret_conv;
17415 }
17416
17417 typedef struct LDKSignBolt12InvoiceFn_JCalls {
17418         atomic_size_t refcnt;
17419         uint32_t instance_ptr;
17420 } LDKSignBolt12InvoiceFn_JCalls;
17421 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
17422         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17423         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17424                 FREE(j_calls);
17425         }
17426 }
17427 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
17428         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17429         LDKUnsignedBolt12Invoice message_var = *message;
17430         int64_t message_ref = 0;
17431         message_var = UnsignedBolt12Invoice_clone(&message_var);
17432         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17433         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17434         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 152, message_ref);
17435         void* ret_ptr = untag_ptr(ret);
17436         CHECK_ACCESS(ret_ptr);
17437         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17438         FREE(untag_ptr(ret));
17439         return ret_conv;
17440 }
17441 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
17442         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
17443         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17444 }
17445 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (int64_t o) {
17446         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
17447         atomic_init(&calls->refcnt, 1);
17448         calls->instance_ptr = o;
17449
17450         LDKSignBolt12InvoiceFn ret = {
17451                 .this_arg = (void*) calls,
17452                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
17453                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
17454         };
17455         return ret;
17456 }
17457 uint64_t  CS_LDK_LDKSignBolt12InvoiceFn_new(int32_t o) {
17458         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
17459         *res_ptr = LDKSignBolt12InvoiceFn_init(o);
17460         return tag_ptr(res_ptr, true);
17461 }
17462 int64_t  CS_LDK_SignBolt12InvoiceFn_sign_invoice(int64_t this_arg, int64_t message) {
17463         void* this_arg_ptr = untag_ptr(this_arg);
17464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17465         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
17466         LDKUnsignedBolt12Invoice message_conv;
17467         message_conv.inner = untag_ptr(message);
17468         message_conv.is_owned = ptr_is_owned(message);
17469         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17470         message_conv.is_owned = false;
17471         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17472         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
17473         return tag_ptr(ret_conv, true);
17474 }
17475
17476 typedef struct LDKSignInvoiceRequestFn_JCalls {
17477         atomic_size_t refcnt;
17478         uint32_t instance_ptr;
17479 } LDKSignInvoiceRequestFn_JCalls;
17480 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
17481         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17482         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17483                 FREE(j_calls);
17484         }
17485 }
17486 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
17487         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17488         LDKUnsignedInvoiceRequest message_var = *message;
17489         int64_t message_ref = 0;
17490         message_var = UnsignedInvoiceRequest_clone(&message_var);
17491         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17492         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17493         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 153, message_ref);
17494         void* ret_ptr = untag_ptr(ret);
17495         CHECK_ACCESS(ret_ptr);
17496         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17497         FREE(untag_ptr(ret));
17498         return ret_conv;
17499 }
17500 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
17501         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
17502         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17503 }
17504 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (int64_t o) {
17505         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
17506         atomic_init(&calls->refcnt, 1);
17507         calls->instance_ptr = o;
17508
17509         LDKSignInvoiceRequestFn ret = {
17510                 .this_arg = (void*) calls,
17511                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
17512                 .free = LDKSignInvoiceRequestFn_JCalls_free,
17513         };
17514         return ret;
17515 }
17516 uint64_t  CS_LDK_LDKSignInvoiceRequestFn_new(int32_t o) {
17517         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
17518         *res_ptr = LDKSignInvoiceRequestFn_init(o);
17519         return tag_ptr(res_ptr, true);
17520 }
17521 int64_t  CS_LDK_SignInvoiceRequestFn_sign_invoice_request(int64_t this_arg, int64_t message) {
17522         void* this_arg_ptr = untag_ptr(this_arg);
17523         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17524         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
17525         LDKUnsignedInvoiceRequest message_conv;
17526         message_conv.inner = untag_ptr(message);
17527         message_conv.is_owned = ptr_is_owned(message);
17528         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17529         message_conv.is_owned = false;
17530         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17531         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
17532         return tag_ptr(ret_conv, true);
17533 }
17534
17535 uint32_t CS_LDK_LDKSignError_ty_from_ptr(int64_t ptr) {
17536         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17537         switch(obj->tag) {
17538                 case LDKSignError_Signing: return 0;
17539                 case LDKSignError_Verification: return 1;
17540                 default: abort();
17541         }
17542 }
17543 int32_t CS_LDK_LDKSignError_Verification_get_verification(int64_t ptr) {
17544         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17545         CHECK(obj->tag == LDKSignError_Verification);
17546         int32_t verification_conv = LDKSecp256k1Error_to_cs(obj->verification);
17547         return verification_conv;
17548 }
17549 uint32_t CS_LDK_LDKEffectiveCapacity_ty_from_ptr(int64_t ptr) {
17550         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17551         switch(obj->tag) {
17552                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
17553                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
17554                 case LDKEffectiveCapacity_Total: return 2;
17555                 case LDKEffectiveCapacity_Infinite: return 3;
17556                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
17557                 case LDKEffectiveCapacity_Unknown: return 5;
17558                 default: abort();
17559         }
17560 }
17561 int64_t CS_LDK_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(int64_t ptr) {
17562         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17563         CHECK(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
17564         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
17565         return liquidity_msat_conv;
17566 }
17567 int64_t CS_LDK_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(int64_t ptr) {
17568         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17569         CHECK(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
17570         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
17571         return amount_msat_conv;
17572 }
17573 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_capacity_msat(int64_t ptr) {
17574         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17575         CHECK(obj->tag == LDKEffectiveCapacity_Total);
17576         int64_t capacity_msat_conv = obj->total.capacity_msat;
17577         return capacity_msat_conv;
17578 }
17579 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(int64_t ptr) {
17580         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17581         CHECK(obj->tag == LDKEffectiveCapacity_Total);
17582         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
17583         return htlc_maximum_msat_conv;
17584 }
17585 int64_t CS_LDK_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(int64_t ptr) {
17586         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17587         CHECK(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
17588         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
17589         return amount_msat_conv;
17590 }
17591 uint32_t CS_LDK_LDKPayee_ty_from_ptr(int64_t ptr) {
17592         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17593         switch(obj->tag) {
17594                 case LDKPayee_Blinded: return 0;
17595                 case LDKPayee_Clear: return 1;
17596                 default: abort();
17597         }
17598 }
17599 int64_tArray CS_LDK_LDKPayee_Blinded_get_route_hints(int64_t ptr) {
17600         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17601         CHECK(obj->tag == LDKPayee_Blinded);
17602         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
17603                         int64_tArray route_hints_arr = NULL;
17604                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
17605                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
17606                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17607                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17608                                 *route_hints_conv_37_conv = route_hints_var.data[l];
17609                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
17610                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
17611                         }
17612                         
17613         return route_hints_arr;
17614 }
17615 int64_t CS_LDK_LDKPayee_Blinded_get_features(int64_t ptr) {
17616         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17617         CHECK(obj->tag == LDKPayee_Blinded);
17618         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
17619                         int64_t features_ref = 0;
17620                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17621                         features_ref = tag_ptr(features_var.inner, false);
17622         return features_ref;
17623 }
17624 int8_tArray CS_LDK_LDKPayee_Clear_get_node_id(int64_t ptr) {
17625         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17626         CHECK(obj->tag == LDKPayee_Clear);
17627         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17628         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
17629         return node_id_arr;
17630 }
17631 int64_tArray CS_LDK_LDKPayee_Clear_get_route_hints(int64_t ptr) {
17632         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17633         CHECK(obj->tag == LDKPayee_Clear);
17634         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
17635                         int64_tArray route_hints_arr = NULL;
17636                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
17637                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
17638                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17639                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
17640                                 int64_t route_hints_conv_11_ref = 0;
17641                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
17642                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
17643                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
17644                         }
17645                         
17646         return route_hints_arr;
17647 }
17648 int64_t CS_LDK_LDKPayee_Clear_get_features(int64_t ptr) {
17649         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17650         CHECK(obj->tag == LDKPayee_Clear);
17651         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
17652                         int64_t features_ref = 0;
17653                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17654                         features_ref = tag_ptr(features_var.inner, false);
17655         return features_ref;
17656 }
17657 int32_t CS_LDK_LDKPayee_Clear_get_final_cltv_expiry_delta(int64_t ptr) {
17658         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17659         CHECK(obj->tag == LDKPayee_Clear);
17660         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
17661         return final_cltv_expiry_delta_conv;
17662 }
17663 typedef struct LDKScore_JCalls {
17664         atomic_size_t refcnt;
17665         uint32_t instance_ptr;
17666         LDKScoreLookUp_JCalls* ScoreLookUp;
17667         LDKScoreUpdate_JCalls* ScoreUpdate;
17668 } LDKScore_JCalls;
17669 static void LDKScore_JCalls_free(void* this_arg) {
17670         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17671         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17672                 FREE(j_calls);
17673         }
17674 }
17675 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
17676         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17677         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 154);
17678         LDKCVec_u8Z ret_ref;
17679         ret_ref.datalen = ret->arr_len;
17680         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
17681         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
17682         return ret_ref;
17683 }
17684 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
17685         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
17686         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17687         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
17688         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
17689 }
17690 static inline LDKScore LDKScore_init (int64_t o, int64_t ScoreLookUp, int64_t ScoreUpdate) {
17691         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
17692         atomic_init(&calls->refcnt, 1);
17693         calls->instance_ptr = o;
17694
17695         LDKScore ret = {
17696                 .this_arg = (void*) calls,
17697                 .write = write_LDKScore_jcall,
17698                 .free = LDKScore_JCalls_free,
17699                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
17700                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
17701         };
17702         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
17703         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
17704         return ret;
17705 }
17706 uint64_t  CS_LDK_LDKScore_new(int32_t o, int32_t ScoreLookUp, int32_t ScoreUpdate) {
17707         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
17708         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
17709         return tag_ptr(res_ptr, true);
17710 }
17711 int8_tArray  CS_LDK_Score_write(int64_t this_arg) {
17712         void* this_arg_ptr = untag_ptr(this_arg);
17713         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17714         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
17715         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
17716         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17717         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17718         CVec_u8Z_free(ret_var);
17719         return ret_arr;
17720 }
17721
17722 uint32_t CS_LDK_LDKIntroductionNode_ty_from_ptr(int64_t ptr) {
17723         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17724         switch(obj->tag) {
17725                 case LDKIntroductionNode_NodeId: return 0;
17726                 case LDKIntroductionNode_DirectedShortChannelId: return 1;
17727                 default: abort();
17728         }
17729 }
17730 int8_tArray CS_LDK_LDKIntroductionNode_NodeId_get_node_id(int64_t ptr) {
17731         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17732         CHECK(obj->tag == LDKIntroductionNode_NodeId);
17733         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17734         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
17735         return node_id_arr;
17736 }
17737 int32_t CS_LDK_LDKIntroductionNode_DirectedShortChannelId_get__0(int64_t ptr) {
17738         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17739         CHECK(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17740         int32_t _0_conv = LDKDirection_to_cs(obj->directed_short_channel_id._0);
17741         return _0_conv;
17742 }
17743 int64_t CS_LDK_LDKIntroductionNode_DirectedShortChannelId_get__1(int64_t ptr) {
17744         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17745         CHECK(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17746         int64_t _1_conv = obj->directed_short_channel_id._1;
17747         return _1_conv;
17748 }
17749 typedef struct LDKCoinSelectionSource_JCalls {
17750         atomic_size_t refcnt;
17751         uint32_t instance_ptr;
17752 } LDKCoinSelectionSource_JCalls;
17753 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
17754         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17755         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17756                 FREE(j_calls);
17757         }
17758 }
17759 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) {
17760         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17761         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
17762         memcpy(claim_id_arr->elems, claim_id.data, 32);
17763         LDKCVec_InputZ must_spend_var = must_spend;
17764         int64_tArray must_spend_arr = NULL;
17765         must_spend_arr = init_int64_tArray(must_spend_var.datalen, __LINE__);
17766         int64_t *must_spend_arr_ptr = (int64_t*)(((uint8_t*)must_spend_arr) + 8);
17767         for (size_t h = 0; h < must_spend_var.datalen; h++) {
17768                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
17769                 int64_t must_spend_conv_7_ref = 0;
17770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
17771                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
17772                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
17773         }
17774         
17775         FREE(must_spend_var.data);
17776         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
17777         int64_tArray must_pay_to_arr = NULL;
17778         must_pay_to_arr = init_int64_tArray(must_pay_to_var.datalen, __LINE__);
17779         int64_t *must_pay_to_arr_ptr = (int64_t*)(((uint8_t*)must_pay_to_arr) + 8);
17780         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
17781                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17782                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
17783                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
17784         }
17785         
17786         FREE(must_pay_to_var.data);
17787         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
17788         uint64_t ret = js_invoke_function_l_llli(j_calls->instance_ptr, 155, (int64_t)claim_id_arr, (int64_t)must_spend_arr, (int64_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
17789         void* ret_ptr = untag_ptr(ret);
17790         CHECK_ACCESS(ret_ptr);
17791         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
17792         FREE(untag_ptr(ret));
17793         return ret_conv;
17794 }
17795 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17796         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17797         LDKCVec_u8Z psbt_var = psbt;
17798         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17799         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17800         CVec_u8Z_free(psbt_var);
17801         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 156, (int64_t)psbt_arr);
17802         void* ret_ptr = untag_ptr(ret);
17803         CHECK_ACCESS(ret_ptr);
17804         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17805         FREE(untag_ptr(ret));
17806         return ret_conv;
17807 }
17808 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
17809         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
17810         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17811 }
17812 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (int64_t o) {
17813         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
17814         atomic_init(&calls->refcnt, 1);
17815         calls->instance_ptr = o;
17816
17817         LDKCoinSelectionSource ret = {
17818                 .this_arg = (void*) calls,
17819                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
17820                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
17821                 .free = LDKCoinSelectionSource_JCalls_free,
17822         };
17823         return ret;
17824 }
17825 uint64_t  CS_LDK_LDKCoinSelectionSource_new(int32_t o) {
17826         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
17827         *res_ptr = LDKCoinSelectionSource_init(o);
17828         return tag_ptr(res_ptr, true);
17829 }
17830 int64_t  CS_LDK_CoinSelectionSource_select_confirmed_utxos(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) {
17831         void* this_arg_ptr = untag_ptr(this_arg);
17832         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17833         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17834         LDKThirtyTwoBytes claim_id_ref;
17835         CHECK(claim_id->arr_len == 32);
17836         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
17837         LDKCVec_InputZ must_spend_constr;
17838         must_spend_constr.datalen = must_spend->arr_len;
17839         if (must_spend_constr.datalen > 0)
17840                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
17841         else
17842                 must_spend_constr.data = NULL;
17843         int64_t* must_spend_vals = must_spend->elems;
17844         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
17845                 int64_t must_spend_conv_7 = must_spend_vals[h];
17846                 LDKInput must_spend_conv_7_conv;
17847                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
17848                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
17849                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
17850                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
17851                 must_spend_constr.data[h] = must_spend_conv_7_conv;
17852         }
17853         FREE(must_spend);
17854         LDKCVec_TxOutZ must_pay_to_constr;
17855         must_pay_to_constr.datalen = must_pay_to->arr_len;
17856         if (must_pay_to_constr.datalen > 0)
17857                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17858         else
17859                 must_pay_to_constr.data = NULL;
17860         int64_t* must_pay_to_vals = must_pay_to->elems;
17861         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
17862                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
17863                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
17864                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
17865                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
17866                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
17867                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
17868         }
17869         FREE(must_pay_to);
17870         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
17871         *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);
17872         return tag_ptr(ret_conv, true);
17873 }
17874
17875 int64_t  CS_LDK_CoinSelectionSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
17876         void* this_arg_ptr = untag_ptr(this_arg);
17877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17878         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
17879         LDKCVec_u8Z psbt_ref;
17880         psbt_ref.datalen = psbt->arr_len;
17881         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17882         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17883         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17884         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17885         return tag_ptr(ret_conv, true);
17886 }
17887
17888 typedef struct LDKWalletSource_JCalls {
17889         atomic_size_t refcnt;
17890         uint32_t instance_ptr;
17891 } LDKWalletSource_JCalls;
17892 static void LDKWalletSource_JCalls_free(void* this_arg) {
17893         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17894         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17895                 FREE(j_calls);
17896         }
17897 }
17898 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
17899         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17900         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 157);
17901         void* ret_ptr = untag_ptr(ret);
17902         CHECK_ACCESS(ret_ptr);
17903         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
17904         FREE(untag_ptr(ret));
17905         return ret_conv;
17906 }
17907 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
17908         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17909         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 158);
17910         void* ret_ptr = untag_ptr(ret);
17911         CHECK_ACCESS(ret_ptr);
17912         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
17913         FREE(untag_ptr(ret));
17914         return ret_conv;
17915 }
17916 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17917         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
17918         LDKCVec_u8Z psbt_var = psbt;
17919         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17920         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17921         CVec_u8Z_free(psbt_var);
17922         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 159, (int64_t)psbt_arr);
17923         void* ret_ptr = untag_ptr(ret);
17924         CHECK_ACCESS(ret_ptr);
17925         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17926         FREE(untag_ptr(ret));
17927         return ret_conv;
17928 }
17929 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
17930         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
17931         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17932 }
17933 static inline LDKWalletSource LDKWalletSource_init (int64_t o) {
17934         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
17935         atomic_init(&calls->refcnt, 1);
17936         calls->instance_ptr = o;
17937
17938         LDKWalletSource ret = {
17939                 .this_arg = (void*) calls,
17940                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
17941                 .get_change_script = get_change_script_LDKWalletSource_jcall,
17942                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
17943                 .free = LDKWalletSource_JCalls_free,
17944         };
17945         return ret;
17946 }
17947 uint64_t  CS_LDK_LDKWalletSource_new(int32_t o) {
17948         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
17949         *res_ptr = LDKWalletSource_init(o);
17950         return tag_ptr(res_ptr, true);
17951 }
17952 int64_t  CS_LDK_WalletSource_list_confirmed_utxos(int64_t this_arg) {
17953         void* this_arg_ptr = untag_ptr(this_arg);
17954         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17955         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17956         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
17957         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
17958         return tag_ptr(ret_conv, true);
17959 }
17960
17961 int64_t  CS_LDK_WalletSource_get_change_script(int64_t this_arg) {
17962         void* this_arg_ptr = untag_ptr(this_arg);
17963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17964         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17965         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
17966         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
17967         return tag_ptr(ret_conv, true);
17968 }
17969
17970 int64_t  CS_LDK_WalletSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
17971         void* this_arg_ptr = untag_ptr(this_arg);
17972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17973         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
17974         LDKCVec_u8Z psbt_ref;
17975         psbt_ref.datalen = psbt->arr_len;
17976         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
17977         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
17978         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17979         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
17980         return tag_ptr(ret_conv, true);
17981 }
17982
17983 uint32_t CS_LDK_LDKGossipSync_ty_from_ptr(int64_t ptr) {
17984         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17985         switch(obj->tag) {
17986                 case LDKGossipSync_P2P: return 0;
17987                 case LDKGossipSync_Rapid: return 1;
17988                 case LDKGossipSync_None: return 2;
17989                 default: abort();
17990         }
17991 }
17992 int64_t CS_LDK_LDKGossipSync_P2P_get_p2p(int64_t ptr) {
17993         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
17994         CHECK(obj->tag == LDKGossipSync_P2P);
17995         LDKP2PGossipSync p2p_var = obj->p2p;
17996                         int64_t p2p_ref = 0;
17997                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
17998                         p2p_ref = tag_ptr(p2p_var.inner, false);
17999         return p2p_ref;
18000 }
18001 int64_t CS_LDK_LDKGossipSync_Rapid_get_rapid(int64_t ptr) {
18002         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
18003         CHECK(obj->tag == LDKGossipSync_Rapid);
18004         LDKRapidGossipSync rapid_var = obj->rapid;
18005                         int64_t rapid_ref = 0;
18006                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
18007                         rapid_ref = tag_ptr(rapid_var.inner, false);
18008         return rapid_ref;
18009 }
18010 uint32_t CS_LDK_LDKFallback_ty_from_ptr(int64_t ptr) {
18011         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18012         switch(obj->tag) {
18013                 case LDKFallback_SegWitProgram: return 0;
18014                 case LDKFallback_PubKeyHash: return 1;
18015                 case LDKFallback_ScriptHash: return 2;
18016                 default: abort();
18017         }
18018 }
18019 int8_t CS_LDK_LDKFallback_SegWitProgram_get_version(int64_t ptr) {
18020         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18021         CHECK(obj->tag == LDKFallback_SegWitProgram);
18022         uint8_t version_val = obj->seg_wit_program.version._0;
18023         return version_val;
18024 }
18025 int8_tArray CS_LDK_LDKFallback_SegWitProgram_get_program(int64_t ptr) {
18026         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18027         CHECK(obj->tag == LDKFallback_SegWitProgram);
18028         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
18029                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
18030                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
18031         return program_arr;
18032 }
18033 int8_tArray CS_LDK_LDKFallback_PubKeyHash_get_pub_key_hash(int64_t ptr) {
18034         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18035         CHECK(obj->tag == LDKFallback_PubKeyHash);
18036         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
18037         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
18038         return pub_key_hash_arr;
18039 }
18040 int8_tArray CS_LDK_LDKFallback_ScriptHash_get_script_hash(int64_t ptr) {
18041         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18042         CHECK(obj->tag == LDKFallback_ScriptHash);
18043         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
18044         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
18045         return script_hash_arr;
18046 }
18047 jstring  CS_LDK__ldk_get_compiled_version() {
18048         LDKStr ret_str = _ldk_get_compiled_version();
18049         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
18050         Str_free(ret_str);
18051         return ret_conv;
18052 }
18053
18054 jstring  CS_LDK__ldk_c_bindings_get_compiled_version() {
18055         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
18056         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
18057         Str_free(ret_str);
18058         return ret_conv;
18059 }
18060
18061 int8_tArray  CS_LDK_U128_le_bytes(int8_tArray val) {
18062         LDKU128 val_ref;
18063         CHECK(val->arr_len == 16);
18064         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
18065         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18066         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
18067         return ret_arr;
18068 }
18069
18070 int8_tArray  CS_LDK_U128_new(int8_tArray le_bytes) {
18071         LDKSixteenBytes le_bytes_ref;
18072         CHECK(le_bytes->arr_len == 16);
18073         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
18074         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18075         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
18076         return ret_arr;
18077 }
18078
18079 int64_t  CS_LDK_WitnessProgram_new(int8_t version, int8_tArray program) {
18080         
18081         LDKCVec_u8Z program_ref;
18082         program_ref.datalen = program->arr_len;
18083         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
18084         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
18085         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18086         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
18087         return tag_ptr(ret_ref, true);
18088 }
18089
18090 int8_t  CS_LDK_WitnessProgram_get_version(int64_t prog) {
18091         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18092         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
18093         return ret_val;
18094 }
18095
18096 int8_tArray  CS_LDK_WitnessProgram_get_program(int64_t prog) {
18097         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18098         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
18099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18101         return ret_arr;
18102 }
18103
18104 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
18105         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18106         *ret_ref = WitnessProgram_clone(arg);
18107         return tag_ptr(ret_ref, true);
18108 }
18109 int64_t  CS_LDK_WitnessProgram_clone_ptr(int64_t arg) {
18110         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
18111         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
18112         return ret_conv;
18113 }
18114
18115 int64_t  CS_LDK_WitnessProgram_clone(int64_t orig) {
18116         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
18117         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18118         *ret_ref = WitnessProgram_clone(orig_conv);
18119         return tag_ptr(ret_ref, true);
18120 }
18121
18122 void  CS_LDK_WitnessProgram_free(int64_t o) {
18123         if (!ptr_is_owned(o)) return;
18124         void* o_ptr = untag_ptr(o);
18125         CHECK_ACCESS(o_ptr);
18126         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
18127         FREE(untag_ptr(o));
18128         WitnessProgram_free(o_conv);
18129 }
18130
18131 int64_t  CS_LDK_BigEndianScalar_new(int8_tArray big_endian_bytes) {
18132         LDKThirtyTwoBytes big_endian_bytes_ref;
18133         CHECK(big_endian_bytes->arr_len == 32);
18134         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
18135         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18136         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
18137         return tag_ptr(ret_ref, true);
18138 }
18139
18140 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
18141         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18142         *ret_ref = BigEndianScalar_clone(arg);
18143         return tag_ptr(ret_ref, true);
18144 }
18145 int64_t  CS_LDK_BigEndianScalar_clone_ptr(int64_t arg) {
18146         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
18147         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
18148         return ret_conv;
18149 }
18150
18151 int64_t  CS_LDK_BigEndianScalar_clone(int64_t orig) {
18152         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
18153         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18154         *ret_ref = BigEndianScalar_clone(orig_conv);
18155         return tag_ptr(ret_ref, true);
18156 }
18157
18158 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
18159         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18160         *ret_copy = Bech32Error_clone(arg);
18161         int64_t ret_ref = tag_ptr(ret_copy, true);
18162         return ret_ref;
18163 }
18164 int64_t  CS_LDK_Bech32Error_clone_ptr(int64_t arg) {
18165         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
18166         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
18167         return ret_conv;
18168 }
18169
18170 int64_t  CS_LDK_Bech32Error_clone(int64_t orig) {
18171         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
18172         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18173         *ret_copy = Bech32Error_clone(orig_conv);
18174         int64_t ret_ref = tag_ptr(ret_copy, true);
18175         return ret_ref;
18176 }
18177
18178 void  CS_LDK_Bech32Error_free(int64_t o) {
18179         if (!ptr_is_owned(o)) return;
18180         void* o_ptr = untag_ptr(o);
18181         CHECK_ACCESS(o_ptr);
18182         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
18183         FREE(untag_ptr(o));
18184         Bech32Error_free(o_conv);
18185 }
18186
18187 void  CS_LDK_Transaction_free(int8_tArray _res) {
18188         LDKTransaction _res_ref;
18189         _res_ref.datalen = _res->arr_len;
18190         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
18191         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18192         _res_ref.data_is_owned = true;
18193         Transaction_free(_res_ref);
18194 }
18195
18196 void  CS_LDK_Witness_free(int8_tArray _res) {
18197         LDKWitness _res_ref;
18198         _res_ref.datalen = _res->arr_len;
18199         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
18200         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18201         _res_ref.data_is_owned = true;
18202         Witness_free(_res_ref);
18203 }
18204
18205 int64_t  CS_LDK_TxIn_new(int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
18206         LDKWitness witness_ref;
18207         witness_ref.datalen = witness->arr_len;
18208         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
18209         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
18210         witness_ref.data_is_owned = true;
18211         LDKCVec_u8Z script_sig_ref;
18212         script_sig_ref.datalen = script_sig->arr_len;
18213         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
18214         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
18215         LDKThirtyTwoBytes previous_txid_ref;
18216         CHECK(previous_txid->arr_len == 32);
18217         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
18218         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
18219         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
18220         return tag_ptr(ret_ref, true);
18221 }
18222
18223 int8_tArray  CS_LDK_TxIn_get_witness(int64_t txin) {
18224         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18225         LDKWitness ret_var = TxIn_get_witness(txin_conv);
18226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18228         Witness_free(ret_var);
18229         return ret_arr;
18230 }
18231
18232 int8_tArray  CS_LDK_TxIn_get_script_sig(int64_t txin) {
18233         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18234         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
18235         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18236         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18237         return ret_arr;
18238 }
18239
18240 int32_t  CS_LDK_TxIn_get_sequence(int64_t txin) {
18241         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18242         int32_t ret_conv = TxIn_get_sequence(txin_conv);
18243         return ret_conv;
18244 }
18245
18246 int8_tArray  CS_LDK_TxIn_get_previous_txid(int64_t txin) {
18247         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18248         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
18249         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
18250         return ret_arr;
18251 }
18252
18253 int32_t  CS_LDK_TxIn_get_previous_vout(int64_t txin) {
18254         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18255         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
18256         return ret_conv;
18257 }
18258
18259 void  CS_LDK_TxIn_free(int64_t _res) {
18260         if (!ptr_is_owned(_res)) return;
18261         void* _res_ptr = untag_ptr(_res);
18262         CHECK_ACCESS(_res_ptr);
18263         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
18264         FREE(untag_ptr(_res));
18265         TxIn_free(_res_conv);
18266 }
18267
18268 int64_t  CS_LDK_TxOut_new(int8_tArray script_pubkey, int64_t value) {
18269         LDKCVec_u8Z script_pubkey_ref;
18270         script_pubkey_ref.datalen = script_pubkey->arr_len;
18271         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
18272         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
18273         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18274         *ret_ref = TxOut_new(script_pubkey_ref, value);
18275         return tag_ptr(ret_ref, true);
18276 }
18277
18278 int8_tArray  CS_LDK_TxOut_get_script_pubkey(int64_t txout) {
18279         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18280         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
18281         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18282         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18283         return ret_arr;
18284 }
18285
18286 int64_t  CS_LDK_TxOut_get_value(int64_t txout) {
18287         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18288         int64_t ret_conv = TxOut_get_value(txout_conv);
18289         return ret_conv;
18290 }
18291
18292 void  CS_LDK_TxOut_free(int64_t _res) {
18293         if (!ptr_is_owned(_res)) return;
18294         void* _res_ptr = untag_ptr(_res);
18295         CHECK_ACCESS(_res_ptr);
18296         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
18297         FREE(untag_ptr(_res));
18298         TxOut_free(_res_conv);
18299 }
18300
18301 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
18302         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18303         *ret_ref = TxOut_clone(arg);
18304         return tag_ptr(ret_ref, true);
18305 }
18306 int64_t  CS_LDK_TxOut_clone_ptr(int64_t arg) {
18307         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
18308         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
18309         return ret_conv;
18310 }
18311
18312 int64_t  CS_LDK_TxOut_clone(int64_t orig) {
18313         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
18314         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18315         *ret_ref = TxOut_clone(orig_conv);
18316         return tag_ptr(ret_ref, true);
18317 }
18318
18319 void  CS_LDK_Str_free(jstring _res) {
18320         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
18321         Str_free(dummy);
18322 }
18323
18324 void  CS_LDK_CVec_u8Z_free(int8_tArray _res) {
18325         LDKCVec_u8Z _res_ref;
18326         _res_ref.datalen = _res->arr_len;
18327         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18328         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18329         CVec_u8Z_free(_res_ref);
18330 }
18331
18332 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(int64_t o) {
18333         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
18334         o_conv.inner = untag_ptr(o);
18335         o_conv.is_owned = ptr_is_owned(o);
18336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18337         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
18338         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18339         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
18340         return tag_ptr(ret_conv, true);
18341 }
18342
18343 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(int32_t e) {
18344         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
18345         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18346         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
18347         return tag_ptr(ret_conv, true);
18348 }
18349
18350 jboolean  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
18351         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
18352         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
18353         return ret_conv;
18354 }
18355
18356 void  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(int64_t _res) {
18357         if (!ptr_is_owned(_res)) return;
18358         void* _res_ptr = untag_ptr(_res);
18359         CHECK_ACCESS(_res_ptr);
18360         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
18361         FREE(untag_ptr(_res));
18362         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
18363 }
18364
18365 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
18366         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18367         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
18368         return tag_ptr(ret_conv, true);
18369 }
18370 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
18371         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
18372         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
18373         return ret_conv;
18374 }
18375
18376 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(int64_t orig) {
18377         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
18378         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18379         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
18380         return tag_ptr(ret_conv, true);
18381 }
18382
18383 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_ok(int64_t o) {
18384         LDKRefund o_conv;
18385         o_conv.inner = untag_ptr(o);
18386         o_conv.is_owned = ptr_is_owned(o);
18387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18388         o_conv = Refund_clone(&o_conv);
18389         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18390         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
18391         return tag_ptr(ret_conv, true);
18392 }
18393
18394 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_err(int32_t e) {
18395         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
18396         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18397         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
18398         return tag_ptr(ret_conv, true);
18399 }
18400
18401 jboolean  CS_LDK_CResult_RefundBolt12SemanticErrorZ_is_ok(int64_t o) {
18402         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
18403         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
18404         return ret_conv;
18405 }
18406
18407 void  CS_LDK_CResult_RefundBolt12SemanticErrorZ_free(int64_t _res) {
18408         if (!ptr_is_owned(_res)) return;
18409         void* _res_ptr = untag_ptr(_res);
18410         CHECK_ACCESS(_res_ptr);
18411         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
18412         FREE(untag_ptr(_res));
18413         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
18414 }
18415
18416 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
18417         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18418         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
18419         return tag_ptr(ret_conv, true);
18420 }
18421 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
18422         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
18423         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
18424         return ret_conv;
18425 }
18426
18427 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_clone(int64_t orig) {
18428         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
18429         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18430         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
18431         return tag_ptr(ret_conv, true);
18432 }
18433
18434 int64_t  CS_LDK_COption_u64Z_some(int64_t o) {
18435         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18436         *ret_copy = COption_u64Z_some(o);
18437         int64_t ret_ref = tag_ptr(ret_copy, true);
18438         return ret_ref;
18439 }
18440
18441 int64_t  CS_LDK_COption_u64Z_none() {
18442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18443         *ret_copy = COption_u64Z_none();
18444         int64_t ret_ref = tag_ptr(ret_copy, true);
18445         return ret_ref;
18446 }
18447
18448 void  CS_LDK_COption_u64Z_free(int64_t _res) {
18449         if (!ptr_is_owned(_res)) return;
18450         void* _res_ptr = untag_ptr(_res);
18451         CHECK_ACCESS(_res_ptr);
18452         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
18453         FREE(untag_ptr(_res));
18454         COption_u64Z_free(_res_conv);
18455 }
18456
18457 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
18458         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18459         *ret_copy = COption_u64Z_clone(arg);
18460         int64_t ret_ref = tag_ptr(ret_copy, true);
18461         return ret_ref;
18462 }
18463 int64_t  CS_LDK_COption_u64Z_clone_ptr(int64_t arg) {
18464         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
18465         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
18466         return ret_conv;
18467 }
18468
18469 int64_t  CS_LDK_COption_u64Z_clone(int64_t orig) {
18470         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
18471         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18472         *ret_copy = COption_u64Z_clone(orig_conv);
18473         int64_t ret_ref = tag_ptr(ret_copy, true);
18474         return ret_ref;
18475 }
18476
18477 void  CS_LDK_CVec_BlindedPathZ_free(int64_tArray _res) {
18478         LDKCVec_BlindedPathZ _res_constr;
18479         _res_constr.datalen = _res->arr_len;
18480         if (_res_constr.datalen > 0)
18481                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18482         else
18483                 _res_constr.data = NULL;
18484         int64_t* _res_vals = _res->elems;
18485         for (size_t n = 0; n < _res_constr.datalen; n++) {
18486                 int64_t _res_conv_13 = _res_vals[n];
18487                 LDKBlindedPath _res_conv_13_conv;
18488                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
18489                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
18490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
18491                 _res_constr.data[n] = _res_conv_13_conv;
18492         }
18493         FREE(_res);
18494         CVec_BlindedPathZ_free(_res_constr);
18495 }
18496
18497 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_ok(int64_t o) {
18498         LDKRefund o_conv;
18499         o_conv.inner = untag_ptr(o);
18500         o_conv.is_owned = ptr_is_owned(o);
18501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18502         o_conv = Refund_clone(&o_conv);
18503         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18504         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
18505         return tag_ptr(ret_conv, true);
18506 }
18507
18508 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_err(int64_t e) {
18509         LDKBolt12ParseError e_conv;
18510         e_conv.inner = untag_ptr(e);
18511         e_conv.is_owned = ptr_is_owned(e);
18512         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18513         e_conv = Bolt12ParseError_clone(&e_conv);
18514         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18515         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 jboolean  CS_LDK_CResult_RefundBolt12ParseErrorZ_is_ok(int64_t o) {
18520         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
18521         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
18522         return ret_conv;
18523 }
18524
18525 void  CS_LDK_CResult_RefundBolt12ParseErrorZ_free(int64_t _res) {
18526         if (!ptr_is_owned(_res)) return;
18527         void* _res_ptr = untag_ptr(_res);
18528         CHECK_ACCESS(_res_ptr);
18529         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
18530         FREE(untag_ptr(_res));
18531         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
18532 }
18533
18534 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
18535         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18536         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
18537         return tag_ptr(ret_conv, true);
18538 }
18539 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone_ptr(int64_t arg) {
18540         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
18541         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
18542         return ret_conv;
18543 }
18544
18545 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone(int64_t orig) {
18546         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
18547         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18548         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
18549         return tag_ptr(ret_conv, true);
18550 }
18551
18552 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_ok(int64_t o) {
18553         void* o_ptr = untag_ptr(o);
18554         CHECK_ACCESS(o_ptr);
18555         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
18556         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
18557         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18558         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
18559         return tag_ptr(ret_conv, true);
18560 }
18561
18562 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_err(int64_t e) {
18563         void* e_ptr = untag_ptr(e);
18564         CHECK_ACCESS(e_ptr);
18565         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18566         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18567         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18568         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
18569         return tag_ptr(ret_conv, true);
18570 }
18571
18572 jboolean  CS_LDK_CResult_RetryDecodeErrorZ_is_ok(int64_t o) {
18573         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
18574         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
18575         return ret_conv;
18576 }
18577
18578 void  CS_LDK_CResult_RetryDecodeErrorZ_free(int64_t _res) {
18579         if (!ptr_is_owned(_res)) return;
18580         void* _res_ptr = untag_ptr(_res);
18581         CHECK_ACCESS(_res_ptr);
18582         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
18583         FREE(untag_ptr(_res));
18584         CResult_RetryDecodeErrorZ_free(_res_conv);
18585 }
18586
18587 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
18588         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18589         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
18590         return tag_ptr(ret_conv, true);
18591 }
18592 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone_ptr(int64_t arg) {
18593         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
18594         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
18595         return ret_conv;
18596 }
18597
18598 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone(int64_t orig) {
18599         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
18600         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18601         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
18602         return tag_ptr(ret_conv, true);
18603 }
18604
18605 int64_t  CS_LDK_CResult_NoneAPIErrorZ_ok() {
18606         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18607         *ret_conv = CResult_NoneAPIErrorZ_ok();
18608         return tag_ptr(ret_conv, true);
18609 }
18610
18611 int64_t  CS_LDK_CResult_NoneAPIErrorZ_err(int64_t e) {
18612         void* e_ptr = untag_ptr(e);
18613         CHECK_ACCESS(e_ptr);
18614         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18615         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18616         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18617         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18618         return tag_ptr(ret_conv, true);
18619 }
18620
18621 jboolean  CS_LDK_CResult_NoneAPIErrorZ_is_ok(int64_t o) {
18622         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18623         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18624         return ret_conv;
18625 }
18626
18627 void  CS_LDK_CResult_NoneAPIErrorZ_free(int64_t _res) {
18628         if (!ptr_is_owned(_res)) return;
18629         void* _res_ptr = untag_ptr(_res);
18630         CHECK_ACCESS(_res_ptr);
18631         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18632         FREE(untag_ptr(_res));
18633         CResult_NoneAPIErrorZ_free(_res_conv);
18634 }
18635
18636 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18637         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18638         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18639         return tag_ptr(ret_conv, true);
18640 }
18641 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone_ptr(int64_t arg) {
18642         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18643         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18644         return ret_conv;
18645 }
18646
18647 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone(int64_t orig) {
18648         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18649         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18650         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18651         return tag_ptr(ret_conv, true);
18652 }
18653
18654 void  CS_LDK_CVec_CResult_NoneAPIErrorZZ_free(int64_tArray _res) {
18655         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18656         _res_constr.datalen = _res->arr_len;
18657         if (_res_constr.datalen > 0)
18658                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18659         else
18660                 _res_constr.data = NULL;
18661         int64_t* _res_vals = _res->elems;
18662         for (size_t w = 0; w < _res_constr.datalen; w++) {
18663                 int64_t _res_conv_22 = _res_vals[w];
18664                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18665                 CHECK_ACCESS(_res_conv_22_ptr);
18666                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18667                 FREE(untag_ptr(_res_conv_22));
18668                 _res_constr.data[w] = _res_conv_22_conv;
18669         }
18670         FREE(_res);
18671         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18672 }
18673
18674 void  CS_LDK_CVec_APIErrorZ_free(int64_tArray _res) {
18675         LDKCVec_APIErrorZ _res_constr;
18676         _res_constr.datalen = _res->arr_len;
18677         if (_res_constr.datalen > 0)
18678                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18679         else
18680                 _res_constr.data = NULL;
18681         int64_t* _res_vals = _res->elems;
18682         for (size_t k = 0; k < _res_constr.datalen; k++) {
18683                 int64_t _res_conv_10 = _res_vals[k];
18684                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18685                 CHECK_ACCESS(_res_conv_10_ptr);
18686                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18687                 FREE(untag_ptr(_res_conv_10));
18688                 _res_constr.data[k] = _res_conv_10_conv;
18689         }
18690         FREE(_res);
18691         CVec_APIErrorZ_free(_res_constr);
18692 }
18693
18694 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
18695         LDKThirtyTwoBytes o_ref;
18696         CHECK(o->arr_len == 32);
18697         memcpy(o_ref.data, o->elems, 32); FREE(o);
18698         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18699         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
18700         int64_t ret_ref = tag_ptr(ret_copy, true);
18701         return ret_ref;
18702 }
18703
18704 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_none() {
18705         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18706         *ret_copy = COption_ThirtyTwoBytesZ_none();
18707         int64_t ret_ref = tag_ptr(ret_copy, true);
18708         return ret_ref;
18709 }
18710
18711 void  CS_LDK_COption_ThirtyTwoBytesZ_free(int64_t _res) {
18712         if (!ptr_is_owned(_res)) return;
18713         void* _res_ptr = untag_ptr(_res);
18714         CHECK_ACCESS(_res_ptr);
18715         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
18716         FREE(untag_ptr(_res));
18717         COption_ThirtyTwoBytesZ_free(_res_conv);
18718 }
18719
18720 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
18721         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18722         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
18723         int64_t ret_ref = tag_ptr(ret_copy, true);
18724         return ret_ref;
18725 }
18726 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone_ptr(int64_t arg) {
18727         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
18728         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
18729         return ret_conv;
18730 }
18731
18732 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone(int64_t orig) {
18733         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
18734         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18735         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
18736         int64_t ret_ref = tag_ptr(ret_copy, true);
18737         return ret_ref;
18738 }
18739
18740 int64_t  CS_LDK_COption_CVec_u8ZZ_some(int8_tArray o) {
18741         LDKCVec_u8Z o_ref;
18742         o_ref.datalen = o->arr_len;
18743         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18744         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18745         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18746         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
18747         int64_t ret_ref = tag_ptr(ret_copy, true);
18748         return ret_ref;
18749 }
18750
18751 int64_t  CS_LDK_COption_CVec_u8ZZ_none() {
18752         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18753         *ret_copy = COption_CVec_u8ZZ_none();
18754         int64_t ret_ref = tag_ptr(ret_copy, true);
18755         return ret_ref;
18756 }
18757
18758 void  CS_LDK_COption_CVec_u8ZZ_free(int64_t _res) {
18759         if (!ptr_is_owned(_res)) return;
18760         void* _res_ptr = untag_ptr(_res);
18761         CHECK_ACCESS(_res_ptr);
18762         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
18763         FREE(untag_ptr(_res));
18764         COption_CVec_u8ZZ_free(_res_conv);
18765 }
18766
18767 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
18768         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18769         *ret_copy = COption_CVec_u8ZZ_clone(arg);
18770         int64_t ret_ref = tag_ptr(ret_copy, true);
18771         return ret_ref;
18772 }
18773 int64_t  CS_LDK_COption_CVec_u8ZZ_clone_ptr(int64_t arg) {
18774         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
18775         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
18776         return ret_conv;
18777 }
18778
18779 int64_t  CS_LDK_COption_CVec_u8ZZ_clone(int64_t orig) {
18780         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
18781         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18782         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
18783         int64_t ret_ref = tag_ptr(ret_copy, true);
18784         return ret_ref;
18785 }
18786
18787 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_ok(int64_t o) {
18788         LDKRecipientOnionFields o_conv;
18789         o_conv.inner = untag_ptr(o);
18790         o_conv.is_owned = ptr_is_owned(o);
18791         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18792         o_conv = RecipientOnionFields_clone(&o_conv);
18793         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18794         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
18795         return tag_ptr(ret_conv, true);
18796 }
18797
18798 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_err(int64_t e) {
18799         void* e_ptr = untag_ptr(e);
18800         CHECK_ACCESS(e_ptr);
18801         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18802         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18803         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18804         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
18805         return tag_ptr(ret_conv, true);
18806 }
18807
18808 jboolean  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(int64_t o) {
18809         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
18810         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
18811         return ret_conv;
18812 }
18813
18814 void  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_free(int64_t _res) {
18815         if (!ptr_is_owned(_res)) return;
18816         void* _res_ptr = untag_ptr(_res);
18817         CHECK_ACCESS(_res_ptr);
18818         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
18819         FREE(untag_ptr(_res));
18820         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
18821 }
18822
18823 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
18824         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18825         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
18826         return tag_ptr(ret_conv, true);
18827 }
18828 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
18829         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
18830         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
18831         return ret_conv;
18832 }
18833
18834 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone(int64_t orig) {
18835         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
18836         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18837         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
18838         return tag_ptr(ret_conv, true);
18839 }
18840
18841 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
18842         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18843         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
18844         return tag_ptr(ret_conv, true);
18845 }
18846 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone_ptr(int64_t arg) {
18847         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
18848         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
18849         return ret_conv;
18850 }
18851
18852 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone(int64_t orig) {
18853         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
18854         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18855         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
18856         return tag_ptr(ret_conv, true);
18857 }
18858
18859 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
18860         LDKCVec_u8Z b_ref;
18861         b_ref.datalen = b->arr_len;
18862         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18863         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18864         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
18865         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
18866         return tag_ptr(ret_conv, true);
18867 }
18868
18869 void  CS_LDK_C2Tuple_u64CVec_u8ZZ_free(int64_t _res) {
18870         if (!ptr_is_owned(_res)) return;
18871         void* _res_ptr = untag_ptr(_res);
18872         CHECK_ACCESS(_res_ptr);
18873         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
18874         FREE(untag_ptr(_res));
18875         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
18876 }
18877
18878 void  CS_LDK_CVec_C2Tuple_u64CVec_u8ZZZ_free(int64_tArray _res) {
18879         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
18880         _res_constr.datalen = _res->arr_len;
18881         if (_res_constr.datalen > 0)
18882                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
18883         else
18884                 _res_constr.data = NULL;
18885         int64_t* _res_vals = _res->elems;
18886         for (size_t x = 0; x < _res_constr.datalen; x++) {
18887                 int64_t _res_conv_23 = _res_vals[x];
18888                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
18889                 CHECK_ACCESS(_res_conv_23_ptr);
18890                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
18891                 FREE(untag_ptr(_res_conv_23));
18892                 _res_constr.data[x] = _res_conv_23_conv;
18893         }
18894         FREE(_res);
18895         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
18896 }
18897
18898 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_ok(int64_t o) {
18899         LDKRecipientOnionFields o_conv;
18900         o_conv.inner = untag_ptr(o);
18901         o_conv.is_owned = ptr_is_owned(o);
18902         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18903         o_conv = RecipientOnionFields_clone(&o_conv);
18904         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18905         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
18906         return tag_ptr(ret_conv, true);
18907 }
18908
18909 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_err() {
18910         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18911         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
18912         return tag_ptr(ret_conv, true);
18913 }
18914
18915 jboolean  CS_LDK_CResult_RecipientOnionFieldsNoneZ_is_ok(int64_t o) {
18916         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
18917         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
18918         return ret_conv;
18919 }
18920
18921 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_free(int64_t _res) {
18922         if (!ptr_is_owned(_res)) return;
18923         void* _res_ptr = untag_ptr(_res);
18924         CHECK_ACCESS(_res_ptr);
18925         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
18926         FREE(untag_ptr(_res));
18927         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
18928 }
18929
18930 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
18931         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18932         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
18933         return tag_ptr(ret_conv, true);
18934 }
18935 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone_ptr(int64_t arg) {
18936         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
18937         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
18938         return ret_conv;
18939 }
18940
18941 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone(int64_t orig) {
18942         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
18943         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
18944         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
18945         return tag_ptr(ret_conv, true);
18946 }
18947
18948 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(int64_t o) {
18949         LDKUnsignedBolt12Invoice o_conv;
18950         o_conv.inner = untag_ptr(o);
18951         o_conv.is_owned = ptr_is_owned(o);
18952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18953         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
18954         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18955         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
18956         return tag_ptr(ret_conv, true);
18957 }
18958
18959 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(int32_t e) {
18960         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
18961         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18962         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
18963         return tag_ptr(ret_conv, true);
18964 }
18965
18966 jboolean  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(int64_t o) {
18967         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
18968         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
18969         return ret_conv;
18970 }
18971
18972 void  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(int64_t _res) {
18973         if (!ptr_is_owned(_res)) return;
18974         void* _res_ptr = untag_ptr(_res);
18975         CHECK_ACCESS(_res_ptr);
18976         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
18977         FREE(untag_ptr(_res));
18978         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
18979 }
18980
18981 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
18982         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18983         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
18984         return tag_ptr(ret_conv, true);
18985 }
18986 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
18987         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
18988         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
18989         return ret_conv;
18990 }
18991
18992 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(int64_t orig) {
18993         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
18994         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
18995         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
18996         return tag_ptr(ret_conv, true);
18997 }
18998
18999 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(int64_t o) {
19000         LDKBolt12Invoice o_conv;
19001         o_conv.inner = untag_ptr(o);
19002         o_conv.is_owned = ptr_is_owned(o);
19003         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19004         o_conv = Bolt12Invoice_clone(&o_conv);
19005         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19006         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
19007         return tag_ptr(ret_conv, true);
19008 }
19009
19010 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(int32_t e) {
19011         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
19012         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19013         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
19014         return tag_ptr(ret_conv, true);
19015 }
19016
19017 jboolean  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(int64_t o) {
19018         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
19019         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
19020         return ret_conv;
19021 }
19022
19023 void  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(int64_t _res) {
19024         if (!ptr_is_owned(_res)) return;
19025         void* _res_ptr = untag_ptr(_res);
19026         CHECK_ACCESS(_res_ptr);
19027         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
19028         FREE(untag_ptr(_res));
19029         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
19030 }
19031
19032 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
19033         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19034         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
19035         return tag_ptr(ret_conv, true);
19036 }
19037 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
19038         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
19039         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
19040         return ret_conv;
19041 }
19042
19043 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(int64_t orig) {
19044         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
19045         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19046         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
19047         return tag_ptr(ret_conv, true);
19048 }
19049
19050 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
19051         LDKSchnorrSignature o_ref;
19052         CHECK(o->arr_len == 64);
19053         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
19054         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19055         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
19056         return tag_ptr(ret_conv, true);
19057 }
19058
19059 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_err() {
19060         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19061         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
19062         return tag_ptr(ret_conv, true);
19063 }
19064
19065 jboolean  CS_LDK_CResult_SchnorrSignatureNoneZ_is_ok(int64_t o) {
19066         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
19067         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
19068         return ret_conv;
19069 }
19070
19071 void  CS_LDK_CResult_SchnorrSignatureNoneZ_free(int64_t _res) {
19072         if (!ptr_is_owned(_res)) return;
19073         void* _res_ptr = untag_ptr(_res);
19074         CHECK_ACCESS(_res_ptr);
19075         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
19076         FREE(untag_ptr(_res));
19077         CResult_SchnorrSignatureNoneZ_free(_res_conv);
19078 }
19079
19080 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
19081         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19082         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
19083         return tag_ptr(ret_conv, true);
19084 }
19085 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone_ptr(int64_t arg) {
19086         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
19087         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
19088         return ret_conv;
19089 }
19090
19091 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone(int64_t orig) {
19092         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
19093         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19094         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
19095         return tag_ptr(ret_conv, true);
19096 }
19097
19098 void  CS_LDK_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
19099         LDKCVec_ThirtyTwoBytesZ _res_constr;
19100         _res_constr.datalen = _res->arr_len;
19101         if (_res_constr.datalen > 0)
19102                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19103         else
19104                 _res_constr.data = NULL;
19105         int8_tArray* _res_vals = (void*) _res->elems;
19106         for (size_t i = 0; i < _res_constr.datalen; i++) {
19107                 int8_tArray _res_conv_8 = _res_vals[i];
19108                 LDKThirtyTwoBytes _res_conv_8_ref;
19109                 CHECK(_res_conv_8->arr_len == 32);
19110                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, 32); FREE(_res_conv_8);
19111                 _res_constr.data[i] = _res_conv_8_ref;
19112         }
19113         FREE(_res);
19114         CVec_ThirtyTwoBytesZ_free(_res_constr);
19115 }
19116
19117 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
19118         LDKCVec_ThirtyTwoBytesZ o_constr;
19119         o_constr.datalen = o->arr_len;
19120         if (o_constr.datalen > 0)
19121                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19122         else
19123                 o_constr.data = NULL;
19124         int8_tArray* o_vals = (void*) o->elems;
19125         for (size_t i = 0; i < o_constr.datalen; i++) {
19126                 int8_tArray o_conv_8 = o_vals[i];
19127                 LDKThirtyTwoBytes o_conv_8_ref;
19128                 CHECK(o_conv_8->arr_len == 32);
19129                 memcpy(o_conv_8_ref.data, o_conv_8->elems, 32); FREE(o_conv_8);
19130                 o_constr.data[i] = o_conv_8_ref;
19131         }
19132         FREE(o);
19133         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19134         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
19135         int64_t ret_ref = tag_ptr(ret_copy, true);
19136         return ret_ref;
19137 }
19138
19139 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_none() {
19140         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19141         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
19142         int64_t ret_ref = tag_ptr(ret_copy, true);
19143         return ret_ref;
19144 }
19145
19146 void  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_free(int64_t _res) {
19147         if (!ptr_is_owned(_res)) return;
19148         void* _res_ptr = untag_ptr(_res);
19149         CHECK_ACCESS(_res_ptr);
19150         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
19151         FREE(untag_ptr(_res));
19152         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
19153 }
19154
19155 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
19156         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19157         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
19158         int64_t ret_ref = tag_ptr(ret_copy, true);
19159         return ret_ref;
19160 }
19161 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
19162         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
19163         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
19164         return ret_conv;
19165 }
19166
19167 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone(int64_t orig) {
19168         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
19169         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19170         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
19171         int64_t ret_ref = tag_ptr(ret_copy, true);
19172         return ret_ref;
19173 }
19174
19175 int64_t  CS_LDK_COption_AmountZ_some(int64_t o) {
19176         void* o_ptr = untag_ptr(o);
19177         CHECK_ACCESS(o_ptr);
19178         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
19179         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
19180         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19181         *ret_copy = COption_AmountZ_some(o_conv);
19182         int64_t ret_ref = tag_ptr(ret_copy, true);
19183         return ret_ref;
19184 }
19185
19186 int64_t  CS_LDK_COption_AmountZ_none() {
19187         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19188         *ret_copy = COption_AmountZ_none();
19189         int64_t ret_ref = tag_ptr(ret_copy, true);
19190         return ret_ref;
19191 }
19192
19193 void  CS_LDK_COption_AmountZ_free(int64_t _res) {
19194         if (!ptr_is_owned(_res)) return;
19195         void* _res_ptr = untag_ptr(_res);
19196         CHECK_ACCESS(_res_ptr);
19197         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
19198         FREE(untag_ptr(_res));
19199         COption_AmountZ_free(_res_conv);
19200 }
19201
19202 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
19203         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19204         *ret_copy = COption_AmountZ_clone(arg);
19205         int64_t ret_ref = tag_ptr(ret_copy, true);
19206         return ret_ref;
19207 }
19208 int64_t  CS_LDK_COption_AmountZ_clone_ptr(int64_t arg) {
19209         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
19210         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
19211         return ret_conv;
19212 }
19213
19214 int64_t  CS_LDK_COption_AmountZ_clone(int64_t orig) {
19215         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
19216         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19217         *ret_copy = COption_AmountZ_clone(orig_conv);
19218         int64_t ret_ref = tag_ptr(ret_copy, true);
19219         return ret_ref;
19220 }
19221
19222 int64_t  CS_LDK_COption_QuantityZ_some(int64_t o) {
19223         void* o_ptr = untag_ptr(o);
19224         CHECK_ACCESS(o_ptr);
19225         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
19226         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
19227         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19228         *ret_copy = COption_QuantityZ_some(o_conv);
19229         int64_t ret_ref = tag_ptr(ret_copy, true);
19230         return ret_ref;
19231 }
19232
19233 int64_t  CS_LDK_COption_QuantityZ_none() {
19234         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19235         *ret_copy = COption_QuantityZ_none();
19236         int64_t ret_ref = tag_ptr(ret_copy, true);
19237         return ret_ref;
19238 }
19239
19240 void  CS_LDK_COption_QuantityZ_free(int64_t _res) {
19241         if (!ptr_is_owned(_res)) return;
19242         void* _res_ptr = untag_ptr(_res);
19243         CHECK_ACCESS(_res_ptr);
19244         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
19245         FREE(untag_ptr(_res));
19246         COption_QuantityZ_free(_res_conv);
19247 }
19248
19249 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
19250         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19251         *ret_copy = COption_QuantityZ_clone(arg);
19252         int64_t ret_ref = tag_ptr(ret_copy, true);
19253         return ret_ref;
19254 }
19255 int64_t  CS_LDK_COption_QuantityZ_clone_ptr(int64_t arg) {
19256         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
19257         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
19258         return ret_conv;
19259 }
19260
19261 int64_t  CS_LDK_COption_QuantityZ_clone(int64_t orig) {
19262         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
19263         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19264         *ret_copy = COption_QuantityZ_clone(orig_conv);
19265         int64_t ret_ref = tag_ptr(ret_copy, true);
19266         return ret_ref;
19267 }
19268
19269 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
19270         LDKThirtyTwoBytes o_ref;
19271         CHECK(o->arr_len == 32);
19272         memcpy(o_ref.data, o->elems, 32); FREE(o);
19273         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19274         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
19275         return tag_ptr(ret_conv, true);
19276 }
19277
19278 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_err() {
19279         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19280         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
19281         return tag_ptr(ret_conv, true);
19282 }
19283
19284 jboolean  CS_LDK_CResult_ThirtyTwoBytesNoneZ_is_ok(int64_t o) {
19285         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
19286         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
19287         return ret_conv;
19288 }
19289
19290 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_free(int64_t _res) {
19291         if (!ptr_is_owned(_res)) return;
19292         void* _res_ptr = untag_ptr(_res);
19293         CHECK_ACCESS(_res_ptr);
19294         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
19295         FREE(untag_ptr(_res));
19296         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
19297 }
19298
19299 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
19300         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19301         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
19302         return tag_ptr(ret_conv, true);
19303 }
19304 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone_ptr(int64_t arg) {
19305         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
19306         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
19307         return ret_conv;
19308 }
19309
19310 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone(int64_t orig) {
19311         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
19312         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19313         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
19314         return tag_ptr(ret_conv, true);
19315 }
19316
19317 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_ok(int64_t o) {
19318         LDKBlindedPayInfo o_conv;
19319         o_conv.inner = untag_ptr(o);
19320         o_conv.is_owned = ptr_is_owned(o);
19321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19322         o_conv = BlindedPayInfo_clone(&o_conv);
19323         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19324         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19325         return tag_ptr(ret_conv, true);
19326 }
19327
19328 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_err(int64_t e) {
19329         void* e_ptr = untag_ptr(e);
19330         CHECK_ACCESS(e_ptr);
19331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19333         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19334         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19335         return tag_ptr(ret_conv, true);
19336 }
19337
19338 jboolean  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_is_ok(int64_t o) {
19339         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19340         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19341         return ret_conv;
19342 }
19343
19344 void  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_free(int64_t _res) {
19345         if (!ptr_is_owned(_res)) return;
19346         void* _res_ptr = untag_ptr(_res);
19347         CHECK_ACCESS(_res_ptr);
19348         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19349         FREE(untag_ptr(_res));
19350         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19351 }
19352
19353 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19354         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19355         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19356         return tag_ptr(ret_conv, true);
19357 }
19358 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(int64_t arg) {
19359         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19360         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19361         return ret_conv;
19362 }
19363
19364 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone(int64_t orig) {
19365         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19366         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19367         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19368         return tag_ptr(ret_conv, true);
19369 }
19370
19371 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19372         LDKDelayedPaymentOutputDescriptor o_conv;
19373         o_conv.inner = untag_ptr(o);
19374         o_conv.is_owned = ptr_is_owned(o);
19375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19376         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19377         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19378         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19379         return tag_ptr(ret_conv, true);
19380 }
19381
19382 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
19383         void* e_ptr = untag_ptr(e);
19384         CHECK_ACCESS(e_ptr);
19385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19387         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19388         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19389         return tag_ptr(ret_conv, true);
19390 }
19391
19392 jboolean  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19393         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19394         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19395         return ret_conv;
19396 }
19397
19398 void  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19399         if (!ptr_is_owned(_res)) return;
19400         void* _res_ptr = untag_ptr(_res);
19401         CHECK_ACCESS(_res_ptr);
19402         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19403         FREE(untag_ptr(_res));
19404         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19405 }
19406
19407 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19408         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19409         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19410         return tag_ptr(ret_conv, true);
19411 }
19412 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19413         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19414         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19415         return ret_conv;
19416 }
19417
19418 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19419         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19420         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19421         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19422         return tag_ptr(ret_conv, true);
19423 }
19424
19425 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19426         LDKStaticPaymentOutputDescriptor o_conv;
19427         o_conv.inner = untag_ptr(o);
19428         o_conv.is_owned = ptr_is_owned(o);
19429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19430         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19431         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19432         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19433         return tag_ptr(ret_conv, true);
19434 }
19435
19436 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
19437         void* e_ptr = untag_ptr(e);
19438         CHECK_ACCESS(e_ptr);
19439         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19440         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19441         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19442         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19443         return tag_ptr(ret_conv, true);
19444 }
19445
19446 jboolean  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19447         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19448         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19449         return ret_conv;
19450 }
19451
19452 void  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19453         if (!ptr_is_owned(_res)) return;
19454         void* _res_ptr = untag_ptr(_res);
19455         CHECK_ACCESS(_res_ptr);
19456         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19457         FREE(untag_ptr(_res));
19458         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19459 }
19460
19461 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19462         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19463         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19464         return tag_ptr(ret_conv, true);
19465 }
19466 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19467         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19468         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19469         return ret_conv;
19470 }
19471
19472 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19473         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19474         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19475         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19476         return tag_ptr(ret_conv, true);
19477 }
19478
19479 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19480         void* o_ptr = untag_ptr(o);
19481         CHECK_ACCESS(o_ptr);
19482         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19483         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19484         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19485         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19486         return tag_ptr(ret_conv, true);
19487 }
19488
19489 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_err(int64_t e) {
19490         void* e_ptr = untag_ptr(e);
19491         CHECK_ACCESS(e_ptr);
19492         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19493         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19494         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19495         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19496         return tag_ptr(ret_conv, true);
19497 }
19498
19499 jboolean  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19500         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19501         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19502         return ret_conv;
19503 }
19504
19505 void  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19506         if (!ptr_is_owned(_res)) return;
19507         void* _res_ptr = untag_ptr(_res);
19508         CHECK_ACCESS(_res_ptr);
19509         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19510         FREE(untag_ptr(_res));
19511         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19512 }
19513
19514 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19515         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19516         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19517         return tag_ptr(ret_conv, true);
19518 }
19519 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19520         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19521         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19522         return ret_conv;
19523 }
19524
19525 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19526         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19527         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19528         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19529         return tag_ptr(ret_conv, true);
19530 }
19531
19532 void  CS_LDK_CVec_SpendableOutputDescriptorZ_free(int64_tArray _res) {
19533         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19534         _res_constr.datalen = _res->arr_len;
19535         if (_res_constr.datalen > 0)
19536                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19537         else
19538                 _res_constr.data = NULL;
19539         int64_t* _res_vals = _res->elems;
19540         for (size_t b = 0; b < _res_constr.datalen; b++) {
19541                 int64_t _res_conv_27 = _res_vals[b];
19542                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19543                 CHECK_ACCESS(_res_conv_27_ptr);
19544                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19545                 FREE(untag_ptr(_res_conv_27));
19546                 _res_constr.data[b] = _res_conv_27_conv;
19547         }
19548         FREE(_res);
19549         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19550 }
19551
19552 void  CS_LDK_CVec_TxOutZ_free(int64_tArray _res) {
19553         LDKCVec_TxOutZ _res_constr;
19554         _res_constr.datalen = _res->arr_len;
19555         if (_res_constr.datalen > 0)
19556                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19557         else
19558                 _res_constr.data = NULL;
19559         int64_t* _res_vals = _res->elems;
19560         for (size_t h = 0; h < _res_constr.datalen; h++) {
19561                 int64_t _res_conv_7 = _res_vals[h];
19562                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19563                 CHECK_ACCESS(_res_conv_7_ptr);
19564                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19565                 FREE(untag_ptr(_res_conv_7));
19566                 _res_constr.data[h] = _res_conv_7_conv;
19567         }
19568         FREE(_res);
19569         CVec_TxOutZ_free(_res_constr);
19570 }
19571
19572 int64_t  CS_LDK_COption_u32Z_some(int32_t o) {
19573         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19574         *ret_copy = COption_u32Z_some(o);
19575         int64_t ret_ref = tag_ptr(ret_copy, true);
19576         return ret_ref;
19577 }
19578
19579 int64_t  CS_LDK_COption_u32Z_none() {
19580         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19581         *ret_copy = COption_u32Z_none();
19582         int64_t ret_ref = tag_ptr(ret_copy, true);
19583         return ret_ref;
19584 }
19585
19586 void  CS_LDK_COption_u32Z_free(int64_t _res) {
19587         if (!ptr_is_owned(_res)) return;
19588         void* _res_ptr = untag_ptr(_res);
19589         CHECK_ACCESS(_res_ptr);
19590         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
19591         FREE(untag_ptr(_res));
19592         COption_u32Z_free(_res_conv);
19593 }
19594
19595 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
19596         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19597         *ret_copy = COption_u32Z_clone(arg);
19598         int64_t ret_ref = tag_ptr(ret_copy, true);
19599         return ret_ref;
19600 }
19601 int64_t  CS_LDK_COption_u32Z_clone_ptr(int64_t arg) {
19602         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
19603         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
19604         return ret_conv;
19605 }
19606
19607 int64_t  CS_LDK_COption_u32Z_clone(int64_t orig) {
19608         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
19609         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19610         *ret_copy = COption_u32Z_clone(orig_conv);
19611         int64_t ret_ref = tag_ptr(ret_copy, true);
19612         return ret_ref;
19613 }
19614
19615 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
19616         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19617         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
19618         return tag_ptr(ret_conv, true);
19619 }
19620 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone_ptr(int64_t arg) {
19621         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
19622         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
19623         return ret_conv;
19624 }
19625
19626 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone(int64_t orig) {
19627         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
19628         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19629         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
19630         return tag_ptr(ret_conv, true);
19631 }
19632
19633 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
19634         LDKCVec_u8Z a_ref;
19635         a_ref.datalen = a->arr_len;
19636         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
19637         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
19638         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19639         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
19640         return tag_ptr(ret_conv, true);
19641 }
19642
19643 void  CS_LDK_C2Tuple_CVec_u8Zu64Z_free(int64_t _res) {
19644         if (!ptr_is_owned(_res)) return;
19645         void* _res_ptr = untag_ptr(_res);
19646         CHECK_ACCESS(_res_ptr);
19647         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
19648         FREE(untag_ptr(_res));
19649         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
19650 }
19651
19652 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(int64_t o) {
19653         void* o_ptr = untag_ptr(o);
19654         CHECK_ACCESS(o_ptr);
19655         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
19656         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
19657         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19658         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
19659         return tag_ptr(ret_conv, true);
19660 }
19661
19662 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
19663         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19664         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
19665         return tag_ptr(ret_conv, true);
19666 }
19667
19668 jboolean  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(int64_t o) {
19669         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
19670         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
19671         return ret_conv;
19672 }
19673
19674 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(int64_t _res) {
19675         if (!ptr_is_owned(_res)) return;
19676         void* _res_ptr = untag_ptr(_res);
19677         CHECK_ACCESS(_res_ptr);
19678         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
19679         FREE(untag_ptr(_res));
19680         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
19681 }
19682
19683 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
19684         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19685         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
19686         return tag_ptr(ret_conv, true);
19687 }
19688 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(int64_t arg) {
19689         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
19690         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
19691         return ret_conv;
19692 }
19693
19694 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(int64_t orig) {
19695         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
19696         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19697         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
19698         return tag_ptr(ret_conv, true);
19699 }
19700
19701 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_ok(int64_t o) {
19702         LDKChannelDerivationParameters o_conv;
19703         o_conv.inner = untag_ptr(o);
19704         o_conv.is_owned = ptr_is_owned(o);
19705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19706         o_conv = ChannelDerivationParameters_clone(&o_conv);
19707         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19708         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19709         return tag_ptr(ret_conv, true);
19710 }
19711
19712 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_err(int64_t e) {
19713         void* e_ptr = untag_ptr(e);
19714         CHECK_ACCESS(e_ptr);
19715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19717         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19718         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19719         return tag_ptr(ret_conv, true);
19720 }
19721
19722 jboolean  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(int64_t o) {
19723         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19724         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19725         return ret_conv;
19726 }
19727
19728 void  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_free(int64_t _res) {
19729         if (!ptr_is_owned(_res)) return;
19730         void* _res_ptr = untag_ptr(_res);
19731         CHECK_ACCESS(_res_ptr);
19732         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19733         FREE(untag_ptr(_res));
19734         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19735 }
19736
19737 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19738         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19739         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19740         return tag_ptr(ret_conv, true);
19741 }
19742 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19743         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19744         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19745         return ret_conv;
19746 }
19747
19748 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone(int64_t orig) {
19749         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19750         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19751         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19752         return tag_ptr(ret_conv, true);
19753 }
19754
19755 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_ok(int64_t o) {
19756         LDKHTLCDescriptor o_conv;
19757         o_conv.inner = untag_ptr(o);
19758         o_conv.is_owned = ptr_is_owned(o);
19759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19760         o_conv = HTLCDescriptor_clone(&o_conv);
19761         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19762         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19763         return tag_ptr(ret_conv, true);
19764 }
19765
19766 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_err(int64_t e) {
19767         void* e_ptr = untag_ptr(e);
19768         CHECK_ACCESS(e_ptr);
19769         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19770         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19771         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19772         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19773         return tag_ptr(ret_conv, true);
19774 }
19775
19776 jboolean  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_is_ok(int64_t o) {
19777         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19778         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19779         return ret_conv;
19780 }
19781
19782 void  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_free(int64_t _res) {
19783         if (!ptr_is_owned(_res)) return;
19784         void* _res_ptr = untag_ptr(_res);
19785         CHECK_ACCESS(_res_ptr);
19786         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19787         FREE(untag_ptr(_res));
19788         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19789 }
19790
19791 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19792         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19793         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19794         return tag_ptr(ret_conv, true);
19795 }
19796 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19797         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19798         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19799         return ret_conv;
19800 }
19801
19802 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone(int64_t orig) {
19803         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19804         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19805         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19806         return tag_ptr(ret_conv, true);
19807 }
19808
19809 int64_t  CS_LDK_CResult_NoneNoneZ_ok() {
19810         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19811         *ret_conv = CResult_NoneNoneZ_ok();
19812         return tag_ptr(ret_conv, true);
19813 }
19814
19815 int64_t  CS_LDK_CResult_NoneNoneZ_err() {
19816         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19817         *ret_conv = CResult_NoneNoneZ_err();
19818         return tag_ptr(ret_conv, true);
19819 }
19820
19821 jboolean  CS_LDK_CResult_NoneNoneZ_is_ok(int64_t o) {
19822         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
19823         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
19824         return ret_conv;
19825 }
19826
19827 void  CS_LDK_CResult_NoneNoneZ_free(int64_t _res) {
19828         if (!ptr_is_owned(_res)) return;
19829         void* _res_ptr = untag_ptr(_res);
19830         CHECK_ACCESS(_res_ptr);
19831         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
19832         FREE(untag_ptr(_res));
19833         CResult_NoneNoneZ_free(_res_conv);
19834 }
19835
19836 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
19837         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19838         *ret_conv = CResult_NoneNoneZ_clone(arg);
19839         return tag_ptr(ret_conv, true);
19840 }
19841 int64_t  CS_LDK_CResult_NoneNoneZ_clone_ptr(int64_t arg) {
19842         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
19843         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
19844         return ret_conv;
19845 }
19846
19847 int64_t  CS_LDK_CResult_NoneNoneZ_clone(int64_t orig) {
19848         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
19849         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19850         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
19851         return tag_ptr(ret_conv, true);
19852 }
19853
19854 int64_t  CS_LDK_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
19855         LDKPublicKey o_ref;
19856         CHECK(o->arr_len == 33);
19857         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19858         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19859         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
19860         return tag_ptr(ret_conv, true);
19861 }
19862
19863 int64_t  CS_LDK_CResult_PublicKeyNoneZ_err() {
19864         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19865         *ret_conv = CResult_PublicKeyNoneZ_err();
19866         return tag_ptr(ret_conv, true);
19867 }
19868
19869 jboolean  CS_LDK_CResult_PublicKeyNoneZ_is_ok(int64_t o) {
19870         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
19871         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
19872         return ret_conv;
19873 }
19874
19875 void  CS_LDK_CResult_PublicKeyNoneZ_free(int64_t _res) {
19876         if (!ptr_is_owned(_res)) return;
19877         void* _res_ptr = untag_ptr(_res);
19878         CHECK_ACCESS(_res_ptr);
19879         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
19880         FREE(untag_ptr(_res));
19881         CResult_PublicKeyNoneZ_free(_res_conv);
19882 }
19883
19884 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
19885         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19886         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
19887         return tag_ptr(ret_conv, true);
19888 }
19889 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone_ptr(int64_t arg) {
19890         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
19891         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
19892         return ret_conv;
19893 }
19894
19895 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone(int64_t orig) {
19896         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
19897         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
19898         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
19899         return tag_ptr(ret_conv, true);
19900 }
19901
19902 int64_t  CS_LDK_COption_BigEndianScalarZ_some(int64_t o) {
19903         void* o_ptr = untag_ptr(o);
19904         CHECK_ACCESS(o_ptr);
19905         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
19906         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
19907         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19908         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
19909         int64_t ret_ref = tag_ptr(ret_copy, true);
19910         return ret_ref;
19911 }
19912
19913 int64_t  CS_LDK_COption_BigEndianScalarZ_none() {
19914         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19915         *ret_copy = COption_BigEndianScalarZ_none();
19916         int64_t ret_ref = tag_ptr(ret_copy, true);
19917         return ret_ref;
19918 }
19919
19920 void  CS_LDK_COption_BigEndianScalarZ_free(int64_t _res) {
19921         if (!ptr_is_owned(_res)) return;
19922         void* _res_ptr = untag_ptr(_res);
19923         CHECK_ACCESS(_res_ptr);
19924         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
19925         FREE(untag_ptr(_res));
19926         COption_BigEndianScalarZ_free(_res_conv);
19927 }
19928
19929 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
19930         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19931         *ret_copy = COption_BigEndianScalarZ_clone(arg);
19932         int64_t ret_ref = tag_ptr(ret_copy, true);
19933         return ret_ref;
19934 }
19935 int64_t  CS_LDK_COption_BigEndianScalarZ_clone_ptr(int64_t arg) {
19936         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
19937         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
19938         return ret_conv;
19939 }
19940
19941 int64_t  CS_LDK_COption_BigEndianScalarZ_clone(int64_t orig) {
19942         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
19943         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
19944         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
19945         int64_t ret_ref = tag_ptr(ret_copy, true);
19946         return ret_ref;
19947 }
19948
19949 void  CS_LDK_CVec_U5Z_free(ptrArray _res) {
19950         LDKCVec_U5Z _res_constr;
19951         _res_constr.datalen = _res->arr_len;
19952         if (_res_constr.datalen > 0)
19953                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
19954         else
19955                 _res_constr.data = NULL;
19956         int8_t* _res_vals = (void*) _res->elems;
19957         for (size_t h = 0; h < _res_constr.datalen; h++) {
19958                 int8_t _res_conv_7 = _res_vals[h];
19959                 
19960                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
19961         }
19962         FREE(_res);
19963         CVec_U5Z_free(_res_constr);
19964 }
19965
19966 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
19967         LDKRecoverableSignature o_ref;
19968         CHECK(o->arr_len == 68);
19969         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
19970         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19971         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19972         return tag_ptr(ret_conv, true);
19973 }
19974
19975 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_err() {
19976         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19977         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19978         return tag_ptr(ret_conv, true);
19979 }
19980
19981 jboolean  CS_LDK_CResult_RecoverableSignatureNoneZ_is_ok(int64_t o) {
19982         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
19983         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19984         return ret_conv;
19985 }
19986
19987 void  CS_LDK_CResult_RecoverableSignatureNoneZ_free(int64_t _res) {
19988         if (!ptr_is_owned(_res)) return;
19989         void* _res_ptr = untag_ptr(_res);
19990         CHECK_ACCESS(_res_ptr);
19991         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19992         FREE(untag_ptr(_res));
19993         CResult_RecoverableSignatureNoneZ_free(_res_conv);
19994 }
19995
19996 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19997         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19998         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19999         return tag_ptr(ret_conv, true);
20000 }
20001 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone_ptr(int64_t arg) {
20002         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
20003         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
20004         return ret_conv;
20005 }
20006
20007 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone(int64_t orig) {
20008         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
20009         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20010         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
20011         return tag_ptr(ret_conv, true);
20012 }
20013
20014 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
20015         LDKECDSASignature o_ref;
20016         CHECK(o->arr_len == 64);
20017         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
20018         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20019         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
20020         return tag_ptr(ret_conv, true);
20021 }
20022
20023 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_err() {
20024         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20025         *ret_conv = CResult_ECDSASignatureNoneZ_err();
20026         return tag_ptr(ret_conv, true);
20027 }
20028
20029 jboolean  CS_LDK_CResult_ECDSASignatureNoneZ_is_ok(int64_t o) {
20030         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
20031         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
20032         return ret_conv;
20033 }
20034
20035 void  CS_LDK_CResult_ECDSASignatureNoneZ_free(int64_t _res) {
20036         if (!ptr_is_owned(_res)) return;
20037         void* _res_ptr = untag_ptr(_res);
20038         CHECK_ACCESS(_res_ptr);
20039         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
20040         FREE(untag_ptr(_res));
20041         CResult_ECDSASignatureNoneZ_free(_res_conv);
20042 }
20043
20044 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
20045         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20046         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
20047         return tag_ptr(ret_conv, true);
20048 }
20049 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone_ptr(int64_t arg) {
20050         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
20051         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
20052         return ret_conv;
20053 }
20054
20055 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone(int64_t orig) {
20056         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
20057         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20058         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
20059         return tag_ptr(ret_conv, true);
20060 }
20061
20062 int64_t  CS_LDK_CResult_TransactionNoneZ_ok(int8_tArray o) {
20063         LDKTransaction o_ref;
20064         o_ref.datalen = o->arr_len;
20065         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20066         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20067         o_ref.data_is_owned = true;
20068         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20069         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20070         return tag_ptr(ret_conv, true);
20071 }
20072
20073 int64_t  CS_LDK_CResult_TransactionNoneZ_err() {
20074         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20075         *ret_conv = CResult_TransactionNoneZ_err();
20076         return tag_ptr(ret_conv, true);
20077 }
20078
20079 jboolean  CS_LDK_CResult_TransactionNoneZ_is_ok(int64_t o) {
20080         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20081         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20082         return ret_conv;
20083 }
20084
20085 void  CS_LDK_CResult_TransactionNoneZ_free(int64_t _res) {
20086         if (!ptr_is_owned(_res)) return;
20087         void* _res_ptr = untag_ptr(_res);
20088         CHECK_ACCESS(_res_ptr);
20089         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20090         FREE(untag_ptr(_res));
20091         CResult_TransactionNoneZ_free(_res_conv);
20092 }
20093
20094 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20095         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20096         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20097         return tag_ptr(ret_conv, true);
20098 }
20099 int64_t  CS_LDK_CResult_TransactionNoneZ_clone_ptr(int64_t arg) {
20100         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20101         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20102         return ret_conv;
20103 }
20104
20105 int64_t  CS_LDK_CResult_TransactionNoneZ_clone(int64_t orig) {
20106         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20107         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20108         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20109         return tag_ptr(ret_conv, true);
20110 }
20111
20112 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(int64_t o) {
20113         void* o_ptr = untag_ptr(o);
20114         CHECK_ACCESS(o_ptr);
20115         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20116         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20117                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20118                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20119         }
20120         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20121         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20122         return tag_ptr(ret_conv, true);
20123 }
20124
20125 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(int64_t e) {
20126         void* e_ptr = untag_ptr(e);
20127         CHECK_ACCESS(e_ptr);
20128         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20129         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20130         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20131         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20132         return tag_ptr(ret_conv, true);
20133 }
20134
20135 jboolean  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(int64_t o) {
20136         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20137         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20138         return ret_conv;
20139 }
20140
20141 void  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(int64_t _res) {
20142         if (!ptr_is_owned(_res)) return;
20143         void* _res_ptr = untag_ptr(_res);
20144         CHECK_ACCESS(_res_ptr);
20145         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20146         FREE(untag_ptr(_res));
20147         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20148 }
20149
20150 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20151         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20152         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20153         return tag_ptr(ret_conv, true);
20154 }
20155 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(int64_t arg) {
20156         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20157         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20158         return ret_conv;
20159 }
20160
20161 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(int64_t orig) {
20162         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20163         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20164         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20165         return tag_ptr(ret_conv, true);
20166 }
20167
20168 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
20169         LDKCVec_u8Z o_ref;
20170         o_ref.datalen = o->arr_len;
20171         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20172         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20173         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20174         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
20175         return tag_ptr(ret_conv, true);
20176 }
20177
20178 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_err() {
20179         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20180         *ret_conv = CResult_CVec_u8ZNoneZ_err();
20181         return tag_ptr(ret_conv, true);
20182 }
20183
20184 jboolean  CS_LDK_CResult_CVec_u8ZNoneZ_is_ok(int64_t o) {
20185         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
20186         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
20187         return ret_conv;
20188 }
20189
20190 void  CS_LDK_CResult_CVec_u8ZNoneZ_free(int64_t _res) {
20191         if (!ptr_is_owned(_res)) return;
20192         void* _res_ptr = untag_ptr(_res);
20193         CHECK_ACCESS(_res_ptr);
20194         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
20195         FREE(untag_ptr(_res));
20196         CResult_CVec_u8ZNoneZ_free(_res_conv);
20197 }
20198
20199 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
20200         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20201         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
20202         return tag_ptr(ret_conv, true);
20203 }
20204 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone_ptr(int64_t arg) {
20205         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
20206         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
20207         return ret_conv;
20208 }
20209
20210 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone(int64_t orig) {
20211         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
20212         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20213         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
20214         return tag_ptr(ret_conv, true);
20215 }
20216
20217 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_ok(int64_t o) {
20218         LDKShutdownScript o_conv;
20219         o_conv.inner = untag_ptr(o);
20220         o_conv.is_owned = ptr_is_owned(o);
20221         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20222         o_conv = ShutdownScript_clone(&o_conv);
20223         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20224         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
20225         return tag_ptr(ret_conv, true);
20226 }
20227
20228 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_err() {
20229         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20230         *ret_conv = CResult_ShutdownScriptNoneZ_err();
20231         return tag_ptr(ret_conv, true);
20232 }
20233
20234 jboolean  CS_LDK_CResult_ShutdownScriptNoneZ_is_ok(int64_t o) {
20235         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
20236         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
20237         return ret_conv;
20238 }
20239
20240 void  CS_LDK_CResult_ShutdownScriptNoneZ_free(int64_t _res) {
20241         if (!ptr_is_owned(_res)) return;
20242         void* _res_ptr = untag_ptr(_res);
20243         CHECK_ACCESS(_res_ptr);
20244         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20245         FREE(untag_ptr(_res));
20246         CResult_ShutdownScriptNoneZ_free(_res_conv);
20247 }
20248
20249 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20250         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20251         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20252         return tag_ptr(ret_conv, true);
20253 }
20254 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone_ptr(int64_t arg) {
20255         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20256         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20257         return ret_conv;
20258 }
20259
20260 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone(int64_t orig) {
20261         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20262         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20263         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20264         return tag_ptr(ret_conv, true);
20265 }
20266
20267 int64_t  CS_LDK_COption_u16Z_some(int16_t o) {
20268         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20269         *ret_copy = COption_u16Z_some(o);
20270         int64_t ret_ref = tag_ptr(ret_copy, true);
20271         return ret_ref;
20272 }
20273
20274 int64_t  CS_LDK_COption_u16Z_none() {
20275         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20276         *ret_copy = COption_u16Z_none();
20277         int64_t ret_ref = tag_ptr(ret_copy, true);
20278         return ret_ref;
20279 }
20280
20281 void  CS_LDK_COption_u16Z_free(int64_t _res) {
20282         if (!ptr_is_owned(_res)) return;
20283         void* _res_ptr = untag_ptr(_res);
20284         CHECK_ACCESS(_res_ptr);
20285         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20286         FREE(untag_ptr(_res));
20287         COption_u16Z_free(_res_conv);
20288 }
20289
20290 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20291         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20292         *ret_copy = COption_u16Z_clone(arg);
20293         int64_t ret_ref = tag_ptr(ret_copy, true);
20294         return ret_ref;
20295 }
20296 int64_t  CS_LDK_COption_u16Z_clone_ptr(int64_t arg) {
20297         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20298         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20299         return ret_conv;
20300 }
20301
20302 int64_t  CS_LDK_COption_u16Z_clone(int64_t orig) {
20303         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20304         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20305         *ret_copy = COption_u16Z_clone(orig_conv);
20306         int64_t ret_ref = tag_ptr(ret_copy, true);
20307         return ret_ref;
20308 }
20309
20310 int64_t  CS_LDK_COption_boolZ_some(jboolean o) {
20311         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20312         *ret_copy = COption_boolZ_some(o);
20313         int64_t ret_ref = tag_ptr(ret_copy, true);
20314         return ret_ref;
20315 }
20316
20317 int64_t  CS_LDK_COption_boolZ_none() {
20318         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20319         *ret_copy = COption_boolZ_none();
20320         int64_t ret_ref = tag_ptr(ret_copy, true);
20321         return ret_ref;
20322 }
20323
20324 void  CS_LDK_COption_boolZ_free(int64_t _res) {
20325         if (!ptr_is_owned(_res)) return;
20326         void* _res_ptr = untag_ptr(_res);
20327         CHECK_ACCESS(_res_ptr);
20328         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
20329         FREE(untag_ptr(_res));
20330         COption_boolZ_free(_res_conv);
20331 }
20332
20333 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
20334         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20335         *ret_copy = COption_boolZ_clone(arg);
20336         int64_t ret_ref = tag_ptr(ret_copy, true);
20337         return ret_ref;
20338 }
20339 int64_t  CS_LDK_COption_boolZ_clone_ptr(int64_t arg) {
20340         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
20341         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
20342         return ret_conv;
20343 }
20344
20345 int64_t  CS_LDK_COption_boolZ_clone(int64_t orig) {
20346         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
20347         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20348         *ret_copy = COption_boolZ_clone(orig_conv);
20349         int64_t ret_ref = tag_ptr(ret_copy, true);
20350         return ret_ref;
20351 }
20352
20353 int64_t  CS_LDK_CResult_WitnessNoneZ_ok(int8_tArray o) {
20354         LDKWitness o_ref;
20355         o_ref.datalen = o->arr_len;
20356         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
20357         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20358         o_ref.data_is_owned = true;
20359         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20360         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
20361         return tag_ptr(ret_conv, true);
20362 }
20363
20364 int64_t  CS_LDK_CResult_WitnessNoneZ_err() {
20365         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20366         *ret_conv = CResult_WitnessNoneZ_err();
20367         return tag_ptr(ret_conv, true);
20368 }
20369
20370 jboolean  CS_LDK_CResult_WitnessNoneZ_is_ok(int64_t o) {
20371         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
20372         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
20373         return ret_conv;
20374 }
20375
20376 void  CS_LDK_CResult_WitnessNoneZ_free(int64_t _res) {
20377         if (!ptr_is_owned(_res)) return;
20378         void* _res_ptr = untag_ptr(_res);
20379         CHECK_ACCESS(_res_ptr);
20380         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
20381         FREE(untag_ptr(_res));
20382         CResult_WitnessNoneZ_free(_res_conv);
20383 }
20384
20385 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
20386         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20387         *ret_conv = CResult_WitnessNoneZ_clone(arg);
20388         return tag_ptr(ret_conv, true);
20389 }
20390 int64_t  CS_LDK_CResult_WitnessNoneZ_clone_ptr(int64_t arg) {
20391         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
20392         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
20393         return ret_conv;
20394 }
20395
20396 int64_t  CS_LDK_CResult_WitnessNoneZ_clone(int64_t orig) {
20397         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
20398         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20399         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
20400         return tag_ptr(ret_conv, true);
20401 }
20402
20403 void  CS_LDK_CVec_ECDSASignatureZ_free(ptrArray _res) {
20404         LDKCVec_ECDSASignatureZ _res_constr;
20405         _res_constr.datalen = _res->arr_len;
20406         if (_res_constr.datalen > 0)
20407                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20408         else
20409                 _res_constr.data = NULL;
20410         int8_tArray* _res_vals = (void*) _res->elems;
20411         for (size_t i = 0; i < _res_constr.datalen; i++) {
20412                 int8_tArray _res_conv_8 = _res_vals[i];
20413                 LDKECDSASignature _res_conv_8_ref;
20414                 CHECK(_res_conv_8->arr_len == 64);
20415                 memcpy(_res_conv_8_ref.compact_form, _res_conv_8->elems, 64); FREE(_res_conv_8);
20416                 _res_constr.data[i] = _res_conv_8_ref;
20417         }
20418         FREE(_res);
20419         CVec_ECDSASignatureZ_free(_res_constr);
20420 }
20421
20422 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
20423         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20424         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
20425         return tag_ptr(ret_conv, true);
20426 }
20427 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(int64_t arg) {
20428         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
20429         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
20430         return ret_conv;
20431 }
20432
20433 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(int64_t orig) {
20434         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
20435         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20436         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
20437         return tag_ptr(ret_conv, true);
20438 }
20439
20440 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
20441         LDKECDSASignature a_ref;
20442         CHECK(a->arr_len == 64);
20443         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
20444         LDKCVec_ECDSASignatureZ b_constr;
20445         b_constr.datalen = b->arr_len;
20446         if (b_constr.datalen > 0)
20447                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20448         else
20449                 b_constr.data = NULL;
20450         int8_tArray* b_vals = (void*) b->elems;
20451         for (size_t i = 0; i < b_constr.datalen; i++) {
20452                 int8_tArray b_conv_8 = b_vals[i];
20453                 LDKECDSASignature b_conv_8_ref;
20454                 CHECK(b_conv_8->arr_len == 64);
20455                 memcpy(b_conv_8_ref.compact_form, b_conv_8->elems, 64); FREE(b_conv_8);
20456                 b_constr.data[i] = b_conv_8_ref;
20457         }
20458         FREE(b);
20459         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20460         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
20461         return tag_ptr(ret_conv, true);
20462 }
20463
20464 void  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(int64_t _res) {
20465         if (!ptr_is_owned(_res)) return;
20466         void* _res_ptr = untag_ptr(_res);
20467         CHECK_ACCESS(_res_ptr);
20468         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
20469         FREE(untag_ptr(_res));
20470         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
20471 }
20472
20473 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(int64_t o) {
20474         void* o_ptr = untag_ptr(o);
20475         CHECK_ACCESS(o_ptr);
20476         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
20477         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
20478         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20479         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
20480         return tag_ptr(ret_conv, true);
20481 }
20482
20483 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
20484         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20485         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
20486         return tag_ptr(ret_conv, true);
20487 }
20488
20489 jboolean  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(int64_t o) {
20490         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
20491         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
20492         return ret_conv;
20493 }
20494
20495 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(int64_t _res) {
20496         if (!ptr_is_owned(_res)) return;
20497         void* _res_ptr = untag_ptr(_res);
20498         CHECK_ACCESS(_res_ptr);
20499         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
20500         FREE(untag_ptr(_res));
20501         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
20502 }
20503
20504 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
20505         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20506         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
20507         return tag_ptr(ret_conv, true);
20508 }
20509 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(int64_t arg) {
20510         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
20511         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
20512         return ret_conv;
20513 }
20514
20515 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(int64_t orig) {
20516         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
20517         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20518         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
20519         return tag_ptr(ret_conv, true);
20520 }
20521
20522 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_ok(int64_t o) {
20523         LDKInMemorySigner o_conv;
20524         o_conv.inner = untag_ptr(o);
20525         o_conv.is_owned = ptr_is_owned(o);
20526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20527         o_conv = InMemorySigner_clone(&o_conv);
20528         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20529         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20530         return tag_ptr(ret_conv, true);
20531 }
20532
20533 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_err(int64_t e) {
20534         void* e_ptr = untag_ptr(e);
20535         CHECK_ACCESS(e_ptr);
20536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20538         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20539         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20540         return tag_ptr(ret_conv, true);
20541 }
20542
20543 jboolean  CS_LDK_CResult_InMemorySignerDecodeErrorZ_is_ok(int64_t o) {
20544         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20545         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20546         return ret_conv;
20547 }
20548
20549 void  CS_LDK_CResult_InMemorySignerDecodeErrorZ_free(int64_t _res) {
20550         if (!ptr_is_owned(_res)) return;
20551         void* _res_ptr = untag_ptr(_res);
20552         CHECK_ACCESS(_res_ptr);
20553         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20554         FREE(untag_ptr(_res));
20555         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20556 }
20557
20558 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20559         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20560         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20561         return tag_ptr(ret_conv, true);
20562 }
20563 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone_ptr(int64_t arg) {
20564         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20565         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20566         return ret_conv;
20567 }
20568
20569 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone(int64_t orig) {
20570         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20571         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20572         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20573         return tag_ptr(ret_conv, true);
20574 }
20575
20576 int64_t  CS_LDK_COption_WriteableScoreZ_some(int64_t o) {
20577         void* o_ptr = untag_ptr(o);
20578         CHECK_ACCESS(o_ptr);
20579         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
20580         if (o_conv.free == LDKWriteableScore_JCalls_free) {
20581                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20582                 LDKWriteableScore_JCalls_cloned(&o_conv);
20583         }
20584         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20585         *ret_copy = COption_WriteableScoreZ_some(o_conv);
20586         int64_t ret_ref = tag_ptr(ret_copy, true);
20587         return ret_ref;
20588 }
20589
20590 int64_t  CS_LDK_COption_WriteableScoreZ_none() {
20591         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20592         *ret_copy = COption_WriteableScoreZ_none();
20593         int64_t ret_ref = tag_ptr(ret_copy, true);
20594         return ret_ref;
20595 }
20596
20597 void  CS_LDK_COption_WriteableScoreZ_free(int64_t _res) {
20598         if (!ptr_is_owned(_res)) return;
20599         void* _res_ptr = untag_ptr(_res);
20600         CHECK_ACCESS(_res_ptr);
20601         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
20602         FREE(untag_ptr(_res));
20603         COption_WriteableScoreZ_free(_res_conv);
20604 }
20605
20606 int64_t  CS_LDK_CResult_NoneIOErrorZ_ok() {
20607         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20608         *ret_conv = CResult_NoneIOErrorZ_ok();
20609         return tag_ptr(ret_conv, true);
20610 }
20611
20612 int64_t  CS_LDK_CResult_NoneIOErrorZ_err(int32_t e) {
20613         LDKIOError e_conv = LDKIOError_from_cs(e);
20614         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20615         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 jboolean  CS_LDK_CResult_NoneIOErrorZ_is_ok(int64_t o) {
20620         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
20621         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
20622         return ret_conv;
20623 }
20624
20625 void  CS_LDK_CResult_NoneIOErrorZ_free(int64_t _res) {
20626         if (!ptr_is_owned(_res)) return;
20627         void* _res_ptr = untag_ptr(_res);
20628         CHECK_ACCESS(_res_ptr);
20629         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
20630         FREE(untag_ptr(_res));
20631         CResult_NoneIOErrorZ_free(_res_conv);
20632 }
20633
20634 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
20635         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20636         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
20637         return tag_ptr(ret_conv, true);
20638 }
20639 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone_ptr(int64_t arg) {
20640         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
20641         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
20642         return ret_conv;
20643 }
20644
20645 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone(int64_t orig) {
20646         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
20647         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20648         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
20649         return tag_ptr(ret_conv, true);
20650 }
20651
20652 void  CS_LDK_CVec_ChannelDetailsZ_free(int64_tArray _res) {
20653         LDKCVec_ChannelDetailsZ _res_constr;
20654         _res_constr.datalen = _res->arr_len;
20655         if (_res_constr.datalen > 0)
20656                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
20657         else
20658                 _res_constr.data = NULL;
20659         int64_t* _res_vals = _res->elems;
20660         for (size_t q = 0; q < _res_constr.datalen; q++) {
20661                 int64_t _res_conv_16 = _res_vals[q];
20662                 LDKChannelDetails _res_conv_16_conv;
20663                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20664                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20665                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20666                 _res_constr.data[q] = _res_conv_16_conv;
20667         }
20668         FREE(_res);
20669         CVec_ChannelDetailsZ_free(_res_constr);
20670 }
20671
20672 int64_t  CS_LDK_CResult_RouteLightningErrorZ_ok(int64_t o) {
20673         LDKRoute o_conv;
20674         o_conv.inner = untag_ptr(o);
20675         o_conv.is_owned = ptr_is_owned(o);
20676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20677         o_conv = Route_clone(&o_conv);
20678         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20679         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
20680         return tag_ptr(ret_conv, true);
20681 }
20682
20683 int64_t  CS_LDK_CResult_RouteLightningErrorZ_err(int64_t e) {
20684         LDKLightningError e_conv;
20685         e_conv.inner = untag_ptr(e);
20686         e_conv.is_owned = ptr_is_owned(e);
20687         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20688         e_conv = LightningError_clone(&e_conv);
20689         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20690         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
20691         return tag_ptr(ret_conv, true);
20692 }
20693
20694 jboolean  CS_LDK_CResult_RouteLightningErrorZ_is_ok(int64_t o) {
20695         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
20696         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
20697         return ret_conv;
20698 }
20699
20700 void  CS_LDK_CResult_RouteLightningErrorZ_free(int64_t _res) {
20701         if (!ptr_is_owned(_res)) return;
20702         void* _res_ptr = untag_ptr(_res);
20703         CHECK_ACCESS(_res_ptr);
20704         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
20705         FREE(untag_ptr(_res));
20706         CResult_RouteLightningErrorZ_free(_res_conv);
20707 }
20708
20709 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
20710         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20711         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
20712         return tag_ptr(ret_conv, true);
20713 }
20714 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone_ptr(int64_t arg) {
20715         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
20716         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
20717         return ret_conv;
20718 }
20719
20720 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone(int64_t orig) {
20721         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
20722         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20723         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
20724         return tag_ptr(ret_conv, true);
20725 }
20726
20727 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
20728         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20729         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
20730         return tag_ptr(ret_conv, true);
20731 }
20732 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(int64_t arg) {
20733         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
20734         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
20735         return ret_conv;
20736 }
20737
20738 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone(int64_t orig) {
20739         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
20740         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20741         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
20742         return tag_ptr(ret_conv, true);
20743 }
20744
20745 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_new(int64_t a, int64_t b) {
20746         LDKBlindedPayInfo a_conv;
20747         a_conv.inner = untag_ptr(a);
20748         a_conv.is_owned = ptr_is_owned(a);
20749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20750         a_conv = BlindedPayInfo_clone(&a_conv);
20751         LDKBlindedPath b_conv;
20752         b_conv.inner = untag_ptr(b);
20753         b_conv.is_owned = ptr_is_owned(b);
20754         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20755         b_conv = BlindedPath_clone(&b_conv);
20756         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20757         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
20758         return tag_ptr(ret_conv, true);
20759 }
20760
20761 void  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_free(int64_t _res) {
20762         if (!ptr_is_owned(_res)) return;
20763         void* _res_ptr = untag_ptr(_res);
20764         CHECK_ACCESS(_res_ptr);
20765         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
20766         FREE(untag_ptr(_res));
20767         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
20768 }
20769
20770 void  CS_LDK_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(int64_tArray _res) {
20771         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
20772         _res_constr.datalen = _res->arr_len;
20773         if (_res_constr.datalen > 0)
20774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20775         else
20776                 _res_constr.data = NULL;
20777         int64_t* _res_vals = _res->elems;
20778         for (size_t l = 0; l < _res_constr.datalen; l++) {
20779                 int64_t _res_conv_37 = _res_vals[l];
20780                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
20781                 CHECK_ACCESS(_res_conv_37_ptr);
20782                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
20783                 FREE(untag_ptr(_res_conv_37));
20784                 _res_constr.data[l] = _res_conv_37_conv;
20785         }
20786         FREE(_res);
20787         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
20788 }
20789
20790 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(int64_tArray o) {
20791         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
20792         o_constr.datalen = o->arr_len;
20793         if (o_constr.datalen > 0)
20794                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20795         else
20796                 o_constr.data = NULL;
20797         int64_t* o_vals = o->elems;
20798         for (size_t l = 0; l < o_constr.datalen; l++) {
20799                 int64_t o_conv_37 = o_vals[l];
20800                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
20801                 CHECK_ACCESS(o_conv_37_ptr);
20802                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
20803                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
20804                 o_constr.data[l] = o_conv_37_conv;
20805         }
20806         FREE(o);
20807         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20808         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
20809         return tag_ptr(ret_conv, true);
20810 }
20811
20812 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
20813         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20814         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
20815         return tag_ptr(ret_conv, true);
20816 }
20817
20818 jboolean  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(int64_t o) {
20819         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
20820         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
20821         return ret_conv;
20822 }
20823
20824 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(int64_t _res) {
20825         if (!ptr_is_owned(_res)) return;
20826         void* _res_ptr = untag_ptr(_res);
20827         CHECK_ACCESS(_res_ptr);
20828         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
20829         FREE(untag_ptr(_res));
20830         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
20831 }
20832
20833 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
20834         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20835         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
20836         return tag_ptr(ret_conv, true);
20837 }
20838 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(int64_t arg) {
20839         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
20840         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
20841         return ret_conv;
20842 }
20843
20844 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(int64_t orig) {
20845         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
20846         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20847         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
20848         return tag_ptr(ret_conv, true);
20849 }
20850
20851 void  CS_LDK_CVec_PublicKeyZ_free(ptrArray _res) {
20852         LDKCVec_PublicKeyZ _res_constr;
20853         _res_constr.datalen = _res->arr_len;
20854         if (_res_constr.datalen > 0)
20855                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20856         else
20857                 _res_constr.data = NULL;
20858         int8_tArray* _res_vals = (void*) _res->elems;
20859         for (size_t i = 0; i < _res_constr.datalen; i++) {
20860                 int8_tArray _res_conv_8 = _res_vals[i];
20861                 LDKPublicKey _res_conv_8_ref;
20862                 CHECK(_res_conv_8->arr_len == 33);
20863                 memcpy(_res_conv_8_ref.compressed_form, _res_conv_8->elems, 33); FREE(_res_conv_8);
20864                 _res_constr.data[i] = _res_conv_8_ref;
20865         }
20866         FREE(_res);
20867         CVec_PublicKeyZ_free(_res_constr);
20868 }
20869
20870 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_ok(int64_t o) {
20871         LDKOnionMessagePath o_conv;
20872         o_conv.inner = untag_ptr(o);
20873         o_conv.is_owned = ptr_is_owned(o);
20874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20875         o_conv = OnionMessagePath_clone(&o_conv);
20876         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20877         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
20878         return tag_ptr(ret_conv, true);
20879 }
20880
20881 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_err() {
20882         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20883         *ret_conv = CResult_OnionMessagePathNoneZ_err();
20884         return tag_ptr(ret_conv, true);
20885 }
20886
20887 jboolean  CS_LDK_CResult_OnionMessagePathNoneZ_is_ok(int64_t o) {
20888         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
20889         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
20890         return ret_conv;
20891 }
20892
20893 void  CS_LDK_CResult_OnionMessagePathNoneZ_free(int64_t _res) {
20894         if (!ptr_is_owned(_res)) return;
20895         void* _res_ptr = untag_ptr(_res);
20896         CHECK_ACCESS(_res_ptr);
20897         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
20898         FREE(untag_ptr(_res));
20899         CResult_OnionMessagePathNoneZ_free(_res_conv);
20900 }
20901
20902 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
20903         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20904         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
20905         return tag_ptr(ret_conv, true);
20906 }
20907 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone_ptr(int64_t arg) {
20908         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
20909         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
20910         return ret_conv;
20911 }
20912
20913 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone(int64_t orig) {
20914         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
20915         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
20916         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
20917         return tag_ptr(ret_conv, true);
20918 }
20919
20920 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_ok(int64_tArray o) {
20921         LDKCVec_BlindedPathZ o_constr;
20922         o_constr.datalen = o->arr_len;
20923         if (o_constr.datalen > 0)
20924                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
20925         else
20926                 o_constr.data = NULL;
20927         int64_t* o_vals = o->elems;
20928         for (size_t n = 0; n < o_constr.datalen; n++) {
20929                 int64_t o_conv_13 = o_vals[n];
20930                 LDKBlindedPath o_conv_13_conv;
20931                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
20932                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
20933                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
20934                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
20935                 o_constr.data[n] = o_conv_13_conv;
20936         }
20937         FREE(o);
20938         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20939         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
20940         return tag_ptr(ret_conv, true);
20941 }
20942
20943 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_err() {
20944         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20945         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
20946         return tag_ptr(ret_conv, true);
20947 }
20948
20949 jboolean  CS_LDK_CResult_CVec_BlindedPathZNoneZ_is_ok(int64_t o) {
20950         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
20951         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
20952         return ret_conv;
20953 }
20954
20955 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_free(int64_t _res) {
20956         if (!ptr_is_owned(_res)) return;
20957         void* _res_ptr = untag_ptr(_res);
20958         CHECK_ACCESS(_res_ptr);
20959         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
20960         FREE(untag_ptr(_res));
20961         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
20962 }
20963
20964 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
20965         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20966         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
20967         return tag_ptr(ret_conv, true);
20968 }
20969 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone_ptr(int64_t arg) {
20970         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
20971         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
20972         return ret_conv;
20973 }
20974
20975 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone(int64_t orig) {
20976         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
20977         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
20978         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
20979         return tag_ptr(ret_conv, true);
20980 }
20981
20982 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_ok(int64_t o) {
20983         LDKInFlightHtlcs o_conv;
20984         o_conv.inner = untag_ptr(o);
20985         o_conv.is_owned = ptr_is_owned(o);
20986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20987         o_conv = InFlightHtlcs_clone(&o_conv);
20988         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20989         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
20990         return tag_ptr(ret_conv, true);
20991 }
20992
20993 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_err(int64_t e) {
20994         void* e_ptr = untag_ptr(e);
20995         CHECK_ACCESS(e_ptr);
20996         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20997         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20998         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
20999         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
21000         return tag_ptr(ret_conv, true);
21001 }
21002
21003 jboolean  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_is_ok(int64_t o) {
21004         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
21005         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
21006         return ret_conv;
21007 }
21008
21009 void  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_free(int64_t _res) {
21010         if (!ptr_is_owned(_res)) return;
21011         void* _res_ptr = untag_ptr(_res);
21012         CHECK_ACCESS(_res_ptr);
21013         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
21014         FREE(untag_ptr(_res));
21015         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
21016 }
21017
21018 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
21019         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21020         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
21021         return tag_ptr(ret_conv, true);
21022 }
21023 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(int64_t arg) {
21024         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
21025         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
21026         return ret_conv;
21027 }
21028
21029 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone(int64_t orig) {
21030         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
21031         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21032         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
21033         return tag_ptr(ret_conv, true);
21034 }
21035
21036 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_ok(int64_t o) {
21037         LDKRouteHop o_conv;
21038         o_conv.inner = untag_ptr(o);
21039         o_conv.is_owned = ptr_is_owned(o);
21040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21041         o_conv = RouteHop_clone(&o_conv);
21042         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21043         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
21044         return tag_ptr(ret_conv, true);
21045 }
21046
21047 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_err(int64_t e) {
21048         void* e_ptr = untag_ptr(e);
21049         CHECK_ACCESS(e_ptr);
21050         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21051         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21052         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21053         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
21054         return tag_ptr(ret_conv, true);
21055 }
21056
21057 jboolean  CS_LDK_CResult_RouteHopDecodeErrorZ_is_ok(int64_t o) {
21058         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
21059         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
21060         return ret_conv;
21061 }
21062
21063 void  CS_LDK_CResult_RouteHopDecodeErrorZ_free(int64_t _res) {
21064         if (!ptr_is_owned(_res)) return;
21065         void* _res_ptr = untag_ptr(_res);
21066         CHECK_ACCESS(_res_ptr);
21067         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
21068         FREE(untag_ptr(_res));
21069         CResult_RouteHopDecodeErrorZ_free(_res_conv);
21070 }
21071
21072 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
21073         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21074         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
21075         return tag_ptr(ret_conv, true);
21076 }
21077 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone_ptr(int64_t arg) {
21078         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
21079         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
21080         return ret_conv;
21081 }
21082
21083 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone(int64_t orig) {
21084         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
21085         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21086         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
21087         return tag_ptr(ret_conv, true);
21088 }
21089
21090 void  CS_LDK_CVec_BlindedHopZ_free(int64_tArray _res) {
21091         LDKCVec_BlindedHopZ _res_constr;
21092         _res_constr.datalen = _res->arr_len;
21093         if (_res_constr.datalen > 0)
21094                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
21095         else
21096                 _res_constr.data = NULL;
21097         int64_t* _res_vals = _res->elems;
21098         for (size_t m = 0; m < _res_constr.datalen; m++) {
21099                 int64_t _res_conv_12 = _res_vals[m];
21100                 LDKBlindedHop _res_conv_12_conv;
21101                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
21102                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
21103                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
21104                 _res_constr.data[m] = _res_conv_12_conv;
21105         }
21106         FREE(_res);
21107         CVec_BlindedHopZ_free(_res_constr);
21108 }
21109
21110 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_ok(int64_t o) {
21111         LDKBlindedTail o_conv;
21112         o_conv.inner = untag_ptr(o);
21113         o_conv.is_owned = ptr_is_owned(o);
21114         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21115         o_conv = BlindedTail_clone(&o_conv);
21116         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21117         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
21118         return tag_ptr(ret_conv, true);
21119 }
21120
21121 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_err(int64_t e) {
21122         void* e_ptr = untag_ptr(e);
21123         CHECK_ACCESS(e_ptr);
21124         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21125         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21126         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21127         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
21128         return tag_ptr(ret_conv, true);
21129 }
21130
21131 jboolean  CS_LDK_CResult_BlindedTailDecodeErrorZ_is_ok(int64_t o) {
21132         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
21133         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
21134         return ret_conv;
21135 }
21136
21137 void  CS_LDK_CResult_BlindedTailDecodeErrorZ_free(int64_t _res) {
21138         if (!ptr_is_owned(_res)) return;
21139         void* _res_ptr = untag_ptr(_res);
21140         CHECK_ACCESS(_res_ptr);
21141         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
21142         FREE(untag_ptr(_res));
21143         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
21144 }
21145
21146 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
21147         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21148         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
21149         return tag_ptr(ret_conv, true);
21150 }
21151 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone_ptr(int64_t arg) {
21152         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
21153         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
21154         return ret_conv;
21155 }
21156
21157 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone(int64_t orig) {
21158         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
21159         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21160         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
21161         return tag_ptr(ret_conv, true);
21162 }
21163
21164 void  CS_LDK_CVec_RouteHopZ_free(int64_tArray _res) {
21165         LDKCVec_RouteHopZ _res_constr;
21166         _res_constr.datalen = _res->arr_len;
21167         if (_res_constr.datalen > 0)
21168                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21169         else
21170                 _res_constr.data = NULL;
21171         int64_t* _res_vals = _res->elems;
21172         for (size_t k = 0; k < _res_constr.datalen; k++) {
21173                 int64_t _res_conv_10 = _res_vals[k];
21174                 LDKRouteHop _res_conv_10_conv;
21175                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21176                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21177                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21178                 _res_constr.data[k] = _res_conv_10_conv;
21179         }
21180         FREE(_res);
21181         CVec_RouteHopZ_free(_res_constr);
21182 }
21183
21184 void  CS_LDK_CVec_PathZ_free(int64_tArray _res) {
21185         LDKCVec_PathZ _res_constr;
21186         _res_constr.datalen = _res->arr_len;
21187         if (_res_constr.datalen > 0)
21188                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
21189         else
21190                 _res_constr.data = NULL;
21191         int64_t* _res_vals = _res->elems;
21192         for (size_t g = 0; g < _res_constr.datalen; g++) {
21193                 int64_t _res_conv_6 = _res_vals[g];
21194                 LDKPath _res_conv_6_conv;
21195                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21196                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21197                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21198                 _res_constr.data[g] = _res_conv_6_conv;
21199         }
21200         FREE(_res);
21201         CVec_PathZ_free(_res_constr);
21202 }
21203
21204 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_ok(int64_t o) {
21205         LDKRoute o_conv;
21206         o_conv.inner = untag_ptr(o);
21207         o_conv.is_owned = ptr_is_owned(o);
21208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21209         o_conv = Route_clone(&o_conv);
21210         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21211         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
21212         return tag_ptr(ret_conv, true);
21213 }
21214
21215 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_err(int64_t e) {
21216         void* e_ptr = untag_ptr(e);
21217         CHECK_ACCESS(e_ptr);
21218         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21219         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21220         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21221         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
21222         return tag_ptr(ret_conv, true);
21223 }
21224
21225 jboolean  CS_LDK_CResult_RouteDecodeErrorZ_is_ok(int64_t o) {
21226         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
21227         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
21228         return ret_conv;
21229 }
21230
21231 void  CS_LDK_CResult_RouteDecodeErrorZ_free(int64_t _res) {
21232         if (!ptr_is_owned(_res)) return;
21233         void* _res_ptr = untag_ptr(_res);
21234         CHECK_ACCESS(_res_ptr);
21235         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
21236         FREE(untag_ptr(_res));
21237         CResult_RouteDecodeErrorZ_free(_res_conv);
21238 }
21239
21240 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
21241         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21242         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
21243         return tag_ptr(ret_conv, true);
21244 }
21245 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone_ptr(int64_t arg) {
21246         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
21247         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
21248         return ret_conv;
21249 }
21250
21251 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone(int64_t orig) {
21252         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
21253         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21254         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
21255         return tag_ptr(ret_conv, true);
21256 }
21257
21258 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_ok(int64_t o) {
21259         LDKRouteParameters o_conv;
21260         o_conv.inner = untag_ptr(o);
21261         o_conv.is_owned = ptr_is_owned(o);
21262         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21263         o_conv = RouteParameters_clone(&o_conv);
21264         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21265         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
21266         return tag_ptr(ret_conv, true);
21267 }
21268
21269 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_err(int64_t e) {
21270         void* e_ptr = untag_ptr(e);
21271         CHECK_ACCESS(e_ptr);
21272         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21273         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21274         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21275         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
21276         return tag_ptr(ret_conv, true);
21277 }
21278
21279 jboolean  CS_LDK_CResult_RouteParametersDecodeErrorZ_is_ok(int64_t o) {
21280         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
21281         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
21282         return ret_conv;
21283 }
21284
21285 void  CS_LDK_CResult_RouteParametersDecodeErrorZ_free(int64_t _res) {
21286         if (!ptr_is_owned(_res)) return;
21287         void* _res_ptr = untag_ptr(_res);
21288         CHECK_ACCESS(_res_ptr);
21289         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
21290         FREE(untag_ptr(_res));
21291         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
21292 }
21293
21294 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
21295         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21296         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
21297         return tag_ptr(ret_conv, true);
21298 }
21299 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone_ptr(int64_t arg) {
21300         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
21301         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
21302         return ret_conv;
21303 }
21304
21305 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone(int64_t orig) {
21306         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
21307         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21308         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
21309         return tag_ptr(ret_conv, true);
21310 }
21311
21312 void  CS_LDK_CVec_u64Z_free(int64_tArray _res) {
21313         LDKCVec_u64Z _res_constr;
21314         _res_constr.datalen = _res->arr_len;
21315         if (_res_constr.datalen > 0)
21316                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21317         else
21318                 _res_constr.data = NULL;
21319         int64_t* _res_vals = _res->elems;
21320         for (size_t g = 0; g < _res_constr.datalen; g++) {
21321                 int64_t _res_conv_6 = _res_vals[g];
21322                 _res_constr.data[g] = _res_conv_6;
21323         }
21324         FREE(_res);
21325         CVec_u64Z_free(_res_constr);
21326 }
21327
21328 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_ok(int64_t o) {
21329         LDKPaymentParameters o_conv;
21330         o_conv.inner = untag_ptr(o);
21331         o_conv.is_owned = ptr_is_owned(o);
21332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21333         o_conv = PaymentParameters_clone(&o_conv);
21334         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21335         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21336         return tag_ptr(ret_conv, true);
21337 }
21338
21339 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_err(int64_t e) {
21340         void* e_ptr = untag_ptr(e);
21341         CHECK_ACCESS(e_ptr);
21342         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21343         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21344         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21345         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21346         return tag_ptr(ret_conv, true);
21347 }
21348
21349 jboolean  CS_LDK_CResult_PaymentParametersDecodeErrorZ_is_ok(int64_t o) {
21350         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21351         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21352         return ret_conv;
21353 }
21354
21355 void  CS_LDK_CResult_PaymentParametersDecodeErrorZ_free(int64_t _res) {
21356         if (!ptr_is_owned(_res)) return;
21357         void* _res_ptr = untag_ptr(_res);
21358         CHECK_ACCESS(_res_ptr);
21359         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21360         FREE(untag_ptr(_res));
21361         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21362 }
21363
21364 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21365         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21366         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21367         return tag_ptr(ret_conv, true);
21368 }
21369 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone_ptr(int64_t arg) {
21370         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21371         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21372         return ret_conv;
21373 }
21374
21375 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone(int64_t orig) {
21376         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21377         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21378         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21379         return tag_ptr(ret_conv, true);
21380 }
21381
21382 void  CS_LDK_CVec_RouteHintZ_free(int64_tArray _res) {
21383         LDKCVec_RouteHintZ _res_constr;
21384         _res_constr.datalen = _res->arr_len;
21385         if (_res_constr.datalen > 0)
21386                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21387         else
21388                 _res_constr.data = NULL;
21389         int64_t* _res_vals = _res->elems;
21390         for (size_t l = 0; l < _res_constr.datalen; l++) {
21391                 int64_t _res_conv_11 = _res_vals[l];
21392                 LDKRouteHint _res_conv_11_conv;
21393                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21394                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21395                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21396                 _res_constr.data[l] = _res_conv_11_conv;
21397         }
21398         FREE(_res);
21399         CVec_RouteHintZ_free(_res_constr);
21400 }
21401
21402 void  CS_LDK_CVec_RouteHintHopZ_free(int64_tArray _res) {
21403         LDKCVec_RouteHintHopZ _res_constr;
21404         _res_constr.datalen = _res->arr_len;
21405         if (_res_constr.datalen > 0)
21406                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21407         else
21408                 _res_constr.data = NULL;
21409         int64_t* _res_vals = _res->elems;
21410         for (size_t o = 0; o < _res_constr.datalen; o++) {
21411                 int64_t _res_conv_14 = _res_vals[o];
21412                 LDKRouteHintHop _res_conv_14_conv;
21413                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21414                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21416                 _res_constr.data[o] = _res_conv_14_conv;
21417         }
21418         FREE(_res);
21419         CVec_RouteHintHopZ_free(_res_constr);
21420 }
21421
21422 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_ok(int64_t o) {
21423         LDKRouteHint o_conv;
21424         o_conv.inner = untag_ptr(o);
21425         o_conv.is_owned = ptr_is_owned(o);
21426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21427         o_conv = RouteHint_clone(&o_conv);
21428         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21429         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21430         return tag_ptr(ret_conv, true);
21431 }
21432
21433 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_err(int64_t e) {
21434         void* e_ptr = untag_ptr(e);
21435         CHECK_ACCESS(e_ptr);
21436         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21437         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21438         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21439         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21440         return tag_ptr(ret_conv, true);
21441 }
21442
21443 jboolean  CS_LDK_CResult_RouteHintDecodeErrorZ_is_ok(int64_t o) {
21444         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21445         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21446         return ret_conv;
21447 }
21448
21449 void  CS_LDK_CResult_RouteHintDecodeErrorZ_free(int64_t _res) {
21450         if (!ptr_is_owned(_res)) return;
21451         void* _res_ptr = untag_ptr(_res);
21452         CHECK_ACCESS(_res_ptr);
21453         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21454         FREE(untag_ptr(_res));
21455         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21456 }
21457
21458 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21459         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21460         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21461         return tag_ptr(ret_conv, true);
21462 }
21463 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone_ptr(int64_t arg) {
21464         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21465         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21466         return ret_conv;
21467 }
21468
21469 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone(int64_t orig) {
21470         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21471         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21472         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21473         return tag_ptr(ret_conv, true);
21474 }
21475
21476 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_ok(int64_t o) {
21477         LDKRouteHintHop o_conv;
21478         o_conv.inner = untag_ptr(o);
21479         o_conv.is_owned = ptr_is_owned(o);
21480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21481         o_conv = RouteHintHop_clone(&o_conv);
21482         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21483         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21484         return tag_ptr(ret_conv, true);
21485 }
21486
21487 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_err(int64_t e) {
21488         void* e_ptr = untag_ptr(e);
21489         CHECK_ACCESS(e_ptr);
21490         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21491         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21492         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21493         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21494         return tag_ptr(ret_conv, true);
21495 }
21496
21497 jboolean  CS_LDK_CResult_RouteHintHopDecodeErrorZ_is_ok(int64_t o) {
21498         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21499         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21500         return ret_conv;
21501 }
21502
21503 void  CS_LDK_CResult_RouteHintHopDecodeErrorZ_free(int64_t _res) {
21504         if (!ptr_is_owned(_res)) return;
21505         void* _res_ptr = untag_ptr(_res);
21506         CHECK_ACCESS(_res_ptr);
21507         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21508         FREE(untag_ptr(_res));
21509         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21510 }
21511
21512 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21513         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21514         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21515         return tag_ptr(ret_conv, true);
21516 }
21517 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone_ptr(int64_t arg) {
21518         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21519         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21520         return ret_conv;
21521 }
21522
21523 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone(int64_t orig) {
21524         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21525         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21526         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21527         return tag_ptr(ret_conv, true);
21528 }
21529
21530 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_ok(int64_t o) {
21531         LDKFixedPenaltyScorer o_conv;
21532         o_conv.inner = untag_ptr(o);
21533         o_conv.is_owned = ptr_is_owned(o);
21534         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21535         o_conv = FixedPenaltyScorer_clone(&o_conv);
21536         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21537         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21538         return tag_ptr(ret_conv, true);
21539 }
21540
21541 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_err(int64_t e) {
21542         void* e_ptr = untag_ptr(e);
21543         CHECK_ACCESS(e_ptr);
21544         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21545         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21546         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21547         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21548         return tag_ptr(ret_conv, true);
21549 }
21550
21551 jboolean  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(int64_t o) {
21552         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21553         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21554         return ret_conv;
21555 }
21556
21557 void  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_free(int64_t _res) {
21558         if (!ptr_is_owned(_res)) return;
21559         void* _res_ptr = untag_ptr(_res);
21560         CHECK_ACCESS(_res_ptr);
21561         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21562         FREE(untag_ptr(_res));
21563         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21564 }
21565
21566 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21567         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21568         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21569         return tag_ptr(ret_conv, true);
21570 }
21571 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(int64_t arg) {
21572         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21573         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21574         return ret_conv;
21575 }
21576
21577 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone(int64_t orig) {
21578         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21579         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21580         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21581         return tag_ptr(ret_conv, true);
21582 }
21583
21584 void  CS_LDK_CVec_NodeIdZ_free(int64_tArray _res) {
21585         LDKCVec_NodeIdZ _res_constr;
21586         _res_constr.datalen = _res->arr_len;
21587         if (_res_constr.datalen > 0)
21588                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21589         else
21590                 _res_constr.data = NULL;
21591         int64_t* _res_vals = _res->elems;
21592         for (size_t i = 0; i < _res_constr.datalen; i++) {
21593                 int64_t _res_conv_8 = _res_vals[i];
21594                 LDKNodeId _res_conv_8_conv;
21595                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21596                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21597                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21598                 _res_constr.data[i] = _res_conv_8_conv;
21599         }
21600         FREE(_res);
21601         CVec_NodeIdZ_free(_res_constr);
21602 }
21603
21604 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21605         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21606         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21607         return tag_ptr(ret_conv, true);
21608 }
21609 int64_t  CS_LDK_C2Tuple_u64u64Z_clone_ptr(int64_t arg) {
21610         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21611         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21612         return ret_conv;
21613 }
21614
21615 int64_t  CS_LDK_C2Tuple_u64u64Z_clone(int64_t orig) {
21616         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21617         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21618         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21619         return tag_ptr(ret_conv, true);
21620 }
21621
21622 int64_t  CS_LDK_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
21623         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21624         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21625         return tag_ptr(ret_conv, true);
21626 }
21627
21628 void  CS_LDK_C2Tuple_u64u64Z_free(int64_t _res) {
21629         if (!ptr_is_owned(_res)) return;
21630         void* _res_ptr = untag_ptr(_res);
21631         CHECK_ACCESS(_res_ptr);
21632         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21633         FREE(untag_ptr(_res));
21634         C2Tuple_u64u64Z_free(_res_conv);
21635 }
21636
21637 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_some(int64_t o) {
21638         void* o_ptr = untag_ptr(o);
21639         CHECK_ACCESS(o_ptr);
21640         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21641         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21642         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21643         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21644         int64_t ret_ref = tag_ptr(ret_copy, true);
21645         return ret_ref;
21646 }
21647
21648 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_none() {
21649         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21650         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21651         int64_t ret_ref = tag_ptr(ret_copy, true);
21652         return ret_ref;
21653 }
21654
21655 void  CS_LDK_COption_C2Tuple_u64u64ZZ_free(int64_t _res) {
21656         if (!ptr_is_owned(_res)) return;
21657         void* _res_ptr = untag_ptr(_res);
21658         CHECK_ACCESS(_res_ptr);
21659         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21660         FREE(untag_ptr(_res));
21661         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21662 }
21663
21664 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21665         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21666         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21667         int64_t ret_ref = tag_ptr(ret_copy, true);
21668         return ret_ref;
21669 }
21670 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone_ptr(int64_t arg) {
21671         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21672         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21673         return ret_conv;
21674 }
21675
21676 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone(int64_t orig) {
21677         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21678         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21679         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21680         int64_t ret_ref = tag_ptr(ret_copy, true);
21681         return ret_ref;
21682 }
21683
21684 int64_t  CS_LDK_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
21685         LDKThirtyTwoU16s a_ref;
21686         CHECK(a->arr_len == 32);
21687         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21688         LDKThirtyTwoU16s b_ref;
21689         CHECK(b->arr_len == 32);
21690         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21691         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21692         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21693         return tag_ptr(ret_conv, true);
21694 }
21695
21696 void  CS_LDK_C2Tuple_Z_free(int64_t _res) {
21697         if (!ptr_is_owned(_res)) return;
21698         void* _res_ptr = untag_ptr(_res);
21699         CHECK_ACCESS(_res_ptr);
21700         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21701         FREE(untag_ptr(_res));
21702         C2Tuple_Z_free(_res_conv);
21703 }
21704
21705 int64_t  CS_LDK_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
21706         LDKThirtyTwoU16s a_ref;
21707         CHECK(a->arr_len == 32);
21708         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21709         LDKThirtyTwoU16s b_ref;
21710         CHECK(b->arr_len == 32);
21711         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21712         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
21713         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
21714         return tag_ptr(ret_conv, true);
21715 }
21716
21717 void  CS_LDK_C2Tuple__u1632_u1632Z_free(int64_t _res) {
21718         if (!ptr_is_owned(_res)) return;
21719         void* _res_ptr = untag_ptr(_res);
21720         CHECK_ACCESS(_res_ptr);
21721         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
21722         FREE(untag_ptr(_res));
21723         C2Tuple__u1632_u1632Z_free(_res_conv);
21724 }
21725
21726 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(int64_t o) {
21727         void* o_ptr = untag_ptr(o);
21728         CHECK_ACCESS(o_ptr);
21729         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
21730         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
21731         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21732         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
21733         int64_t ret_ref = tag_ptr(ret_copy, true);
21734         return ret_ref;
21735 }
21736
21737 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
21738         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21739         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
21740         int64_t ret_ref = tag_ptr(ret_copy, true);
21741         return ret_ref;
21742 }
21743
21744 void  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(int64_t _res) {
21745         if (!ptr_is_owned(_res)) return;
21746         void* _res_ptr = untag_ptr(_res);
21747         CHECK_ACCESS(_res_ptr);
21748         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
21749         FREE(untag_ptr(_res));
21750         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
21751 }
21752
21753 int64_t  CS_LDK_COption_f64Z_some(double o) {
21754         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21755         *ret_copy = COption_f64Z_some(o);
21756         int64_t ret_ref = tag_ptr(ret_copy, true);
21757         return ret_ref;
21758 }
21759
21760 int64_t  CS_LDK_COption_f64Z_none() {
21761         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21762         *ret_copy = COption_f64Z_none();
21763         int64_t ret_ref = tag_ptr(ret_copy, true);
21764         return ret_ref;
21765 }
21766
21767 void  CS_LDK_COption_f64Z_free(int64_t _res) {
21768         if (!ptr_is_owned(_res)) return;
21769         void* _res_ptr = untag_ptr(_res);
21770         CHECK_ACCESS(_res_ptr);
21771         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
21772         FREE(untag_ptr(_res));
21773         COption_f64Z_free(_res_conv);
21774 }
21775
21776 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
21777         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21778         *ret_copy = COption_f64Z_clone(arg);
21779         int64_t ret_ref = tag_ptr(ret_copy, true);
21780         return ret_ref;
21781 }
21782 int64_t  CS_LDK_COption_f64Z_clone_ptr(int64_t arg) {
21783         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
21784         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
21785         return ret_conv;
21786 }
21787
21788 int64_t  CS_LDK_COption_f64Z_clone(int64_t orig) {
21789         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
21790         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21791         *ret_copy = COption_f64Z_clone(orig_conv);
21792         int64_t ret_ref = tag_ptr(ret_copy, true);
21793         return ret_ref;
21794 }
21795
21796 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_ok(int64_t o) {
21797         LDKProbabilisticScorer o_conv;
21798         o_conv.inner = untag_ptr(o);
21799         o_conv.is_owned = ptr_is_owned(o);
21800         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21801         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
21802         
21803         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21804         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
21805         return tag_ptr(ret_conv, true);
21806 }
21807
21808 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_err(int64_t e) {
21809         void* e_ptr = untag_ptr(e);
21810         CHECK_ACCESS(e_ptr);
21811         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21812         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21813         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21814         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
21815         return tag_ptr(ret_conv, true);
21816 }
21817
21818 jboolean  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(int64_t o) {
21819         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
21820         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
21821         return ret_conv;
21822 }
21823
21824 void  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_free(int64_t _res) {
21825         if (!ptr_is_owned(_res)) return;
21826         void* _res_ptr = untag_ptr(_res);
21827         CHECK_ACCESS(_res_ptr);
21828         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
21829         FREE(untag_ptr(_res));
21830         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
21831 }
21832
21833 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_ok(int64_t o) {
21834         LDKBestBlock o_conv;
21835         o_conv.inner = untag_ptr(o);
21836         o_conv.is_owned = ptr_is_owned(o);
21837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21838         o_conv = BestBlock_clone(&o_conv);
21839         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21840         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
21841         return tag_ptr(ret_conv, true);
21842 }
21843
21844 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_err(int64_t e) {
21845         void* e_ptr = untag_ptr(e);
21846         CHECK_ACCESS(e_ptr);
21847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21849         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21850         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
21851         return tag_ptr(ret_conv, true);
21852 }
21853
21854 jboolean  CS_LDK_CResult_BestBlockDecodeErrorZ_is_ok(int64_t o) {
21855         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
21856         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
21857         return ret_conv;
21858 }
21859
21860 void  CS_LDK_CResult_BestBlockDecodeErrorZ_free(int64_t _res) {
21861         if (!ptr_is_owned(_res)) return;
21862         void* _res_ptr = untag_ptr(_res);
21863         CHECK_ACCESS(_res_ptr);
21864         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
21865         FREE(untag_ptr(_res));
21866         CResult_BestBlockDecodeErrorZ_free(_res_conv);
21867 }
21868
21869 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
21870         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21871         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
21872         return tag_ptr(ret_conv, true);
21873 }
21874 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_clone_ptr(int64_t arg) {
21875         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
21876         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
21877         return ret_conv;
21878 }
21879
21880 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_clone(int64_t orig) {
21881         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
21882         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
21883         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
21884         return tag_ptr(ret_conv, true);
21885 }
21886
21887 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
21888         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21889         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
21890         return tag_ptr(ret_conv, true);
21891 }
21892 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone_ptr(int64_t arg) {
21893         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
21894         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
21895         return ret_conv;
21896 }
21897
21898 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone(int64_t orig) {
21899         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
21900         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21901         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
21902         return tag_ptr(ret_conv, true);
21903 }
21904
21905 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
21906         LDKTransaction b_ref;
21907         b_ref.datalen = b->arr_len;
21908         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
21909         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
21910         b_ref.data_is_owned = true;
21911         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
21912         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
21913         return tag_ptr(ret_conv, true);
21914 }
21915
21916 void  CS_LDK_C2Tuple_usizeTransactionZ_free(int64_t _res) {
21917         if (!ptr_is_owned(_res)) return;
21918         void* _res_ptr = untag_ptr(_res);
21919         CHECK_ACCESS(_res_ptr);
21920         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
21921         FREE(untag_ptr(_res));
21922         C2Tuple_usizeTransactionZ_free(_res_conv);
21923 }
21924
21925 void  CS_LDK_CVec_C2Tuple_usizeTransactionZZ_free(int64_tArray _res) {
21926         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
21927         _res_constr.datalen = _res->arr_len;
21928         if (_res_constr.datalen > 0)
21929                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
21930         else
21931                 _res_constr.data = NULL;
21932         int64_t* _res_vals = _res->elems;
21933         for (size_t c = 0; c < _res_constr.datalen; c++) {
21934                 int64_t _res_conv_28 = _res_vals[c];
21935                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
21936                 CHECK_ACCESS(_res_conv_28_ptr);
21937                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
21938                 FREE(untag_ptr(_res_conv_28));
21939                 _res_constr.data[c] = _res_conv_28_conv;
21940         }
21941         FREE(_res);
21942         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
21943 }
21944
21945 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
21946         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21947         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
21948         return tag_ptr(ret_conv, true);
21949 }
21950 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
21951         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
21952         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
21953         return ret_conv;
21954 }
21955
21956 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(int64_t orig) {
21957         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
21958         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21959         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
21960         return tag_ptr(ret_conv, true);
21961 }
21962
21963 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, int64_t c) {
21964         LDKThirtyTwoBytes a_ref;
21965         CHECK(a->arr_len == 32);
21966         memcpy(a_ref.data, a->elems, 32); FREE(a);
21967         void* c_ptr = untag_ptr(c);
21968         CHECK_ACCESS(c_ptr);
21969         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
21970         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
21971         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
21972         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
21973         return tag_ptr(ret_conv, true);
21974 }
21975
21976 void  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(int64_t _res) {
21977         if (!ptr_is_owned(_res)) return;
21978         void* _res_ptr = untag_ptr(_res);
21979         CHECK_ACCESS(_res_ptr);
21980         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
21981         FREE(untag_ptr(_res));
21982         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
21983 }
21984
21985 void  CS_LDK_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(int64_tArray _res) {
21986         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
21987         _res_constr.datalen = _res->arr_len;
21988         if (_res_constr.datalen > 0)
21989                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
21990         else
21991                 _res_constr.data = NULL;
21992         int64_t* _res_vals = _res->elems;
21993         for (size_t c = 0; c < _res_constr.datalen; c++) {
21994                 int64_t _res_conv_54 = _res_vals[c];
21995                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
21996                 CHECK_ACCESS(_res_conv_54_ptr);
21997                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
21998                 FREE(untag_ptr(_res_conv_54));
21999                 _res_constr.data[c] = _res_conv_54_conv;
22000         }
22001         FREE(_res);
22002         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
22003 }
22004
22005 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_ok(int32_t o) {
22006         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_cs(o);
22007         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22008         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
22009         return tag_ptr(ret_conv, true);
22010 }
22011
22012 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
22013         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22014         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
22015         return tag_ptr(ret_conv, true);
22016 }
22017
22018 jboolean  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(int64_t o) {
22019         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
22020         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
22021         return ret_conv;
22022 }
22023
22024 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_free(int64_t _res) {
22025         if (!ptr_is_owned(_res)) return;
22026         void* _res_ptr = untag_ptr(_res);
22027         CHECK_ACCESS(_res_ptr);
22028         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
22029         FREE(untag_ptr(_res));
22030         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
22031 }
22032
22033 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
22034         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22035         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
22036         return tag_ptr(ret_conv, true);
22037 }
22038 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(int64_t arg) {
22039         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
22040         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
22041         return ret_conv;
22042 }
22043
22044 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone(int64_t orig) {
22045         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
22046         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22047         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
22048         return tag_ptr(ret_conv, true);
22049 }
22050
22051 void  CS_LDK_CVec_MonitorEventZ_free(int64_tArray _res) {
22052         LDKCVec_MonitorEventZ _res_constr;
22053         _res_constr.datalen = _res->arr_len;
22054         if (_res_constr.datalen > 0)
22055                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22056         else
22057                 _res_constr.data = NULL;
22058         int64_t* _res_vals = _res->elems;
22059         for (size_t o = 0; o < _res_constr.datalen; o++) {
22060                 int64_t _res_conv_14 = _res_vals[o];
22061                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
22062                 CHECK_ACCESS(_res_conv_14_ptr);
22063                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
22064                 FREE(untag_ptr(_res_conv_14));
22065                 _res_constr.data[o] = _res_conv_14_conv;
22066         }
22067         FREE(_res);
22068         CVec_MonitorEventZ_free(_res_constr);
22069 }
22070
22071 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
22072         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22073         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
22074         return tag_ptr(ret_conv, true);
22075 }
22076 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(int64_t arg) {
22077         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
22078         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
22079         return ret_conv;
22080 }
22081
22082 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(int64_t orig) {
22083         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
22084         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22085         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
22086         return tag_ptr(ret_conv, true);
22087 }
22088
22089 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(int64_t a, int64_t b, int64_tArray c, int8_tArray d) {
22090         LDKOutPoint a_conv;
22091         a_conv.inner = untag_ptr(a);
22092         a_conv.is_owned = ptr_is_owned(a);
22093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22094         a_conv = OutPoint_clone(&a_conv);
22095         LDKChannelId b_conv;
22096         b_conv.inner = untag_ptr(b);
22097         b_conv.is_owned = ptr_is_owned(b);
22098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22099         b_conv = ChannelId_clone(&b_conv);
22100         LDKCVec_MonitorEventZ c_constr;
22101         c_constr.datalen = c->arr_len;
22102         if (c_constr.datalen > 0)
22103                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22104         else
22105                 c_constr.data = NULL;
22106         int64_t* c_vals = c->elems;
22107         for (size_t o = 0; o < c_constr.datalen; o++) {
22108                 int64_t c_conv_14 = c_vals[o];
22109                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
22110                 CHECK_ACCESS(c_conv_14_ptr);
22111                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
22112                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
22113                 c_constr.data[o] = c_conv_14_conv;
22114         }
22115         FREE(c);
22116         LDKPublicKey d_ref;
22117         CHECK(d->arr_len == 33);
22118         memcpy(d_ref.compressed_form, d->elems, 33); FREE(d);
22119         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22120         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
22121         return tag_ptr(ret_conv, true);
22122 }
22123
22124 void  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(int64_t _res) {
22125         if (!ptr_is_owned(_res)) return;
22126         void* _res_ptr = untag_ptr(_res);
22127         CHECK_ACCESS(_res_ptr);
22128         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
22129         FREE(untag_ptr(_res));
22130         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
22131 }
22132
22133 void  CS_LDK_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(int64_tArray _res) {
22134         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
22135         _res_constr.datalen = _res->arr_len;
22136         if (_res_constr.datalen > 0)
22137                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
22138         else
22139                 _res_constr.data = NULL;
22140         int64_t* _res_vals = _res->elems;
22141         for (size_t f = 0; f < _res_constr.datalen; f++) {
22142                 int64_t _res_conv_57 = _res_vals[f];
22143                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
22144                 CHECK_ACCESS(_res_conv_57_ptr);
22145                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
22146                 FREE(untag_ptr(_res_conv_57));
22147                 _res_constr.data[f] = _res_conv_57_conv;
22148         }
22149         FREE(_res);
22150         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
22151 }
22152
22153 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_ok(int64_t o) {
22154         LDKInitFeatures o_conv;
22155         o_conv.inner = untag_ptr(o);
22156         o_conv.is_owned = ptr_is_owned(o);
22157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22158         o_conv = InitFeatures_clone(&o_conv);
22159         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22160         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
22161         return tag_ptr(ret_conv, true);
22162 }
22163
22164 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_err(int64_t e) {
22165         void* e_ptr = untag_ptr(e);
22166         CHECK_ACCESS(e_ptr);
22167         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22168         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22169         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22170         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
22171         return tag_ptr(ret_conv, true);
22172 }
22173
22174 jboolean  CS_LDK_CResult_InitFeaturesDecodeErrorZ_is_ok(int64_t o) {
22175         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
22176         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
22177         return ret_conv;
22178 }
22179
22180 void  CS_LDK_CResult_InitFeaturesDecodeErrorZ_free(int64_t _res) {
22181         if (!ptr_is_owned(_res)) return;
22182         void* _res_ptr = untag_ptr(_res);
22183         CHECK_ACCESS(_res_ptr);
22184         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
22185         FREE(untag_ptr(_res));
22186         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
22187 }
22188
22189 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22190         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22191         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
22192         return tag_ptr(ret_conv, true);
22193 }
22194 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22195         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
22196         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22197         return ret_conv;
22198 }
22199
22200 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone(int64_t orig) {
22201         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
22202         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22203         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
22204         return tag_ptr(ret_conv, true);
22205 }
22206
22207 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_ok(int64_t o) {
22208         LDKChannelFeatures o_conv;
22209         o_conv.inner = untag_ptr(o);
22210         o_conv.is_owned = ptr_is_owned(o);
22211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22212         o_conv = ChannelFeatures_clone(&o_conv);
22213         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22214         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
22215         return tag_ptr(ret_conv, true);
22216 }
22217
22218 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_err(int64_t e) {
22219         void* e_ptr = untag_ptr(e);
22220         CHECK_ACCESS(e_ptr);
22221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22223         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22224         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
22225         return tag_ptr(ret_conv, true);
22226 }
22227
22228 jboolean  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_is_ok(int64_t o) {
22229         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
22230         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
22231         return ret_conv;
22232 }
22233
22234 void  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_free(int64_t _res) {
22235         if (!ptr_is_owned(_res)) return;
22236         void* _res_ptr = untag_ptr(_res);
22237         CHECK_ACCESS(_res_ptr);
22238         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
22239         FREE(untag_ptr(_res));
22240         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
22241 }
22242
22243 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22244         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22245         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
22246         return tag_ptr(ret_conv, true);
22247 }
22248 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22249         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
22250         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22251         return ret_conv;
22252 }
22253
22254 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone(int64_t orig) {
22255         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
22256         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22257         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
22258         return tag_ptr(ret_conv, true);
22259 }
22260
22261 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_ok(int64_t o) {
22262         LDKNodeFeatures o_conv;
22263         o_conv.inner = untag_ptr(o);
22264         o_conv.is_owned = ptr_is_owned(o);
22265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22266         o_conv = NodeFeatures_clone(&o_conv);
22267         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22268         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
22269         return tag_ptr(ret_conv, true);
22270 }
22271
22272 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_err(int64_t e) {
22273         void* e_ptr = untag_ptr(e);
22274         CHECK_ACCESS(e_ptr);
22275         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22276         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22277         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22278         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
22279         return tag_ptr(ret_conv, true);
22280 }
22281
22282 jboolean  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_is_ok(int64_t o) {
22283         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
22284         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
22285         return ret_conv;
22286 }
22287
22288 void  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_free(int64_t _res) {
22289         if (!ptr_is_owned(_res)) return;
22290         void* _res_ptr = untag_ptr(_res);
22291         CHECK_ACCESS(_res_ptr);
22292         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
22293         FREE(untag_ptr(_res));
22294         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
22295 }
22296
22297 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22298         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22299         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
22300         return tag_ptr(ret_conv, true);
22301 }
22302 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22303         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
22304         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22305         return ret_conv;
22306 }
22307
22308 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone(int64_t orig) {
22309         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
22310         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22311         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
22312         return tag_ptr(ret_conv, true);
22313 }
22314
22315 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
22316         LDKBolt11InvoiceFeatures o_conv;
22317         o_conv.inner = untag_ptr(o);
22318         o_conv.is_owned = ptr_is_owned(o);
22319         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22320         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22321         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22322         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22323         return tag_ptr(ret_conv, true);
22324 }
22325
22326 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
22327         void* e_ptr = untag_ptr(e);
22328         CHECK_ACCESS(e_ptr);
22329         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22330         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22331         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22332         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22333         return tag_ptr(ret_conv, true);
22334 }
22335
22336 jboolean  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
22337         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22338         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22339         return ret_conv;
22340 }
22341
22342 void  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
22343         if (!ptr_is_owned(_res)) return;
22344         void* _res_ptr = untag_ptr(_res);
22345         CHECK_ACCESS(_res_ptr);
22346         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22347         FREE(untag_ptr(_res));
22348         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22349 }
22350
22351 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22352         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22353         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22354         return tag_ptr(ret_conv, true);
22355 }
22356 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22357         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22358         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22359         return ret_conv;
22360 }
22361
22362 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
22363         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22364         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22365         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22366         return tag_ptr(ret_conv, true);
22367 }
22368
22369 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
22370         LDKBolt12InvoiceFeatures o_conv;
22371         o_conv.inner = untag_ptr(o);
22372         o_conv.is_owned = ptr_is_owned(o);
22373         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22374         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22375         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22376         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22377         return tag_ptr(ret_conv, true);
22378 }
22379
22380 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
22381         void* e_ptr = untag_ptr(e);
22382         CHECK_ACCESS(e_ptr);
22383         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22384         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22385         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22386         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22387         return tag_ptr(ret_conv, true);
22388 }
22389
22390 jboolean  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
22391         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22392         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22393         return ret_conv;
22394 }
22395
22396 void  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
22397         if (!ptr_is_owned(_res)) return;
22398         void* _res_ptr = untag_ptr(_res);
22399         CHECK_ACCESS(_res_ptr);
22400         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22401         FREE(untag_ptr(_res));
22402         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22403 }
22404
22405 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22406         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22407         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22408         return tag_ptr(ret_conv, true);
22409 }
22410 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22411         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22412         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22413         return ret_conv;
22414 }
22415
22416 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
22417         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22418         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22419         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22420         return tag_ptr(ret_conv, true);
22421 }
22422
22423 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_ok(int64_t o) {
22424         LDKBlindedHopFeatures o_conv;
22425         o_conv.inner = untag_ptr(o);
22426         o_conv.is_owned = ptr_is_owned(o);
22427         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22428         o_conv = BlindedHopFeatures_clone(&o_conv);
22429         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22430         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22431         return tag_ptr(ret_conv, true);
22432 }
22433
22434 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_err(int64_t e) {
22435         void* e_ptr = untag_ptr(e);
22436         CHECK_ACCESS(e_ptr);
22437         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22438         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22439         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22440         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22441         return tag_ptr(ret_conv, true);
22442 }
22443
22444 jboolean  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(int64_t o) {
22445         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22446         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22447         return ret_conv;
22448 }
22449
22450 void  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_free(int64_t _res) {
22451         if (!ptr_is_owned(_res)) return;
22452         void* _res_ptr = untag_ptr(_res);
22453         CHECK_ACCESS(_res_ptr);
22454         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22455         FREE(untag_ptr(_res));
22456         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22457 }
22458
22459 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22460         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22461         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22462         return tag_ptr(ret_conv, true);
22463 }
22464 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22465         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22466         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22467         return ret_conv;
22468 }
22469
22470 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone(int64_t orig) {
22471         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22472         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22473         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22474         return tag_ptr(ret_conv, true);
22475 }
22476
22477 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(int64_t o) {
22478         LDKChannelTypeFeatures o_conv;
22479         o_conv.inner = untag_ptr(o);
22480         o_conv.is_owned = ptr_is_owned(o);
22481         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22482         o_conv = ChannelTypeFeatures_clone(&o_conv);
22483         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22484         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22485         return tag_ptr(ret_conv, true);
22486 }
22487
22488 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_err(int64_t e) {
22489         void* e_ptr = untag_ptr(e);
22490         CHECK_ACCESS(e_ptr);
22491         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22492         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22493         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22494         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22495         return tag_ptr(ret_conv, true);
22496 }
22497
22498 jboolean  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(int64_t o) {
22499         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22500         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22501         return ret_conv;
22502 }
22503
22504 void  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_free(int64_t _res) {
22505         if (!ptr_is_owned(_res)) return;
22506         void* _res_ptr = untag_ptr(_res);
22507         CHECK_ACCESS(_res_ptr);
22508         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22509         FREE(untag_ptr(_res));
22510         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22511 }
22512
22513 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22514         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22515         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22516         return tag_ptr(ret_conv, true);
22517 }
22518 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22519         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22520         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22521         return ret_conv;
22522 }
22523
22524 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(int64_t orig) {
22525         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22526         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22527         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22528         return tag_ptr(ret_conv, true);
22529 }
22530
22531 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_ok(int64_t o) {
22532         LDKOfferId o_conv;
22533         o_conv.inner = untag_ptr(o);
22534         o_conv.is_owned = ptr_is_owned(o);
22535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22536         o_conv = OfferId_clone(&o_conv);
22537         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22538         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
22539         return tag_ptr(ret_conv, true);
22540 }
22541
22542 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_err(int64_t e) {
22543         void* e_ptr = untag_ptr(e);
22544         CHECK_ACCESS(e_ptr);
22545         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22546         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22547         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22548         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
22549         return tag_ptr(ret_conv, true);
22550 }
22551
22552 jboolean  CS_LDK_CResult_OfferIdDecodeErrorZ_is_ok(int64_t o) {
22553         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
22554         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
22555         return ret_conv;
22556 }
22557
22558 void  CS_LDK_CResult_OfferIdDecodeErrorZ_free(int64_t _res) {
22559         if (!ptr_is_owned(_res)) return;
22560         void* _res_ptr = untag_ptr(_res);
22561         CHECK_ACCESS(_res_ptr);
22562         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
22563         FREE(untag_ptr(_res));
22564         CResult_OfferIdDecodeErrorZ_free(_res_conv);
22565 }
22566
22567 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
22568         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22569         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
22570         return tag_ptr(ret_conv, true);
22571 }
22572 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_clone_ptr(int64_t arg) {
22573         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
22574         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
22575         return ret_conv;
22576 }
22577
22578 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_clone(int64_t orig) {
22579         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
22580         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22581         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
22582         return tag_ptr(ret_conv, true);
22583 }
22584
22585 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_ok() {
22586         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22587         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22588         return tag_ptr(ret_conv, true);
22589 }
22590
22591 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_err(int32_t e) {
22592         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22593         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22594         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22595         return tag_ptr(ret_conv, true);
22596 }
22597
22598 jboolean  CS_LDK_CResult_NoneBolt12SemanticErrorZ_is_ok(int64_t o) {
22599         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22600         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22601         return ret_conv;
22602 }
22603
22604 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_free(int64_t _res) {
22605         if (!ptr_is_owned(_res)) return;
22606         void* _res_ptr = untag_ptr(_res);
22607         CHECK_ACCESS(_res_ptr);
22608         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22609         FREE(untag_ptr(_res));
22610         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22611 }
22612
22613 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22614         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22615         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22616         return tag_ptr(ret_conv, true);
22617 }
22618 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22619         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22620         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22621         return ret_conv;
22622 }
22623
22624 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone(int64_t orig) {
22625         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22626         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22627         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22628         return tag_ptr(ret_conv, true);
22629 }
22630
22631 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_ok(int64_t o) {
22632         LDKOffer o_conv;
22633         o_conv.inner = untag_ptr(o);
22634         o_conv.is_owned = ptr_is_owned(o);
22635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22636         o_conv = Offer_clone(&o_conv);
22637         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22638         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
22639         return tag_ptr(ret_conv, true);
22640 }
22641
22642 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_err(int32_t e) {
22643         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22644         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22645         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
22646         return tag_ptr(ret_conv, true);
22647 }
22648
22649 jboolean  CS_LDK_CResult_OfferBolt12SemanticErrorZ_is_ok(int64_t o) {
22650         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
22651         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
22652         return ret_conv;
22653 }
22654
22655 void  CS_LDK_CResult_OfferBolt12SemanticErrorZ_free(int64_t _res) {
22656         if (!ptr_is_owned(_res)) return;
22657         void* _res_ptr = untag_ptr(_res);
22658         CHECK_ACCESS(_res_ptr);
22659         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
22660         FREE(untag_ptr(_res));
22661         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
22662 }
22663
22664 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
22665         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22666         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
22667         return tag_ptr(ret_conv, true);
22668 }
22669 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22670         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
22671         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
22672         return ret_conv;
22673 }
22674
22675 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_clone(int64_t orig) {
22676         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
22677         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22678         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
22679         return tag_ptr(ret_conv, true);
22680 }
22681
22682 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(int64_t o) {
22683         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
22684         o_conv.inner = untag_ptr(o);
22685         o_conv.is_owned = ptr_is_owned(o);
22686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22687         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
22688         
22689         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22690         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22691         return tag_ptr(ret_conv, true);
22692 }
22693
22694 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(int32_t e) {
22695         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22696         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22697         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22698         return tag_ptr(ret_conv, true);
22699 }
22700
22701 jboolean  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
22702         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22703         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22704         return ret_conv;
22705 }
22706
22707 void  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(int64_t _res) {
22708         if (!ptr_is_owned(_res)) return;
22709         void* _res_ptr = untag_ptr(_res);
22710         CHECK_ACCESS(_res_ptr);
22711         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22712         FREE(untag_ptr(_res));
22713         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22714 }
22715
22716 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(int64_t o) {
22717         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
22718         o_conv.inner = untag_ptr(o);
22719         o_conv.is_owned = ptr_is_owned(o);
22720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22721         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
22722         
22723         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22724         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22725         return tag_ptr(ret_conv, true);
22726 }
22727
22728 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(int32_t e) {
22729         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22730         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22731         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22732         return tag_ptr(ret_conv, true);
22733 }
22734
22735 jboolean  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
22736         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22737         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22738         return ret_conv;
22739 }
22740
22741 void  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(int64_t _res) {
22742         if (!ptr_is_owned(_res)) return;
22743         void* _res_ptr = untag_ptr(_res);
22744         CHECK_ACCESS(_res_ptr);
22745         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22746         FREE(untag_ptr(_res));
22747         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22748 }
22749
22750 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_ok(int64_t o) {
22751         LDKOffer o_conv;
22752         o_conv.inner = untag_ptr(o);
22753         o_conv.is_owned = ptr_is_owned(o);
22754         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22755         o_conv = Offer_clone(&o_conv);
22756         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22757         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22758         return tag_ptr(ret_conv, true);
22759 }
22760
22761 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_err(int64_t e) {
22762         LDKBolt12ParseError e_conv;
22763         e_conv.inner = untag_ptr(e);
22764         e_conv.is_owned = ptr_is_owned(e);
22765         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22766         e_conv = Bolt12ParseError_clone(&e_conv);
22767         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22768         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22769         return tag_ptr(ret_conv, true);
22770 }
22771
22772 jboolean  CS_LDK_CResult_OfferBolt12ParseErrorZ_is_ok(int64_t o) {
22773         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22774         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22775         return ret_conv;
22776 }
22777
22778 void  CS_LDK_CResult_OfferBolt12ParseErrorZ_free(int64_t _res) {
22779         if (!ptr_is_owned(_res)) return;
22780         void* _res_ptr = untag_ptr(_res);
22781         CHECK_ACCESS(_res_ptr);
22782         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22783         FREE(untag_ptr(_res));
22784         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22785 }
22786
22787 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22788         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22789         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22790         return tag_ptr(ret_conv, true);
22791 }
22792 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone_ptr(int64_t arg) {
22793         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22794         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22795         return ret_conv;
22796 }
22797
22798 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone(int64_t orig) {
22799         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22800         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22801         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22802         return tag_ptr(ret_conv, true);
22803 }
22804
22805 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_ok(int64_t o) {
22806         LDKNodeId o_conv;
22807         o_conv.inner = untag_ptr(o);
22808         o_conv.is_owned = ptr_is_owned(o);
22809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22810         o_conv = NodeId_clone(&o_conv);
22811         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22812         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22813         return tag_ptr(ret_conv, true);
22814 }
22815
22816 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_err(int64_t e) {
22817         void* e_ptr = untag_ptr(e);
22818         CHECK_ACCESS(e_ptr);
22819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22821         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22822         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22823         return tag_ptr(ret_conv, true);
22824 }
22825
22826 jboolean  CS_LDK_CResult_NodeIdDecodeErrorZ_is_ok(int64_t o) {
22827         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22828         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22829         return ret_conv;
22830 }
22831
22832 void  CS_LDK_CResult_NodeIdDecodeErrorZ_free(int64_t _res) {
22833         if (!ptr_is_owned(_res)) return;
22834         void* _res_ptr = untag_ptr(_res);
22835         CHECK_ACCESS(_res_ptr);
22836         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22837         FREE(untag_ptr(_res));
22838         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22839 }
22840
22841 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22842         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22843         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22844         return tag_ptr(ret_conv, true);
22845 }
22846 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone_ptr(int64_t arg) {
22847         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22848         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22849         return ret_conv;
22850 }
22851
22852 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone(int64_t orig) {
22853         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22854         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22855         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22856         return tag_ptr(ret_conv, true);
22857 }
22858
22859 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
22860         LDKPublicKey o_ref;
22861         CHECK(o->arr_len == 33);
22862         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
22863         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22864         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
22865         return tag_ptr(ret_conv, true);
22866 }
22867
22868 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_err(int32_t e) {
22869         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
22870         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22871         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
22872         return tag_ptr(ret_conv, true);
22873 }
22874
22875 jboolean  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_is_ok(int64_t o) {
22876         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
22877         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
22878         return ret_conv;
22879 }
22880
22881 void  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_free(int64_t _res) {
22882         if (!ptr_is_owned(_res)) return;
22883         void* _res_ptr = untag_ptr(_res);
22884         CHECK_ACCESS(_res_ptr);
22885         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
22886         FREE(untag_ptr(_res));
22887         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
22888 }
22889
22890 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
22891         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22892         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
22893         return tag_ptr(ret_conv, true);
22894 }
22895 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
22896         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
22897         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
22898         return ret_conv;
22899 }
22900
22901 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone(int64_t orig) {
22902         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
22903         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
22904         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
22905         return tag_ptr(ret_conv, true);
22906 }
22907
22908 int64_t  CS_LDK_COption_NetworkUpdateZ_some(int64_t o) {
22909         void* o_ptr = untag_ptr(o);
22910         CHECK_ACCESS(o_ptr);
22911         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22912         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22913         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22914         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22915         int64_t ret_ref = tag_ptr(ret_copy, true);
22916         return ret_ref;
22917 }
22918
22919 int64_t  CS_LDK_COption_NetworkUpdateZ_none() {
22920         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22921         *ret_copy = COption_NetworkUpdateZ_none();
22922         int64_t ret_ref = tag_ptr(ret_copy, true);
22923         return ret_ref;
22924 }
22925
22926 void  CS_LDK_COption_NetworkUpdateZ_free(int64_t _res) {
22927         if (!ptr_is_owned(_res)) return;
22928         void* _res_ptr = untag_ptr(_res);
22929         CHECK_ACCESS(_res_ptr);
22930         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22931         FREE(untag_ptr(_res));
22932         COption_NetworkUpdateZ_free(_res_conv);
22933 }
22934
22935 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22936         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22937         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22938         int64_t ret_ref = tag_ptr(ret_copy, true);
22939         return ret_ref;
22940 }
22941 int64_t  CS_LDK_COption_NetworkUpdateZ_clone_ptr(int64_t arg) {
22942         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22943         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22944         return ret_conv;
22945 }
22946
22947 int64_t  CS_LDK_COption_NetworkUpdateZ_clone(int64_t orig) {
22948         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22949         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22950         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22951         int64_t ret_ref = tag_ptr(ret_copy, true);
22952         return ret_ref;
22953 }
22954
22955 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(int64_t o) {
22956         void* o_ptr = untag_ptr(o);
22957         CHECK_ACCESS(o_ptr);
22958         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22959         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22960         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22961         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22962         return tag_ptr(ret_conv, true);
22963 }
22964
22965 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_err(int64_t e) {
22966         void* e_ptr = untag_ptr(e);
22967         CHECK_ACCESS(e_ptr);
22968         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22969         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22970         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22971         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22972         return tag_ptr(ret_conv, true);
22973 }
22974
22975 jboolean  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(int64_t o) {
22976         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22977         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22978         return ret_conv;
22979 }
22980
22981 void  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_free(int64_t _res) {
22982         if (!ptr_is_owned(_res)) return;
22983         void* _res_ptr = untag_ptr(_res);
22984         CHECK_ACCESS(_res_ptr);
22985         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22986         FREE(untag_ptr(_res));
22987         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22988 }
22989
22990 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22991         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22992         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22993         return tag_ptr(ret_conv, true);
22994 }
22995 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(int64_t arg) {
22996         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
22997         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
22998         return ret_conv;
22999 }
23000
23001 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(int64_t orig) {
23002         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
23003         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23004         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
23005         return tag_ptr(ret_conv, true);
23006 }
23007
23008 int64_t  CS_LDK_COption_UtxoLookupZ_some(int64_t o) {
23009         void* o_ptr = untag_ptr(o);
23010         CHECK_ACCESS(o_ptr);
23011         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
23012         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
23013                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23014                 LDKUtxoLookup_JCalls_cloned(&o_conv);
23015         }
23016         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23017         *ret_copy = COption_UtxoLookupZ_some(o_conv);
23018         int64_t ret_ref = tag_ptr(ret_copy, true);
23019         return ret_ref;
23020 }
23021
23022 int64_t  CS_LDK_COption_UtxoLookupZ_none() {
23023         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23024         *ret_copy = COption_UtxoLookupZ_none();
23025         int64_t ret_ref = tag_ptr(ret_copy, true);
23026         return ret_ref;
23027 }
23028
23029 void  CS_LDK_COption_UtxoLookupZ_free(int64_t _res) {
23030         if (!ptr_is_owned(_res)) return;
23031         void* _res_ptr = untag_ptr(_res);
23032         CHECK_ACCESS(_res_ptr);
23033         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
23034         FREE(untag_ptr(_res));
23035         COption_UtxoLookupZ_free(_res_conv);
23036 }
23037
23038 int64_t  CS_LDK_CResult_NoneLightningErrorZ_ok() {
23039         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23040         *ret_conv = CResult_NoneLightningErrorZ_ok();
23041         return tag_ptr(ret_conv, true);
23042 }
23043
23044 int64_t  CS_LDK_CResult_NoneLightningErrorZ_err(int64_t e) {
23045         LDKLightningError e_conv;
23046         e_conv.inner = untag_ptr(e);
23047         e_conv.is_owned = ptr_is_owned(e);
23048         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23049         e_conv = LightningError_clone(&e_conv);
23050         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23051         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
23052         return tag_ptr(ret_conv, true);
23053 }
23054
23055 jboolean  CS_LDK_CResult_NoneLightningErrorZ_is_ok(int64_t o) {
23056         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
23057         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
23058         return ret_conv;
23059 }
23060
23061 void  CS_LDK_CResult_NoneLightningErrorZ_free(int64_t _res) {
23062         if (!ptr_is_owned(_res)) return;
23063         void* _res_ptr = untag_ptr(_res);
23064         CHECK_ACCESS(_res_ptr);
23065         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
23066         FREE(untag_ptr(_res));
23067         CResult_NoneLightningErrorZ_free(_res_conv);
23068 }
23069
23070 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
23071         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23072         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
23073         return tag_ptr(ret_conv, true);
23074 }
23075 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone_ptr(int64_t arg) {
23076         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
23077         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
23078         return ret_conv;
23079 }
23080
23081 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone(int64_t orig) {
23082         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
23083         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23084         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
23085         return tag_ptr(ret_conv, true);
23086 }
23087
23088 int64_t  CS_LDK_CResult_boolLightningErrorZ_ok(jboolean o) {
23089         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23090         *ret_conv = CResult_boolLightningErrorZ_ok(o);
23091         return tag_ptr(ret_conv, true);
23092 }
23093
23094 int64_t  CS_LDK_CResult_boolLightningErrorZ_err(int64_t e) {
23095         LDKLightningError e_conv;
23096         e_conv.inner = untag_ptr(e);
23097         e_conv.is_owned = ptr_is_owned(e);
23098         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23099         e_conv = LightningError_clone(&e_conv);
23100         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23101         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
23102         return tag_ptr(ret_conv, true);
23103 }
23104
23105 jboolean  CS_LDK_CResult_boolLightningErrorZ_is_ok(int64_t o) {
23106         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
23107         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
23108         return ret_conv;
23109 }
23110
23111 void  CS_LDK_CResult_boolLightningErrorZ_free(int64_t _res) {
23112         if (!ptr_is_owned(_res)) return;
23113         void* _res_ptr = untag_ptr(_res);
23114         CHECK_ACCESS(_res_ptr);
23115         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
23116         FREE(untag_ptr(_res));
23117         CResult_boolLightningErrorZ_free(_res_conv);
23118 }
23119
23120 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
23121         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23122         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
23123         return tag_ptr(ret_conv, true);
23124 }
23125 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone_ptr(int64_t arg) {
23126         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
23127         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
23128         return ret_conv;
23129 }
23130
23131 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone(int64_t orig) {
23132         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
23133         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23134         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
23135         return tag_ptr(ret_conv, true);
23136 }
23137
23138 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
23139         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23140         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
23141         return tag_ptr(ret_conv, true);
23142 }
23143 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(int64_t arg) {
23144         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
23145         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
23146         return ret_conv;
23147 }
23148
23149 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(int64_t orig) {
23150         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
23151         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23152         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
23153         return tag_ptr(ret_conv, true);
23154 }
23155
23156 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(int64_t a, int64_t b, int64_t c) {
23157         LDKChannelAnnouncement a_conv;
23158         a_conv.inner = untag_ptr(a);
23159         a_conv.is_owned = ptr_is_owned(a);
23160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23161         a_conv = ChannelAnnouncement_clone(&a_conv);
23162         LDKChannelUpdate b_conv;
23163         b_conv.inner = untag_ptr(b);
23164         b_conv.is_owned = ptr_is_owned(b);
23165         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23166         b_conv = ChannelUpdate_clone(&b_conv);
23167         LDKChannelUpdate c_conv;
23168         c_conv.inner = untag_ptr(c);
23169         c_conv.is_owned = ptr_is_owned(c);
23170         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23171         c_conv = ChannelUpdate_clone(&c_conv);
23172         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23173         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
23174         return tag_ptr(ret_conv, true);
23175 }
23176
23177 void  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(int64_t _res) {
23178         if (!ptr_is_owned(_res)) return;
23179         void* _res_ptr = untag_ptr(_res);
23180         CHECK_ACCESS(_res_ptr);
23181         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
23182         FREE(untag_ptr(_res));
23183         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
23184 }
23185
23186 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(int64_t o) {
23187         void* o_ptr = untag_ptr(o);
23188         CHECK_ACCESS(o_ptr);
23189         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
23190         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
23191         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23192         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
23193         int64_t ret_ref = tag_ptr(ret_copy, true);
23194         return ret_ref;
23195 }
23196
23197 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
23198         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23199         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
23200         int64_t ret_ref = tag_ptr(ret_copy, true);
23201         return ret_ref;
23202 }
23203
23204 void  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(int64_t _res) {
23205         if (!ptr_is_owned(_res)) return;
23206         void* _res_ptr = untag_ptr(_res);
23207         CHECK_ACCESS(_res_ptr);
23208         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
23209         FREE(untag_ptr(_res));
23210         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
23211 }
23212
23213 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
23214         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23215         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
23216         int64_t ret_ref = tag_ptr(ret_copy, true);
23217         return ret_ref;
23218 }
23219 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(int64_t arg) {
23220         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
23221         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
23222         return ret_conv;
23223 }
23224
23225 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(int64_t orig) {
23226         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
23227         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23228         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
23229         int64_t ret_ref = tag_ptr(ret_copy, true);
23230         return ret_ref;
23231 }
23232
23233 void  CS_LDK_CVec_MessageSendEventZ_free(int64_tArray _res) {
23234         LDKCVec_MessageSendEventZ _res_constr;
23235         _res_constr.datalen = _res->arr_len;
23236         if (_res_constr.datalen > 0)
23237                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
23238         else
23239                 _res_constr.data = NULL;
23240         int64_t* _res_vals = _res->elems;
23241         for (size_t s = 0; s < _res_constr.datalen; s++) {
23242                 int64_t _res_conv_18 = _res_vals[s];
23243                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
23244                 CHECK_ACCESS(_res_conv_18_ptr);
23245                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
23246                 FREE(untag_ptr(_res_conv_18));
23247                 _res_constr.data[s] = _res_conv_18_conv;
23248         }
23249         FREE(_res);
23250         CVec_MessageSendEventZ_free(_res_constr);
23251 }
23252
23253 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_ok(int64_t o) {
23254         LDKChannelUpdateInfo o_conv;
23255         o_conv.inner = untag_ptr(o);
23256         o_conv.is_owned = ptr_is_owned(o);
23257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23258         o_conv = ChannelUpdateInfo_clone(&o_conv);
23259         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23260         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
23261         return tag_ptr(ret_conv, true);
23262 }
23263
23264 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_err(int64_t e) {
23265         void* e_ptr = untag_ptr(e);
23266         CHECK_ACCESS(e_ptr);
23267         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23268         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23269         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23270         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
23271         return tag_ptr(ret_conv, true);
23272 }
23273
23274 jboolean  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(int64_t o) {
23275         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
23276         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
23277         return ret_conv;
23278 }
23279
23280 void  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_free(int64_t _res) {
23281         if (!ptr_is_owned(_res)) return;
23282         void* _res_ptr = untag_ptr(_res);
23283         CHECK_ACCESS(_res_ptr);
23284         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
23285         FREE(untag_ptr(_res));
23286         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
23287 }
23288
23289 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
23290         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23291         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
23292         return tag_ptr(ret_conv, true);
23293 }
23294 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23295         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
23296         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
23297         return ret_conv;
23298 }
23299
23300 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone(int64_t orig) {
23301         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
23302         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23303         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
23304         return tag_ptr(ret_conv, true);
23305 }
23306
23307 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_ok(int64_t o) {
23308         LDKChannelInfo o_conv;
23309         o_conv.inner = untag_ptr(o);
23310         o_conv.is_owned = ptr_is_owned(o);
23311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23312         o_conv = ChannelInfo_clone(&o_conv);
23313         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23314         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
23315         return tag_ptr(ret_conv, true);
23316 }
23317
23318 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_err(int64_t e) {
23319         void* e_ptr = untag_ptr(e);
23320         CHECK_ACCESS(e_ptr);
23321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23323         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23324         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23325         return tag_ptr(ret_conv, true);
23326 }
23327
23328 jboolean  CS_LDK_CResult_ChannelInfoDecodeErrorZ_is_ok(int64_t o) {
23329         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23330         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23331         return ret_conv;
23332 }
23333
23334 void  CS_LDK_CResult_ChannelInfoDecodeErrorZ_free(int64_t _res) {
23335         if (!ptr_is_owned(_res)) return;
23336         void* _res_ptr = untag_ptr(_res);
23337         CHECK_ACCESS(_res_ptr);
23338         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23339         FREE(untag_ptr(_res));
23340         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23341 }
23342
23343 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23344         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23345         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23346         return tag_ptr(ret_conv, true);
23347 }
23348 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23349         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23350         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23351         return ret_conv;
23352 }
23353
23354 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone(int64_t orig) {
23355         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23356         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23357         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23358         return tag_ptr(ret_conv, true);
23359 }
23360
23361 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_ok(int64_t o) {
23362         LDKRoutingFees o_conv;
23363         o_conv.inner = untag_ptr(o);
23364         o_conv.is_owned = ptr_is_owned(o);
23365         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23366         o_conv = RoutingFees_clone(&o_conv);
23367         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23368         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23369         return tag_ptr(ret_conv, true);
23370 }
23371
23372 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_err(int64_t e) {
23373         void* e_ptr = untag_ptr(e);
23374         CHECK_ACCESS(e_ptr);
23375         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23376         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23377         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23378         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23379         return tag_ptr(ret_conv, true);
23380 }
23381
23382 jboolean  CS_LDK_CResult_RoutingFeesDecodeErrorZ_is_ok(int64_t o) {
23383         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23384         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23385         return ret_conv;
23386 }
23387
23388 void  CS_LDK_CResult_RoutingFeesDecodeErrorZ_free(int64_t _res) {
23389         if (!ptr_is_owned(_res)) return;
23390         void* _res_ptr = untag_ptr(_res);
23391         CHECK_ACCESS(_res_ptr);
23392         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23393         FREE(untag_ptr(_res));
23394         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23395 }
23396
23397 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23398         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23399         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23400         return tag_ptr(ret_conv, true);
23401 }
23402 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone_ptr(int64_t arg) {
23403         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23404         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23405         return ret_conv;
23406 }
23407
23408 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone(int64_t orig) {
23409         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23410         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23411         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23412         return tag_ptr(ret_conv, true);
23413 }
23414
23415 void  CS_LDK_CVec_SocketAddressZ_free(int64_tArray _res) {
23416         LDKCVec_SocketAddressZ _res_constr;
23417         _res_constr.datalen = _res->arr_len;
23418         if (_res_constr.datalen > 0)
23419                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23420         else
23421                 _res_constr.data = NULL;
23422         int64_t* _res_vals = _res->elems;
23423         for (size_t p = 0; p < _res_constr.datalen; p++) {
23424                 int64_t _res_conv_15 = _res_vals[p];
23425                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
23426                 CHECK_ACCESS(_res_conv_15_ptr);
23427                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
23428                 FREE(untag_ptr(_res_conv_15));
23429                 _res_constr.data[p] = _res_conv_15_conv;
23430         }
23431         FREE(_res);
23432         CVec_SocketAddressZ_free(_res_constr);
23433 }
23434
23435 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(int64_t o) {
23436         LDKNodeAnnouncementInfo o_conv;
23437         o_conv.inner = untag_ptr(o);
23438         o_conv.is_owned = ptr_is_owned(o);
23439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23440         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23441         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23442         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23443         return tag_ptr(ret_conv, true);
23444 }
23445
23446 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_err(int64_t e) {
23447         void* e_ptr = untag_ptr(e);
23448         CHECK_ACCESS(e_ptr);
23449         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23450         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23451         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23452         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23453         return tag_ptr(ret_conv, true);
23454 }
23455
23456 jboolean  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(int64_t o) {
23457         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23458         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23459         return ret_conv;
23460 }
23461
23462 void  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_free(int64_t _res) {
23463         if (!ptr_is_owned(_res)) return;
23464         void* _res_ptr = untag_ptr(_res);
23465         CHECK_ACCESS(_res_ptr);
23466         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23467         FREE(untag_ptr(_res));
23468         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23469 }
23470
23471 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23472         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23473         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23474         return tag_ptr(ret_conv, true);
23475 }
23476 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23477         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23478         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23479         return ret_conv;
23480 }
23481
23482 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(int64_t orig) {
23483         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23484         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23485         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23486         return tag_ptr(ret_conv, true);
23487 }
23488
23489 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_ok(int64_t o) {
23490         LDKNodeAlias o_conv;
23491         o_conv.inner = untag_ptr(o);
23492         o_conv.is_owned = ptr_is_owned(o);
23493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23494         o_conv = NodeAlias_clone(&o_conv);
23495         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23496         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23497         return tag_ptr(ret_conv, true);
23498 }
23499
23500 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_err(int64_t e) {
23501         void* e_ptr = untag_ptr(e);
23502         CHECK_ACCESS(e_ptr);
23503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23505         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23506         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23507         return tag_ptr(ret_conv, true);
23508 }
23509
23510 jboolean  CS_LDK_CResult_NodeAliasDecodeErrorZ_is_ok(int64_t o) {
23511         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23512         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23513         return ret_conv;
23514 }
23515
23516 void  CS_LDK_CResult_NodeAliasDecodeErrorZ_free(int64_t _res) {
23517         if (!ptr_is_owned(_res)) return;
23518         void* _res_ptr = untag_ptr(_res);
23519         CHECK_ACCESS(_res_ptr);
23520         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23521         FREE(untag_ptr(_res));
23522         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23523 }
23524
23525 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23526         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23527         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23528         return tag_ptr(ret_conv, true);
23529 }
23530 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone_ptr(int64_t arg) {
23531         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23532         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23533         return ret_conv;
23534 }
23535
23536 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone(int64_t orig) {
23537         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23538         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23539         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23540         return tag_ptr(ret_conv, true);
23541 }
23542
23543 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_ok(int64_t o) {
23544         LDKNodeInfo o_conv;
23545         o_conv.inner = untag_ptr(o);
23546         o_conv.is_owned = ptr_is_owned(o);
23547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23548         o_conv = NodeInfo_clone(&o_conv);
23549         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23550         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23551         return tag_ptr(ret_conv, true);
23552 }
23553
23554 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_err(int64_t e) {
23555         void* e_ptr = untag_ptr(e);
23556         CHECK_ACCESS(e_ptr);
23557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23559         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23560         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23561         return tag_ptr(ret_conv, true);
23562 }
23563
23564 jboolean  CS_LDK_CResult_NodeInfoDecodeErrorZ_is_ok(int64_t o) {
23565         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23566         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23567         return ret_conv;
23568 }
23569
23570 void  CS_LDK_CResult_NodeInfoDecodeErrorZ_free(int64_t _res) {
23571         if (!ptr_is_owned(_res)) return;
23572         void* _res_ptr = untag_ptr(_res);
23573         CHECK_ACCESS(_res_ptr);
23574         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23575         FREE(untag_ptr(_res));
23576         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23577 }
23578
23579 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23580         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23581         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23582         return tag_ptr(ret_conv, true);
23583 }
23584 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23585         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23586         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23587         return ret_conv;
23588 }
23589
23590 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone(int64_t orig) {
23591         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23592         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23593         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23594         return tag_ptr(ret_conv, true);
23595 }
23596
23597 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_ok(int64_t o) {
23598         LDKNetworkGraph o_conv;
23599         o_conv.inner = untag_ptr(o);
23600         o_conv.is_owned = ptr_is_owned(o);
23601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23602         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23603         
23604         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23605         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23606         return tag_ptr(ret_conv, true);
23607 }
23608
23609 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_err(int64_t e) {
23610         void* e_ptr = untag_ptr(e);
23611         CHECK_ACCESS(e_ptr);
23612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23614         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23615         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23616         return tag_ptr(ret_conv, true);
23617 }
23618
23619 jboolean  CS_LDK_CResult_NetworkGraphDecodeErrorZ_is_ok(int64_t o) {
23620         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23621         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23622         return ret_conv;
23623 }
23624
23625 void  CS_LDK_CResult_NetworkGraphDecodeErrorZ_free(int64_t _res) {
23626         if (!ptr_is_owned(_res)) return;
23627         void* _res_ptr = untag_ptr(_res);
23628         CHECK_ACCESS(_res_ptr);
23629         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23630         FREE(untag_ptr(_res));
23631         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23632 }
23633
23634 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_some(int64_tArray o) {
23635         LDKCVec_SocketAddressZ o_constr;
23636         o_constr.datalen = o->arr_len;
23637         if (o_constr.datalen > 0)
23638                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23639         else
23640                 o_constr.data = NULL;
23641         int64_t* o_vals = o->elems;
23642         for (size_t p = 0; p < o_constr.datalen; p++) {
23643                 int64_t o_conv_15 = o_vals[p];
23644                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
23645                 CHECK_ACCESS(o_conv_15_ptr);
23646                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
23647                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
23648                 o_constr.data[p] = o_conv_15_conv;
23649         }
23650         FREE(o);
23651         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23652         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
23653         int64_t ret_ref = tag_ptr(ret_copy, true);
23654         return ret_ref;
23655 }
23656
23657 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_none() {
23658         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23659         *ret_copy = COption_CVec_SocketAddressZZ_none();
23660         int64_t ret_ref = tag_ptr(ret_copy, true);
23661         return ret_ref;
23662 }
23663
23664 void  CS_LDK_COption_CVec_SocketAddressZZ_free(int64_t _res) {
23665         if (!ptr_is_owned(_res)) return;
23666         void* _res_ptr = untag_ptr(_res);
23667         CHECK_ACCESS(_res_ptr);
23668         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
23669         FREE(untag_ptr(_res));
23670         COption_CVec_SocketAddressZZ_free(_res_conv);
23671 }
23672
23673 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
23674         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23675         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
23676         int64_t ret_ref = tag_ptr(ret_copy, true);
23677         return ret_ref;
23678 }
23679 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone_ptr(int64_t arg) {
23680         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
23681         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
23682         return ret_conv;
23683 }
23684
23685 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone(int64_t orig) {
23686         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
23687         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23688         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
23689         int64_t ret_ref = tag_ptr(ret_copy, true);
23690         return ret_ref;
23691 }
23692
23693 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_ok(int64_t o) {
23694         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23695         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
23696         return tag_ptr(ret_conv, true);
23697 }
23698
23699 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_err(int32_t e) {
23700         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_cs(e);
23701         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23702         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
23703         return tag_ptr(ret_conv, true);
23704 }
23705
23706 jboolean  CS_LDK_CResult_u64ShortChannelIdErrorZ_is_ok(int64_t o) {
23707         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
23708         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
23709         return ret_conv;
23710 }
23711
23712 void  CS_LDK_CResult_u64ShortChannelIdErrorZ_free(int64_t _res) {
23713         if (!ptr_is_owned(_res)) return;
23714         void* _res_ptr = untag_ptr(_res);
23715         CHECK_ACCESS(_res_ptr);
23716         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
23717         FREE(untag_ptr(_res));
23718         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
23719 }
23720
23721 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(int64_t o) {
23722         LDKPendingHTLCInfo o_conv;
23723         o_conv.inner = untag_ptr(o);
23724         o_conv.is_owned = ptr_is_owned(o);
23725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23726         o_conv = PendingHTLCInfo_clone(&o_conv);
23727         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23728         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
23729         return tag_ptr(ret_conv, true);
23730 }
23731
23732 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_err(int64_t e) {
23733         LDKInboundHTLCErr e_conv;
23734         e_conv.inner = untag_ptr(e);
23735         e_conv.is_owned = ptr_is_owned(e);
23736         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23737         e_conv = InboundHTLCErr_clone(&e_conv);
23738         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23739         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
23740         return tag_ptr(ret_conv, true);
23741 }
23742
23743 jboolean  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(int64_t o) {
23744         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
23745         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
23746         return ret_conv;
23747 }
23748
23749 void  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_free(int64_t _res) {
23750         if (!ptr_is_owned(_res)) return;
23751         void* _res_ptr = untag_ptr(_res);
23752         CHECK_ACCESS(_res_ptr);
23753         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
23754         FREE(untag_ptr(_res));
23755         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
23756 }
23757
23758 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
23759         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23760         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
23761         return tag_ptr(ret_conv, true);
23762 }
23763 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(int64_t arg) {
23764         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
23765         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
23766         return ret_conv;
23767 }
23768
23769 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_clone(int64_t orig) {
23770         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
23771         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23772         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
23773         return tag_ptr(ret_conv, true);
23774 }
23775
23776 void  CS_LDK_CVec_HTLCOutputInCommitmentZ_free(int64_tArray _res) {
23777         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23778         _res_constr.datalen = _res->arr_len;
23779         if (_res_constr.datalen > 0)
23780                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23781         else
23782                 _res_constr.data = NULL;
23783         int64_t* _res_vals = _res->elems;
23784         for (size_t y = 0; y < _res_constr.datalen; y++) {
23785                 int64_t _res_conv_24 = _res_vals[y];
23786                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23787                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23788                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23790                 _res_constr.data[y] = _res_conv_24_conv;
23791         }
23792         FREE(_res);
23793         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23794 }
23795
23796 void  CS_LDK_CVec_HTLCDescriptorZ_free(int64_tArray _res) {
23797         LDKCVec_HTLCDescriptorZ _res_constr;
23798         _res_constr.datalen = _res->arr_len;
23799         if (_res_constr.datalen > 0)
23800                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23801         else
23802                 _res_constr.data = NULL;
23803         int64_t* _res_vals = _res->elems;
23804         for (size_t q = 0; q < _res_constr.datalen; q++) {
23805                 int64_t _res_conv_16 = _res_vals[q];
23806                 LDKHTLCDescriptor _res_conv_16_conv;
23807                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23808                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23809                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23810                 _res_constr.data[q] = _res_conv_16_conv;
23811         }
23812         FREE(_res);
23813         CVec_HTLCDescriptorZ_free(_res_constr);
23814 }
23815
23816 void  CS_LDK_CVec_UtxoZ_free(int64_tArray _res) {
23817         LDKCVec_UtxoZ _res_constr;
23818         _res_constr.datalen = _res->arr_len;
23819         if (_res_constr.datalen > 0)
23820                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23821         else
23822                 _res_constr.data = NULL;
23823         int64_t* _res_vals = _res->elems;
23824         for (size_t g = 0; g < _res_constr.datalen; g++) {
23825                 int64_t _res_conv_6 = _res_vals[g];
23826                 LDKUtxo _res_conv_6_conv;
23827                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23828                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23829                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23830                 _res_constr.data[g] = _res_conv_6_conv;
23831         }
23832         FREE(_res);
23833         CVec_UtxoZ_free(_res_constr);
23834 }
23835
23836 int64_t  CS_LDK_COption_TxOutZ_some(int64_t o) {
23837         void* o_ptr = untag_ptr(o);
23838         CHECK_ACCESS(o_ptr);
23839         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23840         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23841         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23842         *ret_copy = COption_TxOutZ_some(o_conv);
23843         int64_t ret_ref = tag_ptr(ret_copy, true);
23844         return ret_ref;
23845 }
23846
23847 int64_t  CS_LDK_COption_TxOutZ_none() {
23848         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23849         *ret_copy = COption_TxOutZ_none();
23850         int64_t ret_ref = tag_ptr(ret_copy, true);
23851         return ret_ref;
23852 }
23853
23854 void  CS_LDK_COption_TxOutZ_free(int64_t _res) {
23855         if (!ptr_is_owned(_res)) return;
23856         void* _res_ptr = untag_ptr(_res);
23857         CHECK_ACCESS(_res_ptr);
23858         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23859         FREE(untag_ptr(_res));
23860         COption_TxOutZ_free(_res_conv);
23861 }
23862
23863 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23864         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23865         *ret_copy = COption_TxOutZ_clone(arg);
23866         int64_t ret_ref = tag_ptr(ret_copy, true);
23867         return ret_ref;
23868 }
23869 int64_t  CS_LDK_COption_TxOutZ_clone_ptr(int64_t arg) {
23870         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23871         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23872         return ret_conv;
23873 }
23874
23875 int64_t  CS_LDK_COption_TxOutZ_clone(int64_t orig) {
23876         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23877         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23878         *ret_copy = COption_TxOutZ_clone(orig_conv);
23879         int64_t ret_ref = tag_ptr(ret_copy, true);
23880         return ret_ref;
23881 }
23882
23883 void  CS_LDK_CVec_InputZ_free(int64_tArray _res) {
23884         LDKCVec_InputZ _res_constr;
23885         _res_constr.datalen = _res->arr_len;
23886         if (_res_constr.datalen > 0)
23887                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23888         else
23889                 _res_constr.data = NULL;
23890         int64_t* _res_vals = _res->elems;
23891         for (size_t h = 0; h < _res_constr.datalen; h++) {
23892                 int64_t _res_conv_7 = _res_vals[h];
23893                 LDKInput _res_conv_7_conv;
23894                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23895                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23897                 _res_constr.data[h] = _res_conv_7_conv;
23898         }
23899         FREE(_res);
23900         CVec_InputZ_free(_res_constr);
23901 }
23902
23903 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_ok(int64_t o) {
23904         LDKCoinSelection o_conv;
23905         o_conv.inner = untag_ptr(o);
23906         o_conv.is_owned = ptr_is_owned(o);
23907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23908         o_conv = CoinSelection_clone(&o_conv);
23909         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23910         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23911         return tag_ptr(ret_conv, true);
23912 }
23913
23914 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_err() {
23915         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23916         *ret_conv = CResult_CoinSelectionNoneZ_err();
23917         return tag_ptr(ret_conv, true);
23918 }
23919
23920 jboolean  CS_LDK_CResult_CoinSelectionNoneZ_is_ok(int64_t o) {
23921         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23922         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23923         return ret_conv;
23924 }
23925
23926 void  CS_LDK_CResult_CoinSelectionNoneZ_free(int64_t _res) {
23927         if (!ptr_is_owned(_res)) return;
23928         void* _res_ptr = untag_ptr(_res);
23929         CHECK_ACCESS(_res_ptr);
23930         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23931         FREE(untag_ptr(_res));
23932         CResult_CoinSelectionNoneZ_free(_res_conv);
23933 }
23934
23935 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23936         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23937         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23938         return tag_ptr(ret_conv, true);
23939 }
23940 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone_ptr(int64_t arg) {
23941         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23942         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23943         return ret_conv;
23944 }
23945
23946 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone(int64_t orig) {
23947         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23948         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23949         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23950         return tag_ptr(ret_conv, true);
23951 }
23952
23953 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_ok(int64_tArray o) {
23954         LDKCVec_UtxoZ o_constr;
23955         o_constr.datalen = o->arr_len;
23956         if (o_constr.datalen > 0)
23957                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23958         else
23959                 o_constr.data = NULL;
23960         int64_t* o_vals = o->elems;
23961         for (size_t g = 0; g < o_constr.datalen; g++) {
23962                 int64_t o_conv_6 = o_vals[g];
23963                 LDKUtxo o_conv_6_conv;
23964                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23965                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23966                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23967                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23968                 o_constr.data[g] = o_conv_6_conv;
23969         }
23970         FREE(o);
23971         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23972         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23973         return tag_ptr(ret_conv, true);
23974 }
23975
23976 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_err() {
23977         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23978         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23979         return tag_ptr(ret_conv, true);
23980 }
23981
23982 jboolean  CS_LDK_CResult_CVec_UtxoZNoneZ_is_ok(int64_t o) {
23983         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23984         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23985         return ret_conv;
23986 }
23987
23988 void  CS_LDK_CResult_CVec_UtxoZNoneZ_free(int64_t _res) {
23989         if (!ptr_is_owned(_res)) return;
23990         void* _res_ptr = untag_ptr(_res);
23991         CHECK_ACCESS(_res_ptr);
23992         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23993         FREE(untag_ptr(_res));
23994         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23995 }
23996
23997 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23998         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23999         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
24000         return tag_ptr(ret_conv, true);
24001 }
24002 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone_ptr(int64_t arg) {
24003         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
24004         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
24005         return ret_conv;
24006 }
24007
24008 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone(int64_t orig) {
24009         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
24010         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
24011         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
24012         return tag_ptr(ret_conv, true);
24013 }
24014
24015 int64_t  CS_LDK_COption_PaymentContextZ_some(int64_t o) {
24016         void* o_ptr = untag_ptr(o);
24017         CHECK_ACCESS(o_ptr);
24018         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
24019         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
24020         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24021         *ret_copy = COption_PaymentContextZ_some(o_conv);
24022         int64_t ret_ref = tag_ptr(ret_copy, true);
24023         return ret_ref;
24024 }
24025
24026 int64_t  CS_LDK_COption_PaymentContextZ_none() {
24027         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24028         *ret_copy = COption_PaymentContextZ_none();
24029         int64_t ret_ref = tag_ptr(ret_copy, true);
24030         return ret_ref;
24031 }
24032
24033 void  CS_LDK_COption_PaymentContextZ_free(int64_t _res) {
24034         if (!ptr_is_owned(_res)) return;
24035         void* _res_ptr = untag_ptr(_res);
24036         CHECK_ACCESS(_res_ptr);
24037         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
24038         FREE(untag_ptr(_res));
24039         COption_PaymentContextZ_free(_res_conv);
24040 }
24041
24042 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
24043         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24044         *ret_copy = COption_PaymentContextZ_clone(arg);
24045         int64_t ret_ref = tag_ptr(ret_copy, true);
24046         return ret_ref;
24047 }
24048 int64_t  CS_LDK_COption_PaymentContextZ_clone_ptr(int64_t arg) {
24049         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
24050         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
24051         return ret_conv;
24052 }
24053
24054 int64_t  CS_LDK_COption_PaymentContextZ_clone(int64_t orig) {
24055         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
24056         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24057         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
24058         int64_t ret_ref = tag_ptr(ret_copy, true);
24059         return ret_ref;
24060 }
24061
24062 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
24063         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24064         *ret_conv = C2Tuple_u64u16Z_clone(arg);
24065         return tag_ptr(ret_conv, true);
24066 }
24067 int64_t  CS_LDK_C2Tuple_u64u16Z_clone_ptr(int64_t arg) {
24068         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
24069         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
24070         return ret_conv;
24071 }
24072
24073 int64_t  CS_LDK_C2Tuple_u64u16Z_clone(int64_t orig) {
24074         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
24075         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24076         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
24077         return tag_ptr(ret_conv, true);
24078 }
24079
24080 int64_t  CS_LDK_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
24081         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24082         *ret_conv = C2Tuple_u64u16Z_new(a, b);
24083         return tag_ptr(ret_conv, true);
24084 }
24085
24086 void  CS_LDK_C2Tuple_u64u16Z_free(int64_t _res) {
24087         if (!ptr_is_owned(_res)) return;
24088         void* _res_ptr = untag_ptr(_res);
24089         CHECK_ACCESS(_res_ptr);
24090         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
24091         FREE(untag_ptr(_res));
24092         C2Tuple_u64u16Z_free(_res_conv);
24093 }
24094
24095 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_some(int64_t o) {
24096         void* o_ptr = untag_ptr(o);
24097         CHECK_ACCESS(o_ptr);
24098         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
24099         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
24100         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24101         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
24102         int64_t ret_ref = tag_ptr(ret_copy, true);
24103         return ret_ref;
24104 }
24105
24106 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_none() {
24107         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24108         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
24109         int64_t ret_ref = tag_ptr(ret_copy, true);
24110         return ret_ref;
24111 }
24112
24113 void  CS_LDK_COption_C2Tuple_u64u16ZZ_free(int64_t _res) {
24114         if (!ptr_is_owned(_res)) return;
24115         void* _res_ptr = untag_ptr(_res);
24116         CHECK_ACCESS(_res_ptr);
24117         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
24118         FREE(untag_ptr(_res));
24119         COption_C2Tuple_u64u16ZZ_free(_res_conv);
24120 }
24121
24122 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
24123         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24124         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
24125         int64_t ret_ref = tag_ptr(ret_copy, true);
24126         return ret_ref;
24127 }
24128 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone_ptr(int64_t arg) {
24129         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
24130         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
24131         return ret_conv;
24132 }
24133
24134 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone(int64_t orig) {
24135         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
24136         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24137         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
24138         int64_t ret_ref = tag_ptr(ret_copy, true);
24139         return ret_ref;
24140 }
24141
24142 int64_t  CS_LDK_COption_ChannelShutdownStateZ_some(int32_t o) {
24143         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
24144         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24145         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
24146         int64_t ret_ref = tag_ptr(ret_copy, true);
24147         return ret_ref;
24148 }
24149
24150 int64_t  CS_LDK_COption_ChannelShutdownStateZ_none() {
24151         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24152         *ret_copy = COption_ChannelShutdownStateZ_none();
24153         int64_t ret_ref = tag_ptr(ret_copy, true);
24154         return ret_ref;
24155 }
24156
24157 void  CS_LDK_COption_ChannelShutdownStateZ_free(int64_t _res) {
24158         if (!ptr_is_owned(_res)) return;
24159         void* _res_ptr = untag_ptr(_res);
24160         CHECK_ACCESS(_res_ptr);
24161         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
24162         FREE(untag_ptr(_res));
24163         COption_ChannelShutdownStateZ_free(_res_conv);
24164 }
24165
24166 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
24167         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24168         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
24169         int64_t ret_ref = tag_ptr(ret_copy, true);
24170         return ret_ref;
24171 }
24172 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone_ptr(int64_t arg) {
24173         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
24174         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
24175         return ret_conv;
24176 }
24177
24178 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone(int64_t orig) {
24179         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
24180         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24181         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
24182         int64_t ret_ref = tag_ptr(ret_copy, true);
24183         return ret_ref;
24184 }
24185
24186 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_ok(int64_t o) {
24187         LDKChannelId o_conv;
24188         o_conv.inner = untag_ptr(o);
24189         o_conv.is_owned = ptr_is_owned(o);
24190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24191         o_conv = ChannelId_clone(&o_conv);
24192         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24193         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
24194         return tag_ptr(ret_conv, true);
24195 }
24196
24197 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_err(int64_t e) {
24198         void* e_ptr = untag_ptr(e);
24199         CHECK_ACCESS(e_ptr);
24200         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24201         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24202         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24203         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
24204         return tag_ptr(ret_conv, true);
24205 }
24206
24207 jboolean  CS_LDK_CResult_ChannelIdAPIErrorZ_is_ok(int64_t o) {
24208         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
24209         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
24210         return ret_conv;
24211 }
24212
24213 void  CS_LDK_CResult_ChannelIdAPIErrorZ_free(int64_t _res) {
24214         if (!ptr_is_owned(_res)) return;
24215         void* _res_ptr = untag_ptr(_res);
24216         CHECK_ACCESS(_res_ptr);
24217         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
24218         FREE(untag_ptr(_res));
24219         CResult_ChannelIdAPIErrorZ_free(_res_conv);
24220 }
24221
24222 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
24223         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24224         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
24225         return tag_ptr(ret_conv, true);
24226 }
24227 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_clone_ptr(int64_t arg) {
24228         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
24229         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
24230         return ret_conv;
24231 }
24232
24233 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_clone(int64_t orig) {
24234         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
24235         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24236         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
24237         return tag_ptr(ret_conv, true);
24238 }
24239
24240 void  CS_LDK_CVec_RecentPaymentDetailsZ_free(int64_tArray _res) {
24241         LDKCVec_RecentPaymentDetailsZ _res_constr;
24242         _res_constr.datalen = _res->arr_len;
24243         if (_res_constr.datalen > 0)
24244                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
24245         else
24246                 _res_constr.data = NULL;
24247         int64_t* _res_vals = _res->elems;
24248         for (size_t w = 0; w < _res_constr.datalen; w++) {
24249                 int64_t _res_conv_22 = _res_vals[w];
24250                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24251                 CHECK_ACCESS(_res_conv_22_ptr);
24252                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
24253                 FREE(untag_ptr(_res_conv_22));
24254                 _res_constr.data[w] = _res_conv_22_conv;
24255         }
24256         FREE(_res);
24257         CVec_RecentPaymentDetailsZ_free(_res_constr);
24258 }
24259
24260 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_ok() {
24261         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24262         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
24263         return tag_ptr(ret_conv, true);
24264 }
24265
24266 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_err(int64_t e) {
24267         void* e_ptr = untag_ptr(e);
24268         CHECK_ACCESS(e_ptr);
24269         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24270         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24271         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24272         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
24273         return tag_ptr(ret_conv, true);
24274 }
24275
24276 jboolean  CS_LDK_CResult_NonePaymentSendFailureZ_is_ok(int64_t o) {
24277         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
24278         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
24279         return ret_conv;
24280 }
24281
24282 void  CS_LDK_CResult_NonePaymentSendFailureZ_free(int64_t _res) {
24283         if (!ptr_is_owned(_res)) return;
24284         void* _res_ptr = untag_ptr(_res);
24285         CHECK_ACCESS(_res_ptr);
24286         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
24287         FREE(untag_ptr(_res));
24288         CResult_NonePaymentSendFailureZ_free(_res_conv);
24289 }
24290
24291 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
24292         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24293         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
24294         return tag_ptr(ret_conv, true);
24295 }
24296 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone_ptr(int64_t arg) {
24297         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
24298         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
24299         return ret_conv;
24300 }
24301
24302 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone(int64_t orig) {
24303         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
24304         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24305         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
24306         return tag_ptr(ret_conv, true);
24307 }
24308
24309 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_ok() {
24310         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24311         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
24312         return tag_ptr(ret_conv, true);
24313 }
24314
24315 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_err(int32_t e) {
24316         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
24317         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24318         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24319         return tag_ptr(ret_conv, true);
24320 }
24321
24322 jboolean  CS_LDK_CResult_NoneRetryableSendFailureZ_is_ok(int64_t o) {
24323         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24324         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24325         return ret_conv;
24326 }
24327
24328 void  CS_LDK_CResult_NoneRetryableSendFailureZ_free(int64_t _res) {
24329         if (!ptr_is_owned(_res)) return;
24330         void* _res_ptr = untag_ptr(_res);
24331         CHECK_ACCESS(_res_ptr);
24332         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24333         FREE(untag_ptr(_res));
24334         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24335 }
24336
24337 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24338         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24339         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24340         return tag_ptr(ret_conv, true);
24341 }
24342 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone_ptr(int64_t arg) {
24343         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24344         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24345         return ret_conv;
24346 }
24347
24348 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone(int64_t orig) {
24349         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24350         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24351         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24352         return tag_ptr(ret_conv, true);
24353 }
24354
24355 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
24356         LDKThirtyTwoBytes o_ref;
24357         CHECK(o->arr_len == 32);
24358         memcpy(o_ref.data, o->elems, 32); FREE(o);
24359         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24360         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
24361         return tag_ptr(ret_conv, true);
24362 }
24363
24364 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(int64_t e) {
24365         void* e_ptr = untag_ptr(e);
24366         CHECK_ACCESS(e_ptr);
24367         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24368         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24369         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24370         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
24371         return tag_ptr(ret_conv, true);
24372 }
24373
24374 jboolean  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(int64_t o) {
24375         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
24376         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
24377         return ret_conv;
24378 }
24379
24380 void  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(int64_t _res) {
24381         if (!ptr_is_owned(_res)) return;
24382         void* _res_ptr = untag_ptr(_res);
24383         CHECK_ACCESS(_res_ptr);
24384         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
24385         FREE(untag_ptr(_res));
24386         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
24387 }
24388
24389 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
24390         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24391         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
24392         return tag_ptr(ret_conv, true);
24393 }
24394 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(int64_t arg) {
24395         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
24396         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
24397         return ret_conv;
24398 }
24399
24400 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(int64_t orig) {
24401         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
24402         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24403         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
24404         return tag_ptr(ret_conv, true);
24405 }
24406
24407 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
24408         LDKThirtyTwoBytes o_ref;
24409         CHECK(o->arr_len == 32);
24410         memcpy(o_ref.data, o->elems, 32); FREE(o);
24411         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24412         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
24413         return tag_ptr(ret_conv, true);
24414 }
24415
24416 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(int32_t e) {
24417         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
24418         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24419         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
24420         return tag_ptr(ret_conv, true);
24421 }
24422
24423 jboolean  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(int64_t o) {
24424         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
24425         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
24426         return ret_conv;
24427 }
24428
24429 void  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(int64_t _res) {
24430         if (!ptr_is_owned(_res)) return;
24431         void* _res_ptr = untag_ptr(_res);
24432         CHECK_ACCESS(_res_ptr);
24433         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
24434         FREE(untag_ptr(_res));
24435         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
24436 }
24437
24438 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
24439         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24440         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
24441         return tag_ptr(ret_conv, true);
24442 }
24443 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(int64_t arg) {
24444         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
24445         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
24446         return ret_conv;
24447 }
24448
24449 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(int64_t orig) {
24450         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
24451         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24452         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
24453         return tag_ptr(ret_conv, true);
24454 }
24455
24456 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
24457         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24458         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
24459         return tag_ptr(ret_conv, true);
24460 }
24461 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(int64_t arg) {
24462         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
24463         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
24464         return ret_conv;
24465 }
24466
24467 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(int64_t orig) {
24468         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
24469         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24470         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
24471         return tag_ptr(ret_conv, true);
24472 }
24473
24474 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
24475         LDKThirtyTwoBytes a_ref;
24476         CHECK(a->arr_len == 32);
24477         memcpy(a_ref.data, a->elems, 32); FREE(a);
24478         LDKThirtyTwoBytes b_ref;
24479         CHECK(b->arr_len == 32);
24480         memcpy(b_ref.data, b->elems, 32); FREE(b);
24481         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24482         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
24483         return tag_ptr(ret_conv, true);
24484 }
24485
24486 void  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(int64_t _res) {
24487         if (!ptr_is_owned(_res)) return;
24488         void* _res_ptr = untag_ptr(_res);
24489         CHECK_ACCESS(_res_ptr);
24490         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
24491         FREE(untag_ptr(_res));
24492         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
24493 }
24494
24495 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(int64_t o) {
24496         void* o_ptr = untag_ptr(o);
24497         CHECK_ACCESS(o_ptr);
24498         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24499         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24500         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24501         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
24502         return tag_ptr(ret_conv, true);
24503 }
24504
24505 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(int64_t e) {
24506         void* e_ptr = untag_ptr(e);
24507         CHECK_ACCESS(e_ptr);
24508         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24509         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24510         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24511         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
24512         return tag_ptr(ret_conv, true);
24513 }
24514
24515 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(int64_t o) {
24516         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
24517         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
24518         return ret_conv;
24519 }
24520
24521 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(int64_t _res) {
24522         if (!ptr_is_owned(_res)) return;
24523         void* _res_ptr = untag_ptr(_res);
24524         CHECK_ACCESS(_res_ptr);
24525         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
24526         FREE(untag_ptr(_res));
24527         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
24528 }
24529
24530 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
24531         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24532         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
24533         return tag_ptr(ret_conv, true);
24534 }
24535 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(int64_t arg) {
24536         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
24537         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
24538         return ret_conv;
24539 }
24540
24541 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(int64_t orig) {
24542         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
24543         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24544         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
24545         return tag_ptr(ret_conv, true);
24546 }
24547
24548 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(int64_tArray _res) {
24549         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
24550         _res_constr.datalen = _res->arr_len;
24551         if (_res_constr.datalen > 0)
24552                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24553         else
24554                 _res_constr.data = NULL;
24555         int64_t* _res_vals = _res->elems;
24556         for (size_t o = 0; o < _res_constr.datalen; o++) {
24557                 int64_t _res_conv_40 = _res_vals[o];
24558                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24559                 CHECK_ACCESS(_res_conv_40_ptr);
24560                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
24561                 FREE(untag_ptr(_res_conv_40));
24562                 _res_constr.data[o] = _res_conv_40_conv;
24563         }
24564         FREE(_res);
24565         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
24566 }
24567
24568 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(int64_tArray o) {
24569         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
24570         o_constr.datalen = o->arr_len;
24571         if (o_constr.datalen > 0)
24572                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24573         else
24574                 o_constr.data = NULL;
24575         int64_t* o_vals = o->elems;
24576         for (size_t o = 0; o < o_constr.datalen; o++) {
24577                 int64_t o_conv_40 = o_vals[o];
24578                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24579                 CHECK_ACCESS(o_conv_40_ptr);
24580                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
24581                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
24582                 o_constr.data[o] = o_conv_40_conv;
24583         }
24584         FREE(o);
24585         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24586         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
24587         return tag_ptr(ret_conv, true);
24588 }
24589
24590 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(int64_t e) {
24591         void* e_ptr = untag_ptr(e);
24592         CHECK_ACCESS(e_ptr);
24593         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
24594         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
24595         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24596         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
24597         return tag_ptr(ret_conv, true);
24598 }
24599
24600 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(int64_t o) {
24601         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
24602         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
24603         return ret_conv;
24604 }
24605
24606 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(int64_t _res) {
24607         if (!ptr_is_owned(_res)) return;
24608         void* _res_ptr = untag_ptr(_res);
24609         CHECK_ACCESS(_res_ptr);
24610         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
24611         FREE(untag_ptr(_res));
24612         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
24613 }
24614
24615 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
24616         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24617         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
24618         return tag_ptr(ret_conv, true);
24619 }
24620 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(int64_t arg) {
24621         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
24622         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
24623         return ret_conv;
24624 }
24625
24626 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(int64_t orig) {
24627         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
24628         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24629         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
24630         return tag_ptr(ret_conv, true);
24631 }
24632
24633 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
24634         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24635         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
24636         return tag_ptr(ret_conv, true);
24637 }
24638 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_clone_ptr(int64_t arg) {
24639         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
24640         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
24641         return ret_conv;
24642 }
24643
24644 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_clone(int64_t orig) {
24645         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
24646         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24647         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
24648         return tag_ptr(ret_conv, true);
24649 }
24650
24651 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_new(int64_t a, int8_tArray b) {
24652         LDKChannelId a_conv;
24653         a_conv.inner = untag_ptr(a);
24654         a_conv.is_owned = ptr_is_owned(a);
24655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24656         a_conv = ChannelId_clone(&a_conv);
24657         LDKPublicKey b_ref;
24658         CHECK(b->arr_len == 33);
24659         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
24660         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24661         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
24662         return tag_ptr(ret_conv, true);
24663 }
24664
24665 void  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_free(int64_t _res) {
24666         if (!ptr_is_owned(_res)) return;
24667         void* _res_ptr = untag_ptr(_res);
24668         CHECK_ACCESS(_res_ptr);
24669         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
24670         FREE(untag_ptr(_res));
24671         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
24672 }
24673
24674 void  CS_LDK_CVec_C2Tuple_ChannelIdPublicKeyZZ_free(int64_tArray _res) {
24675         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
24676         _res_constr.datalen = _res->arr_len;
24677         if (_res_constr.datalen > 0)
24678                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
24679         else
24680                 _res_constr.data = NULL;
24681         int64_t* _res_vals = _res->elems;
24682         for (size_t e = 0; e < _res_constr.datalen; e++) {
24683                 int64_t _res_conv_30 = _res_vals[e];
24684                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
24685                 CHECK_ACCESS(_res_conv_30_ptr);
24686                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
24687                 FREE(untag_ptr(_res_conv_30));
24688                 _res_constr.data[e] = _res_conv_30_conv;
24689         }
24690         FREE(_res);
24691         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
24692 }
24693
24694 void  CS_LDK_CVec_ChannelIdZ_free(int64_tArray _res) {
24695         LDKCVec_ChannelIdZ _res_constr;
24696         _res_constr.datalen = _res->arr_len;
24697         if (_res_constr.datalen > 0)
24698                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
24699         else
24700                 _res_constr.data = NULL;
24701         int64_t* _res_vals = _res->elems;
24702         for (size_t l = 0; l < _res_constr.datalen; l++) {
24703                 int64_t _res_conv_11 = _res_vals[l];
24704                 LDKChannelId _res_conv_11_conv;
24705                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24706                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24707                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24708                 _res_constr.data[l] = _res_conv_11_conv;
24709         }
24710         FREE(_res);
24711         CVec_ChannelIdZ_free(_res_constr);
24712 }
24713
24714 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(int64_t o) {
24715         LDKOfferWithDerivedMetadataBuilder o_conv;
24716         o_conv.inner = untag_ptr(o);
24717         o_conv.is_owned = ptr_is_owned(o);
24718         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24719         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
24720         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24721         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24722         return tag_ptr(ret_conv, true);
24723 }
24724
24725 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(int32_t e) {
24726         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
24727         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24728         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24729         return tag_ptr(ret_conv, true);
24730 }
24731
24732 jboolean  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
24733         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24734         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24735         return ret_conv;
24736 }
24737
24738 void  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(int64_t _res) {
24739         if (!ptr_is_owned(_res)) return;
24740         void* _res_ptr = untag_ptr(_res);
24741         CHECK_ACCESS(_res_ptr);
24742         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24743         FREE(untag_ptr(_res));
24744         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24745 }
24746
24747 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24748         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24749         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24750         return tag_ptr(ret_conv, true);
24751 }
24752 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
24753         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24754         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24755         return ret_conv;
24756 }
24757
24758 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(int64_t orig) {
24759         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24760         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24761         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24762         return tag_ptr(ret_conv, true);
24763 }
24764
24765 int64_t  CS_LDK_COption_StrZ_some(jstring o) {
24766         LDKStr o_conv = str_ref_to_owned_c(o);
24767         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24768         *ret_copy = COption_StrZ_some(o_conv);
24769         int64_t ret_ref = tag_ptr(ret_copy, true);
24770         return ret_ref;
24771 }
24772
24773 int64_t  CS_LDK_COption_StrZ_none() {
24774         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24775         *ret_copy = COption_StrZ_none();
24776         int64_t ret_ref = tag_ptr(ret_copy, true);
24777         return ret_ref;
24778 }
24779
24780 void  CS_LDK_COption_StrZ_free(int64_t _res) {
24781         if (!ptr_is_owned(_res)) return;
24782         void* _res_ptr = untag_ptr(_res);
24783         CHECK_ACCESS(_res_ptr);
24784         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
24785         FREE(untag_ptr(_res));
24786         COption_StrZ_free(_res_conv);
24787 }
24788
24789 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
24790         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24791         *ret_copy = COption_StrZ_clone(arg);
24792         int64_t ret_ref = tag_ptr(ret_copy, true);
24793         return ret_ref;
24794 }
24795 int64_t  CS_LDK_COption_StrZ_clone_ptr(int64_t arg) {
24796         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
24797         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
24798         return ret_conv;
24799 }
24800
24801 int64_t  CS_LDK_COption_StrZ_clone(int64_t orig) {
24802         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
24803         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24804         *ret_copy = COption_StrZ_clone(orig_conv);
24805         int64_t ret_ref = tag_ptr(ret_copy, true);
24806         return ret_ref;
24807 }
24808
24809 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(int64_t o) {
24810         void* o_ptr = untag_ptr(o);
24811         CHECK_ACCESS(o_ptr);
24812         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24813         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24814         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24815         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
24816         return tag_ptr(ret_conv, true);
24817 }
24818
24819 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
24820         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24821         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
24822         return tag_ptr(ret_conv, true);
24823 }
24824
24825 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(int64_t o) {
24826         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
24827         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
24828         return ret_conv;
24829 }
24830
24831 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(int64_t _res) {
24832         if (!ptr_is_owned(_res)) return;
24833         void* _res_ptr = untag_ptr(_res);
24834         CHECK_ACCESS(_res_ptr);
24835         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
24836         FREE(untag_ptr(_res));
24837         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
24838 }
24839
24840 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
24841         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24842         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
24843         return tag_ptr(ret_conv, true);
24844 }
24845 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(int64_t arg) {
24846         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
24847         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
24848         return ret_conv;
24849 }
24850
24851 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(int64_t orig) {
24852         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
24853         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24854         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
24855         return tag_ptr(ret_conv, true);
24856 }
24857
24858 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
24859         LDKThirtyTwoBytes o_ref;
24860         CHECK(o->arr_len == 32);
24861         memcpy(o_ref.data, o->elems, 32); FREE(o);
24862         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24863         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
24864         return tag_ptr(ret_conv, true);
24865 }
24866
24867 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_err(int64_t e) {
24868         void* e_ptr = untag_ptr(e);
24869         CHECK_ACCESS(e_ptr);
24870         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24871         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24872         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24873         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
24874         return tag_ptr(ret_conv, true);
24875 }
24876
24877 jboolean  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(int64_t o) {
24878         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
24879         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
24880         return ret_conv;
24881 }
24882
24883 void  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_free(int64_t _res) {
24884         if (!ptr_is_owned(_res)) return;
24885         void* _res_ptr = untag_ptr(_res);
24886         CHECK_ACCESS(_res_ptr);
24887         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
24888         FREE(untag_ptr(_res));
24889         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
24890 }
24891
24892 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
24893         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24894         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
24895         return tag_ptr(ret_conv, true);
24896 }
24897 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(int64_t arg) {
24898         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
24899         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
24900         return ret_conv;
24901 }
24902
24903 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone(int64_t orig) {
24904         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
24905         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24906         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
24907         return tag_ptr(ret_conv, true);
24908 }
24909
24910 int64_t  CS_LDK_COption_OffersMessageZ_some(int64_t o) {
24911         void* o_ptr = untag_ptr(o);
24912         CHECK_ACCESS(o_ptr);
24913         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
24914         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
24915         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24916         *ret_copy = COption_OffersMessageZ_some(o_conv);
24917         int64_t ret_ref = tag_ptr(ret_copy, true);
24918         return ret_ref;
24919 }
24920
24921 int64_t  CS_LDK_COption_OffersMessageZ_none() {
24922         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24923         *ret_copy = COption_OffersMessageZ_none();
24924         int64_t ret_ref = tag_ptr(ret_copy, true);
24925         return ret_ref;
24926 }
24927
24928 void  CS_LDK_COption_OffersMessageZ_free(int64_t _res) {
24929         if (!ptr_is_owned(_res)) return;
24930         void* _res_ptr = untag_ptr(_res);
24931         CHECK_ACCESS(_res_ptr);
24932         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
24933         FREE(untag_ptr(_res));
24934         COption_OffersMessageZ_free(_res_conv);
24935 }
24936
24937 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
24938         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24939         *ret_copy = COption_OffersMessageZ_clone(arg);
24940         int64_t ret_ref = tag_ptr(ret_copy, true);
24941         return ret_ref;
24942 }
24943 int64_t  CS_LDK_COption_OffersMessageZ_clone_ptr(int64_t arg) {
24944         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
24945         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
24946         return ret_conv;
24947 }
24948
24949 int64_t  CS_LDK_COption_OffersMessageZ_clone(int64_t orig) {
24950         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
24951         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
24952         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
24953         int64_t ret_ref = tag_ptr(ret_copy, true);
24954         return ret_ref;
24955 }
24956
24957 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
24958         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24959         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
24960         return tag_ptr(ret_conv, true);
24961 }
24962 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(int64_t arg) {
24963         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
24964         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
24965         return ret_conv;
24966 }
24967
24968 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(int64_t orig) {
24969         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
24970         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24971         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
24972         return tag_ptr(ret_conv, true);
24973 }
24974
24975 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
24976         void* a_ptr = untag_ptr(a);
24977         CHECK_ACCESS(a_ptr);
24978         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
24979         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
24980         void* b_ptr = untag_ptr(b);
24981         CHECK_ACCESS(b_ptr);
24982         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24983         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24984         LDKBlindedPath c_conv;
24985         c_conv.inner = untag_ptr(c);
24986         c_conv.is_owned = ptr_is_owned(c);
24987         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24988         c_conv = BlindedPath_clone(&c_conv);
24989         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
24990         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24991         return tag_ptr(ret_conv, true);
24992 }
24993
24994 void  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_free(int64_t _res) {
24995         if (!ptr_is_owned(_res)) return;
24996         void* _res_ptr = untag_ptr(_res);
24997         CHECK_ACCESS(_res_ptr);
24998         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
24999         FREE(untag_ptr(_res));
25000         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
25001 }
25002
25003 void  CS_LDK_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(int64_tArray _res) {
25004         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
25005         _res_constr.datalen = _res->arr_len;
25006         if (_res_constr.datalen > 0)
25007                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
25008         else
25009                 _res_constr.data = NULL;
25010         int64_t* _res_vals = _res->elems;
25011         for (size_t x = 0; x < _res_constr.datalen; x++) {
25012                 int64_t _res_conv_49 = _res_vals[x];
25013                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
25014                 CHECK_ACCESS(_res_conv_49_ptr);
25015                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
25016                 FREE(untag_ptr(_res_conv_49));
25017                 _res_constr.data[x] = _res_conv_49_conv;
25018         }
25019         FREE(_res);
25020         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
25021 }
25022
25023 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(int64_t o) {
25024         LDKCounterpartyForwardingInfo o_conv;
25025         o_conv.inner = untag_ptr(o);
25026         o_conv.is_owned = ptr_is_owned(o);
25027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25028         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
25029         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25030         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
25031         return tag_ptr(ret_conv, true);
25032 }
25033
25034 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(int64_t e) {
25035         void* e_ptr = untag_ptr(e);
25036         CHECK_ACCESS(e_ptr);
25037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25039         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25040         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
25041         return tag_ptr(ret_conv, true);
25042 }
25043
25044 jboolean  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(int64_t o) {
25045         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
25046         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
25047         return ret_conv;
25048 }
25049
25050 void  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(int64_t _res) {
25051         if (!ptr_is_owned(_res)) return;
25052         void* _res_ptr = untag_ptr(_res);
25053         CHECK_ACCESS(_res_ptr);
25054         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
25055         FREE(untag_ptr(_res));
25056         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
25057 }
25058
25059 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
25060         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25061         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
25062         return tag_ptr(ret_conv, true);
25063 }
25064 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(int64_t arg) {
25065         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
25066         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
25067         return ret_conv;
25068 }
25069
25070 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(int64_t orig) {
25071         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
25072         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25073         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
25074         return tag_ptr(ret_conv, true);
25075 }
25076
25077 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_ok(int64_t o) {
25078         LDKChannelCounterparty o_conv;
25079         o_conv.inner = untag_ptr(o);
25080         o_conv.is_owned = ptr_is_owned(o);
25081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25082         o_conv = ChannelCounterparty_clone(&o_conv);
25083         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25084         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
25085         return tag_ptr(ret_conv, true);
25086 }
25087
25088 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_err(int64_t e) {
25089         void* e_ptr = untag_ptr(e);
25090         CHECK_ACCESS(e_ptr);
25091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25093         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25094         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
25095         return tag_ptr(ret_conv, true);
25096 }
25097
25098 jboolean  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(int64_t o) {
25099         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
25100         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
25101         return ret_conv;
25102 }
25103
25104 void  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_free(int64_t _res) {
25105         if (!ptr_is_owned(_res)) return;
25106         void* _res_ptr = untag_ptr(_res);
25107         CHECK_ACCESS(_res_ptr);
25108         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
25109         FREE(untag_ptr(_res));
25110         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
25111 }
25112
25113 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
25114         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25115         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
25116         return tag_ptr(ret_conv, true);
25117 }
25118 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(int64_t arg) {
25119         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
25120         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
25121         return ret_conv;
25122 }
25123
25124 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone(int64_t orig) {
25125         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
25126         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25127         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
25128         return tag_ptr(ret_conv, true);
25129 }
25130
25131 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_ok(int64_t o) {
25132         LDKChannelDetails 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 = ChannelDetails_clone(&o_conv);
25137         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25138         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
25139         return tag_ptr(ret_conv, true);
25140 }
25141
25142 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_err(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_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25148         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
25149         return tag_ptr(ret_conv, true);
25150 }
25151
25152 jboolean  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_is_ok(int64_t o) {
25153         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
25154         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
25155         return ret_conv;
25156 }
25157
25158 void  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_free(int64_t _res) {
25159         if (!ptr_is_owned(_res)) return;
25160         void* _res_ptr = untag_ptr(_res);
25161         CHECK_ACCESS(_res_ptr);
25162         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
25163         FREE(untag_ptr(_res));
25164         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
25165 }
25166
25167 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
25168         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25169         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
25170         return tag_ptr(ret_conv, true);
25171 }
25172 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
25173         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
25174         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
25175         return ret_conv;
25176 }
25177
25178 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone(int64_t orig) {
25179         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
25180         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25181         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
25182         return tag_ptr(ret_conv, true);
25183 }
25184
25185 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_ok(int64_t o) {
25186         LDKPhantomRouteHints 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 = PhantomRouteHints_clone(&o_conv);
25191         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25192         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
25193         return tag_ptr(ret_conv, true);
25194 }
25195
25196 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_err(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_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25202         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
25203         return tag_ptr(ret_conv, true);
25204 }
25205
25206 jboolean  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(int64_t o) {
25207         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
25208         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
25209         return ret_conv;
25210 }
25211
25212 void  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_free(int64_t _res) {
25213         if (!ptr_is_owned(_res)) return;
25214         void* _res_ptr = untag_ptr(_res);
25215         CHECK_ACCESS(_res_ptr);
25216         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
25217         FREE(untag_ptr(_res));
25218         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
25219 }
25220
25221 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
25222         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25223         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
25224         return tag_ptr(ret_conv, true);
25225 }
25226 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(int64_t arg) {
25227         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
25228         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
25229         return ret_conv;
25230 }
25231
25232 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone(int64_t orig) {
25233         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
25234         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25235         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
25236         return tag_ptr(ret_conv, true);
25237 }
25238
25239 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_ok(int64_t o) {
25240         LDKBlindedForward 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 = BlindedForward_clone(&o_conv);
25245         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25246         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
25247         return tag_ptr(ret_conv, true);
25248 }
25249
25250 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_err(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_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25256         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
25257         return tag_ptr(ret_conv, true);
25258 }
25259
25260 jboolean  CS_LDK_CResult_BlindedForwardDecodeErrorZ_is_ok(int64_t o) {
25261         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
25262         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
25263         return ret_conv;
25264 }
25265
25266 void  CS_LDK_CResult_BlindedForwardDecodeErrorZ_free(int64_t _res) {
25267         if (!ptr_is_owned(_res)) return;
25268         void* _res_ptr = untag_ptr(_res);
25269         CHECK_ACCESS(_res_ptr);
25270         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
25271         FREE(untag_ptr(_res));
25272         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
25273 }
25274
25275 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
25276         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25277         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
25278         return tag_ptr(ret_conv, true);
25279 }
25280 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone_ptr(int64_t arg) {
25281         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
25282         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
25283         return ret_conv;
25284 }
25285
25286 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone(int64_t orig) {
25287         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
25288         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25289         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
25290         return tag_ptr(ret_conv, true);
25291 }
25292
25293 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_ok(int64_t o) {
25294         void* o_ptr = untag_ptr(o);
25295         CHECK_ACCESS(o_ptr);
25296         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
25297         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
25298         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25299         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
25300         return tag_ptr(ret_conv, true);
25301 }
25302
25303 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_err(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_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25309         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
25310         return tag_ptr(ret_conv, true);
25311 }
25312
25313 jboolean  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(int64_t o) {
25314         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
25315         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
25316         return ret_conv;
25317 }
25318
25319 void  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_free(int64_t _res) {
25320         if (!ptr_is_owned(_res)) return;
25321         void* _res_ptr = untag_ptr(_res);
25322         CHECK_ACCESS(_res_ptr);
25323         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
25324         FREE(untag_ptr(_res));
25325         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
25326 }
25327
25328 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
25329         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25330         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
25331         return tag_ptr(ret_conv, true);
25332 }
25333 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(int64_t arg) {
25334         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
25335         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
25336         return ret_conv;
25337 }
25338
25339 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone(int64_t orig) {
25340         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
25341         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25342         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
25343         return tag_ptr(ret_conv, true);
25344 }
25345
25346 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_ok(int64_t o) {
25347         LDKPendingHTLCInfo o_conv;
25348         o_conv.inner = untag_ptr(o);
25349         o_conv.is_owned = ptr_is_owned(o);
25350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25351         o_conv = PendingHTLCInfo_clone(&o_conv);
25352         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25353         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
25354         return tag_ptr(ret_conv, true);
25355 }
25356
25357 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_err(int64_t e) {
25358         void* e_ptr = untag_ptr(e);
25359         CHECK_ACCESS(e_ptr);
25360         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25361         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25362         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25363         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
25364         return tag_ptr(ret_conv, true);
25365 }
25366
25367 jboolean  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(int64_t o) {
25368         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
25369         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
25370         return ret_conv;
25371 }
25372
25373 void  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_free(int64_t _res) {
25374         if (!ptr_is_owned(_res)) return;
25375         void* _res_ptr = untag_ptr(_res);
25376         CHECK_ACCESS(_res_ptr);
25377         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
25378         FREE(untag_ptr(_res));
25379         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
25380 }
25381
25382 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
25383         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25384         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
25385         return tag_ptr(ret_conv, true);
25386 }
25387 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(int64_t arg) {
25388         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
25389         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
25390         return ret_conv;
25391 }
25392
25393 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone(int64_t orig) {
25394         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
25395         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25396         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
25397         return tag_ptr(ret_conv, true);
25398 }
25399
25400 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_ok(int32_t o) {
25401         LDKBlindedFailure o_conv = LDKBlindedFailure_from_cs(o);
25402         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25403         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
25404         return tag_ptr(ret_conv, true);
25405 }
25406
25407 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_err(int64_t e) {
25408         void* e_ptr = untag_ptr(e);
25409         CHECK_ACCESS(e_ptr);
25410         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25411         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25412         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25413         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
25414         return tag_ptr(ret_conv, true);
25415 }
25416
25417 jboolean  CS_LDK_CResult_BlindedFailureDecodeErrorZ_is_ok(int64_t o) {
25418         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
25419         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
25420         return ret_conv;
25421 }
25422
25423 void  CS_LDK_CResult_BlindedFailureDecodeErrorZ_free(int64_t _res) {
25424         if (!ptr_is_owned(_res)) return;
25425         void* _res_ptr = untag_ptr(_res);
25426         CHECK_ACCESS(_res_ptr);
25427         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
25428         FREE(untag_ptr(_res));
25429         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
25430 }
25431
25432 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
25433         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25434         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
25435         return tag_ptr(ret_conv, true);
25436 }
25437 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone_ptr(int64_t arg) {
25438         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
25439         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
25440         return ret_conv;
25441 }
25442
25443 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone(int64_t orig) {
25444         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
25445         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25446         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
25447         return tag_ptr(ret_conv, true);
25448 }
25449
25450 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_ok(int32_t o) {
25451         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
25452         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25453         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
25454         return tag_ptr(ret_conv, true);
25455 }
25456
25457 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_err(int64_t e) {
25458         void* e_ptr = untag_ptr(e);
25459         CHECK_ACCESS(e_ptr);
25460         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25461         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25462         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25463         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
25464         return tag_ptr(ret_conv, true);
25465 }
25466
25467 jboolean  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(int64_t o) {
25468         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
25469         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
25470         return ret_conv;
25471 }
25472
25473 void  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_free(int64_t _res) {
25474         if (!ptr_is_owned(_res)) return;
25475         void* _res_ptr = untag_ptr(_res);
25476         CHECK_ACCESS(_res_ptr);
25477         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
25478         FREE(untag_ptr(_res));
25479         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
25480 }
25481
25482 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
25483         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25484         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
25485         return tag_ptr(ret_conv, true);
25486 }
25487 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(int64_t arg) {
25488         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
25489         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
25490         return ret_conv;
25491 }
25492
25493 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone(int64_t orig) {
25494         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
25495         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
25496         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
25497         return tag_ptr(ret_conv, true);
25498 }
25499
25500 void  CS_LDK_CVec_ChannelMonitorZ_free(int64_tArray _res) {
25501         LDKCVec_ChannelMonitorZ _res_constr;
25502         _res_constr.datalen = _res->arr_len;
25503         if (_res_constr.datalen > 0)
25504                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25505         else
25506                 _res_constr.data = NULL;
25507         int64_t* _res_vals = _res->elems;
25508         for (size_t q = 0; q < _res_constr.datalen; q++) {
25509                 int64_t _res_conv_16 = _res_vals[q];
25510                 LDKChannelMonitor _res_conv_16_conv;
25511                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25512                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25514                 _res_constr.data[q] = _res_conv_16_conv;
25515         }
25516         FREE(_res);
25517         CVec_ChannelMonitorZ_free(_res_constr);
25518 }
25519
25520 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, int64_t b) {
25521         LDKThirtyTwoBytes a_ref;
25522         CHECK(a->arr_len == 32);
25523         memcpy(a_ref.data, a->elems, 32); FREE(a);
25524         LDKChannelManager b_conv;
25525         b_conv.inner = untag_ptr(b);
25526         b_conv.is_owned = ptr_is_owned(b);
25527         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25528         // WARNING: we need a move here but no clone is available for LDKChannelManager
25529         
25530         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
25531         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
25532         return tag_ptr(ret_conv, true);
25533 }
25534
25535 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(int64_t _res) {
25536         if (!ptr_is_owned(_res)) return;
25537         void* _res_ptr = untag_ptr(_res);
25538         CHECK_ACCESS(_res_ptr);
25539         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
25540         FREE(untag_ptr(_res));
25541         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
25542 }
25543
25544 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(int64_t o) {
25545         void* o_ptr = untag_ptr(o);
25546         CHECK_ACCESS(o_ptr);
25547         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
25548         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
25549         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25550         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
25551         return tag_ptr(ret_conv, true);
25552 }
25553
25554 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(int64_t e) {
25555         void* e_ptr = untag_ptr(e);
25556         CHECK_ACCESS(e_ptr);
25557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25559         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25560         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
25561         return tag_ptr(ret_conv, true);
25562 }
25563
25564 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(int64_t o) {
25565         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
25566         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
25567         return ret_conv;
25568 }
25569
25570 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(int64_t _res) {
25571         if (!ptr_is_owned(_res)) return;
25572         void* _res_ptr = untag_ptr(_res);
25573         CHECK_ACCESS(_res_ptr);
25574         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
25575         FREE(untag_ptr(_res));
25576         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
25577 }
25578
25579 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(int64_t o) {
25580         void* o_ptr = untag_ptr(o);
25581         CHECK_ACCESS(o_ptr);
25582         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25583         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25584         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25585         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25586         return tag_ptr(ret_conv, true);
25587 }
25588
25589 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_err(int64_t e) {
25590         void* e_ptr = untag_ptr(e);
25591         CHECK_ACCESS(e_ptr);
25592         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25593         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25594         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25595         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25596         return tag_ptr(ret_conv, true);
25597 }
25598
25599 jboolean  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(int64_t o) {
25600         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25601         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25602         return ret_conv;
25603 }
25604
25605 void  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_free(int64_t _res) {
25606         if (!ptr_is_owned(_res)) return;
25607         void* _res_ptr = untag_ptr(_res);
25608         CHECK_ACCESS(_res_ptr);
25609         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25610         FREE(untag_ptr(_res));
25611         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25612 }
25613
25614 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25615         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25616         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25617         return tag_ptr(ret_conv, true);
25618 }
25619 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(int64_t arg) {
25620         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25621         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25622         return ret_conv;
25623 }
25624
25625 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(int64_t orig) {
25626         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25627         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25628         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25629         return tag_ptr(ret_conv, true);
25630 }
25631
25632 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_ok(int64_t o) {
25633         LDKChannelConfig o_conv;
25634         o_conv.inner = untag_ptr(o);
25635         o_conv.is_owned = ptr_is_owned(o);
25636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25637         o_conv = ChannelConfig_clone(&o_conv);
25638         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25639         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25640         return tag_ptr(ret_conv, true);
25641 }
25642
25643 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_err(int64_t e) {
25644         void* e_ptr = untag_ptr(e);
25645         CHECK_ACCESS(e_ptr);
25646         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25647         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25648         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25649         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25650         return tag_ptr(ret_conv, true);
25651 }
25652
25653 jboolean  CS_LDK_CResult_ChannelConfigDecodeErrorZ_is_ok(int64_t o) {
25654         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25655         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25656         return ret_conv;
25657 }
25658
25659 void  CS_LDK_CResult_ChannelConfigDecodeErrorZ_free(int64_t _res) {
25660         if (!ptr_is_owned(_res)) return;
25661         void* _res_ptr = untag_ptr(_res);
25662         CHECK_ACCESS(_res_ptr);
25663         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25664         FREE(untag_ptr(_res));
25665         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25666 }
25667
25668 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25669         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25670         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25671         return tag_ptr(ret_conv, true);
25672 }
25673 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone_ptr(int64_t arg) {
25674         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25675         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25676         return ret_conv;
25677 }
25678
25679 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone(int64_t orig) {
25680         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25681         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25682         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25683         return tag_ptr(ret_conv, true);
25684 }
25685
25686 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_some(int64_t o) {
25687         void* o_ptr = untag_ptr(o);
25688         CHECK_ACCESS(o_ptr);
25689         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25690         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25691         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25692         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25693         int64_t ret_ref = tag_ptr(ret_copy, true);
25694         return ret_ref;
25695 }
25696
25697 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_none() {
25698         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25699         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25700         int64_t ret_ref = tag_ptr(ret_copy, true);
25701         return ret_ref;
25702 }
25703
25704 void  CS_LDK_COption_MaxDustHTLCExposureZ_free(int64_t _res) {
25705         if (!ptr_is_owned(_res)) return;
25706         void* _res_ptr = untag_ptr(_res);
25707         CHECK_ACCESS(_res_ptr);
25708         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25709         FREE(untag_ptr(_res));
25710         COption_MaxDustHTLCExposureZ_free(_res_conv);
25711 }
25712
25713 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25714         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25715         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25716         int64_t ret_ref = tag_ptr(ret_copy, true);
25717         return ret_ref;
25718 }
25719 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone_ptr(int64_t arg) {
25720         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25721         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25722         return ret_conv;
25723 }
25724
25725 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone(int64_t orig) {
25726         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25727         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25728         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25729         int64_t ret_ref = tag_ptr(ret_copy, true);
25730         return ret_ref;
25731 }
25732
25733 int64_t  CS_LDK_COption_APIErrorZ_some(int64_t o) {
25734         void* o_ptr = untag_ptr(o);
25735         CHECK_ACCESS(o_ptr);
25736         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25737         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25738         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25739         *ret_copy = COption_APIErrorZ_some(o_conv);
25740         int64_t ret_ref = tag_ptr(ret_copy, true);
25741         return ret_ref;
25742 }
25743
25744 int64_t  CS_LDK_COption_APIErrorZ_none() {
25745         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25746         *ret_copy = COption_APIErrorZ_none();
25747         int64_t ret_ref = tag_ptr(ret_copy, true);
25748         return ret_ref;
25749 }
25750
25751 void  CS_LDK_COption_APIErrorZ_free(int64_t _res) {
25752         if (!ptr_is_owned(_res)) return;
25753         void* _res_ptr = untag_ptr(_res);
25754         CHECK_ACCESS(_res_ptr);
25755         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25756         FREE(untag_ptr(_res));
25757         COption_APIErrorZ_free(_res_conv);
25758 }
25759
25760 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25761         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25762         *ret_copy = COption_APIErrorZ_clone(arg);
25763         int64_t ret_ref = tag_ptr(ret_copy, true);
25764         return ret_ref;
25765 }
25766 int64_t  CS_LDK_COption_APIErrorZ_clone_ptr(int64_t arg) {
25767         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25768         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25769         return ret_conv;
25770 }
25771
25772 int64_t  CS_LDK_COption_APIErrorZ_clone(int64_t orig) {
25773         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25774         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25775         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25776         int64_t ret_ref = tag_ptr(ret_copy, true);
25777         return ret_ref;
25778 }
25779
25780 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_ok(int64_t o) {
25781         void* o_ptr = untag_ptr(o);
25782         CHECK_ACCESS(o_ptr);
25783         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25784         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25785         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25786         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25787         return tag_ptr(ret_conv, true);
25788 }
25789
25790 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_err(int64_t e) {
25791         void* e_ptr = untag_ptr(e);
25792         CHECK_ACCESS(e_ptr);
25793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25795         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25796         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25797         return tag_ptr(ret_conv, true);
25798 }
25799
25800 jboolean  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_is_ok(int64_t o) {
25801         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25802         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25803         return ret_conv;
25804 }
25805
25806 void  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_free(int64_t _res) {
25807         if (!ptr_is_owned(_res)) return;
25808         void* _res_ptr = untag_ptr(_res);
25809         CHECK_ACCESS(_res_ptr);
25810         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25811         FREE(untag_ptr(_res));
25812         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25813 }
25814
25815 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25816         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25817         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25818         return tag_ptr(ret_conv, true);
25819 }
25820 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(int64_t arg) {
25821         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25822         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25823         return ret_conv;
25824 }
25825
25826 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone(int64_t orig) {
25827         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25828         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25829         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25830         return tag_ptr(ret_conv, true);
25831 }
25832
25833 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(int64_t o) {
25834         LDKChannelMonitorUpdate o_conv;
25835         o_conv.inner = untag_ptr(o);
25836         o_conv.is_owned = ptr_is_owned(o);
25837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25838         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25839         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25840         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25841         return tag_ptr(ret_conv, true);
25842 }
25843
25844 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_err(int64_t e) {
25845         void* e_ptr = untag_ptr(e);
25846         CHECK_ACCESS(e_ptr);
25847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25849         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25850         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25851         return tag_ptr(ret_conv, true);
25852 }
25853
25854 jboolean  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(int64_t o) {
25855         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25856         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25857         return ret_conv;
25858 }
25859
25860 void  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_free(int64_t _res) {
25861         if (!ptr_is_owned(_res)) return;
25862         void* _res_ptr = untag_ptr(_res);
25863         CHECK_ACCESS(_res_ptr);
25864         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25865         FREE(untag_ptr(_res));
25866         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25867 }
25868
25869 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25870         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25871         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25872         return tag_ptr(ret_conv, true);
25873 }
25874 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
25875         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25876         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25877         return ret_conv;
25878 }
25879
25880 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(int64_t orig) {
25881         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25882         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25883         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25884         return tag_ptr(ret_conv, true);
25885 }
25886
25887 int64_t  CS_LDK_COption_MonitorEventZ_some(int64_t o) {
25888         void* o_ptr = untag_ptr(o);
25889         CHECK_ACCESS(o_ptr);
25890         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25891         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25892         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25893         *ret_copy = COption_MonitorEventZ_some(o_conv);
25894         int64_t ret_ref = tag_ptr(ret_copy, true);
25895         return ret_ref;
25896 }
25897
25898 int64_t  CS_LDK_COption_MonitorEventZ_none() {
25899         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25900         *ret_copy = COption_MonitorEventZ_none();
25901         int64_t ret_ref = tag_ptr(ret_copy, true);
25902         return ret_ref;
25903 }
25904
25905 void  CS_LDK_COption_MonitorEventZ_free(int64_t _res) {
25906         if (!ptr_is_owned(_res)) return;
25907         void* _res_ptr = untag_ptr(_res);
25908         CHECK_ACCESS(_res_ptr);
25909         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25910         FREE(untag_ptr(_res));
25911         COption_MonitorEventZ_free(_res_conv);
25912 }
25913
25914 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25915         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25916         *ret_copy = COption_MonitorEventZ_clone(arg);
25917         int64_t ret_ref = tag_ptr(ret_copy, true);
25918         return ret_ref;
25919 }
25920 int64_t  CS_LDK_COption_MonitorEventZ_clone_ptr(int64_t arg) {
25921         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25922         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25923         return ret_conv;
25924 }
25925
25926 int64_t  CS_LDK_COption_MonitorEventZ_clone(int64_t orig) {
25927         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25928         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25929         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25930         int64_t ret_ref = tag_ptr(ret_copy, true);
25931         return ret_ref;
25932 }
25933
25934 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_ok(int64_t o) {
25935         void* o_ptr = untag_ptr(o);
25936         CHECK_ACCESS(o_ptr);
25937         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25938         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25939         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25940         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25941         return tag_ptr(ret_conv, true);
25942 }
25943
25944 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_err(int64_t e) {
25945         void* e_ptr = untag_ptr(e);
25946         CHECK_ACCESS(e_ptr);
25947         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25948         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25949         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25950         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25951         return tag_ptr(ret_conv, true);
25952 }
25953
25954 jboolean  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(int64_t o) {
25955         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25956         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25957         return ret_conv;
25958 }
25959
25960 void  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_free(int64_t _res) {
25961         if (!ptr_is_owned(_res)) return;
25962         void* _res_ptr = untag_ptr(_res);
25963         CHECK_ACCESS(_res_ptr);
25964         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25965         FREE(untag_ptr(_res));
25966         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25967 }
25968
25969 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25970         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25971         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25972         return tag_ptr(ret_conv, true);
25973 }
25974 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(int64_t arg) {
25975         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25976         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25977         return ret_conv;
25978 }
25979
25980 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone(int64_t orig) {
25981         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25982         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25983         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25984         return tag_ptr(ret_conv, true);
25985 }
25986
25987 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_ok(int64_t o) {
25988         LDKHTLCUpdate o_conv;
25989         o_conv.inner = untag_ptr(o);
25990         o_conv.is_owned = ptr_is_owned(o);
25991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25992         o_conv = HTLCUpdate_clone(&o_conv);
25993         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25994         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25995         return tag_ptr(ret_conv, true);
25996 }
25997
25998 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_err(int64_t e) {
25999         void* e_ptr = untag_ptr(e);
26000         CHECK_ACCESS(e_ptr);
26001         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26002         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26003         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26004         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
26005         return tag_ptr(ret_conv, true);
26006 }
26007
26008 jboolean  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_is_ok(int64_t o) {
26009         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
26010         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
26011         return ret_conv;
26012 }
26013
26014 void  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_free(int64_t _res) {
26015         if (!ptr_is_owned(_res)) return;
26016         void* _res_ptr = untag_ptr(_res);
26017         CHECK_ACCESS(_res_ptr);
26018         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
26019         FREE(untag_ptr(_res));
26020         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
26021 }
26022
26023 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
26024         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26025         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
26026         return tag_ptr(ret_conv, true);
26027 }
26028 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
26029         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
26030         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
26031         return ret_conv;
26032 }
26033
26034 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone(int64_t orig) {
26035         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
26036         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26037         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
26038         return tag_ptr(ret_conv, true);
26039 }
26040
26041 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
26042         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26043         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
26044         return tag_ptr(ret_conv, true);
26045 }
26046 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(int64_t arg) {
26047         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
26048         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
26049         return ret_conv;
26050 }
26051
26052 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone(int64_t orig) {
26053         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
26054         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26055         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
26056         return tag_ptr(ret_conv, true);
26057 }
26058
26059 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_new(int64_t a, int8_tArray b) {
26060         LDKOutPoint a_conv;
26061         a_conv.inner = untag_ptr(a);
26062         a_conv.is_owned = ptr_is_owned(a);
26063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26064         a_conv = OutPoint_clone(&a_conv);
26065         LDKCVec_u8Z b_ref;
26066         b_ref.datalen = b->arr_len;
26067         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26068         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
26069         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
26070         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
26071         return tag_ptr(ret_conv, true);
26072 }
26073
26074 void  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_free(int64_t _res) {
26075         if (!ptr_is_owned(_res)) return;
26076         void* _res_ptr = untag_ptr(_res);
26077         CHECK_ACCESS(_res_ptr);
26078         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
26079         FREE(untag_ptr(_res));
26080         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
26081 }
26082
26083 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
26084         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26085         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
26086         return tag_ptr(ret_conv, true);
26087 }
26088 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone_ptr(int64_t arg) {
26089         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
26090         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
26091         return ret_conv;
26092 }
26093
26094 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone(int64_t orig) {
26095         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
26096         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26097         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
26098         return tag_ptr(ret_conv, true);
26099 }
26100
26101 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
26102         LDKCVec_u8Z b_ref;
26103         b_ref.datalen = b->arr_len;
26104         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26105         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
26106         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26107         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
26108         return tag_ptr(ret_conv, true);
26109 }
26110
26111 void  CS_LDK_C2Tuple_u32CVec_u8ZZ_free(int64_t _res) {
26112         if (!ptr_is_owned(_res)) return;
26113         void* _res_ptr = untag_ptr(_res);
26114         CHECK_ACCESS(_res_ptr);
26115         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
26116         FREE(untag_ptr(_res));
26117         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
26118 }
26119
26120 void  CS_LDK_CVec_C2Tuple_u32CVec_u8ZZZ_free(int64_tArray _res) {
26121         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
26122         _res_constr.datalen = _res->arr_len;
26123         if (_res_constr.datalen > 0)
26124                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26125         else
26126                 _res_constr.data = NULL;
26127         int64_t* _res_vals = _res->elems;
26128         for (size_t x = 0; x < _res_constr.datalen; x++) {
26129                 int64_t _res_conv_23 = _res_vals[x];
26130                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
26131                 CHECK_ACCESS(_res_conv_23_ptr);
26132                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
26133                 FREE(untag_ptr(_res_conv_23));
26134                 _res_constr.data[x] = _res_conv_23_conv;
26135         }
26136         FREE(_res);
26137         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
26138 }
26139
26140 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
26141         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26142         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
26143         return tag_ptr(ret_conv, true);
26144 }
26145 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(int64_t arg) {
26146         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
26147         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
26148         return ret_conv;
26149 }
26150
26151 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(int64_t orig) {
26152         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
26153         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26154         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
26155         return tag_ptr(ret_conv, true);
26156 }
26157
26158 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, int64_tArray b) {
26159         LDKThirtyTwoBytes a_ref;
26160         CHECK(a->arr_len == 32);
26161         memcpy(a_ref.data, a->elems, 32); FREE(a);
26162         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
26163         b_constr.datalen = b->arr_len;
26164         if (b_constr.datalen > 0)
26165                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26166         else
26167                 b_constr.data = NULL;
26168         int64_t* b_vals = b->elems;
26169         for (size_t x = 0; x < b_constr.datalen; x++) {
26170                 int64_t b_conv_23 = b_vals[x];
26171                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
26172                 CHECK_ACCESS(b_conv_23_ptr);
26173                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
26174                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
26175                 b_constr.data[x] = b_conv_23_conv;
26176         }
26177         FREE(b);
26178         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26179         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
26180         return tag_ptr(ret_conv, true);
26181 }
26182
26183 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(int64_t _res) {
26184         if (!ptr_is_owned(_res)) return;
26185         void* _res_ptr = untag_ptr(_res);
26186         CHECK_ACCESS(_res_ptr);
26187         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
26188         FREE(untag_ptr(_res));
26189         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
26190 }
26191
26192 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(int64_tArray _res) {
26193         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
26194         _res_constr.datalen = _res->arr_len;
26195         if (_res_constr.datalen > 0)
26196                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
26197         else
26198                 _res_constr.data = NULL;
26199         int64_t* _res_vals = _res->elems;
26200         for (size_t a = 0; a < _res_constr.datalen; a++) {
26201                 int64_t _res_conv_52 = _res_vals[a];
26202                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
26203                 CHECK_ACCESS(_res_conv_52_ptr);
26204                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
26205                 FREE(untag_ptr(_res_conv_52));
26206                 _res_constr.data[a] = _res_conv_52_conv;
26207         }
26208         FREE(_res);
26209         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
26210 }
26211
26212 void  CS_LDK_CVec_CommitmentTransactionZ_free(int64_tArray _res) {
26213         LDKCVec_CommitmentTransactionZ _res_constr;
26214         _res_constr.datalen = _res->arr_len;
26215         if (_res_constr.datalen > 0)
26216                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
26217         else
26218                 _res_constr.data = NULL;
26219         int64_t* _res_vals = _res->elems;
26220         for (size_t x = 0; x < _res_constr.datalen; x++) {
26221                 int64_t _res_conv_23 = _res_vals[x];
26222                 LDKCommitmentTransaction _res_conv_23_conv;
26223                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
26224                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
26225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
26226                 _res_constr.data[x] = _res_conv_23_conv;
26227         }
26228         FREE(_res);
26229         CVec_CommitmentTransactionZ_free(_res_constr);
26230 }
26231
26232 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
26233         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26234         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
26235         return tag_ptr(ret_conv, true);
26236 }
26237 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone_ptr(int64_t arg) {
26238         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
26239         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
26240         return ret_conv;
26241 }
26242
26243 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone(int64_t orig) {
26244         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
26245         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26246         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
26247         return tag_ptr(ret_conv, true);
26248 }
26249
26250 int64_t  CS_LDK_C2Tuple_u32TxOutZ_new(int32_t a, int64_t b) {
26251         void* b_ptr = untag_ptr(b);
26252         CHECK_ACCESS(b_ptr);
26253         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
26254         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
26255         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26256         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
26257         return tag_ptr(ret_conv, true);
26258 }
26259
26260 void  CS_LDK_C2Tuple_u32TxOutZ_free(int64_t _res) {
26261         if (!ptr_is_owned(_res)) return;
26262         void* _res_ptr = untag_ptr(_res);
26263         CHECK_ACCESS(_res_ptr);
26264         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
26265         FREE(untag_ptr(_res));
26266         C2Tuple_u32TxOutZ_free(_res_conv);
26267 }
26268
26269 void  CS_LDK_CVec_C2Tuple_u32TxOutZZ_free(int64_tArray _res) {
26270         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
26271         _res_constr.datalen = _res->arr_len;
26272         if (_res_constr.datalen > 0)
26273                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
26274         else
26275                 _res_constr.data = NULL;
26276         int64_t* _res_vals = _res->elems;
26277         for (size_t u = 0; u < _res_constr.datalen; u++) {
26278                 int64_t _res_conv_20 = _res_vals[u];
26279                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
26280                 CHECK_ACCESS(_res_conv_20_ptr);
26281                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
26282                 FREE(untag_ptr(_res_conv_20));
26283                 _res_constr.data[u] = _res_conv_20_conv;
26284         }
26285         FREE(_res);
26286         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
26287 }
26288
26289 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
26290         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26291         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
26292         return tag_ptr(ret_conv, true);
26293 }
26294 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(int64_t arg) {
26295         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
26296         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
26297         return ret_conv;
26298 }
26299
26300 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(int64_t orig) {
26301         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
26302         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26303         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
26304         return tag_ptr(ret_conv, true);
26305 }
26306
26307 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, int64_tArray b) {
26308         LDKThirtyTwoBytes a_ref;
26309         CHECK(a->arr_len == 32);
26310         memcpy(a_ref.data, a->elems, 32); FREE(a);
26311         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
26312         b_constr.datalen = b->arr_len;
26313         if (b_constr.datalen > 0)
26314                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
26315         else
26316                 b_constr.data = NULL;
26317         int64_t* b_vals = b->elems;
26318         for (size_t u = 0; u < b_constr.datalen; u++) {
26319                 int64_t b_conv_20 = b_vals[u];
26320                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
26321                 CHECK_ACCESS(b_conv_20_ptr);
26322                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
26323                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
26324                 b_constr.data[u] = b_conv_20_conv;
26325         }
26326         FREE(b);
26327         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26328         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
26329         return tag_ptr(ret_conv, true);
26330 }
26331
26332 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(int64_t _res) {
26333         if (!ptr_is_owned(_res)) return;
26334         void* _res_ptr = untag_ptr(_res);
26335         CHECK_ACCESS(_res_ptr);
26336         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
26337         FREE(untag_ptr(_res));
26338         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
26339 }
26340
26341 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(int64_tArray _res) {
26342         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
26343         _res_constr.datalen = _res->arr_len;
26344         if (_res_constr.datalen > 0)
26345                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
26346         else
26347                 _res_constr.data = NULL;
26348         int64_t* _res_vals = _res->elems;
26349         for (size_t x = 0; x < _res_constr.datalen; x++) {
26350                 int64_t _res_conv_49 = _res_vals[x];
26351                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26352                 CHECK_ACCESS(_res_conv_49_ptr);
26353                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
26354                 FREE(untag_ptr(_res_conv_49));
26355                 _res_constr.data[x] = _res_conv_49_conv;
26356         }
26357         FREE(_res);
26358         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
26359 }
26360
26361 void  CS_LDK_CVec_BalanceZ_free(int64_tArray _res) {
26362         LDKCVec_BalanceZ _res_constr;
26363         _res_constr.datalen = _res->arr_len;
26364         if (_res_constr.datalen > 0)
26365                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
26366         else
26367                 _res_constr.data = NULL;
26368         int64_t* _res_vals = _res->elems;
26369         for (size_t j = 0; j < _res_constr.datalen; j++) {
26370                 int64_t _res_conv_9 = _res_vals[j];
26371                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
26372                 CHECK_ACCESS(_res_conv_9_ptr);
26373                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
26374                 FREE(untag_ptr(_res_conv_9));
26375                 _res_constr.data[j] = _res_conv_9_conv;
26376         }
26377         FREE(_res);
26378         CVec_BalanceZ_free(_res_constr);
26379 }
26380
26381 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
26382         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26383         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
26384         return tag_ptr(ret_conv, true);
26385 }
26386 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(int64_t arg) {
26387         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
26388         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
26389         return ret_conv;
26390 }
26391
26392 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(int64_t orig) {
26393         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
26394         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26395         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
26396         return tag_ptr(ret_conv, true);
26397 }
26398
26399 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, int64_t b) {
26400         LDKThirtyTwoBytes a_ref;
26401         CHECK(a->arr_len == 32);
26402         memcpy(a_ref.data, a->elems, 32); FREE(a);
26403         LDKChannelMonitor b_conv;
26404         b_conv.inner = untag_ptr(b);
26405         b_conv.is_owned = ptr_is_owned(b);
26406         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26407         b_conv = ChannelMonitor_clone(&b_conv);
26408         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26409         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
26410         return tag_ptr(ret_conv, true);
26411 }
26412
26413 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(int64_t _res) {
26414         if (!ptr_is_owned(_res)) return;
26415         void* _res_ptr = untag_ptr(_res);
26416         CHECK_ACCESS(_res_ptr);
26417         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
26418         FREE(untag_ptr(_res));
26419         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
26420 }
26421
26422 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(int64_t o) {
26423         void* o_ptr = untag_ptr(o);
26424         CHECK_ACCESS(o_ptr);
26425         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
26426         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
26427         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26428         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
26429         return tag_ptr(ret_conv, true);
26430 }
26431
26432 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(int64_t e) {
26433         void* e_ptr = untag_ptr(e);
26434         CHECK_ACCESS(e_ptr);
26435         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26436         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26437         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26438         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
26439         return tag_ptr(ret_conv, true);
26440 }
26441
26442 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(int64_t o) {
26443         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
26444         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
26445         return ret_conv;
26446 }
26447
26448 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(int64_t _res) {
26449         if (!ptr_is_owned(_res)) return;
26450         void* _res_ptr = untag_ptr(_res);
26451         CHECK_ACCESS(_res_ptr);
26452         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
26453         FREE(untag_ptr(_res));
26454         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
26455 }
26456
26457 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
26458         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26459         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
26460         return tag_ptr(ret_conv, true);
26461 }
26462 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(int64_t arg) {
26463         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
26464         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
26465         return ret_conv;
26466 }
26467
26468 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(int64_t orig) {
26469         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
26470         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26471         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
26472         return tag_ptr(ret_conv, true);
26473 }
26474
26475 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
26476         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26477         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
26478         return tag_ptr(ret_conv, true);
26479 }
26480 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone_ptr(int64_t arg) {
26481         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
26482         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
26483         return ret_conv;
26484 }
26485
26486 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone(int64_t orig) {
26487         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
26488         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26489         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
26490         return tag_ptr(ret_conv, true);
26491 }
26492
26493 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, int64_t b) {
26494         LDKPublicKey a_ref;
26495         CHECK(a->arr_len == 33);
26496         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26497         void* b_ptr = untag_ptr(b);
26498         CHECK_ACCESS(b_ptr);
26499         LDKType b_conv = *(LDKType*)(b_ptr);
26500         if (b_conv.free == LDKType_JCalls_free) {
26501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26502                 LDKType_JCalls_cloned(&b_conv);
26503         }
26504         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26505         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26506         return tag_ptr(ret_conv, true);
26507 }
26508
26509 void  CS_LDK_C2Tuple_PublicKeyTypeZ_free(int64_t _res) {
26510         if (!ptr_is_owned(_res)) return;
26511         void* _res_ptr = untag_ptr(_res);
26512         CHECK_ACCESS(_res_ptr);
26513         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26514         FREE(untag_ptr(_res));
26515         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26516 }
26517
26518 void  CS_LDK_CVec_C2Tuple_PublicKeyTypeZZ_free(int64_tArray _res) {
26519         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26520         _res_constr.datalen = _res->arr_len;
26521         if (_res_constr.datalen > 0)
26522                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26523         else
26524                 _res_constr.data = NULL;
26525         int64_t* _res_vals = _res->elems;
26526         for (size_t z = 0; z < _res_constr.datalen; z++) {
26527                 int64_t _res_conv_25 = _res_vals[z];
26528                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26529                 CHECK_ACCESS(_res_conv_25_ptr);
26530                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26531                 FREE(untag_ptr(_res_conv_25));
26532                 _res_constr.data[z] = _res_conv_25_conv;
26533         }
26534         FREE(_res);
26535         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26536 }
26537
26538 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
26539         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26540         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
26541         return tag_ptr(ret_conv, true);
26542 }
26543 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(int64_t arg) {
26544         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
26545         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
26546         return ret_conv;
26547 }
26548
26549 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(int64_t orig) {
26550         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
26551         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26552         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
26553         return tag_ptr(ret_conv, true);
26554 }
26555
26556 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, int64_tArray b) {
26557         LDKPublicKey a_ref;
26558         CHECK(a->arr_len == 33);
26559         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26560         LDKCVec_SocketAddressZ b_constr;
26561         b_constr.datalen = b->arr_len;
26562         if (b_constr.datalen > 0)
26563                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26564         else
26565                 b_constr.data = NULL;
26566         int64_t* b_vals = b->elems;
26567         for (size_t p = 0; p < b_constr.datalen; p++) {
26568                 int64_t b_conv_15 = b_vals[p];
26569                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
26570                 CHECK_ACCESS(b_conv_15_ptr);
26571                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
26572                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
26573                 b_constr.data[p] = b_conv_15_conv;
26574         }
26575         FREE(b);
26576         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26577         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
26578         return tag_ptr(ret_conv, true);
26579 }
26580
26581 void  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(int64_t _res) {
26582         if (!ptr_is_owned(_res)) return;
26583         void* _res_ptr = untag_ptr(_res);
26584         CHECK_ACCESS(_res_ptr);
26585         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
26586         FREE(untag_ptr(_res));
26587         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
26588 }
26589
26590 void  CS_LDK_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(int64_tArray _res) {
26591         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
26592         _res_constr.datalen = _res->arr_len;
26593         if (_res_constr.datalen > 0)
26594                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
26595         else
26596                 _res_constr.data = NULL;
26597         int64_t* _res_vals = _res->elems;
26598         for (size_t o = 0; o < _res_constr.datalen; o++) {
26599                 int64_t _res_conv_40 = _res_vals[o];
26600                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26601                 CHECK_ACCESS(_res_conv_40_ptr);
26602                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
26603                 FREE(untag_ptr(_res_conv_40));
26604                 _res_constr.data[o] = _res_conv_40_conv;
26605         }
26606         FREE(_res);
26607         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
26608 }
26609
26610 int64_t  CS_LDK_COption_OnionMessageContentsZ_some(int64_t o) {
26611         void* o_ptr = untag_ptr(o);
26612         CHECK_ACCESS(o_ptr);
26613         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
26614         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
26615                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26616                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
26617         }
26618         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26619         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
26620         int64_t ret_ref = tag_ptr(ret_copy, true);
26621         return ret_ref;
26622 }
26623
26624 int64_t  CS_LDK_COption_OnionMessageContentsZ_none() {
26625         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26626         *ret_copy = COption_OnionMessageContentsZ_none();
26627         int64_t ret_ref = tag_ptr(ret_copy, true);
26628         return ret_ref;
26629 }
26630
26631 void  CS_LDK_COption_OnionMessageContentsZ_free(int64_t _res) {
26632         if (!ptr_is_owned(_res)) return;
26633         void* _res_ptr = untag_ptr(_res);
26634         CHECK_ACCESS(_res_ptr);
26635         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
26636         FREE(untag_ptr(_res));
26637         COption_OnionMessageContentsZ_free(_res_conv);
26638 }
26639
26640 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
26641         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26642         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
26643         int64_t ret_ref = tag_ptr(ret_copy, true);
26644         return ret_ref;
26645 }
26646 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone_ptr(int64_t arg) {
26647         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
26648         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
26649         return ret_conv;
26650 }
26651
26652 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone(int64_t orig) {
26653         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
26654         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26655         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
26656         int64_t ret_ref = tag_ptr(ret_copy, true);
26657         return ret_ref;
26658 }
26659
26660 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(int64_t o) {
26661         void* o_ptr = untag_ptr(o);
26662         CHECK_ACCESS(o_ptr);
26663         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
26664         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
26665         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26666         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
26667         return tag_ptr(ret_conv, true);
26668 }
26669
26670 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(int64_t e) {
26671         void* e_ptr = untag_ptr(e);
26672         CHECK_ACCESS(e_ptr);
26673         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26674         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26675         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26676         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
26677         return tag_ptr(ret_conv, true);
26678 }
26679
26680 jboolean  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(int64_t o) {
26681         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26682         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26683         return ret_conv;
26684 }
26685
26686 void  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(int64_t _res) {
26687         if (!ptr_is_owned(_res)) return;
26688         void* _res_ptr = untag_ptr(_res);
26689         CHECK_ACCESS(_res_ptr);
26690         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26691         FREE(untag_ptr(_res));
26692         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
26693 }
26694
26695 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26696         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26697         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
26698         return tag_ptr(ret_conv, true);
26699 }
26700 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(int64_t arg) {
26701         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26702         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26703         return ret_conv;
26704 }
26705
26706 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(int64_t orig) {
26707         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26708         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26709         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26710         return tag_ptr(ret_conv, true);
26711 }
26712
26713 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
26714         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26715         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
26716         return tag_ptr(ret_conv, true);
26717 }
26718 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(int64_t arg) {
26719         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
26720         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
26721         return ret_conv;
26722 }
26723
26724 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(int64_t orig) {
26725         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
26726         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26727         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
26728         return tag_ptr(ret_conv, true);
26729 }
26730
26731 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
26732         void* a_ptr = untag_ptr(a);
26733         CHECK_ACCESS(a_ptr);
26734         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
26735         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
26736                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26737                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
26738         }
26739         void* b_ptr = untag_ptr(b);
26740         CHECK_ACCESS(b_ptr);
26741         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26742         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26743         LDKBlindedPath c_conv;
26744         c_conv.inner = untag_ptr(c);
26745         c_conv.is_owned = ptr_is_owned(c);
26746         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26747         c_conv = BlindedPath_clone(&c_conv);
26748         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26749         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 void  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(int64_t _res) {
26754         if (!ptr_is_owned(_res)) return;
26755         void* _res_ptr = untag_ptr(_res);
26756         CHECK_ACCESS(_res_ptr);
26757         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
26758         FREE(untag_ptr(_res));
26759         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
26760 }
26761
26762 void  CS_LDK_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(int64_tArray _res) {
26763         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
26764         _res_constr.datalen = _res->arr_len;
26765         if (_res_constr.datalen > 0)
26766                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
26767         else
26768                 _res_constr.data = NULL;
26769         int64_t* _res_vals = _res->elems;
26770         for (size_t e = 0; e < _res_constr.datalen; e++) {
26771                 int64_t _res_conv_56 = _res_vals[e];
26772                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
26773                 CHECK_ACCESS(_res_conv_56_ptr);
26774                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
26775                 FREE(untag_ptr(_res_conv_56));
26776                 _res_constr.data[e] = _res_conv_56_conv;
26777         }
26778         FREE(_res);
26779         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
26780 }
26781
26782 int64_t  CS_LDK_COption_TypeZ_some(int64_t o) {
26783         void* o_ptr = untag_ptr(o);
26784         CHECK_ACCESS(o_ptr);
26785         LDKType o_conv = *(LDKType*)(o_ptr);
26786         if (o_conv.free == LDKType_JCalls_free) {
26787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26788                 LDKType_JCalls_cloned(&o_conv);
26789         }
26790         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26791         *ret_copy = COption_TypeZ_some(o_conv);
26792         int64_t ret_ref = tag_ptr(ret_copy, true);
26793         return ret_ref;
26794 }
26795
26796 int64_t  CS_LDK_COption_TypeZ_none() {
26797         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26798         *ret_copy = COption_TypeZ_none();
26799         int64_t ret_ref = tag_ptr(ret_copy, true);
26800         return ret_ref;
26801 }
26802
26803 void  CS_LDK_COption_TypeZ_free(int64_t _res) {
26804         if (!ptr_is_owned(_res)) return;
26805         void* _res_ptr = untag_ptr(_res);
26806         CHECK_ACCESS(_res_ptr);
26807         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26808         FREE(untag_ptr(_res));
26809         COption_TypeZ_free(_res_conv);
26810 }
26811
26812 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26813         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26814         *ret_copy = COption_TypeZ_clone(arg);
26815         int64_t ret_ref = tag_ptr(ret_copy, true);
26816         return ret_ref;
26817 }
26818 int64_t  CS_LDK_COption_TypeZ_clone_ptr(int64_t arg) {
26819         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26820         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26821         return ret_conv;
26822 }
26823
26824 int64_t  CS_LDK_COption_TypeZ_clone(int64_t orig) {
26825         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26826         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26827         *ret_copy = COption_TypeZ_clone(orig_conv);
26828         int64_t ret_ref = tag_ptr(ret_copy, true);
26829         return ret_ref;
26830 }
26831
26832 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_ok(int64_t o) {
26833         void* o_ptr = untag_ptr(o);
26834         CHECK_ACCESS(o_ptr);
26835         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26836         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26837         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26838         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26839         return tag_ptr(ret_conv, true);
26840 }
26841
26842 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_err(int64_t e) {
26843         void* e_ptr = untag_ptr(e);
26844         CHECK_ACCESS(e_ptr);
26845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26847         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26848         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26849         return tag_ptr(ret_conv, true);
26850 }
26851
26852 jboolean  CS_LDK_CResult_COption_TypeZDecodeErrorZ_is_ok(int64_t o) {
26853         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26854         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26855         return ret_conv;
26856 }
26857
26858 void  CS_LDK_CResult_COption_TypeZDecodeErrorZ_free(int64_t _res) {
26859         if (!ptr_is_owned(_res)) return;
26860         void* _res_ptr = untag_ptr(_res);
26861         CHECK_ACCESS(_res_ptr);
26862         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26863         FREE(untag_ptr(_res));
26864         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26865 }
26866
26867 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26868         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26869         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26870         return tag_ptr(ret_conv, true);
26871 }
26872 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone_ptr(int64_t arg) {
26873         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26874         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26875         return ret_conv;
26876 }
26877
26878 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone(int64_t orig) {
26879         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26880         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26881         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26882         return tag_ptr(ret_conv, true);
26883 }
26884
26885 int64_t  CS_LDK_COption_SocketAddressZ_some(int64_t o) {
26886         void* o_ptr = untag_ptr(o);
26887         CHECK_ACCESS(o_ptr);
26888         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
26889         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
26890         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26891         *ret_copy = COption_SocketAddressZ_some(o_conv);
26892         int64_t ret_ref = tag_ptr(ret_copy, true);
26893         return ret_ref;
26894 }
26895
26896 int64_t  CS_LDK_COption_SocketAddressZ_none() {
26897         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26898         *ret_copy = COption_SocketAddressZ_none();
26899         int64_t ret_ref = tag_ptr(ret_copy, true);
26900         return ret_ref;
26901 }
26902
26903 void  CS_LDK_COption_SocketAddressZ_free(int64_t _res) {
26904         if (!ptr_is_owned(_res)) return;
26905         void* _res_ptr = untag_ptr(_res);
26906         CHECK_ACCESS(_res_ptr);
26907         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
26908         FREE(untag_ptr(_res));
26909         COption_SocketAddressZ_free(_res_conv);
26910 }
26911
26912 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
26913         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26914         *ret_copy = COption_SocketAddressZ_clone(arg);
26915         int64_t ret_ref = tag_ptr(ret_copy, true);
26916         return ret_ref;
26917 }
26918 int64_t  CS_LDK_COption_SocketAddressZ_clone_ptr(int64_t arg) {
26919         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
26920         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
26921         return ret_conv;
26922 }
26923
26924 int64_t  CS_LDK_COption_SocketAddressZ_clone(int64_t orig) {
26925         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
26926         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26927         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
26928         int64_t ret_ref = tag_ptr(ret_copy, true);
26929         return ret_ref;
26930 }
26931
26932 void  CS_LDK_CVec_PeerDetailsZ_free(int64_tArray _res) {
26933         LDKCVec_PeerDetailsZ _res_constr;
26934         _res_constr.datalen = _res->arr_len;
26935         if (_res_constr.datalen > 0)
26936                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
26937         else
26938                 _res_constr.data = NULL;
26939         int64_t* _res_vals = _res->elems;
26940         for (size_t n = 0; n < _res_constr.datalen; n++) {
26941                 int64_t _res_conv_13 = _res_vals[n];
26942                 LDKPeerDetails _res_conv_13_conv;
26943                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
26944                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
26945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
26946                 _res_constr.data[n] = _res_conv_13_conv;
26947         }
26948         FREE(_res);
26949         CVec_PeerDetailsZ_free(_res_constr);
26950 }
26951
26952 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
26953         LDKCVec_u8Z o_ref;
26954         o_ref.datalen = o->arr_len;
26955         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26956         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26957         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26958         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26959         return tag_ptr(ret_conv, true);
26960 }
26961
26962 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_err(int64_t e) {
26963         LDKPeerHandleError e_conv;
26964         e_conv.inner = untag_ptr(e);
26965         e_conv.is_owned = ptr_is_owned(e);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26967         e_conv = PeerHandleError_clone(&e_conv);
26968         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26969         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26970         return tag_ptr(ret_conv, true);
26971 }
26972
26973 jboolean  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(int64_t o) {
26974         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26975         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26976         return ret_conv;
26977 }
26978
26979 void  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_free(int64_t _res) {
26980         if (!ptr_is_owned(_res)) return;
26981         void* _res_ptr = untag_ptr(_res);
26982         CHECK_ACCESS(_res_ptr);
26983         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26984         FREE(untag_ptr(_res));
26985         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26986 }
26987
26988 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26989         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26990         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26991         return tag_ptr(ret_conv, true);
26992 }
26993 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(int64_t arg) {
26994         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26995         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26996         return ret_conv;
26997 }
26998
26999 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone(int64_t orig) {
27000         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
27001         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
27002         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
27003         return tag_ptr(ret_conv, true);
27004 }
27005
27006 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_ok() {
27007         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27008         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
27009         return tag_ptr(ret_conv, true);
27010 }
27011
27012 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_err(int64_t e) {
27013         LDKPeerHandleError e_conv;
27014         e_conv.inner = untag_ptr(e);
27015         e_conv.is_owned = ptr_is_owned(e);
27016         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27017         e_conv = PeerHandleError_clone(&e_conv);
27018         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27019         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
27020         return tag_ptr(ret_conv, true);
27021 }
27022
27023 jboolean  CS_LDK_CResult_NonePeerHandleErrorZ_is_ok(int64_t o) {
27024         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
27025         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
27026         return ret_conv;
27027 }
27028
27029 void  CS_LDK_CResult_NonePeerHandleErrorZ_free(int64_t _res) {
27030         if (!ptr_is_owned(_res)) return;
27031         void* _res_ptr = untag_ptr(_res);
27032         CHECK_ACCESS(_res_ptr);
27033         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
27034         FREE(untag_ptr(_res));
27035         CResult_NonePeerHandleErrorZ_free(_res_conv);
27036 }
27037
27038 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
27039         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27040         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
27041         return tag_ptr(ret_conv, true);
27042 }
27043 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone_ptr(int64_t arg) {
27044         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
27045         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
27046         return ret_conv;
27047 }
27048
27049 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone(int64_t orig) {
27050         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
27051         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
27052         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
27053         return tag_ptr(ret_conv, true);
27054 }
27055
27056 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
27057         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27058         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
27059         return tag_ptr(ret_conv, true);
27060 }
27061
27062 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_err(int64_t e) {
27063         LDKPeerHandleError e_conv;
27064         e_conv.inner = untag_ptr(e);
27065         e_conv.is_owned = ptr_is_owned(e);
27066         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
27067         e_conv = PeerHandleError_clone(&e_conv);
27068         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27069         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
27070         return tag_ptr(ret_conv, true);
27071 }
27072
27073 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_is_ok(int64_t o) {
27074         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
27075         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
27076         return ret_conv;
27077 }
27078
27079 void  CS_LDK_CResult_boolPeerHandleErrorZ_free(int64_t _res) {
27080         if (!ptr_is_owned(_res)) return;
27081         void* _res_ptr = untag_ptr(_res);
27082         CHECK_ACCESS(_res_ptr);
27083         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
27084         FREE(untag_ptr(_res));
27085         CResult_boolPeerHandleErrorZ_free(_res_conv);
27086 }
27087
27088 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
27089         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27090         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
27091         return tag_ptr(ret_conv, true);
27092 }
27093 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone_ptr(int64_t arg) {
27094         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
27095         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
27096         return ret_conv;
27097 }
27098
27099 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone(int64_t orig) {
27100         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
27101         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27102         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
27103         return tag_ptr(ret_conv, true);
27104 }
27105
27106 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
27107         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27108         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
27109         return tag_ptr(ret_conv, true);
27110 }
27111
27112 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_err(int64_t e) {
27113         void* e_ptr = untag_ptr(e);
27114         CHECK_ACCESS(e_ptr);
27115         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
27116         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
27117         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27118         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
27119         return tag_ptr(ret_conv, true);
27120 }
27121
27122 jboolean  CS_LDK_CResult_u32GraphSyncErrorZ_is_ok(int64_t o) {
27123         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
27124         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
27125         return ret_conv;
27126 }
27127
27128 void  CS_LDK_CResult_u32GraphSyncErrorZ_free(int64_t _res) {
27129         if (!ptr_is_owned(_res)) return;
27130         void* _res_ptr = untag_ptr(_res);
27131         CHECK_ACCESS(_res_ptr);
27132         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
27133         FREE(untag_ptr(_res));
27134         CResult_u32GraphSyncErrorZ_free(_res_conv);
27135 }
27136
27137 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
27138         LDKCVec_u8Z o_ref;
27139         o_ref.datalen = o->arr_len;
27140         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27141         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
27142         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27143         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
27144         return tag_ptr(ret_conv, true);
27145 }
27146
27147 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_err(int32_t e) {
27148         LDKIOError e_conv = LDKIOError_from_cs(e);
27149         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27150         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
27151         return tag_ptr(ret_conv, true);
27152 }
27153
27154 jboolean  CS_LDK_CResult_CVec_u8ZIOErrorZ_is_ok(int64_t o) {
27155         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
27156         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
27157         return ret_conv;
27158 }
27159
27160 void  CS_LDK_CResult_CVec_u8ZIOErrorZ_free(int64_t _res) {
27161         if (!ptr_is_owned(_res)) return;
27162         void* _res_ptr = untag_ptr(_res);
27163         CHECK_ACCESS(_res_ptr);
27164         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
27165         FREE(untag_ptr(_res));
27166         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
27167 }
27168
27169 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
27170         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27171         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
27172         return tag_ptr(ret_conv, true);
27173 }
27174 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone_ptr(int64_t arg) {
27175         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
27176         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
27177         return ret_conv;
27178 }
27179
27180 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone(int64_t orig) {
27181         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
27182         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27183         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
27184         return tag_ptr(ret_conv, true);
27185 }
27186
27187 void  CS_LDK_CVec_StrZ_free(ptrArray _res) {
27188         LDKCVec_StrZ _res_constr;
27189         _res_constr.datalen = _res->arr_len;
27190         if (_res_constr.datalen > 0)
27191                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27192         else
27193                 _res_constr.data = NULL;
27194         jstring* _res_vals = (void*) _res->elems;
27195         for (size_t i = 0; i < _res_constr.datalen; i++) {
27196                 jstring _res_conv_8 = _res_vals[i];
27197                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27198                 _res_constr.data[i] = dummy;
27199         }
27200         FREE(_res);
27201         CVec_StrZ_free(_res_constr);
27202 }
27203
27204 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
27205         LDKCVec_StrZ o_constr;
27206         o_constr.datalen = o->arr_len;
27207         if (o_constr.datalen > 0)
27208                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27209         else
27210                 o_constr.data = NULL;
27211         jstring* o_vals = (void*) o->elems;
27212         for (size_t i = 0; i < o_constr.datalen; i++) {
27213                 jstring o_conv_8 = o_vals[i];
27214                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
27215                 o_constr.data[i] = o_conv_8_conv;
27216         }
27217         FREE(o);
27218         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27219         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
27220         return tag_ptr(ret_conv, true);
27221 }
27222
27223 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_err(int32_t e) {
27224         LDKIOError e_conv = LDKIOError_from_cs(e);
27225         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27226         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
27227         return tag_ptr(ret_conv, true);
27228 }
27229
27230 jboolean  CS_LDK_CResult_CVec_StrZIOErrorZ_is_ok(int64_t o) {
27231         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
27232         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
27233         return ret_conv;
27234 }
27235
27236 void  CS_LDK_CResult_CVec_StrZIOErrorZ_free(int64_t _res) {
27237         if (!ptr_is_owned(_res)) return;
27238         void* _res_ptr = untag_ptr(_res);
27239         CHECK_ACCESS(_res_ptr);
27240         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
27241         FREE(untag_ptr(_res));
27242         CResult_CVec_StrZIOErrorZ_free(_res_conv);
27243 }
27244
27245 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
27246         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27247         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
27248         return tag_ptr(ret_conv, true);
27249 }
27250 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone_ptr(int64_t arg) {
27251         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
27252         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
27253         return ret_conv;
27254 }
27255
27256 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone(int64_t orig) {
27257         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
27258         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27259         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
27260         return tag_ptr(ret_conv, true);
27261 }
27262
27263 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(int64_tArray _res) {
27264         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
27265         _res_constr.datalen = _res->arr_len;
27266         if (_res_constr.datalen > 0)
27267                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27268         else
27269                 _res_constr.data = NULL;
27270         int64_t* _res_vals = _res->elems;
27271         for (size_t o = 0; o < _res_constr.datalen; o++) {
27272                 int64_t _res_conv_40 = _res_vals[o];
27273                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27274                 CHECK_ACCESS(_res_conv_40_ptr);
27275                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
27276                 FREE(untag_ptr(_res_conv_40));
27277                 _res_constr.data[o] = _res_conv_40_conv;
27278         }
27279         FREE(_res);
27280         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
27281 }
27282
27283 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(int64_tArray o) {
27284         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
27285         o_constr.datalen = o->arr_len;
27286         if (o_constr.datalen > 0)
27287                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27288         else
27289                 o_constr.data = NULL;
27290         int64_t* o_vals = o->elems;
27291         for (size_t o = 0; o < o_constr.datalen; o++) {
27292                 int64_t o_conv_40 = o_vals[o];
27293                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27294                 CHECK_ACCESS(o_conv_40_ptr);
27295                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
27296                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
27297                 o_constr.data[o] = o_conv_40_conv;
27298         }
27299         FREE(o);
27300         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27301         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
27302         return tag_ptr(ret_conv, true);
27303 }
27304
27305 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(int32_t e) {
27306         LDKIOError e_conv = LDKIOError_from_cs(e);
27307         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27308         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
27309         return tag_ptr(ret_conv, true);
27310 }
27311
27312 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(int64_t o) {
27313         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
27314         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
27315         return ret_conv;
27316 }
27317
27318 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(int64_t _res) {
27319         if (!ptr_is_owned(_res)) return;
27320         void* _res_ptr = untag_ptr(_res);
27321         CHECK_ACCESS(_res_ptr);
27322         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
27323         FREE(untag_ptr(_res));
27324         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
27325 }
27326
27327 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
27328         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27329         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
27330         return tag_ptr(ret_conv, true);
27331 }
27332 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(int64_t arg) {
27333         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
27334         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
27335         return ret_conv;
27336 }
27337
27338 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(int64_t orig) {
27339         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
27340         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27341         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
27342         return tag_ptr(ret_conv, true);
27343 }
27344
27345 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(int64_t o) {
27346         void* o_ptr = untag_ptr(o);
27347         CHECK_ACCESS(o_ptr);
27348         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27349         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27350         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27351         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
27352         return tag_ptr(ret_conv, true);
27353 }
27354
27355 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(int32_t e) {
27356         LDKIOError e_conv = LDKIOError_from_cs(e);
27357         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27358         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
27359         return tag_ptr(ret_conv, true);
27360 }
27361
27362 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(int64_t o) {
27363         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
27364         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
27365         return ret_conv;
27366 }
27367
27368 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(int64_t _res) {
27369         if (!ptr_is_owned(_res)) return;
27370         void* _res_ptr = untag_ptr(_res);
27371         CHECK_ACCESS(_res_ptr);
27372         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
27373         FREE(untag_ptr(_res));
27374         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
27375 }
27376
27377 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
27378         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27379         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
27380         return tag_ptr(ret_conv, true);
27381 }
27382 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(int64_t arg) {
27383         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
27384         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
27385         return ret_conv;
27386 }
27387
27388 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(int64_t orig) {
27389         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
27390         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27391         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
27392         return tag_ptr(ret_conv, true);
27393 }
27394
27395 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(int64_t o) {
27396         LDKUnsignedInvoiceRequest o_conv;
27397         o_conv.inner = untag_ptr(o);
27398         o_conv.is_owned = ptr_is_owned(o);
27399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27400         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
27401         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27402         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27403         return tag_ptr(ret_conv, true);
27404 }
27405
27406 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(int32_t e) {
27407         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27408         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27409         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27410         return tag_ptr(ret_conv, true);
27411 }
27412
27413 jboolean  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(int64_t o) {
27414         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27415         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27416         return ret_conv;
27417 }
27418
27419 void  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(int64_t _res) {
27420         if (!ptr_is_owned(_res)) return;
27421         void* _res_ptr = untag_ptr(_res);
27422         CHECK_ACCESS(_res_ptr);
27423         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27424         FREE(untag_ptr(_res));
27425         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27426 }
27427
27428 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27429         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27430         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
27431         return tag_ptr(ret_conv, true);
27432 }
27433 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
27434         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27435         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27436         return ret_conv;
27437 }
27438
27439 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(int64_t orig) {
27440         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27441         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27442         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27443         return tag_ptr(ret_conv, true);
27444 }
27445
27446 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_ok(int64_t o) {
27447         LDKInvoiceRequest o_conv;
27448         o_conv.inner = untag_ptr(o);
27449         o_conv.is_owned = ptr_is_owned(o);
27450         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27451         o_conv = InvoiceRequest_clone(&o_conv);
27452         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27453         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27454         return tag_ptr(ret_conv, true);
27455 }
27456
27457 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_err(int32_t e) {
27458         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27459         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27460         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27461         return tag_ptr(ret_conv, true);
27462 }
27463
27464 jboolean  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(int64_t o) {
27465         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27466         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27467         return ret_conv;
27468 }
27469
27470 void  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_free(int64_t _res) {
27471         if (!ptr_is_owned(_res)) return;
27472         void* _res_ptr = untag_ptr(_res);
27473         CHECK_ACCESS(_res_ptr);
27474         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27475         FREE(untag_ptr(_res));
27476         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27477 }
27478
27479 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27480         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27481         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
27482         return tag_ptr(ret_conv, true);
27483 }
27484 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
27485         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27486         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27487         return ret_conv;
27488 }
27489
27490 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_clone(int64_t orig) {
27491         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27492         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27493         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27494         return tag_ptr(ret_conv, true);
27495 }
27496
27497 int64_t  CS_LDK_COption_SecretKeyZ_some(int8_tArray o) {
27498         LDKSecretKey o_ref;
27499         CHECK(o->arr_len == 32);
27500         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
27501         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27502         *ret_copy = COption_SecretKeyZ_some(o_ref);
27503         int64_t ret_ref = tag_ptr(ret_copy, true);
27504         return ret_ref;
27505 }
27506
27507 int64_t  CS_LDK_COption_SecretKeyZ_none() {
27508         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27509         *ret_copy = COption_SecretKeyZ_none();
27510         int64_t ret_ref = tag_ptr(ret_copy, true);
27511         return ret_ref;
27512 }
27513
27514 void  CS_LDK_COption_SecretKeyZ_free(int64_t _res) {
27515         if (!ptr_is_owned(_res)) return;
27516         void* _res_ptr = untag_ptr(_res);
27517         CHECK_ACCESS(_res_ptr);
27518         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
27519         FREE(untag_ptr(_res));
27520         COption_SecretKeyZ_free(_res_conv);
27521 }
27522
27523 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
27524         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27525         *ret_copy = COption_SecretKeyZ_clone(arg);
27526         int64_t ret_ref = tag_ptr(ret_copy, true);
27527         return ret_ref;
27528 }
27529 int64_t  CS_LDK_COption_SecretKeyZ_clone_ptr(int64_t arg) {
27530         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
27531         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
27532         return ret_conv;
27533 }
27534
27535 int64_t  CS_LDK_COption_SecretKeyZ_clone(int64_t orig) {
27536         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
27537         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27538         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
27539         int64_t ret_ref = tag_ptr(ret_copy, true);
27540         return ret_ref;
27541 }
27542
27543 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(int64_t o) {
27544         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
27545         o_conv.inner = untag_ptr(o);
27546         o_conv.is_owned = ptr_is_owned(o);
27547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27548         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
27549         
27550         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27551         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27552         return tag_ptr(ret_conv, true);
27553 }
27554
27555 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(int32_t e) {
27556         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27557         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27558         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27559         return tag_ptr(ret_conv, true);
27560 }
27561
27562 jboolean  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
27563         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27564         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27565         return ret_conv;
27566 }
27567
27568 void  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(int64_t _res) {
27569         if (!ptr_is_owned(_res)) return;
27570         void* _res_ptr = untag_ptr(_res);
27571         CHECK_ACCESS(_res_ptr);
27572         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27573         FREE(untag_ptr(_res));
27574         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27575 }
27576
27577 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_ok(int64_t o) {
27578         LDKVerifiedInvoiceRequest o_conv;
27579         o_conv.inner = untag_ptr(o);
27580         o_conv.is_owned = ptr_is_owned(o);
27581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27582         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
27583         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27584         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
27585         return tag_ptr(ret_conv, true);
27586 }
27587
27588 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_err() {
27589         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27590         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
27591         return tag_ptr(ret_conv, true);
27592 }
27593
27594 jboolean  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_is_ok(int64_t o) {
27595         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
27596         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
27597         return ret_conv;
27598 }
27599
27600 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_free(int64_t _res) {
27601         if (!ptr_is_owned(_res)) return;
27602         void* _res_ptr = untag_ptr(_res);
27603         CHECK_ACCESS(_res_ptr);
27604         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
27605         FREE(untag_ptr(_res));
27606         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
27607 }
27608
27609 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
27610         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27611         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
27612         return tag_ptr(ret_conv, true);
27613 }
27614 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(int64_t arg) {
27615         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
27616         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
27617         return ret_conv;
27618 }
27619
27620 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone(int64_t orig) {
27621         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
27622         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27623         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
27624         return tag_ptr(ret_conv, true);
27625 }
27626
27627 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(int64_t o) {
27628         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
27629         o_conv.inner = untag_ptr(o);
27630         o_conv.is_owned = ptr_is_owned(o);
27631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27632         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
27633         
27634         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27635         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27636         return tag_ptr(ret_conv, true);
27637 }
27638
27639 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(int32_t e) {
27640         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27641         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27642         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27643         return tag_ptr(ret_conv, true);
27644 }
27645
27646 jboolean  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
27647         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27648         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27649         return ret_conv;
27650 }
27651
27652 void  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(int64_t _res) {
27653         if (!ptr_is_owned(_res)) return;
27654         void* _res_ptr = untag_ptr(_res);
27655         CHECK_ACCESS(_res_ptr);
27656         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27657         FREE(untag_ptr(_res));
27658         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27659 }
27660
27661 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_ok(int64_t o) {
27662         LDKInvoiceRequestFields o_conv;
27663         o_conv.inner = untag_ptr(o);
27664         o_conv.is_owned = ptr_is_owned(o);
27665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27666         o_conv = InvoiceRequestFields_clone(&o_conv);
27667         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27668         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
27669         return tag_ptr(ret_conv, true);
27670 }
27671
27672 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_err(int64_t e) {
27673         void* e_ptr = untag_ptr(e);
27674         CHECK_ACCESS(e_ptr);
27675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27677         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27678         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 jboolean  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(int64_t o) {
27683         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
27684         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
27685         return ret_conv;
27686 }
27687
27688 void  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_free(int64_t _res) {
27689         if (!ptr_is_owned(_res)) return;
27690         void* _res_ptr = untag_ptr(_res);
27691         CHECK_ACCESS(_res_ptr);
27692         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
27693         FREE(untag_ptr(_res));
27694         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
27695 }
27696
27697 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
27698         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27699         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
27700         return tag_ptr(ret_conv, true);
27701 }
27702 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
27703         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
27704         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
27705         return ret_conv;
27706 }
27707
27708 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_clone(int64_t orig) {
27709         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
27710         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27711         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
27712         return tag_ptr(ret_conv, true);
27713 }
27714
27715 int32_t  CS_LDK_COption_NoneZ_some() {
27716         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_some());
27717         return ret_conv;
27718 }
27719
27720 int32_t  CS_LDK_COption_NoneZ_none() {
27721         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_none());
27722         return ret_conv;
27723 }
27724
27725 void  CS_LDK_COption_NoneZ_free(int32_t _res) {
27726         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_cs(_res);
27727         COption_NoneZ_free(_res_conv);
27728 }
27729
27730 void  CS_LDK_CVec_WitnessZ_free(ptrArray _res) {
27731         LDKCVec_WitnessZ _res_constr;
27732         _res_constr.datalen = _res->arr_len;
27733         if (_res_constr.datalen > 0)
27734                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
27735         else
27736                 _res_constr.data = NULL;
27737         int8_tArray* _res_vals = (void*) _res->elems;
27738         for (size_t i = 0; i < _res_constr.datalen; i++) {
27739                 int8_tArray _res_conv_8 = _res_vals[i];
27740                 LDKWitness _res_conv_8_ref;
27741                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
27742                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
27743                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
27744                 _res_conv_8_ref.data_is_owned = true;
27745                 _res_constr.data[i] = _res_conv_8_ref;
27746         }
27747         FREE(_res);
27748         CVec_WitnessZ_free(_res_constr);
27749 }
27750
27751 int64_t  CS_LDK_COption_ECDSASignatureZ_some(int8_tArray o) {
27752         LDKECDSASignature o_ref;
27753         CHECK(o->arr_len == 64);
27754         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
27755         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27756         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
27757         int64_t ret_ref = tag_ptr(ret_copy, true);
27758         return ret_ref;
27759 }
27760
27761 int64_t  CS_LDK_COption_ECDSASignatureZ_none() {
27762         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27763         *ret_copy = COption_ECDSASignatureZ_none();
27764         int64_t ret_ref = tag_ptr(ret_copy, true);
27765         return ret_ref;
27766 }
27767
27768 void  CS_LDK_COption_ECDSASignatureZ_free(int64_t _res) {
27769         if (!ptr_is_owned(_res)) return;
27770         void* _res_ptr = untag_ptr(_res);
27771         CHECK_ACCESS(_res_ptr);
27772         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
27773         FREE(untag_ptr(_res));
27774         COption_ECDSASignatureZ_free(_res_conv);
27775 }
27776
27777 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
27778         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27779         *ret_copy = COption_ECDSASignatureZ_clone(arg);
27780         int64_t ret_ref = tag_ptr(ret_copy, true);
27781         return ret_ref;
27782 }
27783 int64_t  CS_LDK_COption_ECDSASignatureZ_clone_ptr(int64_t arg) {
27784         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
27785         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
27786         return ret_conv;
27787 }
27788
27789 int64_t  CS_LDK_COption_ECDSASignatureZ_clone(int64_t orig) {
27790         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
27791         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27792         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
27793         int64_t ret_ref = tag_ptr(ret_copy, true);
27794         return ret_ref;
27795 }
27796
27797 int64_t  CS_LDK_COption_i64Z_some(int64_t o) {
27798         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27799         *ret_copy = COption_i64Z_some(o);
27800         int64_t ret_ref = tag_ptr(ret_copy, true);
27801         return ret_ref;
27802 }
27803
27804 int64_t  CS_LDK_COption_i64Z_none() {
27805         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27806         *ret_copy = COption_i64Z_none();
27807         int64_t ret_ref = tag_ptr(ret_copy, true);
27808         return ret_ref;
27809 }
27810
27811 void  CS_LDK_COption_i64Z_free(int64_t _res) {
27812         if (!ptr_is_owned(_res)) return;
27813         void* _res_ptr = untag_ptr(_res);
27814         CHECK_ACCESS(_res_ptr);
27815         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
27816         FREE(untag_ptr(_res));
27817         COption_i64Z_free(_res_conv);
27818 }
27819
27820 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
27821         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27822         *ret_copy = COption_i64Z_clone(arg);
27823         int64_t ret_ref = tag_ptr(ret_copy, true);
27824         return ret_ref;
27825 }
27826 int64_t  CS_LDK_COption_i64Z_clone_ptr(int64_t arg) {
27827         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
27828         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
27829         return ret_conv;
27830 }
27831
27832 int64_t  CS_LDK_COption_i64Z_clone(int64_t orig) {
27833         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
27834         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27835         *ret_copy = COption_i64Z_clone(orig_conv);
27836         int64_t ret_ref = tag_ptr(ret_copy, true);
27837         return ret_ref;
27838 }
27839
27840 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_ok(int64_t o) {
27841         void* o_ptr = untag_ptr(o);
27842         CHECK_ACCESS(o_ptr);
27843         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27844         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27845         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27846         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
27847         return tag_ptr(ret_conv, true);
27848 }
27849
27850 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_err(int64_t e) {
27851         void* e_ptr = untag_ptr(e);
27852         CHECK_ACCESS(e_ptr);
27853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27855         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27856         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
27857         return tag_ptr(ret_conv, true);
27858 }
27859
27860 jboolean  CS_LDK_CResult_SocketAddressDecodeErrorZ_is_ok(int64_t o) {
27861         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
27862         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
27863         return ret_conv;
27864 }
27865
27866 void  CS_LDK_CResult_SocketAddressDecodeErrorZ_free(int64_t _res) {
27867         if (!ptr_is_owned(_res)) return;
27868         void* _res_ptr = untag_ptr(_res);
27869         CHECK_ACCESS(_res_ptr);
27870         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
27871         FREE(untag_ptr(_res));
27872         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
27873 }
27874
27875 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
27876         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27877         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
27878         return tag_ptr(ret_conv, true);
27879 }
27880 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone_ptr(int64_t arg) {
27881         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
27882         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
27883         return ret_conv;
27884 }
27885
27886 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone(int64_t orig) {
27887         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
27888         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27889         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
27890         return tag_ptr(ret_conv, true);
27891 }
27892
27893 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_ok(int64_t o) {
27894         void* o_ptr = untag_ptr(o);
27895         CHECK_ACCESS(o_ptr);
27896         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27897         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27898         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27899         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
27900         return tag_ptr(ret_conv, true);
27901 }
27902
27903 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_err(int32_t e) {
27904         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_cs(e);
27905         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27906         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
27907         return tag_ptr(ret_conv, true);
27908 }
27909
27910 jboolean  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(int64_t o) {
27911         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
27912         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
27913         return ret_conv;
27914 }
27915
27916 void  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_free(int64_t _res) {
27917         if (!ptr_is_owned(_res)) return;
27918         void* _res_ptr = untag_ptr(_res);
27919         CHECK_ACCESS(_res_ptr);
27920         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
27921         FREE(untag_ptr(_res));
27922         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
27923 }
27924
27925 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
27926         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27927         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
27928         return tag_ptr(ret_conv, true);
27929 }
27930 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(int64_t arg) {
27931         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
27932         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
27933         return ret_conv;
27934 }
27935
27936 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone(int64_t orig) {
27937         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
27938         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27939         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
27940         return tag_ptr(ret_conv, true);
27941 }
27942
27943 void  CS_LDK_CVec_UpdateAddHTLCZ_free(int64_tArray _res) {
27944         LDKCVec_UpdateAddHTLCZ _res_constr;
27945         _res_constr.datalen = _res->arr_len;
27946         if (_res_constr.datalen > 0)
27947                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27948         else
27949                 _res_constr.data = NULL;
27950         int64_t* _res_vals = _res->elems;
27951         for (size_t p = 0; p < _res_constr.datalen; p++) {
27952                 int64_t _res_conv_15 = _res_vals[p];
27953                 LDKUpdateAddHTLC _res_conv_15_conv;
27954                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
27955                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
27956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
27957                 _res_constr.data[p] = _res_conv_15_conv;
27958         }
27959         FREE(_res);
27960         CVec_UpdateAddHTLCZ_free(_res_constr);
27961 }
27962
27963 void  CS_LDK_CVec_UpdateFulfillHTLCZ_free(int64_tArray _res) {
27964         LDKCVec_UpdateFulfillHTLCZ _res_constr;
27965         _res_constr.datalen = _res->arr_len;
27966         if (_res_constr.datalen > 0)
27967                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27968         else
27969                 _res_constr.data = NULL;
27970         int64_t* _res_vals = _res->elems;
27971         for (size_t t = 0; t < _res_constr.datalen; t++) {
27972                 int64_t _res_conv_19 = _res_vals[t];
27973                 LDKUpdateFulfillHTLC _res_conv_19_conv;
27974                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
27975                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
27976                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
27977                 _res_constr.data[t] = _res_conv_19_conv;
27978         }
27979         FREE(_res);
27980         CVec_UpdateFulfillHTLCZ_free(_res_constr);
27981 }
27982
27983 void  CS_LDK_CVec_UpdateFailHTLCZ_free(int64_tArray _res) {
27984         LDKCVec_UpdateFailHTLCZ _res_constr;
27985         _res_constr.datalen = _res->arr_len;
27986         if (_res_constr.datalen > 0)
27987                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27988         else
27989                 _res_constr.data = NULL;
27990         int64_t* _res_vals = _res->elems;
27991         for (size_t q = 0; q < _res_constr.datalen; q++) {
27992                 int64_t _res_conv_16 = _res_vals[q];
27993                 LDKUpdateFailHTLC _res_conv_16_conv;
27994                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
27995                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
27996                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
27997                 _res_constr.data[q] = _res_conv_16_conv;
27998         }
27999         FREE(_res);
28000         CVec_UpdateFailHTLCZ_free(_res_constr);
28001 }
28002
28003 void  CS_LDK_CVec_UpdateFailMalformedHTLCZ_free(int64_tArray _res) {
28004         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
28005         _res_constr.datalen = _res->arr_len;
28006         if (_res_constr.datalen > 0)
28007                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
28008         else
28009                 _res_constr.data = NULL;
28010         int64_t* _res_vals = _res->elems;
28011         for (size_t z = 0; z < _res_constr.datalen; z++) {
28012                 int64_t _res_conv_25 = _res_vals[z];
28013                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
28014                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
28015                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
28016                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
28017                 _res_constr.data[z] = _res_conv_25_conv;
28018         }
28019         FREE(_res);
28020         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
28021 }
28022
28023 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_ok(int64_t o) {
28024         LDKAcceptChannel o_conv;
28025         o_conv.inner = untag_ptr(o);
28026         o_conv.is_owned = ptr_is_owned(o);
28027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28028         o_conv = AcceptChannel_clone(&o_conv);
28029         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28030         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
28031         return tag_ptr(ret_conv, true);
28032 }
28033
28034 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_err(int64_t e) {
28035         void* e_ptr = untag_ptr(e);
28036         CHECK_ACCESS(e_ptr);
28037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28039         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28040         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
28041         return tag_ptr(ret_conv, true);
28042 }
28043
28044 jboolean  CS_LDK_CResult_AcceptChannelDecodeErrorZ_is_ok(int64_t o) {
28045         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
28046         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
28047         return ret_conv;
28048 }
28049
28050 void  CS_LDK_CResult_AcceptChannelDecodeErrorZ_free(int64_t _res) {
28051         if (!ptr_is_owned(_res)) return;
28052         void* _res_ptr = untag_ptr(_res);
28053         CHECK_ACCESS(_res_ptr);
28054         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
28055         FREE(untag_ptr(_res));
28056         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
28057 }
28058
28059 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
28060         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28061         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
28062         return tag_ptr(ret_conv, true);
28063 }
28064 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone_ptr(int64_t arg) {
28065         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
28066         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
28067         return ret_conv;
28068 }
28069
28070 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone(int64_t orig) {
28071         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
28072         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
28073         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
28074         return tag_ptr(ret_conv, true);
28075 }
28076
28077 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_ok(int64_t o) {
28078         LDKAcceptChannelV2 o_conv;
28079         o_conv.inner = untag_ptr(o);
28080         o_conv.is_owned = ptr_is_owned(o);
28081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28082         o_conv = AcceptChannelV2_clone(&o_conv);
28083         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28084         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
28085         return tag_ptr(ret_conv, true);
28086 }
28087
28088 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_err(int64_t e) {
28089         void* e_ptr = untag_ptr(e);
28090         CHECK_ACCESS(e_ptr);
28091         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28092         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28093         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28094         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
28095         return tag_ptr(ret_conv, true);
28096 }
28097
28098 jboolean  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_is_ok(int64_t o) {
28099         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
28100         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
28101         return ret_conv;
28102 }
28103
28104 void  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_free(int64_t _res) {
28105         if (!ptr_is_owned(_res)) return;
28106         void* _res_ptr = untag_ptr(_res);
28107         CHECK_ACCESS(_res_ptr);
28108         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
28109         FREE(untag_ptr(_res));
28110         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
28111 }
28112
28113 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28114         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28115         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
28116         return tag_ptr(ret_conv, true);
28117 }
28118 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
28119         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
28120         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28121         return ret_conv;
28122 }
28123
28124 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone(int64_t orig) {
28125         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
28126         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28127         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
28128         return tag_ptr(ret_conv, true);
28129 }
28130
28131 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_ok(int64_t o) {
28132         LDKStfu o_conv;
28133         o_conv.inner = untag_ptr(o);
28134         o_conv.is_owned = ptr_is_owned(o);
28135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28136         o_conv = Stfu_clone(&o_conv);
28137         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28138         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
28139         return tag_ptr(ret_conv, true);
28140 }
28141
28142 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_err(int64_t e) {
28143         void* e_ptr = untag_ptr(e);
28144         CHECK_ACCESS(e_ptr);
28145         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28146         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28147         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28148         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
28149         return tag_ptr(ret_conv, true);
28150 }
28151
28152 jboolean  CS_LDK_CResult_StfuDecodeErrorZ_is_ok(int64_t o) {
28153         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
28154         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
28155         return ret_conv;
28156 }
28157
28158 void  CS_LDK_CResult_StfuDecodeErrorZ_free(int64_t _res) {
28159         if (!ptr_is_owned(_res)) return;
28160         void* _res_ptr = untag_ptr(_res);
28161         CHECK_ACCESS(_res_ptr);
28162         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
28163         FREE(untag_ptr(_res));
28164         CResult_StfuDecodeErrorZ_free(_res_conv);
28165 }
28166
28167 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
28168         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28169         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
28170         return tag_ptr(ret_conv, true);
28171 }
28172 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone_ptr(int64_t arg) {
28173         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
28174         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
28175         return ret_conv;
28176 }
28177
28178 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone(int64_t orig) {
28179         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
28180         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28181         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
28182         return tag_ptr(ret_conv, true);
28183 }
28184
28185 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_ok(int64_t o) {
28186         LDKSplice o_conv;
28187         o_conv.inner = untag_ptr(o);
28188         o_conv.is_owned = ptr_is_owned(o);
28189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28190         o_conv = Splice_clone(&o_conv);
28191         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28192         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
28193         return tag_ptr(ret_conv, true);
28194 }
28195
28196 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_err(int64_t e) {
28197         void* e_ptr = untag_ptr(e);
28198         CHECK_ACCESS(e_ptr);
28199         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28200         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28201         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28202         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
28203         return tag_ptr(ret_conv, true);
28204 }
28205
28206 jboolean  CS_LDK_CResult_SpliceDecodeErrorZ_is_ok(int64_t o) {
28207         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
28208         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
28209         return ret_conv;
28210 }
28211
28212 void  CS_LDK_CResult_SpliceDecodeErrorZ_free(int64_t _res) {
28213         if (!ptr_is_owned(_res)) return;
28214         void* _res_ptr = untag_ptr(_res);
28215         CHECK_ACCESS(_res_ptr);
28216         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
28217         FREE(untag_ptr(_res));
28218         CResult_SpliceDecodeErrorZ_free(_res_conv);
28219 }
28220
28221 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
28222         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28223         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
28224         return tag_ptr(ret_conv, true);
28225 }
28226 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone_ptr(int64_t arg) {
28227         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
28228         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
28229         return ret_conv;
28230 }
28231
28232 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone(int64_t orig) {
28233         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
28234         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28235         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
28236         return tag_ptr(ret_conv, true);
28237 }
28238
28239 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_ok(int64_t o) {
28240         LDKSpliceAck o_conv;
28241         o_conv.inner = untag_ptr(o);
28242         o_conv.is_owned = ptr_is_owned(o);
28243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28244         o_conv = SpliceAck_clone(&o_conv);
28245         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28246         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
28247         return tag_ptr(ret_conv, true);
28248 }
28249
28250 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_err(int64_t e) {
28251         void* e_ptr = untag_ptr(e);
28252         CHECK_ACCESS(e_ptr);
28253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28255         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28256         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
28257         return tag_ptr(ret_conv, true);
28258 }
28259
28260 jboolean  CS_LDK_CResult_SpliceAckDecodeErrorZ_is_ok(int64_t o) {
28261         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
28262         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
28263         return ret_conv;
28264 }
28265
28266 void  CS_LDK_CResult_SpliceAckDecodeErrorZ_free(int64_t _res) {
28267         if (!ptr_is_owned(_res)) return;
28268         void* _res_ptr = untag_ptr(_res);
28269         CHECK_ACCESS(_res_ptr);
28270         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
28271         FREE(untag_ptr(_res));
28272         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
28273 }
28274
28275 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
28276         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28277         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
28278         return tag_ptr(ret_conv, true);
28279 }
28280 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone_ptr(int64_t arg) {
28281         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
28282         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
28283         return ret_conv;
28284 }
28285
28286 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone(int64_t orig) {
28287         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
28288         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28289         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
28290         return tag_ptr(ret_conv, true);
28291 }
28292
28293 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_ok(int64_t o) {
28294         LDKSpliceLocked o_conv;
28295         o_conv.inner = untag_ptr(o);
28296         o_conv.is_owned = ptr_is_owned(o);
28297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28298         o_conv = SpliceLocked_clone(&o_conv);
28299         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28300         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
28301         return tag_ptr(ret_conv, true);
28302 }
28303
28304 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_err(int64_t e) {
28305         void* e_ptr = untag_ptr(e);
28306         CHECK_ACCESS(e_ptr);
28307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28309         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28310         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
28311         return tag_ptr(ret_conv, true);
28312 }
28313
28314 jboolean  CS_LDK_CResult_SpliceLockedDecodeErrorZ_is_ok(int64_t o) {
28315         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
28316         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
28317         return ret_conv;
28318 }
28319
28320 void  CS_LDK_CResult_SpliceLockedDecodeErrorZ_free(int64_t _res) {
28321         if (!ptr_is_owned(_res)) return;
28322         void* _res_ptr = untag_ptr(_res);
28323         CHECK_ACCESS(_res_ptr);
28324         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
28325         FREE(untag_ptr(_res));
28326         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
28327 }
28328
28329 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
28330         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28331         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
28332         return tag_ptr(ret_conv, true);
28333 }
28334 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone_ptr(int64_t arg) {
28335         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
28336         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
28337         return ret_conv;
28338 }
28339
28340 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone(int64_t orig) {
28341         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
28342         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28343         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
28344         return tag_ptr(ret_conv, true);
28345 }
28346
28347 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_ok(int64_t o) {
28348         LDKTxAddInput o_conv;
28349         o_conv.inner = untag_ptr(o);
28350         o_conv.is_owned = ptr_is_owned(o);
28351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28352         o_conv = TxAddInput_clone(&o_conv);
28353         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28354         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28355         return tag_ptr(ret_conv, true);
28356 }
28357
28358 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_err(int64_t e) {
28359         void* e_ptr = untag_ptr(e);
28360         CHECK_ACCESS(e_ptr);
28361         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28362         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28363         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28364         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28365         return tag_ptr(ret_conv, true);
28366 }
28367
28368 jboolean  CS_LDK_CResult_TxAddInputDecodeErrorZ_is_ok(int64_t o) {
28369         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28370         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28371         return ret_conv;
28372 }
28373
28374 void  CS_LDK_CResult_TxAddInputDecodeErrorZ_free(int64_t _res) {
28375         if (!ptr_is_owned(_res)) return;
28376         void* _res_ptr = untag_ptr(_res);
28377         CHECK_ACCESS(_res_ptr);
28378         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28379         FREE(untag_ptr(_res));
28380         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28381 }
28382
28383 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28384         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28385         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28386         return tag_ptr(ret_conv, true);
28387 }
28388 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone_ptr(int64_t arg) {
28389         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28390         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28391         return ret_conv;
28392 }
28393
28394 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone(int64_t orig) {
28395         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28396         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28397         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28398         return tag_ptr(ret_conv, true);
28399 }
28400
28401 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_ok(int64_t o) {
28402         LDKTxAddOutput o_conv;
28403         o_conv.inner = untag_ptr(o);
28404         o_conv.is_owned = ptr_is_owned(o);
28405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28406         o_conv = TxAddOutput_clone(&o_conv);
28407         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28408         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28409         return tag_ptr(ret_conv, true);
28410 }
28411
28412 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_err(int64_t e) {
28413         void* e_ptr = untag_ptr(e);
28414         CHECK_ACCESS(e_ptr);
28415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28417         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28418         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28419         return tag_ptr(ret_conv, true);
28420 }
28421
28422 jboolean  CS_LDK_CResult_TxAddOutputDecodeErrorZ_is_ok(int64_t o) {
28423         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28424         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28425         return ret_conv;
28426 }
28427
28428 void  CS_LDK_CResult_TxAddOutputDecodeErrorZ_free(int64_t _res) {
28429         if (!ptr_is_owned(_res)) return;
28430         void* _res_ptr = untag_ptr(_res);
28431         CHECK_ACCESS(_res_ptr);
28432         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28433         FREE(untag_ptr(_res));
28434         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28435 }
28436
28437 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28438         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28439         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28440         return tag_ptr(ret_conv, true);
28441 }
28442 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone_ptr(int64_t arg) {
28443         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28444         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28445         return ret_conv;
28446 }
28447
28448 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone(int64_t orig) {
28449         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28450         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28451         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28452         return tag_ptr(ret_conv, true);
28453 }
28454
28455 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_ok(int64_t o) {
28456         LDKTxRemoveInput o_conv;
28457         o_conv.inner = untag_ptr(o);
28458         o_conv.is_owned = ptr_is_owned(o);
28459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28460         o_conv = TxRemoveInput_clone(&o_conv);
28461         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28462         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28463         return tag_ptr(ret_conv, true);
28464 }
28465
28466 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_err(int64_t e) {
28467         void* e_ptr = untag_ptr(e);
28468         CHECK_ACCESS(e_ptr);
28469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28471         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28472         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28473         return tag_ptr(ret_conv, true);
28474 }
28475
28476 jboolean  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_is_ok(int64_t o) {
28477         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28478         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28479         return ret_conv;
28480 }
28481
28482 void  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_free(int64_t _res) {
28483         if (!ptr_is_owned(_res)) return;
28484         void* _res_ptr = untag_ptr(_res);
28485         CHECK_ACCESS(_res_ptr);
28486         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28487         FREE(untag_ptr(_res));
28488         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28489 }
28490
28491 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28492         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28493         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28494         return tag_ptr(ret_conv, true);
28495 }
28496 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(int64_t arg) {
28497         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28498         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28499         return ret_conv;
28500 }
28501
28502 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone(int64_t orig) {
28503         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28504         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28505         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28506         return tag_ptr(ret_conv, true);
28507 }
28508
28509 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_ok(int64_t o) {
28510         LDKTxRemoveOutput o_conv;
28511         o_conv.inner = untag_ptr(o);
28512         o_conv.is_owned = ptr_is_owned(o);
28513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28514         o_conv = TxRemoveOutput_clone(&o_conv);
28515         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28516         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28517         return tag_ptr(ret_conv, true);
28518 }
28519
28520 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_err(int64_t e) {
28521         void* e_ptr = untag_ptr(e);
28522         CHECK_ACCESS(e_ptr);
28523         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28524         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28525         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28526         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28527         return tag_ptr(ret_conv, true);
28528 }
28529
28530 jboolean  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_is_ok(int64_t o) {
28531         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28532         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28533         return ret_conv;
28534 }
28535
28536 void  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_free(int64_t _res) {
28537         if (!ptr_is_owned(_res)) return;
28538         void* _res_ptr = untag_ptr(_res);
28539         CHECK_ACCESS(_res_ptr);
28540         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28541         FREE(untag_ptr(_res));
28542         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28543 }
28544
28545 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28546         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28547         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28548         return tag_ptr(ret_conv, true);
28549 }
28550 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(int64_t arg) {
28551         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28552         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28553         return ret_conv;
28554 }
28555
28556 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone(int64_t orig) {
28557         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28558         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28559         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28560         return tag_ptr(ret_conv, true);
28561 }
28562
28563 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_ok(int64_t o) {
28564         LDKTxComplete o_conv;
28565         o_conv.inner = untag_ptr(o);
28566         o_conv.is_owned = ptr_is_owned(o);
28567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28568         o_conv = TxComplete_clone(&o_conv);
28569         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28570         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28571         return tag_ptr(ret_conv, true);
28572 }
28573
28574 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_err(int64_t e) {
28575         void* e_ptr = untag_ptr(e);
28576         CHECK_ACCESS(e_ptr);
28577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28579         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28580         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28581         return tag_ptr(ret_conv, true);
28582 }
28583
28584 jboolean  CS_LDK_CResult_TxCompleteDecodeErrorZ_is_ok(int64_t o) {
28585         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28586         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28587         return ret_conv;
28588 }
28589
28590 void  CS_LDK_CResult_TxCompleteDecodeErrorZ_free(int64_t _res) {
28591         if (!ptr_is_owned(_res)) return;
28592         void* _res_ptr = untag_ptr(_res);
28593         CHECK_ACCESS(_res_ptr);
28594         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28595         FREE(untag_ptr(_res));
28596         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28597 }
28598
28599 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28600         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28601         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28602         return tag_ptr(ret_conv, true);
28603 }
28604 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone_ptr(int64_t arg) {
28605         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28606         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28607         return ret_conv;
28608 }
28609
28610 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone(int64_t orig) {
28611         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28612         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28613         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28614         return tag_ptr(ret_conv, true);
28615 }
28616
28617 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_ok(int64_t o) {
28618         LDKTxSignatures o_conv;
28619         o_conv.inner = untag_ptr(o);
28620         o_conv.is_owned = ptr_is_owned(o);
28621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28622         o_conv = TxSignatures_clone(&o_conv);
28623         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28624         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28625         return tag_ptr(ret_conv, true);
28626 }
28627
28628 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_err(int64_t e) {
28629         void* e_ptr = untag_ptr(e);
28630         CHECK_ACCESS(e_ptr);
28631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28633         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28634         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28635         return tag_ptr(ret_conv, true);
28636 }
28637
28638 jboolean  CS_LDK_CResult_TxSignaturesDecodeErrorZ_is_ok(int64_t o) {
28639         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28640         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28641         return ret_conv;
28642 }
28643
28644 void  CS_LDK_CResult_TxSignaturesDecodeErrorZ_free(int64_t _res) {
28645         if (!ptr_is_owned(_res)) return;
28646         void* _res_ptr = untag_ptr(_res);
28647         CHECK_ACCESS(_res_ptr);
28648         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28649         FREE(untag_ptr(_res));
28650         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28651 }
28652
28653 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28654         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28655         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28656         return tag_ptr(ret_conv, true);
28657 }
28658 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
28659         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28660         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28661         return ret_conv;
28662 }
28663
28664 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone(int64_t orig) {
28665         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28666         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28667         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28668         return tag_ptr(ret_conv, true);
28669 }
28670
28671 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_ok(int64_t o) {
28672         LDKTxInitRbf o_conv;
28673         o_conv.inner = untag_ptr(o);
28674         o_conv.is_owned = ptr_is_owned(o);
28675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28676         o_conv = TxInitRbf_clone(&o_conv);
28677         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28678         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28679         return tag_ptr(ret_conv, true);
28680 }
28681
28682 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_err(int64_t e) {
28683         void* e_ptr = untag_ptr(e);
28684         CHECK_ACCESS(e_ptr);
28685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28687         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28688         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28689         return tag_ptr(ret_conv, true);
28690 }
28691
28692 jboolean  CS_LDK_CResult_TxInitRbfDecodeErrorZ_is_ok(int64_t o) {
28693         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28694         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28695         return ret_conv;
28696 }
28697
28698 void  CS_LDK_CResult_TxInitRbfDecodeErrorZ_free(int64_t _res) {
28699         if (!ptr_is_owned(_res)) return;
28700         void* _res_ptr = untag_ptr(_res);
28701         CHECK_ACCESS(_res_ptr);
28702         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28703         FREE(untag_ptr(_res));
28704         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28705 }
28706
28707 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28708         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28709         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28710         return tag_ptr(ret_conv, true);
28711 }
28712 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone_ptr(int64_t arg) {
28713         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28714         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28715         return ret_conv;
28716 }
28717
28718 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone(int64_t orig) {
28719         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28720         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28721         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28722         return tag_ptr(ret_conv, true);
28723 }
28724
28725 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_ok(int64_t o) {
28726         LDKTxAckRbf o_conv;
28727         o_conv.inner = untag_ptr(o);
28728         o_conv.is_owned = ptr_is_owned(o);
28729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28730         o_conv = TxAckRbf_clone(&o_conv);
28731         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28732         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28733         return tag_ptr(ret_conv, true);
28734 }
28735
28736 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_err(int64_t e) {
28737         void* e_ptr = untag_ptr(e);
28738         CHECK_ACCESS(e_ptr);
28739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28741         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28742         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28743         return tag_ptr(ret_conv, true);
28744 }
28745
28746 jboolean  CS_LDK_CResult_TxAckRbfDecodeErrorZ_is_ok(int64_t o) {
28747         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28748         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28749         return ret_conv;
28750 }
28751
28752 void  CS_LDK_CResult_TxAckRbfDecodeErrorZ_free(int64_t _res) {
28753         if (!ptr_is_owned(_res)) return;
28754         void* _res_ptr = untag_ptr(_res);
28755         CHECK_ACCESS(_res_ptr);
28756         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28757         FREE(untag_ptr(_res));
28758         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28759 }
28760
28761 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28762         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28763         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28764         return tag_ptr(ret_conv, true);
28765 }
28766 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone_ptr(int64_t arg) {
28767         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
28768         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
28769         return ret_conv;
28770 }
28771
28772 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone(int64_t orig) {
28773         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
28774         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28775         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
28776         return tag_ptr(ret_conv, true);
28777 }
28778
28779 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_ok(int64_t o) {
28780         LDKTxAbort o_conv;
28781         o_conv.inner = untag_ptr(o);
28782         o_conv.is_owned = ptr_is_owned(o);
28783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28784         o_conv = TxAbort_clone(&o_conv);
28785         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28786         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
28787         return tag_ptr(ret_conv, true);
28788 }
28789
28790 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_err(int64_t e) {
28791         void* e_ptr = untag_ptr(e);
28792         CHECK_ACCESS(e_ptr);
28793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28795         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28796         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
28797         return tag_ptr(ret_conv, true);
28798 }
28799
28800 jboolean  CS_LDK_CResult_TxAbortDecodeErrorZ_is_ok(int64_t o) {
28801         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
28802         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
28803         return ret_conv;
28804 }
28805
28806 void  CS_LDK_CResult_TxAbortDecodeErrorZ_free(int64_t _res) {
28807         if (!ptr_is_owned(_res)) return;
28808         void* _res_ptr = untag_ptr(_res);
28809         CHECK_ACCESS(_res_ptr);
28810         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
28811         FREE(untag_ptr(_res));
28812         CResult_TxAbortDecodeErrorZ_free(_res_conv);
28813 }
28814
28815 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
28816         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28817         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
28818         return tag_ptr(ret_conv, true);
28819 }
28820 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone_ptr(int64_t arg) {
28821         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
28822         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
28823         return ret_conv;
28824 }
28825
28826 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone(int64_t orig) {
28827         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
28828         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28829         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
28830         return tag_ptr(ret_conv, true);
28831 }
28832
28833 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_ok(int64_t o) {
28834         LDKAnnouncementSignatures o_conv;
28835         o_conv.inner = untag_ptr(o);
28836         o_conv.is_owned = ptr_is_owned(o);
28837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28838         o_conv = AnnouncementSignatures_clone(&o_conv);
28839         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28840         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
28841         return tag_ptr(ret_conv, true);
28842 }
28843
28844 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_err(int64_t e) {
28845         void* e_ptr = untag_ptr(e);
28846         CHECK_ACCESS(e_ptr);
28847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28849         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28850         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
28851         return tag_ptr(ret_conv, true);
28852 }
28853
28854 jboolean  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(int64_t o) {
28855         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
28856         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
28857         return ret_conv;
28858 }
28859
28860 void  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_free(int64_t _res) {
28861         if (!ptr_is_owned(_res)) return;
28862         void* _res_ptr = untag_ptr(_res);
28863         CHECK_ACCESS(_res_ptr);
28864         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
28865         FREE(untag_ptr(_res));
28866         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
28867 }
28868
28869 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28870         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28871         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
28872         return tag_ptr(ret_conv, true);
28873 }
28874 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
28875         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
28876         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28877         return ret_conv;
28878 }
28879
28880 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone(int64_t orig) {
28881         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
28882         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28883         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
28884         return tag_ptr(ret_conv, true);
28885 }
28886
28887 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_ok(int64_t o) {
28888         LDKChannelReestablish o_conv;
28889         o_conv.inner = untag_ptr(o);
28890         o_conv.is_owned = ptr_is_owned(o);
28891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28892         o_conv = ChannelReestablish_clone(&o_conv);
28893         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28894         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
28895         return tag_ptr(ret_conv, true);
28896 }
28897
28898 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_err(int64_t e) {
28899         void* e_ptr = untag_ptr(e);
28900         CHECK_ACCESS(e_ptr);
28901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28903         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28904         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
28905         return tag_ptr(ret_conv, true);
28906 }
28907
28908 jboolean  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_is_ok(int64_t o) {
28909         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
28910         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
28911         return ret_conv;
28912 }
28913
28914 void  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_free(int64_t _res) {
28915         if (!ptr_is_owned(_res)) return;
28916         void* _res_ptr = untag_ptr(_res);
28917         CHECK_ACCESS(_res_ptr);
28918         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
28919         FREE(untag_ptr(_res));
28920         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
28921 }
28922
28923 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
28924         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28925         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
28926         return tag_ptr(ret_conv, true);
28927 }
28928 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(int64_t arg) {
28929         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
28930         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
28931         return ret_conv;
28932 }
28933
28934 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone(int64_t orig) {
28935         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
28936         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28937         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
28938         return tag_ptr(ret_conv, true);
28939 }
28940
28941 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_ok(int64_t o) {
28942         LDKClosingSigned o_conv;
28943         o_conv.inner = untag_ptr(o);
28944         o_conv.is_owned = ptr_is_owned(o);
28945         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28946         o_conv = ClosingSigned_clone(&o_conv);
28947         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28948         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
28949         return tag_ptr(ret_conv, true);
28950 }
28951
28952 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_err(int64_t e) {
28953         void* e_ptr = untag_ptr(e);
28954         CHECK_ACCESS(e_ptr);
28955         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28956         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28957         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28958         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
28959         return tag_ptr(ret_conv, true);
28960 }
28961
28962 jboolean  CS_LDK_CResult_ClosingSignedDecodeErrorZ_is_ok(int64_t o) {
28963         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
28964         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
28965         return ret_conv;
28966 }
28967
28968 void  CS_LDK_CResult_ClosingSignedDecodeErrorZ_free(int64_t _res) {
28969         if (!ptr_is_owned(_res)) return;
28970         void* _res_ptr = untag_ptr(_res);
28971         CHECK_ACCESS(_res_ptr);
28972         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
28973         FREE(untag_ptr(_res));
28974         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
28975 }
28976
28977 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
28978         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28979         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
28980         return tag_ptr(ret_conv, true);
28981 }
28982 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
28983         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
28984         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
28985         return ret_conv;
28986 }
28987
28988 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone(int64_t orig) {
28989         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
28990         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28991         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
28992         return tag_ptr(ret_conv, true);
28993 }
28994
28995 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(int64_t o) {
28996         LDKClosingSignedFeeRange o_conv;
28997         o_conv.inner = untag_ptr(o);
28998         o_conv.is_owned = ptr_is_owned(o);
28999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29000         o_conv = ClosingSignedFeeRange_clone(&o_conv);
29001         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29002         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
29003         return tag_ptr(ret_conv, true);
29004 }
29005
29006 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(int64_t e) {
29007         void* e_ptr = untag_ptr(e);
29008         CHECK_ACCESS(e_ptr);
29009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29011         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29012         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
29013         return tag_ptr(ret_conv, true);
29014 }
29015
29016 jboolean  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(int64_t o) {
29017         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
29018         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
29019         return ret_conv;
29020 }
29021
29022 void  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(int64_t _res) {
29023         if (!ptr_is_owned(_res)) return;
29024         void* _res_ptr = untag_ptr(_res);
29025         CHECK_ACCESS(_res_ptr);
29026         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
29027         FREE(untag_ptr(_res));
29028         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
29029 }
29030
29031 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
29032         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29033         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
29034         return tag_ptr(ret_conv, true);
29035 }
29036 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(int64_t arg) {
29037         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
29038         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
29039         return ret_conv;
29040 }
29041
29042 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(int64_t orig) {
29043         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
29044         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
29045         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
29046         return tag_ptr(ret_conv, true);
29047 }
29048
29049 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_ok(int64_t o) {
29050         LDKCommitmentSigned o_conv;
29051         o_conv.inner = untag_ptr(o);
29052         o_conv.is_owned = ptr_is_owned(o);
29053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29054         o_conv = CommitmentSigned_clone(&o_conv);
29055         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29056         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
29057         return tag_ptr(ret_conv, true);
29058 }
29059
29060 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_err(int64_t e) {
29061         void* e_ptr = untag_ptr(e);
29062         CHECK_ACCESS(e_ptr);
29063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29065         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29066         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
29067         return tag_ptr(ret_conv, true);
29068 }
29069
29070 jboolean  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_is_ok(int64_t o) {
29071         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
29072         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
29073         return ret_conv;
29074 }
29075
29076 void  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_free(int64_t _res) {
29077         if (!ptr_is_owned(_res)) return;
29078         void* _res_ptr = untag_ptr(_res);
29079         CHECK_ACCESS(_res_ptr);
29080         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29081         FREE(untag_ptr(_res));
29082         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29083 }
29084
29085 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29086         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29087         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29088         return tag_ptr(ret_conv, true);
29089 }
29090 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(int64_t arg) {
29091         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29092         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29093         return ret_conv;
29094 }
29095
29096 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone(int64_t orig) {
29097         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29098         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29099         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29100         return tag_ptr(ret_conv, true);
29101 }
29102
29103 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_ok(int64_t o) {
29104         LDKFundingCreated o_conv;
29105         o_conv.inner = untag_ptr(o);
29106         o_conv.is_owned = ptr_is_owned(o);
29107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29108         o_conv = FundingCreated_clone(&o_conv);
29109         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29110         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29111         return tag_ptr(ret_conv, true);
29112 }
29113
29114 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_err(int64_t e) {
29115         void* e_ptr = untag_ptr(e);
29116         CHECK_ACCESS(e_ptr);
29117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29119         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29120         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29121         return tag_ptr(ret_conv, true);
29122 }
29123
29124 jboolean  CS_LDK_CResult_FundingCreatedDecodeErrorZ_is_ok(int64_t o) {
29125         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29126         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29127         return ret_conv;
29128 }
29129
29130 void  CS_LDK_CResult_FundingCreatedDecodeErrorZ_free(int64_t _res) {
29131         if (!ptr_is_owned(_res)) return;
29132         void* _res_ptr = untag_ptr(_res);
29133         CHECK_ACCESS(_res_ptr);
29134         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29135         FREE(untag_ptr(_res));
29136         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29137 }
29138
29139 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29140         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29141         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29142         return tag_ptr(ret_conv, true);
29143 }
29144 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone_ptr(int64_t arg) {
29145         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29146         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29147         return ret_conv;
29148 }
29149
29150 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone(int64_t orig) {
29151         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29152         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29153         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29154         return tag_ptr(ret_conv, true);
29155 }
29156
29157 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_ok(int64_t o) {
29158         LDKFundingSigned o_conv;
29159         o_conv.inner = untag_ptr(o);
29160         o_conv.is_owned = ptr_is_owned(o);
29161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29162         o_conv = FundingSigned_clone(&o_conv);
29163         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29164         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29165         return tag_ptr(ret_conv, true);
29166 }
29167
29168 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_err(int64_t e) {
29169         void* e_ptr = untag_ptr(e);
29170         CHECK_ACCESS(e_ptr);
29171         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29172         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29173         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29174         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29175         return tag_ptr(ret_conv, true);
29176 }
29177
29178 jboolean  CS_LDK_CResult_FundingSignedDecodeErrorZ_is_ok(int64_t o) {
29179         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29180         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29181         return ret_conv;
29182 }
29183
29184 void  CS_LDK_CResult_FundingSignedDecodeErrorZ_free(int64_t _res) {
29185         if (!ptr_is_owned(_res)) return;
29186         void* _res_ptr = untag_ptr(_res);
29187         CHECK_ACCESS(_res_ptr);
29188         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29189         FREE(untag_ptr(_res));
29190         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29191 }
29192
29193 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29194         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29195         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29196         return tag_ptr(ret_conv, true);
29197 }
29198 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
29199         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29200         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29201         return ret_conv;
29202 }
29203
29204 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone(int64_t orig) {
29205         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29206         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29207         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29208         return tag_ptr(ret_conv, true);
29209 }
29210
29211 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_ok(int64_t o) {
29212         LDKChannelReady o_conv;
29213         o_conv.inner = untag_ptr(o);
29214         o_conv.is_owned = ptr_is_owned(o);
29215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29216         o_conv = ChannelReady_clone(&o_conv);
29217         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29218         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29219         return tag_ptr(ret_conv, true);
29220 }
29221
29222 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_err(int64_t e) {
29223         void* e_ptr = untag_ptr(e);
29224         CHECK_ACCESS(e_ptr);
29225         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29226         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29227         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29228         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29229         return tag_ptr(ret_conv, true);
29230 }
29231
29232 jboolean  CS_LDK_CResult_ChannelReadyDecodeErrorZ_is_ok(int64_t o) {
29233         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29234         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29235         return ret_conv;
29236 }
29237
29238 void  CS_LDK_CResult_ChannelReadyDecodeErrorZ_free(int64_t _res) {
29239         if (!ptr_is_owned(_res)) return;
29240         void* _res_ptr = untag_ptr(_res);
29241         CHECK_ACCESS(_res_ptr);
29242         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
29243         FREE(untag_ptr(_res));
29244         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
29245 }
29246
29247 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
29248         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29249         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
29250         return tag_ptr(ret_conv, true);
29251 }
29252 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone_ptr(int64_t arg) {
29253         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
29254         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
29255         return ret_conv;
29256 }
29257
29258 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone(int64_t orig) {
29259         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
29260         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29261         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
29262         return tag_ptr(ret_conv, true);
29263 }
29264
29265 int64_t  CS_LDK_CResult_InitDecodeErrorZ_ok(int64_t o) {
29266         LDKInit o_conv;
29267         o_conv.inner = untag_ptr(o);
29268         o_conv.is_owned = ptr_is_owned(o);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29270         o_conv = Init_clone(&o_conv);
29271         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29272         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29273         return tag_ptr(ret_conv, true);
29274 }
29275
29276 int64_t  CS_LDK_CResult_InitDecodeErrorZ_err(int64_t e) {
29277         void* e_ptr = untag_ptr(e);
29278         CHECK_ACCESS(e_ptr);
29279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29281         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29282         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29283         return tag_ptr(ret_conv, true);
29284 }
29285
29286 jboolean  CS_LDK_CResult_InitDecodeErrorZ_is_ok(int64_t o) {
29287         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29288         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29289         return ret_conv;
29290 }
29291
29292 void  CS_LDK_CResult_InitDecodeErrorZ_free(int64_t _res) {
29293         if (!ptr_is_owned(_res)) return;
29294         void* _res_ptr = untag_ptr(_res);
29295         CHECK_ACCESS(_res_ptr);
29296         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29297         FREE(untag_ptr(_res));
29298         CResult_InitDecodeErrorZ_free(_res_conv);
29299 }
29300
29301 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29302         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29303         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29304         return tag_ptr(ret_conv, true);
29305 }
29306 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone_ptr(int64_t arg) {
29307         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29308         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29309         return ret_conv;
29310 }
29311
29312 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone(int64_t orig) {
29313         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29314         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29315         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29316         return tag_ptr(ret_conv, true);
29317 }
29318
29319 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_ok(int64_t o) {
29320         LDKOpenChannel o_conv;
29321         o_conv.inner = untag_ptr(o);
29322         o_conv.is_owned = ptr_is_owned(o);
29323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29324         o_conv = OpenChannel_clone(&o_conv);
29325         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29326         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29327         return tag_ptr(ret_conv, true);
29328 }
29329
29330 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_err(int64_t e) {
29331         void* e_ptr = untag_ptr(e);
29332         CHECK_ACCESS(e_ptr);
29333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29335         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29336         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29337         return tag_ptr(ret_conv, true);
29338 }
29339
29340 jboolean  CS_LDK_CResult_OpenChannelDecodeErrorZ_is_ok(int64_t o) {
29341         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29342         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29343         return ret_conv;
29344 }
29345
29346 void  CS_LDK_CResult_OpenChannelDecodeErrorZ_free(int64_t _res) {
29347         if (!ptr_is_owned(_res)) return;
29348         void* _res_ptr = untag_ptr(_res);
29349         CHECK_ACCESS(_res_ptr);
29350         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29351         FREE(untag_ptr(_res));
29352         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29353 }
29354
29355 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29356         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29357         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29358         return tag_ptr(ret_conv, true);
29359 }
29360 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone_ptr(int64_t arg) {
29361         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29362         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29363         return ret_conv;
29364 }
29365
29366 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone(int64_t orig) {
29367         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29368         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29369         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29370         return tag_ptr(ret_conv, true);
29371 }
29372
29373 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_ok(int64_t o) {
29374         LDKOpenChannelV2 o_conv;
29375         o_conv.inner = untag_ptr(o);
29376         o_conv.is_owned = ptr_is_owned(o);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29378         o_conv = OpenChannelV2_clone(&o_conv);
29379         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29380         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29381         return tag_ptr(ret_conv, true);
29382 }
29383
29384 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_err(int64_t e) {
29385         void* e_ptr = untag_ptr(e);
29386         CHECK_ACCESS(e_ptr);
29387         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29388         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29389         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29390         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29391         return tag_ptr(ret_conv, true);
29392 }
29393
29394 jboolean  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_is_ok(int64_t o) {
29395         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29396         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29397         return ret_conv;
29398 }
29399
29400 void  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_free(int64_t _res) {
29401         if (!ptr_is_owned(_res)) return;
29402         void* _res_ptr = untag_ptr(_res);
29403         CHECK_ACCESS(_res_ptr);
29404         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29405         FREE(untag_ptr(_res));
29406         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29407 }
29408
29409 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29410         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29411         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29412         return tag_ptr(ret_conv, true);
29413 }
29414 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
29415         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29416         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29417         return ret_conv;
29418 }
29419
29420 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone(int64_t orig) {
29421         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29422         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29423         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29424         return tag_ptr(ret_conv, true);
29425 }
29426
29427 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_ok(int64_t o) {
29428         LDKRevokeAndACK o_conv;
29429         o_conv.inner = untag_ptr(o);
29430         o_conv.is_owned = ptr_is_owned(o);
29431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29432         o_conv = RevokeAndACK_clone(&o_conv);
29433         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29434         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29435         return tag_ptr(ret_conv, true);
29436 }
29437
29438 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_err(int64_t e) {
29439         void* e_ptr = untag_ptr(e);
29440         CHECK_ACCESS(e_ptr);
29441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29443         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29444         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29445         return tag_ptr(ret_conv, true);
29446 }
29447
29448 jboolean  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_is_ok(int64_t o) {
29449         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29450         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29451         return ret_conv;
29452 }
29453
29454 void  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_free(int64_t _res) {
29455         if (!ptr_is_owned(_res)) return;
29456         void* _res_ptr = untag_ptr(_res);
29457         CHECK_ACCESS(_res_ptr);
29458         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29459         FREE(untag_ptr(_res));
29460         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29461 }
29462
29463 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29464         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29465         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29466         return tag_ptr(ret_conv, true);
29467 }
29468 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(int64_t arg) {
29469         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29470         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29471         return ret_conv;
29472 }
29473
29474 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone(int64_t orig) {
29475         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29476         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29477         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29478         return tag_ptr(ret_conv, true);
29479 }
29480
29481 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_ok(int64_t o) {
29482         LDKShutdown o_conv;
29483         o_conv.inner = untag_ptr(o);
29484         o_conv.is_owned = ptr_is_owned(o);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29486         o_conv = Shutdown_clone(&o_conv);
29487         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29488         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29489         return tag_ptr(ret_conv, true);
29490 }
29491
29492 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_err(int64_t e) {
29493         void* e_ptr = untag_ptr(e);
29494         CHECK_ACCESS(e_ptr);
29495         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29496         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29497         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29498         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29499         return tag_ptr(ret_conv, true);
29500 }
29501
29502 jboolean  CS_LDK_CResult_ShutdownDecodeErrorZ_is_ok(int64_t o) {
29503         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29504         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29505         return ret_conv;
29506 }
29507
29508 void  CS_LDK_CResult_ShutdownDecodeErrorZ_free(int64_t _res) {
29509         if (!ptr_is_owned(_res)) return;
29510         void* _res_ptr = untag_ptr(_res);
29511         CHECK_ACCESS(_res_ptr);
29512         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29513         FREE(untag_ptr(_res));
29514         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29515 }
29516
29517 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29518         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29519         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29520         return tag_ptr(ret_conv, true);
29521 }
29522 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone_ptr(int64_t arg) {
29523         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29524         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29525         return ret_conv;
29526 }
29527
29528 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone(int64_t orig) {
29529         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29530         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29531         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29532         return tag_ptr(ret_conv, true);
29533 }
29534
29535 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_ok(int64_t o) {
29536         LDKUpdateFailHTLC o_conv;
29537         o_conv.inner = untag_ptr(o);
29538         o_conv.is_owned = ptr_is_owned(o);
29539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29540         o_conv = UpdateFailHTLC_clone(&o_conv);
29541         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29542         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29543         return tag_ptr(ret_conv, true);
29544 }
29545
29546 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_err(int64_t e) {
29547         void* e_ptr = untag_ptr(e);
29548         CHECK_ACCESS(e_ptr);
29549         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29550         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29551         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29552         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29553         return tag_ptr(ret_conv, true);
29554 }
29555
29556 jboolean  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(int64_t o) {
29557         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29558         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29559         return ret_conv;
29560 }
29561
29562 void  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_free(int64_t _res) {
29563         if (!ptr_is_owned(_res)) return;
29564         void* _res_ptr = untag_ptr(_res);
29565         CHECK_ACCESS(_res_ptr);
29566         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29567         FREE(untag_ptr(_res));
29568         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29569 }
29570
29571 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29572         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29573         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29574         return tag_ptr(ret_conv, true);
29575 }
29576 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29577         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29578         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29579         return ret_conv;
29580 }
29581
29582 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone(int64_t orig) {
29583         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29584         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29585         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29586         return tag_ptr(ret_conv, true);
29587 }
29588
29589 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(int64_t o) {
29590         LDKUpdateFailMalformedHTLC o_conv;
29591         o_conv.inner = untag_ptr(o);
29592         o_conv.is_owned = ptr_is_owned(o);
29593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29594         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29595         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29596         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29597         return tag_ptr(ret_conv, true);
29598 }
29599
29600 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(int64_t e) {
29601         void* e_ptr = untag_ptr(e);
29602         CHECK_ACCESS(e_ptr);
29603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29605         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29606         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29607         return tag_ptr(ret_conv, true);
29608 }
29609
29610 jboolean  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(int64_t o) {
29611         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29612         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29613         return ret_conv;
29614 }
29615
29616 void  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(int64_t _res) {
29617         if (!ptr_is_owned(_res)) return;
29618         void* _res_ptr = untag_ptr(_res);
29619         CHECK_ACCESS(_res_ptr);
29620         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29621         FREE(untag_ptr(_res));
29622         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29623 }
29624
29625 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29626         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29627         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29628         return tag_ptr(ret_conv, true);
29629 }
29630 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29631         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29632         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29633         return ret_conv;
29634 }
29635
29636 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(int64_t orig) {
29637         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29638         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29639         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29640         return tag_ptr(ret_conv, true);
29641 }
29642
29643 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_ok(int64_t o) {
29644         LDKUpdateFee o_conv;
29645         o_conv.inner = untag_ptr(o);
29646         o_conv.is_owned = ptr_is_owned(o);
29647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29648         o_conv = UpdateFee_clone(&o_conv);
29649         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29650         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29651         return tag_ptr(ret_conv, true);
29652 }
29653
29654 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_err(int64_t e) {
29655         void* e_ptr = untag_ptr(e);
29656         CHECK_ACCESS(e_ptr);
29657         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29658         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29659         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29660         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29661         return tag_ptr(ret_conv, true);
29662 }
29663
29664 jboolean  CS_LDK_CResult_UpdateFeeDecodeErrorZ_is_ok(int64_t o) {
29665         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29666         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29667         return ret_conv;
29668 }
29669
29670 void  CS_LDK_CResult_UpdateFeeDecodeErrorZ_free(int64_t _res) {
29671         if (!ptr_is_owned(_res)) return;
29672         void* _res_ptr = untag_ptr(_res);
29673         CHECK_ACCESS(_res_ptr);
29674         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29675         FREE(untag_ptr(_res));
29676         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29677 }
29678
29679 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29680         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29681         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29682         return tag_ptr(ret_conv, true);
29683 }
29684 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone_ptr(int64_t arg) {
29685         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29686         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29687         return ret_conv;
29688 }
29689
29690 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone(int64_t orig) {
29691         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29692         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29693         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29694         return tag_ptr(ret_conv, true);
29695 }
29696
29697 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(int64_t o) {
29698         LDKUpdateFulfillHTLC o_conv;
29699         o_conv.inner = untag_ptr(o);
29700         o_conv.is_owned = ptr_is_owned(o);
29701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29702         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29703         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29704         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29705         return tag_ptr(ret_conv, true);
29706 }
29707
29708 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_err(int64_t e) {
29709         void* e_ptr = untag_ptr(e);
29710         CHECK_ACCESS(e_ptr);
29711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29713         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29714         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29715         return tag_ptr(ret_conv, true);
29716 }
29717
29718 jboolean  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(int64_t o) {
29719         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29720         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29721         return ret_conv;
29722 }
29723
29724 void  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_free(int64_t _res) {
29725         if (!ptr_is_owned(_res)) return;
29726         void* _res_ptr = untag_ptr(_res);
29727         CHECK_ACCESS(_res_ptr);
29728         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29729         FREE(untag_ptr(_res));
29730         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29731 }
29732
29733 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29734         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29735         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29736         return tag_ptr(ret_conv, true);
29737 }
29738 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29739         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29740         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29741         return ret_conv;
29742 }
29743
29744 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(int64_t orig) {
29745         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29746         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29747         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29748         return tag_ptr(ret_conv, true);
29749 }
29750
29751 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_ok(int64_t o) {
29752         LDKOnionPacket o_conv;
29753         o_conv.inner = untag_ptr(o);
29754         o_conv.is_owned = ptr_is_owned(o);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29756         o_conv = OnionPacket_clone(&o_conv);
29757         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29758         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
29759         return tag_ptr(ret_conv, true);
29760 }
29761
29762 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_err(int64_t e) {
29763         void* e_ptr = untag_ptr(e);
29764         CHECK_ACCESS(e_ptr);
29765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29767         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29768         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
29769         return tag_ptr(ret_conv, true);
29770 }
29771
29772 jboolean  CS_LDK_CResult_OnionPacketDecodeErrorZ_is_ok(int64_t o) {
29773         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
29774         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
29775         return ret_conv;
29776 }
29777
29778 void  CS_LDK_CResult_OnionPacketDecodeErrorZ_free(int64_t _res) {
29779         if (!ptr_is_owned(_res)) return;
29780         void* _res_ptr = untag_ptr(_res);
29781         CHECK_ACCESS(_res_ptr);
29782         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
29783         FREE(untag_ptr(_res));
29784         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
29785 }
29786
29787 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
29788         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29789         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
29790         return tag_ptr(ret_conv, true);
29791 }
29792 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone_ptr(int64_t arg) {
29793         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
29794         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
29795         return ret_conv;
29796 }
29797
29798 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone(int64_t orig) {
29799         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
29800         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29801         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
29802         return tag_ptr(ret_conv, true);
29803 }
29804
29805 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_ok(int64_t o) {
29806         LDKUpdateAddHTLC o_conv;
29807         o_conv.inner = untag_ptr(o);
29808         o_conv.is_owned = ptr_is_owned(o);
29809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29810         o_conv = UpdateAddHTLC_clone(&o_conv);
29811         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29812         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29813         return tag_ptr(ret_conv, true);
29814 }
29815
29816 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_err(int64_t e) {
29817         void* e_ptr = untag_ptr(e);
29818         CHECK_ACCESS(e_ptr);
29819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29821         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29822         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
29823         return tag_ptr(ret_conv, true);
29824 }
29825
29826 jboolean  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(int64_t o) {
29827         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
29828         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
29829         return ret_conv;
29830 }
29831
29832 void  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_free(int64_t _res) {
29833         if (!ptr_is_owned(_res)) return;
29834         void* _res_ptr = untag_ptr(_res);
29835         CHECK_ACCESS(_res_ptr);
29836         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
29837         FREE(untag_ptr(_res));
29838         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
29839 }
29840
29841 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
29842         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29843         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
29844         return tag_ptr(ret_conv, true);
29845 }
29846 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29847         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
29848         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
29849         return ret_conv;
29850 }
29851
29852 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone(int64_t orig) {
29853         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
29854         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29855         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
29856         return tag_ptr(ret_conv, true);
29857 }
29858
29859 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_ok(int64_t o) {
29860         LDKOnionMessage o_conv;
29861         o_conv.inner = untag_ptr(o);
29862         o_conv.is_owned = ptr_is_owned(o);
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29864         o_conv = OnionMessage_clone(&o_conv);
29865         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29866         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
29867         return tag_ptr(ret_conv, true);
29868 }
29869
29870 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_err(int64_t e) {
29871         void* e_ptr = untag_ptr(e);
29872         CHECK_ACCESS(e_ptr);
29873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29875         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29876         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
29877         return tag_ptr(ret_conv, true);
29878 }
29879
29880 jboolean  CS_LDK_CResult_OnionMessageDecodeErrorZ_is_ok(int64_t o) {
29881         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
29882         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
29883         return ret_conv;
29884 }
29885
29886 void  CS_LDK_CResult_OnionMessageDecodeErrorZ_free(int64_t _res) {
29887         if (!ptr_is_owned(_res)) return;
29888         void* _res_ptr = untag_ptr(_res);
29889         CHECK_ACCESS(_res_ptr);
29890         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
29891         FREE(untag_ptr(_res));
29892         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
29893 }
29894
29895 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
29896         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29897         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
29898         return tag_ptr(ret_conv, true);
29899 }
29900 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone_ptr(int64_t arg) {
29901         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
29902         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
29903         return ret_conv;
29904 }
29905
29906 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone(int64_t orig) {
29907         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
29908         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29909         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
29910         return tag_ptr(ret_conv, true);
29911 }
29912
29913 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_ok(int64_t o) {
29914         LDKFinalOnionHopData o_conv;
29915         o_conv.inner = untag_ptr(o);
29916         o_conv.is_owned = ptr_is_owned(o);
29917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29918         o_conv = FinalOnionHopData_clone(&o_conv);
29919         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29920         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
29921         return tag_ptr(ret_conv, true);
29922 }
29923
29924 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_err(int64_t e) {
29925         void* e_ptr = untag_ptr(e);
29926         CHECK_ACCESS(e_ptr);
29927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29929         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29930         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
29931         return tag_ptr(ret_conv, true);
29932 }
29933
29934 jboolean  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(int64_t o) {
29935         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
29936         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
29937         return ret_conv;
29938 }
29939
29940 void  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_free(int64_t _res) {
29941         if (!ptr_is_owned(_res)) return;
29942         void* _res_ptr = untag_ptr(_res);
29943         CHECK_ACCESS(_res_ptr);
29944         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
29945         FREE(untag_ptr(_res));
29946         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
29947 }
29948
29949 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
29950         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29951         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
29952         return tag_ptr(ret_conv, true);
29953 }
29954 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(int64_t arg) {
29955         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
29956         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
29957         return ret_conv;
29958 }
29959
29960 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone(int64_t orig) {
29961         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
29962         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29963         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 int64_t  CS_LDK_CResult_PingDecodeErrorZ_ok(int64_t o) {
29968         LDKPing o_conv;
29969         o_conv.inner = untag_ptr(o);
29970         o_conv.is_owned = ptr_is_owned(o);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29972         o_conv = Ping_clone(&o_conv);
29973         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29974         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
29975         return tag_ptr(ret_conv, true);
29976 }
29977
29978 int64_t  CS_LDK_CResult_PingDecodeErrorZ_err(int64_t e) {
29979         void* e_ptr = untag_ptr(e);
29980         CHECK_ACCESS(e_ptr);
29981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29983         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29984         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
29985         return tag_ptr(ret_conv, true);
29986 }
29987
29988 jboolean  CS_LDK_CResult_PingDecodeErrorZ_is_ok(int64_t o) {
29989         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
29990         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
29991         return ret_conv;
29992 }
29993
29994 void  CS_LDK_CResult_PingDecodeErrorZ_free(int64_t _res) {
29995         if (!ptr_is_owned(_res)) return;
29996         void* _res_ptr = untag_ptr(_res);
29997         CHECK_ACCESS(_res_ptr);
29998         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
29999         FREE(untag_ptr(_res));
30000         CResult_PingDecodeErrorZ_free(_res_conv);
30001 }
30002
30003 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
30004         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30005         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
30006         return tag_ptr(ret_conv, true);
30007 }
30008 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone_ptr(int64_t arg) {
30009         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
30010         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
30011         return ret_conv;
30012 }
30013
30014 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone(int64_t orig) {
30015         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
30016         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
30017         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 int64_t  CS_LDK_CResult_PongDecodeErrorZ_ok(int64_t o) {
30022         LDKPong o_conv;
30023         o_conv.inner = untag_ptr(o);
30024         o_conv.is_owned = ptr_is_owned(o);
30025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30026         o_conv = Pong_clone(&o_conv);
30027         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30028         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
30029         return tag_ptr(ret_conv, true);
30030 }
30031
30032 int64_t  CS_LDK_CResult_PongDecodeErrorZ_err(int64_t e) {
30033         void* e_ptr = untag_ptr(e);
30034         CHECK_ACCESS(e_ptr);
30035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30037         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30038         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
30039         return tag_ptr(ret_conv, true);
30040 }
30041
30042 jboolean  CS_LDK_CResult_PongDecodeErrorZ_is_ok(int64_t o) {
30043         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
30044         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
30045         return ret_conv;
30046 }
30047
30048 void  CS_LDK_CResult_PongDecodeErrorZ_free(int64_t _res) {
30049         if (!ptr_is_owned(_res)) return;
30050         void* _res_ptr = untag_ptr(_res);
30051         CHECK_ACCESS(_res_ptr);
30052         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
30053         FREE(untag_ptr(_res));
30054         CResult_PongDecodeErrorZ_free(_res_conv);
30055 }
30056
30057 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
30058         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30059         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
30060         return tag_ptr(ret_conv, true);
30061 }
30062 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone_ptr(int64_t arg) {
30063         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
30064         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
30065         return ret_conv;
30066 }
30067
30068 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone(int64_t orig) {
30069         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
30070         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
30071         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
30076         LDKUnsignedChannelAnnouncement o_conv;
30077         o_conv.inner = untag_ptr(o);
30078         o_conv.is_owned = ptr_is_owned(o);
30079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30080         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30081         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30082         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30083         return tag_ptr(ret_conv, true);
30084 }
30085
30086 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(int64_t e) {
30087         void* e_ptr = untag_ptr(e);
30088         CHECK_ACCESS(e_ptr);
30089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30091         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30092         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30093         return tag_ptr(ret_conv, true);
30094 }
30095
30096 jboolean  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30097         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30098         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30099         return ret_conv;
30100 }
30101
30102 void  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
30103         if (!ptr_is_owned(_res)) return;
30104         void* _res_ptr = untag_ptr(_res);
30105         CHECK_ACCESS(_res_ptr);
30106         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30107         FREE(untag_ptr(_res));
30108         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30109 }
30110
30111 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30112         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30113         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30114         return tag_ptr(ret_conv, true);
30115 }
30116 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30117         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30118         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30119         return ret_conv;
30120 }
30121
30122 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
30123         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30124         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30125         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30126         return tag_ptr(ret_conv, true);
30127 }
30128
30129 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
30130         LDKChannelAnnouncement o_conv;
30131         o_conv.inner = untag_ptr(o);
30132         o_conv.is_owned = ptr_is_owned(o);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30134         o_conv = ChannelAnnouncement_clone(&o_conv);
30135         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30136         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30137         return tag_ptr(ret_conv, true);
30138 }
30139
30140 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_err(int64_t e) {
30141         void* e_ptr = untag_ptr(e);
30142         CHECK_ACCESS(e_ptr);
30143         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30144         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30145         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30146         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30147         return tag_ptr(ret_conv, true);
30148 }
30149
30150 jboolean  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30151         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30152         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30153         return ret_conv;
30154 }
30155
30156 void  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
30157         if (!ptr_is_owned(_res)) return;
30158         void* _res_ptr = untag_ptr(_res);
30159         CHECK_ACCESS(_res_ptr);
30160         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30161         FREE(untag_ptr(_res));
30162         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30163 }
30164
30165 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30166         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30167         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30168         return tag_ptr(ret_conv, true);
30169 }
30170 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30171         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30172         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30173         return ret_conv;
30174 }
30175
30176 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
30177         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30178         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30179         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30180         return tag_ptr(ret_conv, true);
30181 }
30182
30183 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(int64_t o) {
30184         LDKUnsignedChannelUpdate o_conv;
30185         o_conv.inner = untag_ptr(o);
30186         o_conv.is_owned = ptr_is_owned(o);
30187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30188         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30189         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30190         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30191         return tag_ptr(ret_conv, true);
30192 }
30193
30194 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_err(int64_t e) {
30195         void* e_ptr = untag_ptr(e);
30196         CHECK_ACCESS(e_ptr);
30197         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30198         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30199         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30200         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30201         return tag_ptr(ret_conv, true);
30202 }
30203
30204 jboolean  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
30205         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30206         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30207         return ret_conv;
30208 }
30209
30210 void  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_free(int64_t _res) {
30211         if (!ptr_is_owned(_res)) return;
30212         void* _res_ptr = untag_ptr(_res);
30213         CHECK_ACCESS(_res_ptr);
30214         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30215         FREE(untag_ptr(_res));
30216         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30217 }
30218
30219 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30220         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30221         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30222         return tag_ptr(ret_conv, true);
30223 }
30224 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
30225         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30226         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30227         return ret_conv;
30228 }
30229
30230 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(int64_t orig) {
30231         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30232         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30233         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30234         return tag_ptr(ret_conv, true);
30235 }
30236
30237 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_ok(int64_t o) {
30238         LDKChannelUpdate o_conv;
30239         o_conv.inner = untag_ptr(o);
30240         o_conv.is_owned = ptr_is_owned(o);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30242         o_conv = ChannelUpdate_clone(&o_conv);
30243         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30244         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30245         return tag_ptr(ret_conv, true);
30246 }
30247
30248 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_err(int64_t e) {
30249         void* e_ptr = untag_ptr(e);
30250         CHECK_ACCESS(e_ptr);
30251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30253         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30254         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30255         return tag_ptr(ret_conv, true);
30256 }
30257
30258 jboolean  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
30259         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30260         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30261         return ret_conv;
30262 }
30263
30264 void  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_free(int64_t _res) {
30265         if (!ptr_is_owned(_res)) return;
30266         void* _res_ptr = untag_ptr(_res);
30267         CHECK_ACCESS(_res_ptr);
30268         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30269         FREE(untag_ptr(_res));
30270         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30271 }
30272
30273 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30274         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30275         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30276         return tag_ptr(ret_conv, true);
30277 }
30278 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
30279         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30280         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30281         return ret_conv;
30282 }
30283
30284 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone(int64_t orig) {
30285         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30286         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30287         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30288         return tag_ptr(ret_conv, true);
30289 }
30290
30291 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_ok(int64_t o) {
30292         LDKErrorMessage o_conv;
30293         o_conv.inner = untag_ptr(o);
30294         o_conv.is_owned = ptr_is_owned(o);
30295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30296         o_conv = ErrorMessage_clone(&o_conv);
30297         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30298         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30299         return tag_ptr(ret_conv, true);
30300 }
30301
30302 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_err(int64_t e) {
30303         void* e_ptr = untag_ptr(e);
30304         CHECK_ACCESS(e_ptr);
30305         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30306         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30307         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30308         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30309         return tag_ptr(ret_conv, true);
30310 }
30311
30312 jboolean  CS_LDK_CResult_ErrorMessageDecodeErrorZ_is_ok(int64_t o) {
30313         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30314         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30315         return ret_conv;
30316 }
30317
30318 void  CS_LDK_CResult_ErrorMessageDecodeErrorZ_free(int64_t _res) {
30319         if (!ptr_is_owned(_res)) return;
30320         void* _res_ptr = untag_ptr(_res);
30321         CHECK_ACCESS(_res_ptr);
30322         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30323         FREE(untag_ptr(_res));
30324         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30325 }
30326
30327 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30328         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30329         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30330         return tag_ptr(ret_conv, true);
30331 }
30332 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone_ptr(int64_t arg) {
30333         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30334         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30335         return ret_conv;
30336 }
30337
30338 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone(int64_t orig) {
30339         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30340         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30341         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30342         return tag_ptr(ret_conv, true);
30343 }
30344
30345 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_ok(int64_t o) {
30346         LDKWarningMessage o_conv;
30347         o_conv.inner = untag_ptr(o);
30348         o_conv.is_owned = ptr_is_owned(o);
30349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30350         o_conv = WarningMessage_clone(&o_conv);
30351         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30352         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30353         return tag_ptr(ret_conv, true);
30354 }
30355
30356 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_err(int64_t e) {
30357         void* e_ptr = untag_ptr(e);
30358         CHECK_ACCESS(e_ptr);
30359         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30360         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30361         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30362         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30363         return tag_ptr(ret_conv, true);
30364 }
30365
30366 jboolean  CS_LDK_CResult_WarningMessageDecodeErrorZ_is_ok(int64_t o) {
30367         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30368         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30369         return ret_conv;
30370 }
30371
30372 void  CS_LDK_CResult_WarningMessageDecodeErrorZ_free(int64_t _res) {
30373         if (!ptr_is_owned(_res)) return;
30374         void* _res_ptr = untag_ptr(_res);
30375         CHECK_ACCESS(_res_ptr);
30376         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30377         FREE(untag_ptr(_res));
30378         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30379 }
30380
30381 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30382         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30383         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30384         return tag_ptr(ret_conv, true);
30385 }
30386 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone_ptr(int64_t arg) {
30387         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30388         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30389         return ret_conv;
30390 }
30391
30392 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone(int64_t orig) {
30393         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30394         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30395         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30396         return tag_ptr(ret_conv, true);
30397 }
30398
30399 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(int64_t o) {
30400         LDKUnsignedNodeAnnouncement o_conv;
30401         o_conv.inner = untag_ptr(o);
30402         o_conv.is_owned = ptr_is_owned(o);
30403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30404         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30405         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30406         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30407         return tag_ptr(ret_conv, true);
30408 }
30409
30410 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(int64_t e) {
30411         void* e_ptr = untag_ptr(e);
30412         CHECK_ACCESS(e_ptr);
30413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30415         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30416         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 jboolean  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30421         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30422         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30423         return ret_conv;
30424 }
30425
30426 void  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(int64_t _res) {
30427         if (!ptr_is_owned(_res)) return;
30428         void* _res_ptr = untag_ptr(_res);
30429         CHECK_ACCESS(_res_ptr);
30430         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30431         FREE(untag_ptr(_res));
30432         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30433 }
30434
30435 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30436         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30437         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30438         return tag_ptr(ret_conv, true);
30439 }
30440 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30441         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30442         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30443         return ret_conv;
30444 }
30445
30446 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
30447         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30448         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30449         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30450         return tag_ptr(ret_conv, true);
30451 }
30452
30453 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_ok(int64_t o) {
30454         LDKNodeAnnouncement o_conv;
30455         o_conv.inner = untag_ptr(o);
30456         o_conv.is_owned = ptr_is_owned(o);
30457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30458         o_conv = NodeAnnouncement_clone(&o_conv);
30459         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30460         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30461         return tag_ptr(ret_conv, true);
30462 }
30463
30464 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_err(int64_t e) {
30465         void* e_ptr = untag_ptr(e);
30466         CHECK_ACCESS(e_ptr);
30467         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30468         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30469         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30470         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30471         return tag_ptr(ret_conv, true);
30472 }
30473
30474 jboolean  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30475         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30476         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30477         return ret_conv;
30478 }
30479
30480 void  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_free(int64_t _res) {
30481         if (!ptr_is_owned(_res)) return;
30482         void* _res_ptr = untag_ptr(_res);
30483         CHECK_ACCESS(_res_ptr);
30484         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30485         FREE(untag_ptr(_res));
30486         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30487 }
30488
30489 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30490         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30491         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30492         return tag_ptr(ret_conv, true);
30493 }
30494 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30495         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30496         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30497         return ret_conv;
30498 }
30499
30500 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
30501         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30502         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30503         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30504         return tag_ptr(ret_conv, true);
30505 }
30506
30507 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_ok(int64_t o) {
30508         LDKQueryShortChannelIds o_conv;
30509         o_conv.inner = untag_ptr(o);
30510         o_conv.is_owned = ptr_is_owned(o);
30511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30512         o_conv = QueryShortChannelIds_clone(&o_conv);
30513         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30514         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30515         return tag_ptr(ret_conv, true);
30516 }
30517
30518 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_err(int64_t e) {
30519         void* e_ptr = untag_ptr(e);
30520         CHECK_ACCESS(e_ptr);
30521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30523         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30524         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30525         return tag_ptr(ret_conv, true);
30526 }
30527
30528 jboolean  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(int64_t o) {
30529         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30530         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30531         return ret_conv;
30532 }
30533
30534 void  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_free(int64_t _res) {
30535         if (!ptr_is_owned(_res)) return;
30536         void* _res_ptr = untag_ptr(_res);
30537         CHECK_ACCESS(_res_ptr);
30538         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30539         FREE(untag_ptr(_res));
30540         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30541 }
30542
30543 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30544         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30545         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30546         return tag_ptr(ret_conv, true);
30547 }
30548 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(int64_t arg) {
30549         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30550         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30551         return ret_conv;
30552 }
30553
30554 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone(int64_t orig) {
30555         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30556         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30557         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30558         return tag_ptr(ret_conv, true);
30559 }
30560
30561 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(int64_t o) {
30562         LDKReplyShortChannelIdsEnd o_conv;
30563         o_conv.inner = untag_ptr(o);
30564         o_conv.is_owned = ptr_is_owned(o);
30565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30566         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30567         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30568         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30569         return tag_ptr(ret_conv, true);
30570 }
30571
30572 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(int64_t e) {
30573         void* e_ptr = untag_ptr(e);
30574         CHECK_ACCESS(e_ptr);
30575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30577         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30578         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30579         return tag_ptr(ret_conv, true);
30580 }
30581
30582 jboolean  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(int64_t o) {
30583         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30584         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30585         return ret_conv;
30586 }
30587
30588 void  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(int64_t _res) {
30589         if (!ptr_is_owned(_res)) return;
30590         void* _res_ptr = untag_ptr(_res);
30591         CHECK_ACCESS(_res_ptr);
30592         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30593         FREE(untag_ptr(_res));
30594         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30595 }
30596
30597 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30598         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30599         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30600         return tag_ptr(ret_conv, true);
30601 }
30602 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(int64_t arg) {
30603         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30604         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30605         return ret_conv;
30606 }
30607
30608 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(int64_t orig) {
30609         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30610         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30611         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30612         return tag_ptr(ret_conv, true);
30613 }
30614
30615 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_ok(int64_t o) {
30616         LDKQueryChannelRange o_conv;
30617         o_conv.inner = untag_ptr(o);
30618         o_conv.is_owned = ptr_is_owned(o);
30619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30620         o_conv = QueryChannelRange_clone(&o_conv);
30621         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30622         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30623         return tag_ptr(ret_conv, true);
30624 }
30625
30626 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_err(int64_t e) {
30627         void* e_ptr = untag_ptr(e);
30628         CHECK_ACCESS(e_ptr);
30629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30631         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30632         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30633         return tag_ptr(ret_conv, true);
30634 }
30635
30636 jboolean  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_is_ok(int64_t o) {
30637         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30638         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30639         return ret_conv;
30640 }
30641
30642 void  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_free(int64_t _res) {
30643         if (!ptr_is_owned(_res)) return;
30644         void* _res_ptr = untag_ptr(_res);
30645         CHECK_ACCESS(_res_ptr);
30646         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30647         FREE(untag_ptr(_res));
30648         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30649 }
30650
30651 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30652         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30653         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30654         return tag_ptr(ret_conv, true);
30655 }
30656 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
30657         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30658         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30659         return ret_conv;
30660 }
30661
30662 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone(int64_t orig) {
30663         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30664         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30665         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30666         return tag_ptr(ret_conv, true);
30667 }
30668
30669 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_ok(int64_t o) {
30670         LDKReplyChannelRange o_conv;
30671         o_conv.inner = untag_ptr(o);
30672         o_conv.is_owned = ptr_is_owned(o);
30673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30674         o_conv = ReplyChannelRange_clone(&o_conv);
30675         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30676         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30677         return tag_ptr(ret_conv, true);
30678 }
30679
30680 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_err(int64_t e) {
30681         void* e_ptr = untag_ptr(e);
30682         CHECK_ACCESS(e_ptr);
30683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30685         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30686         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30687         return tag_ptr(ret_conv, true);
30688 }
30689
30690 jboolean  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(int64_t o) {
30691         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30692         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30693         return ret_conv;
30694 }
30695
30696 void  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_free(int64_t _res) {
30697         if (!ptr_is_owned(_res)) return;
30698         void* _res_ptr = untag_ptr(_res);
30699         CHECK_ACCESS(_res_ptr);
30700         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30701         FREE(untag_ptr(_res));
30702         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30703 }
30704
30705 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30706         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30707         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30708         return tag_ptr(ret_conv, true);
30709 }
30710 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
30711         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30712         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30713         return ret_conv;
30714 }
30715
30716 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone(int64_t orig) {
30717         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30718         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30719         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30720         return tag_ptr(ret_conv, true);
30721 }
30722
30723 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_ok(int64_t o) {
30724         LDKGossipTimestampFilter o_conv;
30725         o_conv.inner = untag_ptr(o);
30726         o_conv.is_owned = ptr_is_owned(o);
30727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30728         o_conv = GossipTimestampFilter_clone(&o_conv);
30729         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30730         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30731         return tag_ptr(ret_conv, true);
30732 }
30733
30734 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_err(int64_t e) {
30735         void* e_ptr = untag_ptr(e);
30736         CHECK_ACCESS(e_ptr);
30737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30739         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30740         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30741         return tag_ptr(ret_conv, true);
30742 }
30743
30744 jboolean  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(int64_t o) {
30745         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30746         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30747         return ret_conv;
30748 }
30749
30750 void  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_free(int64_t _res) {
30751         if (!ptr_is_owned(_res)) return;
30752         void* _res_ptr = untag_ptr(_res);
30753         CHECK_ACCESS(_res_ptr);
30754         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30755         FREE(untag_ptr(_res));
30756         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30757 }
30758
30759 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30760         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30761         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30762         return tag_ptr(ret_conv, true);
30763 }
30764 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(int64_t arg) {
30765         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30766         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30767         return ret_conv;
30768 }
30769
30770 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone(int64_t orig) {
30771         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30772         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30773         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30774         return tag_ptr(ret_conv, true);
30775 }
30776
30777 void  CS_LDK_CVec_PhantomRouteHintsZ_free(int64_tArray _res) {
30778         LDKCVec_PhantomRouteHintsZ _res_constr;
30779         _res_constr.datalen = _res->arr_len;
30780         if (_res_constr.datalen > 0)
30781                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30782         else
30783                 _res_constr.data = NULL;
30784         int64_t* _res_vals = _res->elems;
30785         for (size_t t = 0; t < _res_constr.datalen; t++) {
30786                 int64_t _res_conv_19 = _res_vals[t];
30787                 LDKPhantomRouteHints _res_conv_19_conv;
30788                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30789                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30790                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30791                 _res_constr.data[t] = _res_conv_19_conv;
30792         }
30793         FREE(_res);
30794         CVec_PhantomRouteHintsZ_free(_res_constr);
30795 }
30796
30797 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(int64_t o) {
30798         LDKBolt11Invoice o_conv;
30799         o_conv.inner = untag_ptr(o);
30800         o_conv.is_owned = ptr_is_owned(o);
30801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30802         o_conv = Bolt11Invoice_clone(&o_conv);
30803         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30804         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30805         return tag_ptr(ret_conv, true);
30806 }
30807
30808 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(int64_t e) {
30809         void* e_ptr = untag_ptr(e);
30810         CHECK_ACCESS(e_ptr);
30811         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30812         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30813         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30814         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30815         return tag_ptr(ret_conv, true);
30816 }
30817
30818 jboolean  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(int64_t o) {
30819         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30820         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30821         return ret_conv;
30822 }
30823
30824 void  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(int64_t _res) {
30825         if (!ptr_is_owned(_res)) return;
30826         void* _res_ptr = untag_ptr(_res);
30827         CHECK_ACCESS(_res_ptr);
30828         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30829         FREE(untag_ptr(_res));
30830         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30831 }
30832
30833 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30834         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30835         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30836         return tag_ptr(ret_conv, true);
30837 }
30838 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(int64_t arg) {
30839         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30840         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30841         return ret_conv;
30842 }
30843
30844 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(int64_t orig) {
30845         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30846         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30847         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30848         return tag_ptr(ret_conv, true);
30849 }
30850
30851 void  CS_LDK_CVec_FutureZ_free(int64_tArray _res) {
30852         LDKCVec_FutureZ _res_constr;
30853         _res_constr.datalen = _res->arr_len;
30854         if (_res_constr.datalen > 0)
30855                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
30856         else
30857                 _res_constr.data = NULL;
30858         int64_t* _res_vals = _res->elems;
30859         for (size_t i = 0; i < _res_constr.datalen; i++) {
30860                 int64_t _res_conv_8 = _res_vals[i];
30861                 LDKFuture _res_conv_8_conv;
30862                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
30863                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
30864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
30865                 _res_constr.data[i] = _res_conv_8_conv;
30866         }
30867         FREE(_res);
30868         CVec_FutureZ_free(_res_constr);
30869 }
30870
30871 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_ok(int64_t o) {
30872         void* o_ptr = untag_ptr(o);
30873         CHECK_ACCESS(o_ptr);
30874         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30875         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30876         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30877         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
30878         return tag_ptr(ret_conv, true);
30879 }
30880
30881 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_err(int64_t e) {
30882         void* e_ptr = untag_ptr(e);
30883         CHECK_ACCESS(e_ptr);
30884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30886         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30887         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
30888         return tag_ptr(ret_conv, true);
30889 }
30890
30891 jboolean  CS_LDK_CResult_OffersMessageDecodeErrorZ_is_ok(int64_t o) {
30892         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
30893         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
30894         return ret_conv;
30895 }
30896
30897 void  CS_LDK_CResult_OffersMessageDecodeErrorZ_free(int64_t _res) {
30898         if (!ptr_is_owned(_res)) return;
30899         void* _res_ptr = untag_ptr(_res);
30900         CHECK_ACCESS(_res_ptr);
30901         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
30902         FREE(untag_ptr(_res));
30903         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
30904 }
30905
30906 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
30907         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30908         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
30909         return tag_ptr(ret_conv, true);
30910 }
30911 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone_ptr(int64_t arg) {
30912         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
30913         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
30914         return ret_conv;
30915 }
30916
30917 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone(int64_t orig) {
30918         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
30919         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
30920         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
30921         return tag_ptr(ret_conv, true);
30922 }
30923
30924 int64_t  CS_LDK_COption_HTLCClaimZ_some(int32_t o) {
30925         LDKHTLCClaim o_conv = LDKHTLCClaim_from_cs(o);
30926         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30927         *ret_copy = COption_HTLCClaimZ_some(o_conv);
30928         int64_t ret_ref = tag_ptr(ret_copy, true);
30929         return ret_ref;
30930 }
30931
30932 int64_t  CS_LDK_COption_HTLCClaimZ_none() {
30933         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
30934         *ret_copy = COption_HTLCClaimZ_none();
30935         int64_t ret_ref = tag_ptr(ret_copy, true);
30936         return ret_ref;
30937 }
30938
30939 void  CS_LDK_COption_HTLCClaimZ_free(int64_t _res) {
30940         if (!ptr_is_owned(_res)) return;
30941         void* _res_ptr = untag_ptr(_res);
30942         CHECK_ACCESS(_res_ptr);
30943         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
30944         FREE(untag_ptr(_res));
30945         COption_HTLCClaimZ_free(_res_conv);
30946 }
30947
30948 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(int64_t o) {
30949         LDKCounterpartyCommitmentSecrets 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 = CounterpartyCommitmentSecrets_clone(&o_conv);
30954         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30955         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
30956         return tag_ptr(ret_conv, true);
30957 }
30958
30959 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(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_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30965         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
30966         return tag_ptr(ret_conv, true);
30967 }
30968
30969 jboolean  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(int64_t o) {
30970         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
30971         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
30972         return ret_conv;
30973 }
30974
30975 void  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(int64_t _res) {
30976         if (!ptr_is_owned(_res)) return;
30977         void* _res_ptr = untag_ptr(_res);
30978         CHECK_ACCESS(_res_ptr);
30979         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
30980         FREE(untag_ptr(_res));
30981         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
30982 }
30983
30984 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
30985         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30986         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
30987         return tag_ptr(ret_conv, true);
30988 }
30989 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(int64_t arg) {
30990         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
30991         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
30992         return ret_conv;
30993 }
30994
30995 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(int64_t orig) {
30996         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
30997         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
30998         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
30999         return tag_ptr(ret_conv, true);
31000 }
31001
31002 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_ok(int64_t o) {
31003         LDKTxCreationKeys o_conv;
31004         o_conv.inner = untag_ptr(o);
31005         o_conv.is_owned = ptr_is_owned(o);
31006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31007         o_conv = TxCreationKeys_clone(&o_conv);
31008         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31009         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31010         return tag_ptr(ret_conv, true);
31011 }
31012
31013 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_err(int64_t e) {
31014         void* e_ptr = untag_ptr(e);
31015         CHECK_ACCESS(e_ptr);
31016         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31017         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31018         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31019         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31020         return tag_ptr(ret_conv, true);
31021 }
31022
31023 jboolean  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_is_ok(int64_t o) {
31024         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31025         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31026         return ret_conv;
31027 }
31028
31029 void  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_free(int64_t _res) {
31030         if (!ptr_is_owned(_res)) return;
31031         void* _res_ptr = untag_ptr(_res);
31032         CHECK_ACCESS(_res_ptr);
31033         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31034         FREE(untag_ptr(_res));
31035         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31036 }
31037
31038 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31039         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31040         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31041         return tag_ptr(ret_conv, true);
31042 }
31043 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(int64_t arg) {
31044         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31045         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31046         return ret_conv;
31047 }
31048
31049 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone(int64_t orig) {
31050         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31051         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31052         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31053         return tag_ptr(ret_conv, true);
31054 }
31055
31056 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_ok(int64_t o) {
31057         LDKChannelPublicKeys o_conv;
31058         o_conv.inner = untag_ptr(o);
31059         o_conv.is_owned = ptr_is_owned(o);
31060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31061         o_conv = ChannelPublicKeys_clone(&o_conv);
31062         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31063         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31064         return tag_ptr(ret_conv, true);
31065 }
31066
31067 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_err(int64_t e) {
31068         void* e_ptr = untag_ptr(e);
31069         CHECK_ACCESS(e_ptr);
31070         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31071         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31072         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31073         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31074         return tag_ptr(ret_conv, true);
31075 }
31076
31077 jboolean  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(int64_t o) {
31078         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31079         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31080         return ret_conv;
31081 }
31082
31083 void  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_free(int64_t _res) {
31084         if (!ptr_is_owned(_res)) return;
31085         void* _res_ptr = untag_ptr(_res);
31086         CHECK_ACCESS(_res_ptr);
31087         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31088         FREE(untag_ptr(_res));
31089         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31090 }
31091
31092 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31093         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31094         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31095         return tag_ptr(ret_conv, true);
31096 }
31097 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(int64_t arg) {
31098         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31099         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31100         return ret_conv;
31101 }
31102
31103 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone(int64_t orig) {
31104         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31105         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31106         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31107         return tag_ptr(ret_conv, true);
31108 }
31109
31110 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(int64_t o) {
31111         LDKHTLCOutputInCommitment o_conv;
31112         o_conv.inner = untag_ptr(o);
31113         o_conv.is_owned = ptr_is_owned(o);
31114         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31115         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31116         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31117         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31118         return tag_ptr(ret_conv, true);
31119 }
31120
31121 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(int64_t e) {
31122         void* e_ptr = untag_ptr(e);
31123         CHECK_ACCESS(e_ptr);
31124         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31125         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31126         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31127         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31128         return tag_ptr(ret_conv, true);
31129 }
31130
31131 jboolean  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(int64_t o) {
31132         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31133         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31134         return ret_conv;
31135 }
31136
31137 void  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(int64_t _res) {
31138         if (!ptr_is_owned(_res)) return;
31139         void* _res_ptr = untag_ptr(_res);
31140         CHECK_ACCESS(_res_ptr);
31141         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31142         FREE(untag_ptr(_res));
31143         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31144 }
31145
31146 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31147         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31148         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31149         return tag_ptr(ret_conv, true);
31150 }
31151 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(int64_t arg) {
31152         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31153         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31154         return ret_conv;
31155 }
31156
31157 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(int64_t orig) {
31158         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31159         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31160         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31161         return tag_ptr(ret_conv, true);
31162 }
31163
31164 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
31165         LDKCounterpartyChannelTransactionParameters o_conv;
31166         o_conv.inner = untag_ptr(o);
31167         o_conv.is_owned = ptr_is_owned(o);
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31169         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31170         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31171         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31172         return tag_ptr(ret_conv, true);
31173 }
31174
31175 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
31176         void* e_ptr = untag_ptr(e);
31177         CHECK_ACCESS(e_ptr);
31178         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31179         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31180         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31181         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31182         return tag_ptr(ret_conv, true);
31183 }
31184
31185 jboolean  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
31186         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31187         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31188         return ret_conv;
31189 }
31190
31191 void  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
31192         if (!ptr_is_owned(_res)) return;
31193         void* _res_ptr = untag_ptr(_res);
31194         CHECK_ACCESS(_res_ptr);
31195         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31196         FREE(untag_ptr(_res));
31197         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31198 }
31199
31200 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31201         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31202         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31203         return tag_ptr(ret_conv, true);
31204 }
31205 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
31206         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31207         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31208         return ret_conv;
31209 }
31210
31211 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
31212         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31213         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31214         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31215         return tag_ptr(ret_conv, true);
31216 }
31217
31218 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
31219         LDKChannelTransactionParameters o_conv;
31220         o_conv.inner = untag_ptr(o);
31221         o_conv.is_owned = ptr_is_owned(o);
31222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31223         o_conv = ChannelTransactionParameters_clone(&o_conv);
31224         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31225         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31226         return tag_ptr(ret_conv, true);
31227 }
31228
31229 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
31230         void* e_ptr = untag_ptr(e);
31231         CHECK_ACCESS(e_ptr);
31232         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31233         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31234         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31235         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31236         return tag_ptr(ret_conv, true);
31237 }
31238
31239 jboolean  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
31240         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31241         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31242         return ret_conv;
31243 }
31244
31245 void  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
31246         if (!ptr_is_owned(_res)) return;
31247         void* _res_ptr = untag_ptr(_res);
31248         CHECK_ACCESS(_res_ptr);
31249         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31250         FREE(untag_ptr(_res));
31251         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31252 }
31253
31254 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31255         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31256         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31257         return tag_ptr(ret_conv, true);
31258 }
31259 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
31260         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31261         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31262         return ret_conv;
31263 }
31264
31265 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
31266         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31267         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31268         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31269         return tag_ptr(ret_conv, true);
31270 }
31271
31272 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31273         LDKHolderCommitmentTransaction o_conv;
31274         o_conv.inner = untag_ptr(o);
31275         o_conv.is_owned = ptr_is_owned(o);
31276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31277         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31278         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31279         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31280         return tag_ptr(ret_conv, true);
31281 }
31282
31283 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_err(int64_t e) {
31284         void* e_ptr = untag_ptr(e);
31285         CHECK_ACCESS(e_ptr);
31286         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31287         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31288         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31289         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31290         return tag_ptr(ret_conv, true);
31291 }
31292
31293 jboolean  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31294         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31295         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31296         return ret_conv;
31297 }
31298
31299 void  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31300         if (!ptr_is_owned(_res)) return;
31301         void* _res_ptr = untag_ptr(_res);
31302         CHECK_ACCESS(_res_ptr);
31303         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31304         FREE(untag_ptr(_res));
31305         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31306 }
31307
31308 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31309         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31310         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31311         return tag_ptr(ret_conv, true);
31312 }
31313 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31314         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31315         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31316         return ret_conv;
31317 }
31318
31319 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31320         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31321         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31322         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31323         return tag_ptr(ret_conv, true);
31324 }
31325
31326 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31327         LDKBuiltCommitmentTransaction o_conv;
31328         o_conv.inner = untag_ptr(o);
31329         o_conv.is_owned = ptr_is_owned(o);
31330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31331         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31332         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31333         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31334         return tag_ptr(ret_conv, true);
31335 }
31336
31337 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(int64_t e) {
31338         void* e_ptr = untag_ptr(e);
31339         CHECK_ACCESS(e_ptr);
31340         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31341         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31342         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31343         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31344         return tag_ptr(ret_conv, true);
31345 }
31346
31347 jboolean  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31348         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31349         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31350         return ret_conv;
31351 }
31352
31353 void  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31354         if (!ptr_is_owned(_res)) return;
31355         void* _res_ptr = untag_ptr(_res);
31356         CHECK_ACCESS(_res_ptr);
31357         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31358         FREE(untag_ptr(_res));
31359         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31360 }
31361
31362 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31363         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31364         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31365         return tag_ptr(ret_conv, true);
31366 }
31367 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31368         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31369         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31370         return ret_conv;
31371 }
31372
31373 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31374         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31375         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31376         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31377         return tag_ptr(ret_conv, true);
31378 }
31379
31380 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_ok(int64_t o) {
31381         LDKTrustedClosingTransaction o_conv;
31382         o_conv.inner = untag_ptr(o);
31383         o_conv.is_owned = ptr_is_owned(o);
31384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31385         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31386         
31387         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31388         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31389         return tag_ptr(ret_conv, true);
31390 }
31391
31392 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_err() {
31393         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31394         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31395         return tag_ptr(ret_conv, true);
31396 }
31397
31398 jboolean  CS_LDK_CResult_TrustedClosingTransactionNoneZ_is_ok(int64_t o) {
31399         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31400         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31401         return ret_conv;
31402 }
31403
31404 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_free(int64_t _res) {
31405         if (!ptr_is_owned(_res)) return;
31406         void* _res_ptr = untag_ptr(_res);
31407         CHECK_ACCESS(_res_ptr);
31408         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31409         FREE(untag_ptr(_res));
31410         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31411 }
31412
31413 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31414         LDKCommitmentTransaction o_conv;
31415         o_conv.inner = untag_ptr(o);
31416         o_conv.is_owned = ptr_is_owned(o);
31417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31418         o_conv = CommitmentTransaction_clone(&o_conv);
31419         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31420         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31421         return tag_ptr(ret_conv, true);
31422 }
31423
31424 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_err(int64_t e) {
31425         void* e_ptr = untag_ptr(e);
31426         CHECK_ACCESS(e_ptr);
31427         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31428         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31429         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31430         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31431         return tag_ptr(ret_conv, true);
31432 }
31433
31434 jboolean  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31435         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31436         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31437         return ret_conv;
31438 }
31439
31440 void  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31441         if (!ptr_is_owned(_res)) return;
31442         void* _res_ptr = untag_ptr(_res);
31443         CHECK_ACCESS(_res_ptr);
31444         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31445         FREE(untag_ptr(_res));
31446         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31447 }
31448
31449 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31450         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31451         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31452         return tag_ptr(ret_conv, true);
31453 }
31454 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31455         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31456         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31457         return ret_conv;
31458 }
31459
31460 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31461         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31462         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31463         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31464         return tag_ptr(ret_conv, true);
31465 }
31466
31467 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_ok(int64_t o) {
31468         LDKTrustedCommitmentTransaction o_conv;
31469         o_conv.inner = untag_ptr(o);
31470         o_conv.is_owned = ptr_is_owned(o);
31471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31472         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31473         
31474         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31475         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31476         return tag_ptr(ret_conv, true);
31477 }
31478
31479 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_err() {
31480         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31481         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
31482         return tag_ptr(ret_conv, true);
31483 }
31484
31485 jboolean  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_is_ok(int64_t o) {
31486         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
31487         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
31488         return ret_conv;
31489 }
31490
31491 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_free(int64_t _res) {
31492         if (!ptr_is_owned(_res)) return;
31493         void* _res_ptr = untag_ptr(_res);
31494         CHECK_ACCESS(_res_ptr);
31495         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
31496         FREE(untag_ptr(_res));
31497         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
31498 }
31499
31500 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
31501         LDKCVec_ECDSASignatureZ o_constr;
31502         o_constr.datalen = o->arr_len;
31503         if (o_constr.datalen > 0)
31504                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
31505         else
31506                 o_constr.data = NULL;
31507         int8_tArray* o_vals = (void*) o->elems;
31508         for (size_t i = 0; i < o_constr.datalen; i++) {
31509                 int8_tArray o_conv_8 = o_vals[i];
31510                 LDKECDSASignature o_conv_8_ref;
31511                 CHECK(o_conv_8->arr_len == 64);
31512                 memcpy(o_conv_8_ref.compact_form, o_conv_8->elems, 64); FREE(o_conv_8);
31513                 o_constr.data[i] = o_conv_8_ref;
31514         }
31515         FREE(o);
31516         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31517         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
31518         return tag_ptr(ret_conv, true);
31519 }
31520
31521 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_err() {
31522         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31523         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
31524         return tag_ptr(ret_conv, true);
31525 }
31526
31527 jboolean  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_is_ok(int64_t o) {
31528         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
31529         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
31530         return ret_conv;
31531 }
31532
31533 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_free(int64_t _res) {
31534         if (!ptr_is_owned(_res)) return;
31535         void* _res_ptr = untag_ptr(_res);
31536         CHECK_ACCESS(_res_ptr);
31537         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
31538         FREE(untag_ptr(_res));
31539         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
31540 }
31541
31542 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
31543         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31544         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
31545         return tag_ptr(ret_conv, true);
31546 }
31547 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(int64_t arg) {
31548         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
31549         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
31550         return ret_conv;
31551 }
31552
31553 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone(int64_t orig) {
31554         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
31555         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
31556         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
31557         return tag_ptr(ret_conv, true);
31558 }
31559
31560 int64_t  CS_LDK_COption_usizeZ_some(int64_t o) {
31561         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31562         *ret_copy = COption_usizeZ_some(o);
31563         int64_t ret_ref = tag_ptr(ret_copy, true);
31564         return ret_ref;
31565 }
31566
31567 int64_t  CS_LDK_COption_usizeZ_none() {
31568         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31569         *ret_copy = COption_usizeZ_none();
31570         int64_t ret_ref = tag_ptr(ret_copy, true);
31571         return ret_ref;
31572 }
31573
31574 void  CS_LDK_COption_usizeZ_free(int64_t _res) {
31575         if (!ptr_is_owned(_res)) return;
31576         void* _res_ptr = untag_ptr(_res);
31577         CHECK_ACCESS(_res_ptr);
31578         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
31579         FREE(untag_ptr(_res));
31580         COption_usizeZ_free(_res_conv);
31581 }
31582
31583 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
31584         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31585         *ret_copy = COption_usizeZ_clone(arg);
31586         int64_t ret_ref = tag_ptr(ret_copy, true);
31587         return ret_ref;
31588 }
31589 int64_t  CS_LDK_COption_usizeZ_clone_ptr(int64_t arg) {
31590         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
31591         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
31592         return ret_conv;
31593 }
31594
31595 int64_t  CS_LDK_COption_usizeZ_clone(int64_t orig) {
31596         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
31597         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
31598         *ret_copy = COption_usizeZ_clone(orig_conv);
31599         int64_t ret_ref = tag_ptr(ret_copy, true);
31600         return ret_ref;
31601 }
31602
31603 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_ok(int64_t o) {
31604         LDKShutdownScript o_conv;
31605         o_conv.inner = untag_ptr(o);
31606         o_conv.is_owned = ptr_is_owned(o);
31607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31608         o_conv = ShutdownScript_clone(&o_conv);
31609         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31610         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
31611         return tag_ptr(ret_conv, true);
31612 }
31613
31614 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_err(int64_t e) {
31615         void* e_ptr = untag_ptr(e);
31616         CHECK_ACCESS(e_ptr);
31617         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31618         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31619         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31620         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
31621         return tag_ptr(ret_conv, true);
31622 }
31623
31624 jboolean  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_is_ok(int64_t o) {
31625         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
31626         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
31627         return ret_conv;
31628 }
31629
31630 void  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_free(int64_t _res) {
31631         if (!ptr_is_owned(_res)) return;
31632         void* _res_ptr = untag_ptr(_res);
31633         CHECK_ACCESS(_res_ptr);
31634         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
31635         FREE(untag_ptr(_res));
31636         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
31637 }
31638
31639 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
31640         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31641         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
31642         return tag_ptr(ret_conv, true);
31643 }
31644 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(int64_t arg) {
31645         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
31646         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
31647         return ret_conv;
31648 }
31649
31650 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone(int64_t orig) {
31651         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
31652         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31653         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
31654         return tag_ptr(ret_conv, true);
31655 }
31656
31657 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(int64_t o) {
31658         LDKShutdownScript o_conv;
31659         o_conv.inner = untag_ptr(o);
31660         o_conv.is_owned = ptr_is_owned(o);
31661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31662         o_conv = ShutdownScript_clone(&o_conv);
31663         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31664         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
31665         return tag_ptr(ret_conv, true);
31666 }
31667
31668 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_err(int64_t e) {
31669         LDKInvalidShutdownScript e_conv;
31670         e_conv.inner = untag_ptr(e);
31671         e_conv.is_owned = ptr_is_owned(e);
31672         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
31673         e_conv = InvalidShutdownScript_clone(&e_conv);
31674         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31675         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
31676         return tag_ptr(ret_conv, true);
31677 }
31678
31679 jboolean  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(int64_t o) {
31680         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
31681         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
31682         return ret_conv;
31683 }
31684
31685 void  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_free(int64_t _res) {
31686         if (!ptr_is_owned(_res)) return;
31687         void* _res_ptr = untag_ptr(_res);
31688         CHECK_ACCESS(_res_ptr);
31689         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
31690         FREE(untag_ptr(_res));
31691         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
31692 }
31693
31694 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
31695         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31696         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
31697         return tag_ptr(ret_conv, true);
31698 }
31699 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(int64_t arg) {
31700         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
31701         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
31702         return ret_conv;
31703 }
31704
31705 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(int64_t orig) {
31706         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
31707         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31708         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
31709         return tag_ptr(ret_conv, true);
31710 }
31711
31712 void  CS_LDK_CVec_TransactionZ_free(ptrArray _res) {
31713         LDKCVec_TransactionZ _res_constr;
31714         _res_constr.datalen = _res->arr_len;
31715         if (_res_constr.datalen > 0)
31716                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
31717         else
31718                 _res_constr.data = NULL;
31719         int8_tArray* _res_vals = (void*) _res->elems;
31720         for (size_t i = 0; i < _res_constr.datalen; i++) {
31721                 int8_tArray _res_conv_8 = _res_vals[i];
31722                 LDKTransaction _res_conv_8_ref;
31723                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
31724                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
31725                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
31726                 _res_conv_8_ref.data_is_owned = true;
31727                 _res_constr.data[i] = _res_conv_8_ref;
31728         }
31729         FREE(_res);
31730         CVec_TransactionZ_free(_res_constr);
31731 }
31732
31733 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_ok(int64_t o) {
31734         void* o_ptr = untag_ptr(o);
31735         CHECK_ACCESS(o_ptr);
31736         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
31737         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
31738         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31739         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
31740         return tag_ptr(ret_conv, true);
31741 }
31742
31743 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_err(int64_t e) {
31744         void* e_ptr = untag_ptr(e);
31745         CHECK_ACCESS(e_ptr);
31746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31748         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31749         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
31750         return tag_ptr(ret_conv, true);
31751 }
31752
31753 jboolean  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_is_ok(int64_t o) {
31754         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
31755         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
31756         return ret_conv;
31757 }
31758
31759 void  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_free(int64_t _res) {
31760         if (!ptr_is_owned(_res)) return;
31761         void* _res_ptr = untag_ptr(_res);
31762         CHECK_ACCESS(_res_ptr);
31763         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
31764         FREE(untag_ptr(_res));
31765         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
31766 }
31767
31768 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
31769         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31770         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
31771         return tag_ptr(ret_conv, true);
31772 }
31773 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(int64_t arg) {
31774         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
31775         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
31776         return ret_conv;
31777 }
31778
31779 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone(int64_t orig) {
31780         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
31781         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
31782         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
31783         return tag_ptr(ret_conv, true);
31784 }
31785
31786 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_ok(int64_t o) {
31787         LDKClaimedHTLC o_conv;
31788         o_conv.inner = untag_ptr(o);
31789         o_conv.is_owned = ptr_is_owned(o);
31790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31791         o_conv = ClaimedHTLC_clone(&o_conv);
31792         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31793         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
31794         return tag_ptr(ret_conv, true);
31795 }
31796
31797 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_err(int64_t e) {
31798         void* e_ptr = untag_ptr(e);
31799         CHECK_ACCESS(e_ptr);
31800         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31801         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31802         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31803         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
31804         return tag_ptr(ret_conv, true);
31805 }
31806
31807 jboolean  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_is_ok(int64_t o) {
31808         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
31809         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
31810         return ret_conv;
31811 }
31812
31813 void  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_free(int64_t _res) {
31814         if (!ptr_is_owned(_res)) return;
31815         void* _res_ptr = untag_ptr(_res);
31816         CHECK_ACCESS(_res_ptr);
31817         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
31818         FREE(untag_ptr(_res));
31819         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
31820 }
31821
31822 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
31823         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31824         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
31825         return tag_ptr(ret_conv, true);
31826 }
31827 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
31828         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
31829         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
31830         return ret_conv;
31831 }
31832
31833 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone(int64_t orig) {
31834         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
31835         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
31836         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
31837         return tag_ptr(ret_conv, true);
31838 }
31839
31840 int64_t  CS_LDK_COption_PathFailureZ_some(int64_t o) {
31841         void* o_ptr = untag_ptr(o);
31842         CHECK_ACCESS(o_ptr);
31843         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
31844         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
31845         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31846         *ret_copy = COption_PathFailureZ_some(o_conv);
31847         int64_t ret_ref = tag_ptr(ret_copy, true);
31848         return ret_ref;
31849 }
31850
31851 int64_t  CS_LDK_COption_PathFailureZ_none() {
31852         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31853         *ret_copy = COption_PathFailureZ_none();
31854         int64_t ret_ref = tag_ptr(ret_copy, true);
31855         return ret_ref;
31856 }
31857
31858 void  CS_LDK_COption_PathFailureZ_free(int64_t _res) {
31859         if (!ptr_is_owned(_res)) return;
31860         void* _res_ptr = untag_ptr(_res);
31861         CHECK_ACCESS(_res_ptr);
31862         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
31863         FREE(untag_ptr(_res));
31864         COption_PathFailureZ_free(_res_conv);
31865 }
31866
31867 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
31868         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31869         *ret_copy = COption_PathFailureZ_clone(arg);
31870         int64_t ret_ref = tag_ptr(ret_copy, true);
31871         return ret_ref;
31872 }
31873 int64_t  CS_LDK_COption_PathFailureZ_clone_ptr(int64_t arg) {
31874         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
31875         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
31876         return ret_conv;
31877 }
31878
31879 int64_t  CS_LDK_COption_PathFailureZ_clone(int64_t orig) {
31880         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
31881         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
31882         *ret_copy = COption_PathFailureZ_clone(orig_conv);
31883         int64_t ret_ref = tag_ptr(ret_copy, true);
31884         return ret_ref;
31885 }
31886
31887 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_ok(int64_t o) {
31888         void* o_ptr = untag_ptr(o);
31889         CHECK_ACCESS(o_ptr);
31890         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
31891         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
31892         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31893         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
31894         return tag_ptr(ret_conv, true);
31895 }
31896
31897 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_err(int64_t e) {
31898         void* e_ptr = untag_ptr(e);
31899         CHECK_ACCESS(e_ptr);
31900         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31901         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31902         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31903         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
31904         return tag_ptr(ret_conv, true);
31905 }
31906
31907 jboolean  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_is_ok(int64_t o) {
31908         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
31909         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
31910         return ret_conv;
31911 }
31912
31913 void  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_free(int64_t _res) {
31914         if (!ptr_is_owned(_res)) return;
31915         void* _res_ptr = untag_ptr(_res);
31916         CHECK_ACCESS(_res_ptr);
31917         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
31918         FREE(untag_ptr(_res));
31919         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
31920 }
31921
31922 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
31923         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31924         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
31925         return tag_ptr(ret_conv, true);
31926 }
31927 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(int64_t arg) {
31928         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
31929         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
31930         return ret_conv;
31931 }
31932
31933 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone(int64_t orig) {
31934         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
31935         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
31936         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
31937         return tag_ptr(ret_conv, true);
31938 }
31939
31940 int64_t  CS_LDK_COption_ClosureReasonZ_some(int64_t o) {
31941         void* o_ptr = untag_ptr(o);
31942         CHECK_ACCESS(o_ptr);
31943         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
31944         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
31945         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31946         *ret_copy = COption_ClosureReasonZ_some(o_conv);
31947         int64_t ret_ref = tag_ptr(ret_copy, true);
31948         return ret_ref;
31949 }
31950
31951 int64_t  CS_LDK_COption_ClosureReasonZ_none() {
31952         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31953         *ret_copy = COption_ClosureReasonZ_none();
31954         int64_t ret_ref = tag_ptr(ret_copy, true);
31955         return ret_ref;
31956 }
31957
31958 void  CS_LDK_COption_ClosureReasonZ_free(int64_t _res) {
31959         if (!ptr_is_owned(_res)) return;
31960         void* _res_ptr = untag_ptr(_res);
31961         CHECK_ACCESS(_res_ptr);
31962         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
31963         FREE(untag_ptr(_res));
31964         COption_ClosureReasonZ_free(_res_conv);
31965 }
31966
31967 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
31968         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31969         *ret_copy = COption_ClosureReasonZ_clone(arg);
31970         int64_t ret_ref = tag_ptr(ret_copy, true);
31971         return ret_ref;
31972 }
31973 int64_t  CS_LDK_COption_ClosureReasonZ_clone_ptr(int64_t arg) {
31974         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
31975         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
31976         return ret_conv;
31977 }
31978
31979 int64_t  CS_LDK_COption_ClosureReasonZ_clone(int64_t orig) {
31980         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
31981         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
31982         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
31983         int64_t ret_ref = tag_ptr(ret_copy, true);
31984         return ret_ref;
31985 }
31986
31987 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_ok(int64_t o) {
31988         void* o_ptr = untag_ptr(o);
31989         CHECK_ACCESS(o_ptr);
31990         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
31991         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
31992         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
31993         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
31994         return tag_ptr(ret_conv, true);
31995 }
31996
31997 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_err(int64_t e) {
31998         void* e_ptr = untag_ptr(e);
31999         CHECK_ACCESS(e_ptr);
32000         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32001         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32002         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32003         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32004         return tag_ptr(ret_conv, true);
32005 }
32006
32007 jboolean  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(int64_t o) {
32008         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32009         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32010         return ret_conv;
32011 }
32012
32013 void  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_free(int64_t _res) {
32014         if (!ptr_is_owned(_res)) return;
32015         void* _res_ptr = untag_ptr(_res);
32016         CHECK_ACCESS(_res_ptr);
32017         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32018         FREE(untag_ptr(_res));
32019         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32020 }
32021
32022 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32023         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32024         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32025         return tag_ptr(ret_conv, true);
32026 }
32027 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(int64_t arg) {
32028         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32029         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32030         return ret_conv;
32031 }
32032
32033 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone(int64_t orig) {
32034         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32035         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32036         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32037         return tag_ptr(ret_conv, true);
32038 }
32039
32040 int64_t  CS_LDK_COption_HTLCDestinationZ_some(int64_t o) {
32041         void* o_ptr = untag_ptr(o);
32042         CHECK_ACCESS(o_ptr);
32043         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32044         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32045         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32046         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32047         int64_t ret_ref = tag_ptr(ret_copy, true);
32048         return ret_ref;
32049 }
32050
32051 int64_t  CS_LDK_COption_HTLCDestinationZ_none() {
32052         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32053         *ret_copy = COption_HTLCDestinationZ_none();
32054         int64_t ret_ref = tag_ptr(ret_copy, true);
32055         return ret_ref;
32056 }
32057
32058 void  CS_LDK_COption_HTLCDestinationZ_free(int64_t _res) {
32059         if (!ptr_is_owned(_res)) return;
32060         void* _res_ptr = untag_ptr(_res);
32061         CHECK_ACCESS(_res_ptr);
32062         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32063         FREE(untag_ptr(_res));
32064         COption_HTLCDestinationZ_free(_res_conv);
32065 }
32066
32067 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32068         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32069         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32070         int64_t ret_ref = tag_ptr(ret_copy, true);
32071         return ret_ref;
32072 }
32073 int64_t  CS_LDK_COption_HTLCDestinationZ_clone_ptr(int64_t arg) {
32074         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32075         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32076         return ret_conv;
32077 }
32078
32079 int64_t  CS_LDK_COption_HTLCDestinationZ_clone(int64_t orig) {
32080         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32081         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32082         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32083         int64_t ret_ref = tag_ptr(ret_copy, true);
32084         return ret_ref;
32085 }
32086
32087 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(int64_t o) {
32088         void* o_ptr = untag_ptr(o);
32089         CHECK_ACCESS(o_ptr);
32090         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32091         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32092         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32093         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32094         return tag_ptr(ret_conv, true);
32095 }
32096
32097 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_err(int64_t e) {
32098         void* e_ptr = untag_ptr(e);
32099         CHECK_ACCESS(e_ptr);
32100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32102         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32103         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32104         return tag_ptr(ret_conv, true);
32105 }
32106
32107 jboolean  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(int64_t o) {
32108         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32109         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32110         return ret_conv;
32111 }
32112
32113 void  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_free(int64_t _res) {
32114         if (!ptr_is_owned(_res)) return;
32115         void* _res_ptr = untag_ptr(_res);
32116         CHECK_ACCESS(_res_ptr);
32117         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32118         FREE(untag_ptr(_res));
32119         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32120 }
32121
32122 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32123         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32124         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32125         return tag_ptr(ret_conv, true);
32126 }
32127 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(int64_t arg) {
32128         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32129         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32130         return ret_conv;
32131 }
32132
32133 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(int64_t orig) {
32134         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32135         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32136         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32137         return tag_ptr(ret_conv, true);
32138 }
32139
32140 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_ok(int32_t o) {
32141         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
32142         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32143         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32144         return tag_ptr(ret_conv, true);
32145 }
32146
32147 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_err(int64_t e) {
32148         void* e_ptr = untag_ptr(e);
32149         CHECK_ACCESS(e_ptr);
32150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32152         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32153         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32154         return tag_ptr(ret_conv, true);
32155 }
32156
32157 jboolean  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(int64_t o) {
32158         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32159         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32160         return ret_conv;
32161 }
32162
32163 void  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_free(int64_t _res) {
32164         if (!ptr_is_owned(_res)) return;
32165         void* _res_ptr = untag_ptr(_res);
32166         CHECK_ACCESS(_res_ptr);
32167         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32168         FREE(untag_ptr(_res));
32169         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32170 }
32171
32172 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32173         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32174         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32175         return tag_ptr(ret_conv, true);
32176 }
32177 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(int64_t arg) {
32178         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32179         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32180         return ret_conv;
32181 }
32182
32183 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone(int64_t orig) {
32184         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32185         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32186         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32187         return tag_ptr(ret_conv, true);
32188 }
32189
32190 int64_t  CS_LDK_COption_U128Z_some(int8_tArray o) {
32191         LDKU128 o_ref;
32192         CHECK(o->arr_len == 16);
32193         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
32194         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32195         *ret_copy = COption_U128Z_some(o_ref);
32196         int64_t ret_ref = tag_ptr(ret_copy, true);
32197         return ret_ref;
32198 }
32199
32200 int64_t  CS_LDK_COption_U128Z_none() {
32201         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32202         *ret_copy = COption_U128Z_none();
32203         int64_t ret_ref = tag_ptr(ret_copy, true);
32204         return ret_ref;
32205 }
32206
32207 void  CS_LDK_COption_U128Z_free(int64_t _res) {
32208         if (!ptr_is_owned(_res)) return;
32209         void* _res_ptr = untag_ptr(_res);
32210         CHECK_ACCESS(_res_ptr);
32211         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32212         FREE(untag_ptr(_res));
32213         COption_U128Z_free(_res_conv);
32214 }
32215
32216 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32217         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32218         *ret_copy = COption_U128Z_clone(arg);
32219         int64_t ret_ref = tag_ptr(ret_copy, true);
32220         return ret_ref;
32221 }
32222 int64_t  CS_LDK_COption_U128Z_clone_ptr(int64_t arg) {
32223         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32224         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32225         return ret_conv;
32226 }
32227
32228 int64_t  CS_LDK_COption_U128Z_clone(int64_t orig) {
32229         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32230         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32231         *ret_copy = COption_U128Z_clone(orig_conv);
32232         int64_t ret_ref = tag_ptr(ret_copy, true);
32233         return ret_ref;
32234 }
32235
32236 void  CS_LDK_CVec_ClaimedHTLCZ_free(int64_tArray _res) {
32237         LDKCVec_ClaimedHTLCZ _res_constr;
32238         _res_constr.datalen = _res->arr_len;
32239         if (_res_constr.datalen > 0)
32240                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32241         else
32242                 _res_constr.data = NULL;
32243         int64_t* _res_vals = _res->elems;
32244         for (size_t n = 0; n < _res_constr.datalen; n++) {
32245                 int64_t _res_conv_13 = _res_vals[n];
32246                 LDKClaimedHTLC _res_conv_13_conv;
32247                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32248                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32249                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32250                 _res_constr.data[n] = _res_conv_13_conv;
32251         }
32252         FREE(_res);
32253         CVec_ClaimedHTLCZ_free(_res_constr);
32254 }
32255
32256 int64_t  CS_LDK_COption_PaymentFailureReasonZ_some(int32_t o) {
32257         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
32258         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32259         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32260         int64_t ret_ref = tag_ptr(ret_copy, true);
32261         return ret_ref;
32262 }
32263
32264 int64_t  CS_LDK_COption_PaymentFailureReasonZ_none() {
32265         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32266         *ret_copy = COption_PaymentFailureReasonZ_none();
32267         int64_t ret_ref = tag_ptr(ret_copy, true);
32268         return ret_ref;
32269 }
32270
32271 void  CS_LDK_COption_PaymentFailureReasonZ_free(int64_t _res) {
32272         if (!ptr_is_owned(_res)) return;
32273         void* _res_ptr = untag_ptr(_res);
32274         CHECK_ACCESS(_res_ptr);
32275         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32276         FREE(untag_ptr(_res));
32277         COption_PaymentFailureReasonZ_free(_res_conv);
32278 }
32279
32280 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32281         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32282         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32283         int64_t ret_ref = tag_ptr(ret_copy, true);
32284         return ret_ref;
32285 }
32286 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone_ptr(int64_t arg) {
32287         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32288         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32289         return ret_conv;
32290 }
32291
32292 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone(int64_t orig) {
32293         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32294         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32295         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32296         int64_t ret_ref = tag_ptr(ret_copy, true);
32297         return ret_ref;
32298 }
32299
32300 int64_t  CS_LDK_COption_EventZ_some(int64_t o) {
32301         void* o_ptr = untag_ptr(o);
32302         CHECK_ACCESS(o_ptr);
32303         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32304         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32305         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32306         *ret_copy = COption_EventZ_some(o_conv);
32307         int64_t ret_ref = tag_ptr(ret_copy, true);
32308         return ret_ref;
32309 }
32310
32311 int64_t  CS_LDK_COption_EventZ_none() {
32312         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32313         *ret_copy = COption_EventZ_none();
32314         int64_t ret_ref = tag_ptr(ret_copy, true);
32315         return ret_ref;
32316 }
32317
32318 void  CS_LDK_COption_EventZ_free(int64_t _res) {
32319         if (!ptr_is_owned(_res)) return;
32320         void* _res_ptr = untag_ptr(_res);
32321         CHECK_ACCESS(_res_ptr);
32322         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32323         FREE(untag_ptr(_res));
32324         COption_EventZ_free(_res_conv);
32325 }
32326
32327 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32328         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32329         *ret_copy = COption_EventZ_clone(arg);
32330         int64_t ret_ref = tag_ptr(ret_copy, true);
32331         return ret_ref;
32332 }
32333 int64_t  CS_LDK_COption_EventZ_clone_ptr(int64_t arg) {
32334         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32335         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32336         return ret_conv;
32337 }
32338
32339 int64_t  CS_LDK_COption_EventZ_clone(int64_t orig) {
32340         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32341         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32342         *ret_copy = COption_EventZ_clone(orig_conv);
32343         int64_t ret_ref = tag_ptr(ret_copy, true);
32344         return ret_ref;
32345 }
32346
32347 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_ok(int64_t o) {
32348         void* o_ptr = untag_ptr(o);
32349         CHECK_ACCESS(o_ptr);
32350         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32351         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32352         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32353         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32354         return tag_ptr(ret_conv, true);
32355 }
32356
32357 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_err(int64_t e) {
32358         void* e_ptr = untag_ptr(e);
32359         CHECK_ACCESS(e_ptr);
32360         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32361         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32362         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32363         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32364         return tag_ptr(ret_conv, true);
32365 }
32366
32367 jboolean  CS_LDK_CResult_COption_EventZDecodeErrorZ_is_ok(int64_t o) {
32368         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32369         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32370         return ret_conv;
32371 }
32372
32373 void  CS_LDK_CResult_COption_EventZDecodeErrorZ_free(int64_t _res) {
32374         if (!ptr_is_owned(_res)) return;
32375         void* _res_ptr = untag_ptr(_res);
32376         CHECK_ACCESS(_res_ptr);
32377         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32378         FREE(untag_ptr(_res));
32379         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32380 }
32381
32382 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32383         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32384         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32385         return tag_ptr(ret_conv, true);
32386 }
32387 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone_ptr(int64_t arg) {
32388         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32389         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32390         return ret_conv;
32391 }
32392
32393 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone(int64_t orig) {
32394         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32395         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32396         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32397         return tag_ptr(ret_conv, true);
32398 }
32399
32400 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_ok(int32_t o) {
32401         LDKSiPrefix o_conv = LDKSiPrefix_from_cs(o);
32402         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32403         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32404         return tag_ptr(ret_conv, true);
32405 }
32406
32407 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_err(int64_t e) {
32408         void* e_ptr = untag_ptr(e);
32409         CHECK_ACCESS(e_ptr);
32410         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32411         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32412         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32413         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32414         return tag_ptr(ret_conv, true);
32415 }
32416
32417 jboolean  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_is_ok(int64_t o) {
32418         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32419         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32420         return ret_conv;
32421 }
32422
32423 void  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_free(int64_t _res) {
32424         if (!ptr_is_owned(_res)) return;
32425         void* _res_ptr = untag_ptr(_res);
32426         CHECK_ACCESS(_res_ptr);
32427         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32428         FREE(untag_ptr(_res));
32429         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32430 }
32431
32432 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32433         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32434         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32435         return tag_ptr(ret_conv, true);
32436 }
32437 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(int64_t arg) {
32438         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32439         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32440         return ret_conv;
32441 }
32442
32443 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone(int64_t orig) {
32444         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32445         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32446         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32447         return tag_ptr(ret_conv, true);
32448 }
32449
32450 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(int64_t o) {
32451         LDKBolt11Invoice o_conv;
32452         o_conv.inner = untag_ptr(o);
32453         o_conv.is_owned = ptr_is_owned(o);
32454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32455         o_conv = Bolt11Invoice_clone(&o_conv);
32456         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32457         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32458         return tag_ptr(ret_conv, true);
32459 }
32460
32461 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(int64_t e) {
32462         void* e_ptr = untag_ptr(e);
32463         CHECK_ACCESS(e_ptr);
32464         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32465         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32466         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32467         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32468         return tag_ptr(ret_conv, true);
32469 }
32470
32471 jboolean  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(int64_t o) {
32472         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32473         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32474         return ret_conv;
32475 }
32476
32477 void  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(int64_t _res) {
32478         if (!ptr_is_owned(_res)) return;
32479         void* _res_ptr = untag_ptr(_res);
32480         CHECK_ACCESS(_res_ptr);
32481         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
32482         FREE(untag_ptr(_res));
32483         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
32484 }
32485
32486 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
32487         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32488         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
32489         return tag_ptr(ret_conv, true);
32490 }
32491 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(int64_t arg) {
32492         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
32493         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
32494         return ret_conv;
32495 }
32496
32497 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(int64_t orig) {
32498         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
32499         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32500         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
32501         return tag_ptr(ret_conv, true);
32502 }
32503
32504 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(int64_t o) {
32505         LDKSignedRawBolt11Invoice o_conv;
32506         o_conv.inner = untag_ptr(o);
32507         o_conv.is_owned = ptr_is_owned(o);
32508         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32509         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
32510         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32511         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
32512         return tag_ptr(ret_conv, true);
32513 }
32514
32515 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(int64_t e) {
32516         void* e_ptr = untag_ptr(e);
32517         CHECK_ACCESS(e_ptr);
32518         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32519         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32520         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32521         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
32522         return tag_ptr(ret_conv, true);
32523 }
32524
32525 jboolean  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(int64_t o) {
32526         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
32527         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
32528         return ret_conv;
32529 }
32530
32531 void  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(int64_t _res) {
32532         if (!ptr_is_owned(_res)) return;
32533         void* _res_ptr = untag_ptr(_res);
32534         CHECK_ACCESS(_res_ptr);
32535         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
32536         FREE(untag_ptr(_res));
32537         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
32538 }
32539
32540 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
32541         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32542         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
32543         return tag_ptr(ret_conv, true);
32544 }
32545 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(int64_t arg) {
32546         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
32547         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
32548         return ret_conv;
32549 }
32550
32551 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(int64_t orig) {
32552         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
32553         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
32554         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
32555         return tag_ptr(ret_conv, true);
32556 }
32557
32558 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
32559         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32560         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
32561         return tag_ptr(ret_conv, true);
32562 }
32563 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(int64_t arg) {
32564         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
32565         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
32566         return ret_conv;
32567 }
32568
32569 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(int64_t orig) {
32570         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
32571         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32572         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
32573         return tag_ptr(ret_conv, true);
32574 }
32575
32576 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(int64_t a, int8_tArray b, int64_t c) {
32577         LDKRawBolt11Invoice a_conv;
32578         a_conv.inner = untag_ptr(a);
32579         a_conv.is_owned = ptr_is_owned(a);
32580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32581         a_conv = RawBolt11Invoice_clone(&a_conv);
32582         LDKThirtyTwoBytes b_ref;
32583         CHECK(b->arr_len == 32);
32584         memcpy(b_ref.data, b->elems, 32); FREE(b);
32585         LDKBolt11InvoiceSignature c_conv;
32586         c_conv.inner = untag_ptr(c);
32587         c_conv.is_owned = ptr_is_owned(c);
32588         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32589         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
32590         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
32591         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
32592         return tag_ptr(ret_conv, true);
32593 }
32594
32595 void  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(int64_t _res) {
32596         if (!ptr_is_owned(_res)) return;
32597         void* _res_ptr = untag_ptr(_res);
32598         CHECK_ACCESS(_res_ptr);
32599         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
32600         FREE(untag_ptr(_res));
32601         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
32602 }
32603
32604 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_ok(int64_t o) {
32605         LDKPayeePubKey o_conv;
32606         o_conv.inner = untag_ptr(o);
32607         o_conv.is_owned = ptr_is_owned(o);
32608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32609         o_conv = PayeePubKey_clone(&o_conv);
32610         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32611         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
32612         return tag_ptr(ret_conv, true);
32613 }
32614
32615 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_err(int32_t e) {
32616         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
32617         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32618         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
32619         return tag_ptr(ret_conv, true);
32620 }
32621
32622 jboolean  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(int64_t o) {
32623         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
32624         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
32625         return ret_conv;
32626 }
32627
32628 void  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_free(int64_t _res) {
32629         if (!ptr_is_owned(_res)) return;
32630         void* _res_ptr = untag_ptr(_res);
32631         CHECK_ACCESS(_res_ptr);
32632         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
32633         FREE(untag_ptr(_res));
32634         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
32635 }
32636
32637 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
32638         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32639         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
32640         return tag_ptr(ret_conv, true);
32641 }
32642 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
32643         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
32644         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
32645         return ret_conv;
32646 }
32647
32648 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone(int64_t orig) {
32649         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
32650         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
32651         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
32652         return tag_ptr(ret_conv, true);
32653 }
32654
32655 void  CS_LDK_CVec_PrivateRouteZ_free(int64_tArray _res) {
32656         LDKCVec_PrivateRouteZ _res_constr;
32657         _res_constr.datalen = _res->arr_len;
32658         if (_res_constr.datalen > 0)
32659                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
32660         else
32661                 _res_constr.data = NULL;
32662         int64_t* _res_vals = _res->elems;
32663         for (size_t o = 0; o < _res_constr.datalen; o++) {
32664                 int64_t _res_conv_14 = _res_vals[o];
32665                 LDKPrivateRoute _res_conv_14_conv;
32666                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
32667                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
32668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
32669                 _res_constr.data[o] = _res_conv_14_conv;
32670         }
32671         FREE(_res);
32672         CVec_PrivateRouteZ_free(_res_constr);
32673 }
32674
32675 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_ok(int64_t o) {
32676         LDKPositiveTimestamp o_conv;
32677         o_conv.inner = untag_ptr(o);
32678         o_conv.is_owned = ptr_is_owned(o);
32679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32680         o_conv = PositiveTimestamp_clone(&o_conv);
32681         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32682         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
32683         return tag_ptr(ret_conv, true);
32684 }
32685
32686 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_err(int32_t e) {
32687         LDKCreationError e_conv = LDKCreationError_from_cs(e);
32688         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32689         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
32690         return tag_ptr(ret_conv, true);
32691 }
32692
32693 jboolean  CS_LDK_CResult_PositiveTimestampCreationErrorZ_is_ok(int64_t o) {
32694         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
32695         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
32696         return ret_conv;
32697 }
32698
32699 void  CS_LDK_CResult_PositiveTimestampCreationErrorZ_free(int64_t _res) {
32700         if (!ptr_is_owned(_res)) return;
32701         void* _res_ptr = untag_ptr(_res);
32702         CHECK_ACCESS(_res_ptr);
32703         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
32704         FREE(untag_ptr(_res));
32705         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
32706 }
32707
32708 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
32709         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32710         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
32711         return tag_ptr(ret_conv, true);
32712 }
32713 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone_ptr(int64_t arg) {
32714         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
32715         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
32716         return ret_conv;
32717 }
32718
32719 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone(int64_t orig) {
32720         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
32721         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
32722         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
32723         return tag_ptr(ret_conv, true);
32724 }
32725
32726 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_ok() {
32727         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32728         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
32729         return tag_ptr(ret_conv, true);
32730 }
32731
32732 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_err(int32_t e) {
32733         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
32734         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32735         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
32736         return tag_ptr(ret_conv, true);
32737 }
32738
32739 jboolean  CS_LDK_CResult_NoneBolt11SemanticErrorZ_is_ok(int64_t o) {
32740         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
32741         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
32742         return ret_conv;
32743 }
32744
32745 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_free(int64_t _res) {
32746         if (!ptr_is_owned(_res)) return;
32747         void* _res_ptr = untag_ptr(_res);
32748         CHECK_ACCESS(_res_ptr);
32749         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
32750         FREE(untag_ptr(_res));
32751         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
32752 }
32753
32754 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
32755         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32756         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
32757         return tag_ptr(ret_conv, true);
32758 }
32759 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
32760         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
32761         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
32762         return ret_conv;
32763 }
32764
32765 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone(int64_t orig) {
32766         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
32767         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
32768         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
32769         return tag_ptr(ret_conv, true);
32770 }
32771
32772 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(int64_t o) {
32773         LDKBolt11Invoice o_conv;
32774         o_conv.inner = untag_ptr(o);
32775         o_conv.is_owned = ptr_is_owned(o);
32776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32777         o_conv = Bolt11Invoice_clone(&o_conv);
32778         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32779         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
32780         return tag_ptr(ret_conv, true);
32781 }
32782
32783 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(int32_t e) {
32784         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
32785         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32786         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
32787         return tag_ptr(ret_conv, true);
32788 }
32789
32790 jboolean  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(int64_t o) {
32791         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
32792         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
32793         return ret_conv;
32794 }
32795
32796 void  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(int64_t _res) {
32797         if (!ptr_is_owned(_res)) return;
32798         void* _res_ptr = untag_ptr(_res);
32799         CHECK_ACCESS(_res_ptr);
32800         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
32801         FREE(untag_ptr(_res));
32802         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
32803 }
32804
32805 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
32806         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32807         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
32808         return tag_ptr(ret_conv, true);
32809 }
32810 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
32811         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
32812         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
32813         return ret_conv;
32814 }
32815
32816 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(int64_t orig) {
32817         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
32818         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
32819         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
32820         return tag_ptr(ret_conv, true);
32821 }
32822
32823 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_ok(int64_t o) {
32824         LDKDescription o_conv;
32825         o_conv.inner = untag_ptr(o);
32826         o_conv.is_owned = ptr_is_owned(o);
32827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32828         o_conv = Description_clone(&o_conv);
32829         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32830         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
32831         return tag_ptr(ret_conv, true);
32832 }
32833
32834 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_err(int32_t e) {
32835         LDKCreationError e_conv = LDKCreationError_from_cs(e);
32836         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32837         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
32838         return tag_ptr(ret_conv, true);
32839 }
32840
32841 jboolean  CS_LDK_CResult_DescriptionCreationErrorZ_is_ok(int64_t o) {
32842         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
32843         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
32844         return ret_conv;
32845 }
32846
32847 void  CS_LDK_CResult_DescriptionCreationErrorZ_free(int64_t _res) {
32848         if (!ptr_is_owned(_res)) return;
32849         void* _res_ptr = untag_ptr(_res);
32850         CHECK_ACCESS(_res_ptr);
32851         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
32852         FREE(untag_ptr(_res));
32853         CResult_DescriptionCreationErrorZ_free(_res_conv);
32854 }
32855
32856 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
32857         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32858         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
32859         return tag_ptr(ret_conv, true);
32860 }
32861 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone_ptr(int64_t arg) {
32862         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
32863         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
32864         return ret_conv;
32865 }
32866
32867 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone(int64_t orig) {
32868         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
32869         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
32870         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
32871         return tag_ptr(ret_conv, true);
32872 }
32873
32874 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_ok(int64_t o) {
32875         LDKPrivateRoute o_conv;
32876         o_conv.inner = untag_ptr(o);
32877         o_conv.is_owned = ptr_is_owned(o);
32878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32879         o_conv = PrivateRoute_clone(&o_conv);
32880         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32881         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
32882         return tag_ptr(ret_conv, true);
32883 }
32884
32885 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_err(int32_t e) {
32886         LDKCreationError e_conv = LDKCreationError_from_cs(e);
32887         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32888         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
32889         return tag_ptr(ret_conv, true);
32890 }
32891
32892 jboolean  CS_LDK_CResult_PrivateRouteCreationErrorZ_is_ok(int64_t o) {
32893         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
32894         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
32895         return ret_conv;
32896 }
32897
32898 void  CS_LDK_CResult_PrivateRouteCreationErrorZ_free(int64_t _res) {
32899         if (!ptr_is_owned(_res)) return;
32900         void* _res_ptr = untag_ptr(_res);
32901         CHECK_ACCESS(_res_ptr);
32902         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
32903         FREE(untag_ptr(_res));
32904         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
32905 }
32906
32907 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
32908         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32909         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
32910         return tag_ptr(ret_conv, true);
32911 }
32912 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone_ptr(int64_t arg) {
32913         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
32914         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
32915         return ret_conv;
32916 }
32917
32918 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone(int64_t orig) {
32919         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
32920         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
32921         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
32922         return tag_ptr(ret_conv, true);
32923 }
32924
32925 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_ok(int64_t o) {
32926         LDKOutPoint o_conv;
32927         o_conv.inner = untag_ptr(o);
32928         o_conv.is_owned = ptr_is_owned(o);
32929         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32930         o_conv = OutPoint_clone(&o_conv);
32931         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32932         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
32933         return tag_ptr(ret_conv, true);
32934 }
32935
32936 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_err(int64_t e) {
32937         void* e_ptr = untag_ptr(e);
32938         CHECK_ACCESS(e_ptr);
32939         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32940         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32941         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32942         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
32943         return tag_ptr(ret_conv, true);
32944 }
32945
32946 jboolean  CS_LDK_CResult_OutPointDecodeErrorZ_is_ok(int64_t o) {
32947         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
32948         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
32949         return ret_conv;
32950 }
32951
32952 void  CS_LDK_CResult_OutPointDecodeErrorZ_free(int64_t _res) {
32953         if (!ptr_is_owned(_res)) return;
32954         void* _res_ptr = untag_ptr(_res);
32955         CHECK_ACCESS(_res_ptr);
32956         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
32957         FREE(untag_ptr(_res));
32958         CResult_OutPointDecodeErrorZ_free(_res_conv);
32959 }
32960
32961 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
32962         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32963         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
32964         return tag_ptr(ret_conv, true);
32965 }
32966 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone_ptr(int64_t arg) {
32967         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
32968         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
32969         return ret_conv;
32970 }
32971
32972 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone(int64_t orig) {
32973         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
32974         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
32975         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
32976         return tag_ptr(ret_conv, true);
32977 }
32978
32979 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_ok(int64_t o) {
32980         LDKBigSize o_conv;
32981         o_conv.inner = untag_ptr(o);
32982         o_conv.is_owned = ptr_is_owned(o);
32983         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32984         o_conv = BigSize_clone(&o_conv);
32985         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32986         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
32987         return tag_ptr(ret_conv, true);
32988 }
32989
32990 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_err(int64_t e) {
32991         void* e_ptr = untag_ptr(e);
32992         CHECK_ACCESS(e_ptr);
32993         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32994         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32995         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32996         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
32997         return tag_ptr(ret_conv, true);
32998 }
32999
33000 jboolean  CS_LDK_CResult_BigSizeDecodeErrorZ_is_ok(int64_t o) {
33001         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33002         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33003         return ret_conv;
33004 }
33005
33006 void  CS_LDK_CResult_BigSizeDecodeErrorZ_free(int64_t _res) {
33007         if (!ptr_is_owned(_res)) return;
33008         void* _res_ptr = untag_ptr(_res);
33009         CHECK_ACCESS(_res_ptr);
33010         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33011         FREE(untag_ptr(_res));
33012         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33013 }
33014
33015 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33016         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33017         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33018         return tag_ptr(ret_conv, true);
33019 }
33020 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone_ptr(int64_t arg) {
33021         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33022         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33023         return ret_conv;
33024 }
33025
33026 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone(int64_t orig) {
33027         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33028         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33029         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33030         return tag_ptr(ret_conv, true);
33031 }
33032
33033 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_ok(int64_t o) {
33034         LDKHostname o_conv;
33035         o_conv.inner = untag_ptr(o);
33036         o_conv.is_owned = ptr_is_owned(o);
33037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33038         o_conv = Hostname_clone(&o_conv);
33039         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33040         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33041         return tag_ptr(ret_conv, true);
33042 }
33043
33044 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_err(int64_t e) {
33045         void* e_ptr = untag_ptr(e);
33046         CHECK_ACCESS(e_ptr);
33047         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33048         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33049         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33050         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33051         return tag_ptr(ret_conv, true);
33052 }
33053
33054 jboolean  CS_LDK_CResult_HostnameDecodeErrorZ_is_ok(int64_t o) {
33055         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33056         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33057         return ret_conv;
33058 }
33059
33060 void  CS_LDK_CResult_HostnameDecodeErrorZ_free(int64_t _res) {
33061         if (!ptr_is_owned(_res)) return;
33062         void* _res_ptr = untag_ptr(_res);
33063         CHECK_ACCESS(_res_ptr);
33064         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33065         FREE(untag_ptr(_res));
33066         CResult_HostnameDecodeErrorZ_free(_res_conv);
33067 }
33068
33069 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33070         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33071         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33072         return tag_ptr(ret_conv, true);
33073 }
33074 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone_ptr(int64_t arg) {
33075         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33076         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33077         return ret_conv;
33078 }
33079
33080 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone(int64_t orig) {
33081         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33082         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33083         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33084         return tag_ptr(ret_conv, true);
33085 }
33086
33087 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_ok(int64_t o) {
33088         LDKTransactionU16LenLimited o_conv;
33089         o_conv.inner = untag_ptr(o);
33090         o_conv.is_owned = ptr_is_owned(o);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33092         o_conv = TransactionU16LenLimited_clone(&o_conv);
33093         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33094         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33095         return tag_ptr(ret_conv, true);
33096 }
33097
33098 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_err() {
33099         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33100         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33101         return tag_ptr(ret_conv, true);
33102 }
33103
33104 jboolean  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_is_ok(int64_t o) {
33105         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33106         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33107         return ret_conv;
33108 }
33109
33110 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_free(int64_t _res) {
33111         if (!ptr_is_owned(_res)) return;
33112         void* _res_ptr = untag_ptr(_res);
33113         CHECK_ACCESS(_res_ptr);
33114         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33115         FREE(untag_ptr(_res));
33116         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33117 }
33118
33119 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33120         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33121         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33122         return tag_ptr(ret_conv, true);
33123 }
33124 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(int64_t arg) {
33125         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33126         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33127         return ret_conv;
33128 }
33129
33130 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone(int64_t orig) {
33131         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33132         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33133         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33134         return tag_ptr(ret_conv, true);
33135 }
33136
33137 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(int64_t o) {
33138         LDKTransactionU16LenLimited o_conv;
33139         o_conv.inner = untag_ptr(o);
33140         o_conv.is_owned = ptr_is_owned(o);
33141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33142         o_conv = TransactionU16LenLimited_clone(&o_conv);
33143         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33144         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33145         return tag_ptr(ret_conv, true);
33146 }
33147
33148 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_err(int64_t e) {
33149         void* e_ptr = untag_ptr(e);
33150         CHECK_ACCESS(e_ptr);
33151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33153         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33154         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33155         return tag_ptr(ret_conv, true);
33156 }
33157
33158 jboolean  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(int64_t o) {
33159         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33160         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33161         return ret_conv;
33162 }
33163
33164 void  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_free(int64_t _res) {
33165         if (!ptr_is_owned(_res)) return;
33166         void* _res_ptr = untag_ptr(_res);
33167         CHECK_ACCESS(_res_ptr);
33168         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33169         FREE(untag_ptr(_res));
33170         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33171 }
33172
33173 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33174         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33175         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33176         return tag_ptr(ret_conv, true);
33177 }
33178 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(int64_t arg) {
33179         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33180         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33181         return ret_conv;
33182 }
33183
33184 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(int64_t orig) {
33185         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33186         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33187         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33188         return tag_ptr(ret_conv, true);
33189 }
33190
33191 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_ok(int64_t o) {
33192         LDKUntrustedString o_conv;
33193         o_conv.inner = untag_ptr(o);
33194         o_conv.is_owned = ptr_is_owned(o);
33195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33196         o_conv = UntrustedString_clone(&o_conv);
33197         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33198         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33199         return tag_ptr(ret_conv, true);
33200 }
33201
33202 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_err(int64_t e) {
33203         void* e_ptr = untag_ptr(e);
33204         CHECK_ACCESS(e_ptr);
33205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33207         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33208         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33209         return tag_ptr(ret_conv, true);
33210 }
33211
33212 jboolean  CS_LDK_CResult_UntrustedStringDecodeErrorZ_is_ok(int64_t o) {
33213         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33214         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33215         return ret_conv;
33216 }
33217
33218 void  CS_LDK_CResult_UntrustedStringDecodeErrorZ_free(int64_t _res) {
33219         if (!ptr_is_owned(_res)) return;
33220         void* _res_ptr = untag_ptr(_res);
33221         CHECK_ACCESS(_res_ptr);
33222         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33223         FREE(untag_ptr(_res));
33224         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33225 }
33226
33227 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33228         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33229         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33230         return tag_ptr(ret_conv, true);
33231 }
33232 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone_ptr(int64_t arg) {
33233         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33234         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33235         return ret_conv;
33236 }
33237
33238 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone(int64_t orig) {
33239         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33240         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33241         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33242         return tag_ptr(ret_conv, true);
33243 }
33244
33245 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_ok(int64_t o) {
33246         LDKChannelId o_conv;
33247         o_conv.inner = untag_ptr(o);
33248         o_conv.is_owned = ptr_is_owned(o);
33249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33250         o_conv = ChannelId_clone(&o_conv);
33251         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33252         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
33253         return tag_ptr(ret_conv, true);
33254 }
33255
33256 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_err(int64_t e) {
33257         void* e_ptr = untag_ptr(e);
33258         CHECK_ACCESS(e_ptr);
33259         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33260         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33261         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33262         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
33263         return tag_ptr(ret_conv, true);
33264 }
33265
33266 jboolean  CS_LDK_CResult_ChannelIdDecodeErrorZ_is_ok(int64_t o) {
33267         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
33268         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
33269         return ret_conv;
33270 }
33271
33272 void  CS_LDK_CResult_ChannelIdDecodeErrorZ_free(int64_t _res) {
33273         if (!ptr_is_owned(_res)) return;
33274         void* _res_ptr = untag_ptr(_res);
33275         CHECK_ACCESS(_res_ptr);
33276         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
33277         FREE(untag_ptr(_res));
33278         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
33279 }
33280
33281 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
33282         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33283         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
33284         return tag_ptr(ret_conv, true);
33285 }
33286 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_clone_ptr(int64_t arg) {
33287         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
33288         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
33289         return ret_conv;
33290 }
33291
33292 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_clone(int64_t orig) {
33293         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
33294         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33295         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
33296         return tag_ptr(ret_conv, true);
33297 }
33298
33299 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
33300         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33301         *ret_conv = C2Tuple__u832u16Z_clone(arg);
33302         return tag_ptr(ret_conv, true);
33303 }
33304 int64_t  CS_LDK_C2Tuple__u832u16Z_clone_ptr(int64_t arg) {
33305         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
33306         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
33307         return ret_conv;
33308 }
33309
33310 int64_t  CS_LDK_C2Tuple__u832u16Z_clone(int64_t orig) {
33311         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
33312         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33313         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
33314         return tag_ptr(ret_conv, true);
33315 }
33316
33317 int64_t  CS_LDK_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
33318         LDKThirtyTwoBytes a_ref;
33319         CHECK(a->arr_len == 32);
33320         memcpy(a_ref.data, a->elems, 32); FREE(a);
33321         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33322         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
33323         return tag_ptr(ret_conv, true);
33324 }
33325
33326 void  CS_LDK_C2Tuple__u832u16Z_free(int64_t _res) {
33327         if (!ptr_is_owned(_res)) return;
33328         void* _res_ptr = untag_ptr(_res);
33329         CHECK_ACCESS(_res_ptr);
33330         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
33331         FREE(untag_ptr(_res));
33332         C2Tuple__u832u16Z_free(_res_conv);
33333 }
33334
33335 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_ok(int64_t o) {
33336         LDKPaymentRelay o_conv;
33337         o_conv.inner = untag_ptr(o);
33338         o_conv.is_owned = ptr_is_owned(o);
33339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33340         o_conv = PaymentRelay_clone(&o_conv);
33341         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33342         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33343         return tag_ptr(ret_conv, true);
33344 }
33345
33346 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_err(int64_t e) {
33347         void* e_ptr = untag_ptr(e);
33348         CHECK_ACCESS(e_ptr);
33349         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33350         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33351         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33352         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33353         return tag_ptr(ret_conv, true);
33354 }
33355
33356 jboolean  CS_LDK_CResult_PaymentRelayDecodeErrorZ_is_ok(int64_t o) {
33357         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33358         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33359         return ret_conv;
33360 }
33361
33362 void  CS_LDK_CResult_PaymentRelayDecodeErrorZ_free(int64_t _res) {
33363         if (!ptr_is_owned(_res)) return;
33364         void* _res_ptr = untag_ptr(_res);
33365         CHECK_ACCESS(_res_ptr);
33366         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33367         FREE(untag_ptr(_res));
33368         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33369 }
33370
33371 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33372         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33373         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33374         return tag_ptr(ret_conv, true);
33375 }
33376 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone_ptr(int64_t arg) {
33377         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33378         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33379         return ret_conv;
33380 }
33381
33382 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone(int64_t orig) {
33383         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33384         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33385         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33386         return tag_ptr(ret_conv, true);
33387 }
33388
33389 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_ok(int64_t o) {
33390         LDKPaymentConstraints o_conv;
33391         o_conv.inner = untag_ptr(o);
33392         o_conv.is_owned = ptr_is_owned(o);
33393         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33394         o_conv = PaymentConstraints_clone(&o_conv);
33395         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33396         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33397         return tag_ptr(ret_conv, true);
33398 }
33399
33400 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_err(int64_t e) {
33401         void* e_ptr = untag_ptr(e);
33402         CHECK_ACCESS(e_ptr);
33403         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33404         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33405         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33406         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33407         return tag_ptr(ret_conv, true);
33408 }
33409
33410 jboolean  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_is_ok(int64_t o) {
33411         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33412         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33413         return ret_conv;
33414 }
33415
33416 void  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_free(int64_t _res) {
33417         if (!ptr_is_owned(_res)) return;
33418         void* _res_ptr = untag_ptr(_res);
33419         CHECK_ACCESS(_res_ptr);
33420         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33421         FREE(untag_ptr(_res));
33422         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33423 }
33424
33425 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33426         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33427         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33428         return tag_ptr(ret_conv, true);
33429 }
33430 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(int64_t arg) {
33431         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33432         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33433         return ret_conv;
33434 }
33435
33436 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone(int64_t orig) {
33437         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33438         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33439         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33440         return tag_ptr(ret_conv, true);
33441 }
33442
33443 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_ok(int64_t o) {
33444         void* o_ptr = untag_ptr(o);
33445         CHECK_ACCESS(o_ptr);
33446         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
33447         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
33448         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33449         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
33450         return tag_ptr(ret_conv, true);
33451 }
33452
33453 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_err(int64_t e) {
33454         void* e_ptr = untag_ptr(e);
33455         CHECK_ACCESS(e_ptr);
33456         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33457         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33458         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33459         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
33460         return tag_ptr(ret_conv, true);
33461 }
33462
33463 jboolean  CS_LDK_CResult_PaymentContextDecodeErrorZ_is_ok(int64_t o) {
33464         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
33465         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
33466         return ret_conv;
33467 }
33468
33469 void  CS_LDK_CResult_PaymentContextDecodeErrorZ_free(int64_t _res) {
33470         if (!ptr_is_owned(_res)) return;
33471         void* _res_ptr = untag_ptr(_res);
33472         CHECK_ACCESS(_res_ptr);
33473         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
33474         FREE(untag_ptr(_res));
33475         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
33476 }
33477
33478 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33479         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33480         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
33481         return tag_ptr(ret_conv, true);
33482 }
33483 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_clone_ptr(int64_t arg) {
33484         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
33485         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33486         return ret_conv;
33487 }
33488
33489 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_clone(int64_t orig) {
33490         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
33491         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33492         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
33493         return tag_ptr(ret_conv, true);
33494 }
33495
33496 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_ok(int64_t o) {
33497         LDKUnknownPaymentContext o_conv;
33498         o_conv.inner = untag_ptr(o);
33499         o_conv.is_owned = ptr_is_owned(o);
33500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33501         o_conv = UnknownPaymentContext_clone(&o_conv);
33502         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33503         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
33504         return tag_ptr(ret_conv, true);
33505 }
33506
33507 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_err(int64_t e) {
33508         void* e_ptr = untag_ptr(e);
33509         CHECK_ACCESS(e_ptr);
33510         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33511         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33512         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33513         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
33514         return tag_ptr(ret_conv, true);
33515 }
33516
33517 jboolean  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_is_ok(int64_t o) {
33518         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
33519         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
33520         return ret_conv;
33521 }
33522
33523 void  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_free(int64_t _res) {
33524         if (!ptr_is_owned(_res)) return;
33525         void* _res_ptr = untag_ptr(_res);
33526         CHECK_ACCESS(_res_ptr);
33527         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
33528         FREE(untag_ptr(_res));
33529         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
33530 }
33531
33532 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
33533         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33534         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
33535         return tag_ptr(ret_conv, true);
33536 }
33537 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(int64_t arg) {
33538         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
33539         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
33540         return ret_conv;
33541 }
33542
33543 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_clone(int64_t orig) {
33544         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
33545         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
33546         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
33547         return tag_ptr(ret_conv, true);
33548 }
33549
33550 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_ok(int64_t o) {
33551         LDKBolt12OfferContext o_conv;
33552         o_conv.inner = untag_ptr(o);
33553         o_conv.is_owned = ptr_is_owned(o);
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33555         o_conv = Bolt12OfferContext_clone(&o_conv);
33556         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33557         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
33558         return tag_ptr(ret_conv, true);
33559 }
33560
33561 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_err(int64_t e) {
33562         void* e_ptr = untag_ptr(e);
33563         CHECK_ACCESS(e_ptr);
33564         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33565         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33566         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33567         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
33568         return tag_ptr(ret_conv, true);
33569 }
33570
33571 jboolean  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_is_ok(int64_t o) {
33572         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
33573         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
33574         return ret_conv;
33575 }
33576
33577 void  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_free(int64_t _res) {
33578         if (!ptr_is_owned(_res)) return;
33579         void* _res_ptr = untag_ptr(_res);
33580         CHECK_ACCESS(_res_ptr);
33581         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
33582         FREE(untag_ptr(_res));
33583         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
33584 }
33585
33586 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
33587         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33588         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
33589         return tag_ptr(ret_conv, true);
33590 }
33591 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(int64_t arg) {
33592         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
33593         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
33594         return ret_conv;
33595 }
33596
33597 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_clone(int64_t orig) {
33598         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
33599         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
33600         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
33601         return tag_ptr(ret_conv, true);
33602 }
33603
33604 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_ok(int64_t o) {
33605         LDKBolt12RefundContext o_conv;
33606         o_conv.inner = untag_ptr(o);
33607         o_conv.is_owned = ptr_is_owned(o);
33608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33609         o_conv = Bolt12RefundContext_clone(&o_conv);
33610         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33611         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_err(int64_t e) {
33616         void* e_ptr = untag_ptr(e);
33617         CHECK_ACCESS(e_ptr);
33618         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33619         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33620         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33621         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
33622         return tag_ptr(ret_conv, true);
33623 }
33624
33625 jboolean  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_is_ok(int64_t o) {
33626         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
33627         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
33628         return ret_conv;
33629 }
33630
33631 void  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_free(int64_t _res) {
33632         if (!ptr_is_owned(_res)) return;
33633         void* _res_ptr = untag_ptr(_res);
33634         CHECK_ACCESS(_res_ptr);
33635         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
33636         FREE(untag_ptr(_res));
33637         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
33638 }
33639
33640 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
33641         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33642         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
33643         return tag_ptr(ret_conv, true);
33644 }
33645 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(int64_t arg) {
33646         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
33647         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
33648         return ret_conv;
33649 }
33650
33651 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_clone(int64_t orig) {
33652         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
33653         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
33654         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
33655         return tag_ptr(ret_conv, true);
33656 }
33657
33658 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
33659         LDKStr o_conv = str_ref_to_owned_c(o);
33660         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33661         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
33662         return tag_ptr(ret_conv, true);
33663 }
33664
33665 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_err(int32_t e) {
33666         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
33667         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33668         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
33669         return tag_ptr(ret_conv, true);
33670 }
33671
33672 jboolean  CS_LDK_CResult_StrSecp256k1ErrorZ_is_ok(int64_t o) {
33673         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
33674         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
33675         return ret_conv;
33676 }
33677
33678 void  CS_LDK_CResult_StrSecp256k1ErrorZ_free(int64_t _res) {
33679         if (!ptr_is_owned(_res)) return;
33680         void* _res_ptr = untag_ptr(_res);
33681         CHECK_ACCESS(_res_ptr);
33682         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
33683         FREE(untag_ptr(_res));
33684         CResult_StrSecp256k1ErrorZ_free(_res_conv);
33685 }
33686
33687 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
33688         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33689         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
33690         return tag_ptr(ret_conv, true);
33691 }
33692 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone_ptr(int64_t arg) {
33693         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
33694         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
33695         return ret_conv;
33696 }
33697
33698 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone(int64_t orig) {
33699         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
33700         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
33701         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
33702         return tag_ptr(ret_conv, true);
33703 }
33704
33705 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
33706         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33707         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
33708         return tag_ptr(ret_conv, true);
33709 }
33710 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(int64_t arg) {
33711         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
33712         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
33713         return ret_conv;
33714 }
33715
33716 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(int64_t orig) {
33717         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
33718         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33719         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
33720         return tag_ptr(ret_conv, true);
33721 }
33722
33723 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, int64_t b, int64_t c) {
33724         LDKThirtyTwoBytes a_ref;
33725         CHECK(a->arr_len == 32);
33726         memcpy(a_ref.data, a->elems, 32); FREE(a);
33727         LDKRecipientOnionFields b_conv;
33728         b_conv.inner = untag_ptr(b);
33729         b_conv.is_owned = ptr_is_owned(b);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33731         b_conv = RecipientOnionFields_clone(&b_conv);
33732         LDKRouteParameters c_conv;
33733         c_conv.inner = untag_ptr(c);
33734         c_conv.is_owned = ptr_is_owned(c);
33735         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33736         c_conv = RouteParameters_clone(&c_conv);
33737         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
33738         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
33739         return tag_ptr(ret_conv, true);
33740 }
33741
33742 void  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(int64_t _res) {
33743         if (!ptr_is_owned(_res)) return;
33744         void* _res_ptr = untag_ptr(_res);
33745         CHECK_ACCESS(_res_ptr);
33746         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
33747         FREE(untag_ptr(_res));
33748         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
33749 }
33750
33751 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(int64_t o) {
33752         void* o_ptr = untag_ptr(o);
33753         CHECK_ACCESS(o_ptr);
33754         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
33755         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
33756         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33757         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
33758         return tag_ptr(ret_conv, true);
33759 }
33760
33761 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
33762         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33763         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
33764         return tag_ptr(ret_conv, true);
33765 }
33766
33767 jboolean  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(int64_t o) {
33768         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
33769         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
33770         return ret_conv;
33771 }
33772
33773 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(int64_t _res) {
33774         if (!ptr_is_owned(_res)) return;
33775         void* _res_ptr = untag_ptr(_res);
33776         CHECK_ACCESS(_res_ptr);
33777         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
33778         FREE(untag_ptr(_res));
33779         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
33780 }
33781
33782 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
33783         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33784         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
33785         return tag_ptr(ret_conv, true);
33786 }
33787 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(int64_t arg) {
33788         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
33789         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
33790         return ret_conv;
33791 }
33792
33793 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(int64_t orig) {
33794         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
33795         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
33796         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
33797         return tag_ptr(ret_conv, true);
33798 }
33799
33800 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_ok(int64_t o) {
33801         void* o_ptr = untag_ptr(o);
33802         CHECK_ACCESS(o_ptr);
33803         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
33804         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
33805         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33806         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
33807         return tag_ptr(ret_conv, true);
33808 }
33809
33810 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_err(int32_t e) {
33811         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_cs(e);
33812         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33813         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
33814         return tag_ptr(ret_conv, true);
33815 }
33816
33817 jboolean  CS_LDK_CResult_TxOutUtxoLookupErrorZ_is_ok(int64_t o) {
33818         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
33819         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
33820         return ret_conv;
33821 }
33822
33823 void  CS_LDK_CResult_TxOutUtxoLookupErrorZ_free(int64_t _res) {
33824         if (!ptr_is_owned(_res)) return;
33825         void* _res_ptr = untag_ptr(_res);
33826         CHECK_ACCESS(_res_ptr);
33827         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
33828         FREE(untag_ptr(_res));
33829         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
33830 }
33831
33832 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
33833         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33834         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
33835         return tag_ptr(ret_conv, true);
33836 }
33837 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone_ptr(int64_t arg) {
33838         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
33839         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
33840         return ret_conv;
33841 }
33842
33843 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone(int64_t orig) {
33844         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
33845         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
33846         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
33847         return tag_ptr(ret_conv, true);
33848 }
33849
33850 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
33851         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33852         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
33853         return tag_ptr(ret_conv, true);
33854 }
33855 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(int64_t arg) {
33856         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
33857         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
33858         return ret_conv;
33859 }
33860
33861 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(int64_t orig) {
33862         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
33863         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33864         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
33865         return tag_ptr(ret_conv, true);
33866 }
33867
33868 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, int64_t b, int64_t c) {
33869         LDKPublicKey a_ref;
33870         CHECK(a->arr_len == 33);
33871         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
33872         LDKOnionMessage b_conv;
33873         b_conv.inner = untag_ptr(b);
33874         b_conv.is_owned = ptr_is_owned(b);
33875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33876         b_conv = OnionMessage_clone(&b_conv);
33877         void* c_ptr = untag_ptr(c);
33878         CHECK_ACCESS(c_ptr);
33879         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
33880         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
33881         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
33882         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
33883         return tag_ptr(ret_conv, true);
33884 }
33885
33886 void  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(int64_t _res) {
33887         if (!ptr_is_owned(_res)) return;
33888         void* _res_ptr = untag_ptr(_res);
33889         CHECK_ACCESS(_res_ptr);
33890         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
33891         FREE(untag_ptr(_res));
33892         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
33893 }
33894
33895 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(int64_t o) {
33896         void* o_ptr = untag_ptr(o);
33897         CHECK_ACCESS(o_ptr);
33898         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
33899         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
33900         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33901         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
33902         return tag_ptr(ret_conv, true);
33903 }
33904
33905 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(int64_t e) {
33906         void* e_ptr = untag_ptr(e);
33907         CHECK_ACCESS(e_ptr);
33908         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
33909         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
33910         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33911         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
33912         return tag_ptr(ret_conv, true);
33913 }
33914
33915 jboolean  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(int64_t o) {
33916         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
33917         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
33918         return ret_conv;
33919 }
33920
33921 void  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(int64_t _res) {
33922         if (!ptr_is_owned(_res)) return;
33923         void* _res_ptr = untag_ptr(_res);
33924         CHECK_ACCESS(_res_ptr);
33925         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
33926         FREE(untag_ptr(_res));
33927         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
33928 }
33929
33930 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
33931         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33932         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
33933         return tag_ptr(ret_conv, true);
33934 }
33935 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(int64_t arg) {
33936         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
33937         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
33938         return ret_conv;
33939 }
33940
33941 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(int64_t orig) {
33942         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
33943         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
33944         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
33945         return tag_ptr(ret_conv, true);
33946 }
33947
33948 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_ok(int64_t o) {
33949         void* o_ptr = untag_ptr(o);
33950         CHECK_ACCESS(o_ptr);
33951         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
33952         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
33953         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33954         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
33955         return tag_ptr(ret_conv, true);
33956 }
33957
33958 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_err() {
33959         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33960         *ret_conv = CResult_PeeledOnionNoneZ_err();
33961         return tag_ptr(ret_conv, true);
33962 }
33963
33964 jboolean  CS_LDK_CResult_PeeledOnionNoneZ_is_ok(int64_t o) {
33965         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
33966         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
33967         return ret_conv;
33968 }
33969
33970 void  CS_LDK_CResult_PeeledOnionNoneZ_free(int64_t _res) {
33971         if (!ptr_is_owned(_res)) return;
33972         void* _res_ptr = untag_ptr(_res);
33973         CHECK_ACCESS(_res_ptr);
33974         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
33975         FREE(untag_ptr(_res));
33976         CResult_PeeledOnionNoneZ_free(_res_conv);
33977 }
33978
33979 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
33980         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33981         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
33982         return tag_ptr(ret_conv, true);
33983 }
33984 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_clone_ptr(int64_t arg) {
33985         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
33986         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
33987         return ret_conv;
33988 }
33989
33990 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_clone(int64_t orig) {
33991         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
33992         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
33993         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
33994         return tag_ptr(ret_conv, true);
33995 }
33996
33997 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_ok(int64_t o) {
33998         void* o_ptr = untag_ptr(o);
33999         CHECK_ACCESS(o_ptr);
34000         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
34001         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
34002         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34003         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
34004         return tag_ptr(ret_conv, true);
34005 }
34006
34007 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_err(int64_t e) {
34008         void* e_ptr = untag_ptr(e);
34009         CHECK_ACCESS(e_ptr);
34010         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34011         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34012         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34013         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
34014         return tag_ptr(ret_conv, true);
34015 }
34016
34017 jboolean  CS_LDK_CResult_SendSuccessSendErrorZ_is_ok(int64_t o) {
34018         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
34019         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
34020         return ret_conv;
34021 }
34022
34023 void  CS_LDK_CResult_SendSuccessSendErrorZ_free(int64_t _res) {
34024         if (!ptr_is_owned(_res)) return;
34025         void* _res_ptr = untag_ptr(_res);
34026         CHECK_ACCESS(_res_ptr);
34027         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
34028         FREE(untag_ptr(_res));
34029         CResult_SendSuccessSendErrorZ_free(_res_conv);
34030 }
34031
34032 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
34033         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34034         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
34035         return tag_ptr(ret_conv, true);
34036 }
34037 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_clone_ptr(int64_t arg) {
34038         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
34039         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
34040         return ret_conv;
34041 }
34042
34043 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_clone(int64_t orig) {
34044         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
34045         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34046         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
34047         return tag_ptr(ret_conv, true);
34048 }
34049
34050 int64_t  CS_LDK_CResult_BlindedPathNoneZ_ok(int64_t o) {
34051         LDKBlindedPath o_conv;
34052         o_conv.inner = untag_ptr(o);
34053         o_conv.is_owned = ptr_is_owned(o);
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34055         o_conv = BlindedPath_clone(&o_conv);
34056         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34057         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
34058         return tag_ptr(ret_conv, true);
34059 }
34060
34061 int64_t  CS_LDK_CResult_BlindedPathNoneZ_err() {
34062         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34063         *ret_conv = CResult_BlindedPathNoneZ_err();
34064         return tag_ptr(ret_conv, true);
34065 }
34066
34067 jboolean  CS_LDK_CResult_BlindedPathNoneZ_is_ok(int64_t o) {
34068         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
34069         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
34070         return ret_conv;
34071 }
34072
34073 void  CS_LDK_CResult_BlindedPathNoneZ_free(int64_t _res) {
34074         if (!ptr_is_owned(_res)) return;
34075         void* _res_ptr = untag_ptr(_res);
34076         CHECK_ACCESS(_res_ptr);
34077         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
34078         FREE(untag_ptr(_res));
34079         CResult_BlindedPathNoneZ_free(_res_conv);
34080 }
34081
34082 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
34083         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34084         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
34085         return tag_ptr(ret_conv, true);
34086 }
34087 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone_ptr(int64_t arg) {
34088         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
34089         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
34090         return ret_conv;
34091 }
34092
34093 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone(int64_t orig) {
34094         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
34095         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34096         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
34097         return tag_ptr(ret_conv, true);
34098 }
34099
34100 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(int64_t o) {
34101         void* o_ptr = untag_ptr(o);
34102         CHECK_ACCESS(o_ptr);
34103         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
34104         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
34105         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34106         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
34107         return tag_ptr(ret_conv, true);
34108 }
34109
34110 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
34111         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34112         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
34113         return tag_ptr(ret_conv, true);
34114 }
34115
34116 jboolean  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(int64_t o) {
34117         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34118         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34119         return ret_conv;
34120 }
34121
34122 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(int64_t _res) {
34123         if (!ptr_is_owned(_res)) return;
34124         void* _res_ptr = untag_ptr(_res);
34125         CHECK_ACCESS(_res_ptr);
34126         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34127         FREE(untag_ptr(_res));
34128         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34129 }
34130
34131 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34132         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34133         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34134         return tag_ptr(ret_conv, true);
34135 }
34136 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(int64_t arg) {
34137         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34138         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34139         return ret_conv;
34140 }
34141
34142 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(int64_t orig) {
34143         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34144         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34145         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34146         return tag_ptr(ret_conv, true);
34147 }
34148
34149 void  CS_LDK_CVec_ForwardNodeZ_free(int64_tArray _res) {
34150         LDKCVec_ForwardNodeZ _res_constr;
34151         _res_constr.datalen = _res->arr_len;
34152         if (_res_constr.datalen > 0)
34153                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
34154         else
34155                 _res_constr.data = NULL;
34156         int64_t* _res_vals = _res->elems;
34157         for (size_t n = 0; n < _res_constr.datalen; n++) {
34158                 int64_t _res_conv_13 = _res_vals[n];
34159                 LDKForwardNode _res_conv_13_conv;
34160                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
34161                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
34162                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
34163                 _res_constr.data[n] = _res_conv_13_conv;
34164         }
34165         FREE(_res);
34166         CVec_ForwardNodeZ_free(_res_constr);
34167 }
34168
34169 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_ok(int64_t o) {
34170         LDKBlindedPath o_conv;
34171         o_conv.inner = untag_ptr(o);
34172         o_conv.is_owned = ptr_is_owned(o);
34173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34174         o_conv = BlindedPath_clone(&o_conv);
34175         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34176         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34177         return tag_ptr(ret_conv, true);
34178 }
34179
34180 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_err(int64_t e) {
34181         void* e_ptr = untag_ptr(e);
34182         CHECK_ACCESS(e_ptr);
34183         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34184         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34185         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34186         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34187         return tag_ptr(ret_conv, true);
34188 }
34189
34190 jboolean  CS_LDK_CResult_BlindedPathDecodeErrorZ_is_ok(int64_t o) {
34191         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34192         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34193         return ret_conv;
34194 }
34195
34196 void  CS_LDK_CResult_BlindedPathDecodeErrorZ_free(int64_t _res) {
34197         if (!ptr_is_owned(_res)) return;
34198         void* _res_ptr = untag_ptr(_res);
34199         CHECK_ACCESS(_res_ptr);
34200         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34201         FREE(untag_ptr(_res));
34202         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34203 }
34204
34205 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34206         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34207         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34208         return tag_ptr(ret_conv, true);
34209 }
34210 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone_ptr(int64_t arg) {
34211         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34212         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34213         return ret_conv;
34214 }
34215
34216 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone(int64_t orig) {
34217         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34218         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34219         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34220         return tag_ptr(ret_conv, true);
34221 }
34222
34223 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_ok(int64_t o) {
34224         LDKBlindedHop o_conv;
34225         o_conv.inner = untag_ptr(o);
34226         o_conv.is_owned = ptr_is_owned(o);
34227         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34228         o_conv = BlindedHop_clone(&o_conv);
34229         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34230         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34231         return tag_ptr(ret_conv, true);
34232 }
34233
34234 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_err(int64_t e) {
34235         void* e_ptr = untag_ptr(e);
34236         CHECK_ACCESS(e_ptr);
34237         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34238         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34239         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34240         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34241         return tag_ptr(ret_conv, true);
34242 }
34243
34244 jboolean  CS_LDK_CResult_BlindedHopDecodeErrorZ_is_ok(int64_t o) {
34245         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34246         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34247         return ret_conv;
34248 }
34249
34250 void  CS_LDK_CResult_BlindedHopDecodeErrorZ_free(int64_t _res) {
34251         if (!ptr_is_owned(_res)) return;
34252         void* _res_ptr = untag_ptr(_res);
34253         CHECK_ACCESS(_res_ptr);
34254         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34255         FREE(untag_ptr(_res));
34256         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34257 }
34258
34259 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34260         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34261         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34262         return tag_ptr(ret_conv, true);
34263 }
34264 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone_ptr(int64_t arg) {
34265         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34266         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34267         return ret_conv;
34268 }
34269
34270 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone(int64_t orig) {
34271         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34272         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34273         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34274         return tag_ptr(ret_conv, true);
34275 }
34276
34277 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_ok(int64_t o) {
34278         LDKInvoiceError o_conv;
34279         o_conv.inner = untag_ptr(o);
34280         o_conv.is_owned = ptr_is_owned(o);
34281         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34282         o_conv = InvoiceError_clone(&o_conv);
34283         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34284         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34285         return tag_ptr(ret_conv, true);
34286 }
34287
34288 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_err(int64_t e) {
34289         void* e_ptr = untag_ptr(e);
34290         CHECK_ACCESS(e_ptr);
34291         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34292         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34293         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34294         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34295         return tag_ptr(ret_conv, true);
34296 }
34297
34298 jboolean  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_is_ok(int64_t o) {
34299         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34300         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34301         return ret_conv;
34302 }
34303
34304 void  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_free(int64_t _res) {
34305         if (!ptr_is_owned(_res)) return;
34306         void* _res_ptr = untag_ptr(_res);
34307         CHECK_ACCESS(_res_ptr);
34308         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34309         FREE(untag_ptr(_res));
34310         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34311 }
34312
34313 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34314         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34315         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34316         return tag_ptr(ret_conv, true);
34317 }
34318 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(int64_t arg) {
34319         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34320         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34321         return ret_conv;
34322 }
34323
34324 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone(int64_t orig) {
34325         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34326         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34327         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34328         return tag_ptr(ret_conv, true);
34329 }
34330
34331 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_ok(int64_t o) {
34332         LDKTrackedSpendableOutput o_conv;
34333         o_conv.inner = untag_ptr(o);
34334         o_conv.is_owned = ptr_is_owned(o);
34335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34336         o_conv = TrackedSpendableOutput_clone(&o_conv);
34337         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34338         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
34339         return tag_ptr(ret_conv, true);
34340 }
34341
34342 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_err(int64_t e) {
34343         void* e_ptr = untag_ptr(e);
34344         CHECK_ACCESS(e_ptr);
34345         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34346         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34347         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34348         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
34349         return tag_ptr(ret_conv, true);
34350 }
34351
34352 jboolean  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(int64_t o) {
34353         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
34354         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
34355         return ret_conv;
34356 }
34357
34358 void  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_free(int64_t _res) {
34359         if (!ptr_is_owned(_res)) return;
34360         void* _res_ptr = untag_ptr(_res);
34361         CHECK_ACCESS(_res_ptr);
34362         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
34363         FREE(untag_ptr(_res));
34364         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
34365 }
34366
34367 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
34368         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34369         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
34370         return tag_ptr(ret_conv, true);
34371 }
34372 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(int64_t arg) {
34373         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
34374         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
34375         return ret_conv;
34376 }
34377
34378 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_clone(int64_t orig) {
34379         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
34380         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34381         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
34382         return tag_ptr(ret_conv, true);
34383 }
34384
34385 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_ok(int64_t o) {
34386         void* o_ptr = untag_ptr(o);
34387         CHECK_ACCESS(o_ptr);
34388         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
34389         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
34390         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34391         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
34392         return tag_ptr(ret_conv, true);
34393 }
34394
34395 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_err(int64_t e) {
34396         void* e_ptr = untag_ptr(e);
34397         CHECK_ACCESS(e_ptr);
34398         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34399         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34400         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34401         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
34402         return tag_ptr(ret_conv, true);
34403 }
34404
34405 jboolean  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_is_ok(int64_t o) {
34406         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
34407         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
34408         return ret_conv;
34409 }
34410
34411 void  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_free(int64_t _res) {
34412         if (!ptr_is_owned(_res)) return;
34413         void* _res_ptr = untag_ptr(_res);
34414         CHECK_ACCESS(_res_ptr);
34415         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
34416         FREE(untag_ptr(_res));
34417         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
34418 }
34419
34420 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
34421         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34422         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
34423         return tag_ptr(ret_conv, true);
34424 }
34425 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(int64_t arg) {
34426         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
34427         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
34428         return ret_conv;
34429 }
34430
34431 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_clone(int64_t orig) {
34432         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
34433         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34434         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
34435         return tag_ptr(ret_conv, true);
34436 }
34437
34438 int64_t  CS_LDK_COption_FilterZ_some(int64_t o) {
34439         void* o_ptr = untag_ptr(o);
34440         CHECK_ACCESS(o_ptr);
34441         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34442         if (o_conv.free == LDKFilter_JCalls_free) {
34443                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34444                 LDKFilter_JCalls_cloned(&o_conv);
34445         }
34446         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34447         *ret_copy = COption_FilterZ_some(o_conv);
34448         int64_t ret_ref = tag_ptr(ret_copy, true);
34449         return ret_ref;
34450 }
34451
34452 int64_t  CS_LDK_COption_FilterZ_none() {
34453         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34454         *ret_copy = COption_FilterZ_none();
34455         int64_t ret_ref = tag_ptr(ret_copy, true);
34456         return ret_ref;
34457 }
34458
34459 void  CS_LDK_COption_FilterZ_free(int64_t _res) {
34460         if (!ptr_is_owned(_res)) return;
34461         void* _res_ptr = untag_ptr(_res);
34462         CHECK_ACCESS(_res_ptr);
34463         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34464         FREE(untag_ptr(_res));
34465         COption_FilterZ_free(_res_conv);
34466 }
34467
34468 void  CS_LDK_CVec_TrackedSpendableOutputZ_free(int64_tArray _res) {
34469         LDKCVec_TrackedSpendableOutputZ _res_constr;
34470         _res_constr.datalen = _res->arr_len;
34471         if (_res_constr.datalen > 0)
34472                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
34473         else
34474                 _res_constr.data = NULL;
34475         int64_t* _res_vals = _res->elems;
34476         for (size_t y = 0; y < _res_constr.datalen; y++) {
34477                 int64_t _res_conv_24 = _res_vals[y];
34478                 LDKTrackedSpendableOutput _res_conv_24_conv;
34479                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
34480                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
34481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
34482                 _res_constr.data[y] = _res_conv_24_conv;
34483         }
34484         FREE(_res);
34485         CVec_TrackedSpendableOutputZ_free(_res_constr);
34486 }
34487
34488 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_ok(int64_t o) {
34489         LDKOutputSweeper o_conv;
34490         o_conv.inner = untag_ptr(o);
34491         o_conv.is_owned = ptr_is_owned(o);
34492         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34493         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34494         
34495         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34496         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
34497         return tag_ptr(ret_conv, true);
34498 }
34499
34500 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_err(int64_t e) {
34501         void* e_ptr = untag_ptr(e);
34502         CHECK_ACCESS(e_ptr);
34503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34505         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
34506         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
34507         return tag_ptr(ret_conv, true);
34508 }
34509
34510 jboolean  CS_LDK_CResult_OutputSweeperDecodeErrorZ_is_ok(int64_t o) {
34511         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
34512         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
34513         return ret_conv;
34514 }
34515
34516 void  CS_LDK_CResult_OutputSweeperDecodeErrorZ_free(int64_t _res) {
34517         if (!ptr_is_owned(_res)) return;
34518         void* _res_ptr = untag_ptr(_res);
34519         CHECK_ACCESS(_res_ptr);
34520         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
34521         FREE(untag_ptr(_res));
34522         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
34523 }
34524
34525 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_new(int64_t a, int64_t b) {
34526         LDKBestBlock a_conv;
34527         a_conv.inner = untag_ptr(a);
34528         a_conv.is_owned = ptr_is_owned(a);
34529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34530         a_conv = BestBlock_clone(&a_conv);
34531         LDKOutputSweeper b_conv;
34532         b_conv.inner = untag_ptr(b);
34533         b_conv.is_owned = ptr_is_owned(b);
34534         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34535         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
34536         
34537         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
34538         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
34539         return tag_ptr(ret_conv, true);
34540 }
34541
34542 void  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_free(int64_t _res) {
34543         if (!ptr_is_owned(_res)) return;
34544         void* _res_ptr = untag_ptr(_res);
34545         CHECK_ACCESS(_res_ptr);
34546         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
34547         FREE(untag_ptr(_res));
34548         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
34549 }
34550
34551 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(int64_t o) {
34552         void* o_ptr = untag_ptr(o);
34553         CHECK_ACCESS(o_ptr);
34554         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
34555         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
34556         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34557         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
34558         return tag_ptr(ret_conv, true);
34559 }
34560
34561 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(int64_t e) {
34562         void* e_ptr = untag_ptr(e);
34563         CHECK_ACCESS(e_ptr);
34564         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34565         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34566         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
34567         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
34568         return tag_ptr(ret_conv, true);
34569 }
34570
34571 jboolean  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(int64_t o) {
34572         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
34573         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
34574         return ret_conv;
34575 }
34576
34577 void  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(int64_t _res) {
34578         if (!ptr_is_owned(_res)) return;
34579         void* _res_ptr = untag_ptr(_res);
34580         CHECK_ACCESS(_res_ptr);
34581         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
34582         FREE(untag_ptr(_res));
34583         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
34584 }
34585
34586 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(int64_t o) {
34587         LDKDelayedPaymentBasepoint o_conv;
34588         o_conv.inner = untag_ptr(o);
34589         o_conv.is_owned = ptr_is_owned(o);
34590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34591         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
34592         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34593         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
34594         return tag_ptr(ret_conv, true);
34595 }
34596
34597 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_err(int64_t e) {
34598         void* e_ptr = untag_ptr(e);
34599         CHECK_ACCESS(e_ptr);
34600         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34601         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34602         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34603         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
34604         return tag_ptr(ret_conv, true);
34605 }
34606
34607 jboolean  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(int64_t o) {
34608         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
34609         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
34610         return ret_conv;
34611 }
34612
34613 void  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_free(int64_t _res) {
34614         if (!ptr_is_owned(_res)) return;
34615         void* _res_ptr = untag_ptr(_res);
34616         CHECK_ACCESS(_res_ptr);
34617         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
34618         FREE(untag_ptr(_res));
34619         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
34620 }
34621
34622 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
34623         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34624         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
34625         return tag_ptr(ret_conv, true);
34626 }
34627 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
34628         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
34629         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
34630         return ret_conv;
34631 }
34632
34633 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(int64_t orig) {
34634         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
34635         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
34636         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
34637         return tag_ptr(ret_conv, true);
34638 }
34639
34640 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_ok(int64_t o) {
34641         LDKDelayedPaymentKey o_conv;
34642         o_conv.inner = untag_ptr(o);
34643         o_conv.is_owned = ptr_is_owned(o);
34644         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34645         o_conv = DelayedPaymentKey_clone(&o_conv);
34646         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34647         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
34648         return tag_ptr(ret_conv, true);
34649 }
34650
34651 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_err(int64_t e) {
34652         void* e_ptr = untag_ptr(e);
34653         CHECK_ACCESS(e_ptr);
34654         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34655         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34656         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34657         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
34658         return tag_ptr(ret_conv, true);
34659 }
34660
34661 jboolean  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(int64_t o) {
34662         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
34663         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
34664         return ret_conv;
34665 }
34666
34667 void  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_free(int64_t _res) {
34668         if (!ptr_is_owned(_res)) return;
34669         void* _res_ptr = untag_ptr(_res);
34670         CHECK_ACCESS(_res_ptr);
34671         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
34672         FREE(untag_ptr(_res));
34673         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
34674 }
34675
34676 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
34677         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34678         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
34679         return tag_ptr(ret_conv, true);
34680 }
34681 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(int64_t arg) {
34682         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
34683         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
34684         return ret_conv;
34685 }
34686
34687 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone(int64_t orig) {
34688         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
34689         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
34690         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
34691         return tag_ptr(ret_conv, true);
34692 }
34693
34694 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_ok(int64_t o) {
34695         LDKHtlcBasepoint o_conv;
34696         o_conv.inner = untag_ptr(o);
34697         o_conv.is_owned = ptr_is_owned(o);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34699         o_conv = HtlcBasepoint_clone(&o_conv);
34700         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34701         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
34702         return tag_ptr(ret_conv, true);
34703 }
34704
34705 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_err(int64_t e) {
34706         void* e_ptr = untag_ptr(e);
34707         CHECK_ACCESS(e_ptr);
34708         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34709         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34710         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34711         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
34712         return tag_ptr(ret_conv, true);
34713 }
34714
34715 jboolean  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_is_ok(int64_t o) {
34716         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
34717         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
34718         return ret_conv;
34719 }
34720
34721 void  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_free(int64_t _res) {
34722         if (!ptr_is_owned(_res)) return;
34723         void* _res_ptr = untag_ptr(_res);
34724         CHECK_ACCESS(_res_ptr);
34725         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
34726         FREE(untag_ptr(_res));
34727         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
34728 }
34729
34730 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
34731         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34732         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
34733         return tag_ptr(ret_conv, true);
34734 }
34735 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
34736         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
34737         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
34738         return ret_conv;
34739 }
34740
34741 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone(int64_t orig) {
34742         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
34743         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
34744         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
34745         return tag_ptr(ret_conv, true);
34746 }
34747
34748 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_ok(int64_t o) {
34749         LDKHtlcKey o_conv;
34750         o_conv.inner = untag_ptr(o);
34751         o_conv.is_owned = ptr_is_owned(o);
34752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34753         o_conv = HtlcKey_clone(&o_conv);
34754         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34755         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
34756         return tag_ptr(ret_conv, true);
34757 }
34758
34759 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_err(int64_t e) {
34760         void* e_ptr = untag_ptr(e);
34761         CHECK_ACCESS(e_ptr);
34762         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34763         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34764         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34765         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
34766         return tag_ptr(ret_conv, true);
34767 }
34768
34769 jboolean  CS_LDK_CResult_HtlcKeyDecodeErrorZ_is_ok(int64_t o) {
34770         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
34771         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
34772         return ret_conv;
34773 }
34774
34775 void  CS_LDK_CResult_HtlcKeyDecodeErrorZ_free(int64_t _res) {
34776         if (!ptr_is_owned(_res)) return;
34777         void* _res_ptr = untag_ptr(_res);
34778         CHECK_ACCESS(_res_ptr);
34779         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
34780         FREE(untag_ptr(_res));
34781         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
34782 }
34783
34784 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
34785         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34786         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
34787         return tag_ptr(ret_conv, true);
34788 }
34789 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone_ptr(int64_t arg) {
34790         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
34791         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
34792         return ret_conv;
34793 }
34794
34795 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone(int64_t orig) {
34796         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
34797         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
34798         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
34799         return tag_ptr(ret_conv, true);
34800 }
34801
34802 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_ok(int64_t o) {
34803         LDKRevocationBasepoint o_conv;
34804         o_conv.inner = untag_ptr(o);
34805         o_conv.is_owned = ptr_is_owned(o);
34806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34807         o_conv = RevocationBasepoint_clone(&o_conv);
34808         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34809         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
34810         return tag_ptr(ret_conv, true);
34811 }
34812
34813 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_err(int64_t e) {
34814         void* e_ptr = untag_ptr(e);
34815         CHECK_ACCESS(e_ptr);
34816         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34817         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34818         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34819         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
34820         return tag_ptr(ret_conv, true);
34821 }
34822
34823 jboolean  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_is_ok(int64_t o) {
34824         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
34825         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
34826         return ret_conv;
34827 }
34828
34829 void  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_free(int64_t _res) {
34830         if (!ptr_is_owned(_res)) return;
34831         void* _res_ptr = untag_ptr(_res);
34832         CHECK_ACCESS(_res_ptr);
34833         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
34834         FREE(untag_ptr(_res));
34835         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
34836 }
34837
34838 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
34839         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34840         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
34841         return tag_ptr(ret_conv, true);
34842 }
34843 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
34844         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
34845         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
34846         return ret_conv;
34847 }
34848
34849 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone(int64_t orig) {
34850         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
34851         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
34852         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
34853         return tag_ptr(ret_conv, true);
34854 }
34855
34856 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_ok(int64_t o) {
34857         LDKRevocationKey o_conv;
34858         o_conv.inner = untag_ptr(o);
34859         o_conv.is_owned = ptr_is_owned(o);
34860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34861         o_conv = RevocationKey_clone(&o_conv);
34862         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34863         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
34864         return tag_ptr(ret_conv, true);
34865 }
34866
34867 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_err(int64_t e) {
34868         void* e_ptr = untag_ptr(e);
34869         CHECK_ACCESS(e_ptr);
34870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34872         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34873         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
34874         return tag_ptr(ret_conv, true);
34875 }
34876
34877 jboolean  CS_LDK_CResult_RevocationKeyDecodeErrorZ_is_ok(int64_t o) {
34878         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
34879         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
34880         return ret_conv;
34881 }
34882
34883 void  CS_LDK_CResult_RevocationKeyDecodeErrorZ_free(int64_t _res) {
34884         if (!ptr_is_owned(_res)) return;
34885         void* _res_ptr = untag_ptr(_res);
34886         CHECK_ACCESS(_res_ptr);
34887         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
34888         FREE(untag_ptr(_res));
34889         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
34890 }
34891
34892 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
34893         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34894         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
34895         return tag_ptr(ret_conv, true);
34896 }
34897 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone_ptr(int64_t arg) {
34898         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
34899         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
34900         return ret_conv;
34901 }
34902
34903 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone(int64_t orig) {
34904         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
34905         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
34906         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
34907         return tag_ptr(ret_conv, true);
34908 }
34909
34910 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_ok(int64_t o) {
34911         LDKLockedChannelMonitor o_conv;
34912         o_conv.inner = untag_ptr(o);
34913         o_conv.is_owned = ptr_is_owned(o);
34914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34915         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
34916         
34917         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34918         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
34919         return tag_ptr(ret_conv, true);
34920 }
34921
34922 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_err() {
34923         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
34924         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
34925         return tag_ptr(ret_conv, true);
34926 }
34927
34928 jboolean  CS_LDK_CResult_LockedChannelMonitorNoneZ_is_ok(int64_t o) {
34929         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
34930         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
34931         return ret_conv;
34932 }
34933
34934 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_free(int64_t _res) {
34935         if (!ptr_is_owned(_res)) return;
34936         void* _res_ptr = untag_ptr(_res);
34937         CHECK_ACCESS(_res_ptr);
34938         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
34939         FREE(untag_ptr(_res));
34940         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
34941 }
34942
34943 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
34944         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34945         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
34946         return tag_ptr(ret_conv, true);
34947 }
34948 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_clone_ptr(int64_t arg) {
34949         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
34950         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
34951         return ret_conv;
34952 }
34953
34954 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_clone(int64_t orig) {
34955         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
34956         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34957         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
34958         return tag_ptr(ret_conv, true);
34959 }
34960
34961 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_new(int64_t a, int64_t b) {
34962         LDKOutPoint a_conv;
34963         a_conv.inner = untag_ptr(a);
34964         a_conv.is_owned = ptr_is_owned(a);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34966         a_conv = OutPoint_clone(&a_conv);
34967         LDKChannelId b_conv;
34968         b_conv.inner = untag_ptr(b);
34969         b_conv.is_owned = ptr_is_owned(b);
34970         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34971         b_conv = ChannelId_clone(&b_conv);
34972         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
34973         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
34974         return tag_ptr(ret_conv, true);
34975 }
34976
34977 void  CS_LDK_C2Tuple_OutPointChannelIdZ_free(int64_t _res) {
34978         if (!ptr_is_owned(_res)) return;
34979         void* _res_ptr = untag_ptr(_res);
34980         CHECK_ACCESS(_res_ptr);
34981         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
34982         FREE(untag_ptr(_res));
34983         C2Tuple_OutPointChannelIdZ_free(_res_conv);
34984 }
34985
34986 void  CS_LDK_CVec_C2Tuple_OutPointChannelIdZZ_free(int64_tArray _res) {
34987         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
34988         _res_constr.datalen = _res->arr_len;
34989         if (_res_constr.datalen > 0)
34990                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
34991         else
34992                 _res_constr.data = NULL;
34993         int64_t* _res_vals = _res->elems;
34994         for (size_t d = 0; d < _res_constr.datalen; d++) {
34995                 int64_t _res_conv_29 = _res_vals[d];
34996                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
34997                 CHECK_ACCESS(_res_conv_29_ptr);
34998                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
34999                 FREE(untag_ptr(_res_conv_29));
35000                 _res_constr.data[d] = _res_conv_29_conv;
35001         }
35002         FREE(_res);
35003         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
35004 }
35005
35006 void  CS_LDK_CVec_MonitorUpdateIdZ_free(int64_tArray _res) {
35007         LDKCVec_MonitorUpdateIdZ _res_constr;
35008         _res_constr.datalen = _res->arr_len;
35009         if (_res_constr.datalen > 0)
35010                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35011         else
35012                 _res_constr.data = NULL;
35013         int64_t* _res_vals = _res->elems;
35014         for (size_t r = 0; r < _res_constr.datalen; r++) {
35015                 int64_t _res_conv_17 = _res_vals[r];
35016                 LDKMonitorUpdateId _res_conv_17_conv;
35017                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
35018                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
35019                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
35020                 _res_constr.data[r] = _res_conv_17_conv;
35021         }
35022         FREE(_res);
35023         CVec_MonitorUpdateIdZ_free(_res_constr);
35024 }
35025
35026 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
35027         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35028         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
35029         return tag_ptr(ret_conv, true);
35030 }
35031 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(int64_t arg) {
35032         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
35033         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
35034         return ret_conv;
35035 }
35036
35037 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(int64_t orig) {
35038         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
35039         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35040         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
35041         return tag_ptr(ret_conv, true);
35042 }
35043
35044 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(int64_t a, int64_tArray b) {
35045         LDKOutPoint a_conv;
35046         a_conv.inner = untag_ptr(a);
35047         a_conv.is_owned = ptr_is_owned(a);
35048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35049         a_conv = OutPoint_clone(&a_conv);
35050         LDKCVec_MonitorUpdateIdZ b_constr;
35051         b_constr.datalen = b->arr_len;
35052         if (b_constr.datalen > 0)
35053                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35054         else
35055                 b_constr.data = NULL;
35056         int64_t* b_vals = b->elems;
35057         for (size_t r = 0; r < b_constr.datalen; r++) {
35058                 int64_t b_conv_17 = b_vals[r];
35059                 LDKMonitorUpdateId b_conv_17_conv;
35060                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
35061                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
35062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
35063                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
35064                 b_constr.data[r] = b_conv_17_conv;
35065         }
35066         FREE(b);
35067         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35068         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
35069         return tag_ptr(ret_conv, true);
35070 }
35071
35072 void  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(int64_t _res) {
35073         if (!ptr_is_owned(_res)) return;
35074         void* _res_ptr = untag_ptr(_res);
35075         CHECK_ACCESS(_res_ptr);
35076         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
35077         FREE(untag_ptr(_res));
35078         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
35079 }
35080
35081 void  CS_LDK_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(int64_tArray _res) {
35082         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
35083         _res_constr.datalen = _res->arr_len;
35084         if (_res_constr.datalen > 0)
35085                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
35086         else
35087                 _res_constr.data = NULL;
35088         int64_t* _res_vals = _res->elems;
35089         for (size_t p = 0; p < _res_constr.datalen; p++) {
35090                 int64_t _res_conv_41 = _res_vals[p];
35091                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
35092                 CHECK_ACCESS(_res_conv_41_ptr);
35093                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
35094                 FREE(untag_ptr(_res_conv_41));
35095                 _res_constr.data[p] = _res_conv_41_conv;
35096         }
35097         FREE(_res);
35098         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
35099 }
35100
35101 void  CS_LDK_APIError_free(int64_t this_ptr) {
35102         if (!ptr_is_owned(this_ptr)) return;
35103         void* this_ptr_ptr = untag_ptr(this_ptr);
35104         CHECK_ACCESS(this_ptr_ptr);
35105         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
35106         FREE(untag_ptr(this_ptr));
35107         APIError_free(this_ptr_conv);
35108 }
35109
35110 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
35111         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35112         *ret_copy = APIError_clone(arg);
35113         int64_t ret_ref = tag_ptr(ret_copy, true);
35114         return ret_ref;
35115 }
35116 int64_t  CS_LDK_APIError_clone_ptr(int64_t arg) {
35117         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
35118         int64_t ret_conv = APIError_clone_ptr(arg_conv);
35119         return ret_conv;
35120 }
35121
35122 int64_t  CS_LDK_APIError_clone(int64_t orig) {
35123         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
35124         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35125         *ret_copy = APIError_clone(orig_conv);
35126         int64_t ret_ref = tag_ptr(ret_copy, true);
35127         return ret_ref;
35128 }
35129
35130 int64_t  CS_LDK_APIError_apimisuse_error(jstring err) {
35131         LDKStr err_conv = str_ref_to_owned_c(err);
35132         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35133         *ret_copy = APIError_apimisuse_error(err_conv);
35134         int64_t ret_ref = tag_ptr(ret_copy, true);
35135         return ret_ref;
35136 }
35137
35138 int64_t  CS_LDK_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
35139         LDKStr err_conv = str_ref_to_owned_c(err);
35140         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35141         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
35142         int64_t ret_ref = tag_ptr(ret_copy, true);
35143         return ret_ref;
35144 }
35145
35146 int64_t  CS_LDK_APIError_invalid_route(jstring err) {
35147         LDKStr err_conv = str_ref_to_owned_c(err);
35148         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35149         *ret_copy = APIError_invalid_route(err_conv);
35150         int64_t ret_ref = tag_ptr(ret_copy, true);
35151         return ret_ref;
35152 }
35153
35154 int64_t  CS_LDK_APIError_channel_unavailable(jstring err) {
35155         LDKStr err_conv = str_ref_to_owned_c(err);
35156         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35157         *ret_copy = APIError_channel_unavailable(err_conv);
35158         int64_t ret_ref = tag_ptr(ret_copy, true);
35159         return ret_ref;
35160 }
35161
35162 int64_t  CS_LDK_APIError_monitor_update_in_progress() {
35163         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35164         *ret_copy = APIError_monitor_update_in_progress();
35165         int64_t ret_ref = tag_ptr(ret_copy, true);
35166         return ret_ref;
35167 }
35168
35169 int64_t  CS_LDK_APIError_incompatible_shutdown_script(int64_t script) {
35170         LDKShutdownScript script_conv;
35171         script_conv.inner = untag_ptr(script);
35172         script_conv.is_owned = ptr_is_owned(script);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
35174         script_conv = ShutdownScript_clone(&script_conv);
35175         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35176         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
35177         int64_t ret_ref = tag_ptr(ret_copy, true);
35178         return ret_ref;
35179 }
35180
35181 jboolean  CS_LDK_APIError_eq(int64_t a, int64_t b) {
35182         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
35183         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
35184         jboolean ret_conv = APIError_eq(a_conv, b_conv);
35185         return ret_conv;
35186 }
35187
35188 int8_tArray  CS_LDK_APIError_write(int64_t obj) {
35189         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
35190         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
35191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35193         CVec_u8Z_free(ret_var);
35194         return ret_arr;
35195 }
35196
35197 int64_t  CS_LDK_APIError_read(int8_tArray ser) {
35198         LDKu8slice ser_ref;
35199         ser_ref.datalen = ser->arr_len;
35200         ser_ref.data = ser->elems;
35201         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
35202         *ret_conv = APIError_read(ser_ref);
35203         FREE(ser);
35204         return tag_ptr(ret_conv, true);
35205 }
35206
35207 void  CS_LDK_BigSize_free(int64_t this_obj) {
35208         LDKBigSize this_obj_conv;
35209         this_obj_conv.inner = untag_ptr(this_obj);
35210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35212         BigSize_free(this_obj_conv);
35213 }
35214
35215 int64_t  CS_LDK_BigSize_get_a(int64_t this_ptr) {
35216         LDKBigSize this_ptr_conv;
35217         this_ptr_conv.inner = untag_ptr(this_ptr);
35218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35220         this_ptr_conv.is_owned = false;
35221         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
35222         return ret_conv;
35223 }
35224
35225 void  CS_LDK_BigSize_set_a(int64_t this_ptr, int64_t val) {
35226         LDKBigSize this_ptr_conv;
35227         this_ptr_conv.inner = untag_ptr(this_ptr);
35228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35230         this_ptr_conv.is_owned = false;
35231         BigSize_set_a(&this_ptr_conv, val);
35232 }
35233
35234 int64_t  CS_LDK_BigSize_new(int64_t a_arg) {
35235         LDKBigSize ret_var = BigSize_new(a_arg);
35236         int64_t ret_ref = 0;
35237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35239         return ret_ref;
35240 }
35241
35242 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
35243         LDKBigSize ret_var = BigSize_clone(arg);
35244         int64_t ret_ref = 0;
35245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35247         return ret_ref;
35248 }
35249 int64_t  CS_LDK_BigSize_clone_ptr(int64_t arg) {
35250         LDKBigSize arg_conv;
35251         arg_conv.inner = untag_ptr(arg);
35252         arg_conv.is_owned = ptr_is_owned(arg);
35253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35254         arg_conv.is_owned = false;
35255         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
35256         return ret_conv;
35257 }
35258
35259 int64_t  CS_LDK_BigSize_clone(int64_t orig) {
35260         LDKBigSize orig_conv;
35261         orig_conv.inner = untag_ptr(orig);
35262         orig_conv.is_owned = ptr_is_owned(orig);
35263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35264         orig_conv.is_owned = false;
35265         LDKBigSize ret_var = BigSize_clone(&orig_conv);
35266         int64_t ret_ref = 0;
35267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35269         return ret_ref;
35270 }
35271
35272 int64_t  CS_LDK_BigSize_hash(int64_t o) {
35273         LDKBigSize o_conv;
35274         o_conv.inner = untag_ptr(o);
35275         o_conv.is_owned = ptr_is_owned(o);
35276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35277         o_conv.is_owned = false;
35278         int64_t ret_conv = BigSize_hash(&o_conv);
35279         return ret_conv;
35280 }
35281
35282 jboolean  CS_LDK_BigSize_eq(int64_t a, int64_t b) {
35283         LDKBigSize a_conv;
35284         a_conv.inner = untag_ptr(a);
35285         a_conv.is_owned = ptr_is_owned(a);
35286         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35287         a_conv.is_owned = false;
35288         LDKBigSize b_conv;
35289         b_conv.inner = untag_ptr(b);
35290         b_conv.is_owned = ptr_is_owned(b);
35291         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35292         b_conv.is_owned = false;
35293         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35294         return ret_conv;
35295 }
35296
35297 int8_tArray  CS_LDK_BigSize_write(int64_t obj) {
35298         LDKBigSize obj_conv;
35299         obj_conv.inner = untag_ptr(obj);
35300         obj_conv.is_owned = ptr_is_owned(obj);
35301         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35302         obj_conv.is_owned = false;
35303         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35304         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35305         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35306         CVec_u8Z_free(ret_var);
35307         return ret_arr;
35308 }
35309
35310 int64_t  CS_LDK_BigSize_read(int8_tArray ser) {
35311         LDKu8slice ser_ref;
35312         ser_ref.datalen = ser->arr_len;
35313         ser_ref.data = ser->elems;
35314         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35315         *ret_conv = BigSize_read(ser_ref);
35316         FREE(ser);
35317         return tag_ptr(ret_conv, true);
35318 }
35319
35320 void  CS_LDK_Hostname_free(int64_t this_obj) {
35321         LDKHostname this_obj_conv;
35322         this_obj_conv.inner = untag_ptr(this_obj);
35323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35325         Hostname_free(this_obj_conv);
35326 }
35327
35328 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35329         LDKHostname ret_var = Hostname_clone(arg);
35330         int64_t ret_ref = 0;
35331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35333         return ret_ref;
35334 }
35335 int64_t  CS_LDK_Hostname_clone_ptr(int64_t arg) {
35336         LDKHostname arg_conv;
35337         arg_conv.inner = untag_ptr(arg);
35338         arg_conv.is_owned = ptr_is_owned(arg);
35339         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35340         arg_conv.is_owned = false;
35341         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35342         return ret_conv;
35343 }
35344
35345 int64_t  CS_LDK_Hostname_clone(int64_t orig) {
35346         LDKHostname orig_conv;
35347         orig_conv.inner = untag_ptr(orig);
35348         orig_conv.is_owned = ptr_is_owned(orig);
35349         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35350         orig_conv.is_owned = false;
35351         LDKHostname ret_var = Hostname_clone(&orig_conv);
35352         int64_t ret_ref = 0;
35353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35355         return ret_ref;
35356 }
35357
35358 int64_t  CS_LDK_Hostname_hash(int64_t o) {
35359         LDKHostname o_conv;
35360         o_conv.inner = untag_ptr(o);
35361         o_conv.is_owned = ptr_is_owned(o);
35362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35363         o_conv.is_owned = false;
35364         int64_t ret_conv = Hostname_hash(&o_conv);
35365         return ret_conv;
35366 }
35367
35368 jboolean  CS_LDK_Hostname_eq(int64_t a, int64_t b) {
35369         LDKHostname a_conv;
35370         a_conv.inner = untag_ptr(a);
35371         a_conv.is_owned = ptr_is_owned(a);
35372         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35373         a_conv.is_owned = false;
35374         LDKHostname b_conv;
35375         b_conv.inner = untag_ptr(b);
35376         b_conv.is_owned = ptr_is_owned(b);
35377         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35378         b_conv.is_owned = false;
35379         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35380         return ret_conv;
35381 }
35382
35383 int8_t  CS_LDK_Hostname_len(int64_t this_arg) {
35384         LDKHostname this_arg_conv;
35385         this_arg_conv.inner = untag_ptr(this_arg);
35386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35388         this_arg_conv.is_owned = false;
35389         int8_t ret_conv = Hostname_len(&this_arg_conv);
35390         return ret_conv;
35391 }
35392
35393 int8_tArray  CS_LDK_Hostname_write(int64_t obj) {
35394         LDKHostname obj_conv;
35395         obj_conv.inner = untag_ptr(obj);
35396         obj_conv.is_owned = ptr_is_owned(obj);
35397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35398         obj_conv.is_owned = false;
35399         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35402         CVec_u8Z_free(ret_var);
35403         return ret_arr;
35404 }
35405
35406 int64_t  CS_LDK_Hostname_read(int8_tArray ser) {
35407         LDKu8slice ser_ref;
35408         ser_ref.datalen = ser->arr_len;
35409         ser_ref.data = ser->elems;
35410         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35411         *ret_conv = Hostname_read(ser_ref);
35412         FREE(ser);
35413         return tag_ptr(ret_conv, true);
35414 }
35415
35416 void  CS_LDK_TransactionU16LenLimited_free(int64_t this_obj) {
35417         LDKTransactionU16LenLimited this_obj_conv;
35418         this_obj_conv.inner = untag_ptr(this_obj);
35419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35421         TransactionU16LenLimited_free(this_obj_conv);
35422 }
35423
35424 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35425         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35426         int64_t ret_ref = 0;
35427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35429         return ret_ref;
35430 }
35431 int64_t  CS_LDK_TransactionU16LenLimited_clone_ptr(int64_t arg) {
35432         LDKTransactionU16LenLimited arg_conv;
35433         arg_conv.inner = untag_ptr(arg);
35434         arg_conv.is_owned = ptr_is_owned(arg);
35435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35436         arg_conv.is_owned = false;
35437         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35438         return ret_conv;
35439 }
35440
35441 int64_t  CS_LDK_TransactionU16LenLimited_clone(int64_t orig) {
35442         LDKTransactionU16LenLimited orig_conv;
35443         orig_conv.inner = untag_ptr(orig);
35444         orig_conv.is_owned = ptr_is_owned(orig);
35445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35446         orig_conv.is_owned = false;
35447         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35448         int64_t ret_ref = 0;
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35451         return ret_ref;
35452 }
35453
35454 int64_t  CS_LDK_TransactionU16LenLimited_hash(int64_t o) {
35455         LDKTransactionU16LenLimited o_conv;
35456         o_conv.inner = untag_ptr(o);
35457         o_conv.is_owned = ptr_is_owned(o);
35458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35459         o_conv.is_owned = false;
35460         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
35461         return ret_conv;
35462 }
35463
35464 jboolean  CS_LDK_TransactionU16LenLimited_eq(int64_t a, int64_t b) {
35465         LDKTransactionU16LenLimited a_conv;
35466         a_conv.inner = untag_ptr(a);
35467         a_conv.is_owned = ptr_is_owned(a);
35468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35469         a_conv.is_owned = false;
35470         LDKTransactionU16LenLimited b_conv;
35471         b_conv.inner = untag_ptr(b);
35472         b_conv.is_owned = ptr_is_owned(b);
35473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35474         b_conv.is_owned = false;
35475         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
35476         return ret_conv;
35477 }
35478
35479 int64_t  CS_LDK_TransactionU16LenLimited_new(int8_tArray transaction) {
35480         LDKTransaction transaction_ref;
35481         transaction_ref.datalen = transaction->arr_len;
35482         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
35483         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
35484         transaction_ref.data_is_owned = true;
35485         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35486         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
35487         return tag_ptr(ret_conv, true);
35488 }
35489
35490 int8_tArray  CS_LDK_TransactionU16LenLimited_into_transaction(int64_t this_arg) {
35491         LDKTransactionU16LenLimited this_arg_conv;
35492         this_arg_conv.inner = untag_ptr(this_arg);
35493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35495         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
35496         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
35497         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35498         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35499         Transaction_free(ret_var);
35500         return ret_arr;
35501 }
35502
35503 int8_tArray  CS_LDK_TransactionU16LenLimited_as_transaction(int64_t this_arg) {
35504         LDKTransactionU16LenLimited this_arg_conv;
35505         this_arg_conv.inner = untag_ptr(this_arg);
35506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35508         this_arg_conv.is_owned = false;
35509         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
35510         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35511         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35512         Transaction_free(ret_var);
35513         return ret_arr;
35514 }
35515
35516 int8_tArray  CS_LDK_TransactionU16LenLimited_write(int64_t obj) {
35517         LDKTransactionU16LenLimited obj_conv;
35518         obj_conv.inner = untag_ptr(obj);
35519         obj_conv.is_owned = ptr_is_owned(obj);
35520         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35521         obj_conv.is_owned = false;
35522         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
35523         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35524         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35525         CVec_u8Z_free(ret_var);
35526         return ret_arr;
35527 }
35528
35529 int64_t  CS_LDK_TransactionU16LenLimited_read(int8_tArray ser) {
35530         LDKu8slice ser_ref;
35531         ser_ref.datalen = ser->arr_len;
35532         ser_ref.data = ser->elems;
35533         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35534         *ret_conv = TransactionU16LenLimited_read(ser_ref);
35535         FREE(ser);
35536         return tag_ptr(ret_conv, true);
35537 }
35538
35539 int64_t  CS_LDK_sign(int8_tArray msg, int8_tArray sk) {
35540         LDKu8slice msg_ref;
35541         msg_ref.datalen = msg->arr_len;
35542         msg_ref.data = msg->elems;
35543         uint8_t sk_arr[32];
35544         CHECK(sk->arr_len == 32);
35545         memcpy(sk_arr, sk->elems, 32); FREE(sk);
35546         uint8_t (*sk_ref)[32] = &sk_arr;
35547         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
35548         *ret_conv = sign(msg_ref, sk_ref);
35549         FREE(msg);
35550         return tag_ptr(ret_conv, true);
35551 }
35552
35553 int64_t  CS_LDK_recover_pk(int8_tArray msg, jstring sig) {
35554         LDKu8slice msg_ref;
35555         msg_ref.datalen = msg->arr_len;
35556         msg_ref.data = msg->elems;
35557         LDKStr sig_conv = str_ref_to_owned_c(sig);
35558         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
35559         *ret_conv = recover_pk(msg_ref, sig_conv);
35560         FREE(msg);
35561         return tag_ptr(ret_conv, true);
35562 }
35563
35564 jboolean  CS_LDK_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
35565         LDKu8slice msg_ref;
35566         msg_ref.datalen = msg->arr_len;
35567         msg_ref.data = msg->elems;
35568         LDKStr sig_conv = str_ref_to_owned_c(sig);
35569         LDKPublicKey pk_ref;
35570         CHECK(pk->arr_len == 33);
35571         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
35572         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
35573         FREE(msg);
35574         return ret_conv;
35575 }
35576
35577 int8_tArray  CS_LDK_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
35578         LDKu8slice hrp_bytes_ref;
35579         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
35580         hrp_bytes_ref.data = hrp_bytes->elems;
35581         LDKCVec_U5Z data_without_signature_constr;
35582         data_without_signature_constr.datalen = data_without_signature->arr_len;
35583         if (data_without_signature_constr.datalen > 0)
35584                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
35585         else
35586                 data_without_signature_constr.data = NULL;
35587         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
35588         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
35589                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
35590                 
35591                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
35592         }
35593         FREE(data_without_signature);
35594         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
35595         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35596         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35597         CVec_u8Z_free(ret_var);
35598         FREE(hrp_bytes);
35599         return ret_arr;
35600 }
35601
35602 void  CS_LDK_KVStore_free(int64_t this_ptr) {
35603         if (!ptr_is_owned(this_ptr)) return;
35604         void* this_ptr_ptr = untag_ptr(this_ptr);
35605         CHECK_ACCESS(this_ptr_ptr);
35606         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
35607         FREE(untag_ptr(this_ptr));
35608         KVStore_free(this_ptr_conv);
35609 }
35610
35611 void  CS_LDK_Persister_free(int64_t this_ptr) {
35612         if (!ptr_is_owned(this_ptr)) return;
35613         void* this_ptr_ptr = untag_ptr(this_ptr);
35614         CHECK_ACCESS(this_ptr_ptr);
35615         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
35616         FREE(untag_ptr(this_ptr));
35617         Persister_free(this_ptr_conv);
35618 }
35619
35620 int64_t  CS_LDK_read_channel_monitors(int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
35621         void* kv_store_ptr = untag_ptr(kv_store);
35622         CHECK_ACCESS(kv_store_ptr);
35623         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35624         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35625                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35626                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35627         }
35628         void* entropy_source_ptr = untag_ptr(entropy_source);
35629         CHECK_ACCESS(entropy_source_ptr);
35630         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35631         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35632                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35633                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35634         }
35635         void* signer_provider_ptr = untag_ptr(signer_provider);
35636         CHECK_ACCESS(signer_provider_ptr);
35637         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35638         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35639                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35640                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35641         }
35642         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35643         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
35644         return tag_ptr(ret_conv, true);
35645 }
35646
35647 void  CS_LDK_MonitorUpdatingPersister_free(int64_t this_obj) {
35648         LDKMonitorUpdatingPersister this_obj_conv;
35649         this_obj_conv.inner = untag_ptr(this_obj);
35650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35652         MonitorUpdatingPersister_free(this_obj_conv);
35653 }
35654
35655 int64_t  CS_LDK_MonitorUpdatingPersister_new(int64_t kv_store, int64_t logger, int64_t maximum_pending_updates, int64_t entropy_source, int64_t signer_provider) {
35656         void* kv_store_ptr = untag_ptr(kv_store);
35657         CHECK_ACCESS(kv_store_ptr);
35658         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
35659         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
35660                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35661                 LDKKVStore_JCalls_cloned(&kv_store_conv);
35662         }
35663         void* logger_ptr = untag_ptr(logger);
35664         CHECK_ACCESS(logger_ptr);
35665         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35666         if (logger_conv.free == LDKLogger_JCalls_free) {
35667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35668                 LDKLogger_JCalls_cloned(&logger_conv);
35669         }
35670         void* entropy_source_ptr = untag_ptr(entropy_source);
35671         CHECK_ACCESS(entropy_source_ptr);
35672         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
35673         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
35674                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35675                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
35676         }
35677         void* signer_provider_ptr = untag_ptr(signer_provider);
35678         CHECK_ACCESS(signer_provider_ptr);
35679         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
35680         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
35681                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35682                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
35683         }
35684         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
35685         int64_t ret_ref = 0;
35686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35688         return ret_ref;
35689 }
35690
35691 int64_t  CS_LDK_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
35692         LDKMonitorUpdatingPersister this_arg_conv;
35693         this_arg_conv.inner = untag_ptr(this_arg);
35694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35696         this_arg_conv.is_owned = false;
35697         void* broadcaster_ptr = untag_ptr(broadcaster);
35698         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35699         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35700         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35701         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35702         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35703         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
35704         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
35705         return tag_ptr(ret_conv, true);
35706 }
35707
35708 int64_t  CS_LDK_MonitorUpdatingPersister_read_channel_monitor_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
35709         LDKMonitorUpdatingPersister this_arg_conv;
35710         this_arg_conv.inner = untag_ptr(this_arg);
35711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35713         this_arg_conv.is_owned = false;
35714         void* broadcaster_ptr = untag_ptr(broadcaster);
35715         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35716         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35717         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35718         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35719         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35720         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
35721         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
35722         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
35723         return tag_ptr(ret_conv, true);
35724 }
35725
35726 int64_t  CS_LDK_MonitorUpdatingPersister_cleanup_stale_updates(int64_t this_arg, jboolean lazy) {
35727         LDKMonitorUpdatingPersister this_arg_conv;
35728         this_arg_conv.inner = untag_ptr(this_arg);
35729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35731         this_arg_conv.is_owned = false;
35732         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
35733         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
35734         return tag_ptr(ret_conv, true);
35735 }
35736
35737 int64_t  CS_LDK_MonitorUpdatingPersister_as_Persist(int64_t this_arg) {
35738         LDKMonitorUpdatingPersister this_arg_conv;
35739         this_arg_conv.inner = untag_ptr(this_arg);
35740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35742         this_arg_conv.is_owned = false;
35743         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
35744         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
35745         return tag_ptr(ret_ret, true);
35746 }
35747
35748 int32_t  CS_LDK_ShortChannelIdError_clone(int64_t orig) {
35749         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
35750         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_clone(orig_conv));
35751         return ret_conv;
35752 }
35753
35754 int32_t  CS_LDK_ShortChannelIdError_block_overflow() {
35755         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_block_overflow());
35756         return ret_conv;
35757 }
35758
35759 int32_t  CS_LDK_ShortChannelIdError_tx_index_overflow() {
35760         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_tx_index_overflow());
35761         return ret_conv;
35762 }
35763
35764 int32_t  CS_LDK_ShortChannelIdError_vout_index_overflow() {
35765         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_vout_index_overflow());
35766         return ret_conv;
35767 }
35768
35769 jboolean  CS_LDK_ShortChannelIdError_eq(int64_t a, int64_t b) {
35770         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
35771         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
35772         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
35773         return ret_conv;
35774 }
35775
35776 int32_t  CS_LDK_block_from_scid(int64_t short_channel_id) {
35777         int32_t ret_conv = block_from_scid(short_channel_id);
35778         return ret_conv;
35779 }
35780
35781 int32_t  CS_LDK_tx_index_from_scid(int64_t short_channel_id) {
35782         int32_t ret_conv = tx_index_from_scid(short_channel_id);
35783         return ret_conv;
35784 }
35785
35786 int16_t  CS_LDK_vout_from_scid(int64_t short_channel_id) {
35787         int16_t ret_conv = vout_from_scid(short_channel_id);
35788         return ret_conv;
35789 }
35790
35791 int64_t  CS_LDK_scid_from_parts(int64_t block, int64_t tx_index, int64_t vout_index) {
35792         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
35793         *ret_conv = scid_from_parts(block, tx_index, vout_index);
35794         return tag_ptr(ret_conv, true);
35795 }
35796
35797 void  CS_LDK_UntrustedString_free(int64_t this_obj) {
35798         LDKUntrustedString this_obj_conv;
35799         this_obj_conv.inner = untag_ptr(this_obj);
35800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35802         UntrustedString_free(this_obj_conv);
35803 }
35804
35805 jstring  CS_LDK_UntrustedString_get_a(int64_t this_ptr) {
35806         LDKUntrustedString this_ptr_conv;
35807         this_ptr_conv.inner = untag_ptr(this_ptr);
35808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35810         this_ptr_conv.is_owned = false;
35811         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
35812         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
35813         Str_free(ret_str);
35814         return ret_conv;
35815 }
35816
35817 void  CS_LDK_UntrustedString_set_a(int64_t this_ptr, jstring val) {
35818         LDKUntrustedString this_ptr_conv;
35819         this_ptr_conv.inner = untag_ptr(this_ptr);
35820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35822         this_ptr_conv.is_owned = false;
35823         LDKStr val_conv = str_ref_to_owned_c(val);
35824         UntrustedString_set_a(&this_ptr_conv, val_conv);
35825 }
35826
35827 int64_t  CS_LDK_UntrustedString_new(jstring a_arg) {
35828         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35829         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
35830         int64_t ret_ref = 0;
35831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35833         return ret_ref;
35834 }
35835
35836 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
35837         LDKUntrustedString ret_var = UntrustedString_clone(arg);
35838         int64_t ret_ref = 0;
35839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35841         return ret_ref;
35842 }
35843 int64_t  CS_LDK_UntrustedString_clone_ptr(int64_t arg) {
35844         LDKUntrustedString arg_conv;
35845         arg_conv.inner = untag_ptr(arg);
35846         arg_conv.is_owned = ptr_is_owned(arg);
35847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35848         arg_conv.is_owned = false;
35849         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
35850         return ret_conv;
35851 }
35852
35853 int64_t  CS_LDK_UntrustedString_clone(int64_t orig) {
35854         LDKUntrustedString orig_conv;
35855         orig_conv.inner = untag_ptr(orig);
35856         orig_conv.is_owned = ptr_is_owned(orig);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35858         orig_conv.is_owned = false;
35859         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
35860         int64_t ret_ref = 0;
35861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35863         return ret_ref;
35864 }
35865
35866 jboolean  CS_LDK_UntrustedString_eq(int64_t a, int64_t b) {
35867         LDKUntrustedString a_conv;
35868         a_conv.inner = untag_ptr(a);
35869         a_conv.is_owned = ptr_is_owned(a);
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35871         a_conv.is_owned = false;
35872         LDKUntrustedString b_conv;
35873         b_conv.inner = untag_ptr(b);
35874         b_conv.is_owned = ptr_is_owned(b);
35875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35876         b_conv.is_owned = false;
35877         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
35878         return ret_conv;
35879 }
35880
35881 int64_t  CS_LDK_UntrustedString_hash(int64_t o) {
35882         LDKUntrustedString o_conv;
35883         o_conv.inner = untag_ptr(o);
35884         o_conv.is_owned = ptr_is_owned(o);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35886         o_conv.is_owned = false;
35887         int64_t ret_conv = UntrustedString_hash(&o_conv);
35888         return ret_conv;
35889 }
35890
35891 int8_tArray  CS_LDK_UntrustedString_write(int64_t obj) {
35892         LDKUntrustedString obj_conv;
35893         obj_conv.inner = untag_ptr(obj);
35894         obj_conv.is_owned = ptr_is_owned(obj);
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35896         obj_conv.is_owned = false;
35897         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
35898         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35899         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35900         CVec_u8Z_free(ret_var);
35901         return ret_arr;
35902 }
35903
35904 int64_t  CS_LDK_UntrustedString_read(int8_tArray ser) {
35905         LDKu8slice ser_ref;
35906         ser_ref.datalen = ser->arr_len;
35907         ser_ref.data = ser->elems;
35908         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35909         *ret_conv = UntrustedString_read(ser_ref);
35910         FREE(ser);
35911         return tag_ptr(ret_conv, true);
35912 }
35913
35914 void  CS_LDK_PrintableString_free(int64_t this_obj) {
35915         LDKPrintableString this_obj_conv;
35916         this_obj_conv.inner = untag_ptr(this_obj);
35917         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35919         PrintableString_free(this_obj_conv);
35920 }
35921
35922 jstring  CS_LDK_PrintableString_get_a(int64_t this_ptr) {
35923         LDKPrintableString this_ptr_conv;
35924         this_ptr_conv.inner = untag_ptr(this_ptr);
35925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35927         this_ptr_conv.is_owned = false;
35928         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
35929         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
35930         Str_free(ret_str);
35931         return ret_conv;
35932 }
35933
35934 void  CS_LDK_PrintableString_set_a(int64_t this_ptr, jstring val) {
35935         LDKPrintableString this_ptr_conv;
35936         this_ptr_conv.inner = untag_ptr(this_ptr);
35937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35939         this_ptr_conv.is_owned = false;
35940         LDKStr val_conv = str_ref_to_owned_c(val);
35941         PrintableString_set_a(&this_ptr_conv, val_conv);
35942 }
35943
35944 int64_t  CS_LDK_PrintableString_new(jstring a_arg) {
35945         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
35946         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
35947         int64_t ret_ref = 0;
35948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35950         return ret_ref;
35951 }
35952
35953 void  CS_LDK_TrackedSpendableOutput_free(int64_t this_obj) {
35954         LDKTrackedSpendableOutput this_obj_conv;
35955         this_obj_conv.inner = untag_ptr(this_obj);
35956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35958         TrackedSpendableOutput_free(this_obj_conv);
35959 }
35960
35961 int64_t  CS_LDK_TrackedSpendableOutput_get_descriptor(int64_t this_ptr) {
35962         LDKTrackedSpendableOutput this_ptr_conv;
35963         this_ptr_conv.inner = untag_ptr(this_ptr);
35964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35966         this_ptr_conv.is_owned = false;
35967         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
35968         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
35969         int64_t ret_ref = tag_ptr(ret_copy, true);
35970         return ret_ref;
35971 }
35972
35973 void  CS_LDK_TrackedSpendableOutput_set_descriptor(int64_t this_ptr, int64_t val) {
35974         LDKTrackedSpendableOutput this_ptr_conv;
35975         this_ptr_conv.inner = untag_ptr(this_ptr);
35976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35978         this_ptr_conv.is_owned = false;
35979         void* val_ptr = untag_ptr(val);
35980         CHECK_ACCESS(val_ptr);
35981         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
35982         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
35983         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
35984 }
35985
35986 int64_t  CS_LDK_TrackedSpendableOutput_get_channel_id(int64_t this_ptr) {
35987         LDKTrackedSpendableOutput this_ptr_conv;
35988         this_ptr_conv.inner = untag_ptr(this_ptr);
35989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35991         this_ptr_conv.is_owned = false;
35992         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
35993         int64_t ret_ref = 0;
35994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35996         return ret_ref;
35997 }
35998
35999 void  CS_LDK_TrackedSpendableOutput_set_channel_id(int64_t this_ptr, int64_t val) {
36000         LDKTrackedSpendableOutput this_ptr_conv;
36001         this_ptr_conv.inner = untag_ptr(this_ptr);
36002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36004         this_ptr_conv.is_owned = false;
36005         LDKChannelId val_conv;
36006         val_conv.inner = untag_ptr(val);
36007         val_conv.is_owned = ptr_is_owned(val);
36008         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36009         val_conv = ChannelId_clone(&val_conv);
36010         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
36011 }
36012
36013 int64_t  CS_LDK_TrackedSpendableOutput_get_status(int64_t this_ptr) {
36014         LDKTrackedSpendableOutput this_ptr_conv;
36015         this_ptr_conv.inner = untag_ptr(this_ptr);
36016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36018         this_ptr_conv.is_owned = false;
36019         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36020         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
36021         int64_t ret_ref = tag_ptr(ret_copy, true);
36022         return ret_ref;
36023 }
36024
36025 void  CS_LDK_TrackedSpendableOutput_set_status(int64_t this_ptr, int64_t val) {
36026         LDKTrackedSpendableOutput this_ptr_conv;
36027         this_ptr_conv.inner = untag_ptr(this_ptr);
36028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36030         this_ptr_conv.is_owned = false;
36031         void* val_ptr = untag_ptr(val);
36032         CHECK_ACCESS(val_ptr);
36033         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
36034         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
36035         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
36036 }
36037
36038 int64_t  CS_LDK_TrackedSpendableOutput_new(int64_t descriptor_arg, int64_t channel_id_arg, int64_t status_arg) {
36039         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
36040         CHECK_ACCESS(descriptor_arg_ptr);
36041         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
36042         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
36043         LDKChannelId channel_id_arg_conv;
36044         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36045         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36046         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36047         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36048         void* status_arg_ptr = untag_ptr(status_arg);
36049         CHECK_ACCESS(status_arg_ptr);
36050         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
36051         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
36052         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
36053         int64_t ret_ref = 0;
36054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36056         return ret_ref;
36057 }
36058
36059 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
36060         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
36061         int64_t ret_ref = 0;
36062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36064         return ret_ref;
36065 }
36066 int64_t  CS_LDK_TrackedSpendableOutput_clone_ptr(int64_t arg) {
36067         LDKTrackedSpendableOutput arg_conv;
36068         arg_conv.inner = untag_ptr(arg);
36069         arg_conv.is_owned = ptr_is_owned(arg);
36070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36071         arg_conv.is_owned = false;
36072         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
36073         return ret_conv;
36074 }
36075
36076 int64_t  CS_LDK_TrackedSpendableOutput_clone(int64_t orig) {
36077         LDKTrackedSpendableOutput orig_conv;
36078         orig_conv.inner = untag_ptr(orig);
36079         orig_conv.is_owned = ptr_is_owned(orig);
36080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36081         orig_conv.is_owned = false;
36082         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
36083         int64_t ret_ref = 0;
36084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36086         return ret_ref;
36087 }
36088
36089 jboolean  CS_LDK_TrackedSpendableOutput_eq(int64_t a, int64_t b) {
36090         LDKTrackedSpendableOutput a_conv;
36091         a_conv.inner = untag_ptr(a);
36092         a_conv.is_owned = ptr_is_owned(a);
36093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36094         a_conv.is_owned = false;
36095         LDKTrackedSpendableOutput b_conv;
36096         b_conv.inner = untag_ptr(b);
36097         b_conv.is_owned = ptr_is_owned(b);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36099         b_conv.is_owned = false;
36100         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
36101         return ret_conv;
36102 }
36103
36104 jboolean  CS_LDK_TrackedSpendableOutput_is_spent_in(int64_t this_arg, int8_tArray tx) {
36105         LDKTrackedSpendableOutput this_arg_conv;
36106         this_arg_conv.inner = untag_ptr(this_arg);
36107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36109         this_arg_conv.is_owned = false;
36110         LDKTransaction tx_ref;
36111         tx_ref.datalen = tx->arr_len;
36112         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
36113         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
36114         tx_ref.data_is_owned = true;
36115         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
36116         return ret_conv;
36117 }
36118
36119 int8_tArray  CS_LDK_TrackedSpendableOutput_write(int64_t obj) {
36120         LDKTrackedSpendableOutput obj_conv;
36121         obj_conv.inner = untag_ptr(obj);
36122         obj_conv.is_owned = ptr_is_owned(obj);
36123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36124         obj_conv.is_owned = false;
36125         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
36126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36128         CVec_u8Z_free(ret_var);
36129         return ret_arr;
36130 }
36131
36132 int64_t  CS_LDK_TrackedSpendableOutput_read(int8_tArray ser) {
36133         LDKu8slice ser_ref;
36134         ser_ref.datalen = ser->arr_len;
36135         ser_ref.data = ser->elems;
36136         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
36137         *ret_conv = TrackedSpendableOutput_read(ser_ref);
36138         FREE(ser);
36139         return tag_ptr(ret_conv, true);
36140 }
36141
36142 void  CS_LDK_OutputSpendStatus_free(int64_t this_ptr) {
36143         if (!ptr_is_owned(this_ptr)) return;
36144         void* this_ptr_ptr = untag_ptr(this_ptr);
36145         CHECK_ACCESS(this_ptr_ptr);
36146         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
36147         FREE(untag_ptr(this_ptr));
36148         OutputSpendStatus_free(this_ptr_conv);
36149 }
36150
36151 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
36152         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36153         *ret_copy = OutputSpendStatus_clone(arg);
36154         int64_t ret_ref = tag_ptr(ret_copy, true);
36155         return ret_ref;
36156 }
36157 int64_t  CS_LDK_OutputSpendStatus_clone_ptr(int64_t arg) {
36158         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
36159         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
36160         return ret_conv;
36161 }
36162
36163 int64_t  CS_LDK_OutputSpendStatus_clone(int64_t orig) {
36164         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
36165         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36166         *ret_copy = OutputSpendStatus_clone(orig_conv);
36167         int64_t ret_ref = tag_ptr(ret_copy, true);
36168         return ret_ref;
36169 }
36170
36171 int64_t  CS_LDK_OutputSpendStatus_pending_initial_broadcast(int64_t delayed_until_height) {
36172         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
36173         CHECK_ACCESS(delayed_until_height_ptr);
36174         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
36175         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
36176         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36177         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
36178         int64_t ret_ref = tag_ptr(ret_copy, true);
36179         return ret_ref;
36180 }
36181
36182 int64_t  CS_LDK_OutputSpendStatus_pending_first_confirmation(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
36183         LDKThirtyTwoBytes first_broadcast_hash_ref;
36184         CHECK(first_broadcast_hash->arr_len == 32);
36185         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36186         LDKTransaction latest_spending_tx_ref;
36187         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36188         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36189         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36190         latest_spending_tx_ref.data_is_owned = true;
36191         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36192         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
36193         int64_t ret_ref = tag_ptr(ret_copy, true);
36194         return ret_ref;
36195 }
36196
36197 int64_t  CS_LDK_OutputSpendStatus_pending_threshold_confirmations(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
36198         LDKThirtyTwoBytes first_broadcast_hash_ref;
36199         CHECK(first_broadcast_hash->arr_len == 32);
36200         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36201         LDKTransaction latest_spending_tx_ref;
36202         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36203         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36204         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36205         latest_spending_tx_ref.data_is_owned = true;
36206         LDKThirtyTwoBytes confirmation_hash_ref;
36207         CHECK(confirmation_hash->arr_len == 32);
36208         memcpy(confirmation_hash_ref.data, confirmation_hash->elems, 32); FREE(confirmation_hash);
36209         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36210         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
36211         int64_t ret_ref = tag_ptr(ret_copy, true);
36212         return ret_ref;
36213 }
36214
36215 jboolean  CS_LDK_OutputSpendStatus_eq(int64_t a, int64_t b) {
36216         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
36217         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
36218         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
36219         return ret_conv;
36220 }
36221
36222 int8_tArray  CS_LDK_OutputSpendStatus_write(int64_t obj) {
36223         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
36224         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
36225         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36226         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36227         CVec_u8Z_free(ret_var);
36228         return ret_arr;
36229 }
36230
36231 int64_t  CS_LDK_OutputSpendStatus_read(int8_tArray ser) {
36232         LDKu8slice ser_ref;
36233         ser_ref.datalen = ser->arr_len;
36234         ser_ref.data = ser->elems;
36235         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
36236         *ret_conv = OutputSpendStatus_read(ser_ref);
36237         FREE(ser);
36238         return tag_ptr(ret_conv, true);
36239 }
36240
36241 void  CS_LDK_OutputSweeper_free(int64_t this_obj) {
36242         LDKOutputSweeper this_obj_conv;
36243         this_obj_conv.inner = untag_ptr(this_obj);
36244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36246         OutputSweeper_free(this_obj_conv);
36247 }
36248
36249 int64_t  CS_LDK_OutputSweeper_new(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) {
36250         LDKBestBlock best_block_conv;
36251         best_block_conv.inner = untag_ptr(best_block);
36252         best_block_conv.is_owned = ptr_is_owned(best_block);
36253         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
36254         best_block_conv = BestBlock_clone(&best_block_conv);
36255         void* broadcaster_ptr = untag_ptr(broadcaster);
36256         CHECK_ACCESS(broadcaster_ptr);
36257         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36258         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36259                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36260                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36261         }
36262         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36263         CHECK_ACCESS(fee_estimator_ptr);
36264         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36265         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36267                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36268         }
36269         void* chain_data_source_ptr = untag_ptr(chain_data_source);
36270         CHECK_ACCESS(chain_data_source_ptr);
36271         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
36272         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36273         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
36274                 // Manually implement clone for Java trait instances
36275                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
36276                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36277                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
36278                 }
36279         }
36280         void* output_spender_ptr = untag_ptr(output_spender);
36281         CHECK_ACCESS(output_spender_ptr);
36282         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
36283         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
36284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36285                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
36286         }
36287         void* change_destination_source_ptr = untag_ptr(change_destination_source);
36288         CHECK_ACCESS(change_destination_source_ptr);
36289         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
36290         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
36291                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36292                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
36293         }
36294         void* kv_store_ptr = untag_ptr(kv_store);
36295         CHECK_ACCESS(kv_store_ptr);
36296         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36297         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36298                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36299                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36300         }
36301         void* logger_ptr = untag_ptr(logger);
36302         CHECK_ACCESS(logger_ptr);
36303         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36304         if (logger_conv.free == LDKLogger_JCalls_free) {
36305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36306                 LDKLogger_JCalls_cloned(&logger_conv);
36307         }
36308         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);
36309         int64_t ret_ref = 0;
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36312         return ret_ref;
36313 }
36314
36315 int64_t  CS_LDK_OutputSweeper_track_spendable_outputs(int64_t this_arg, int64_tArray output_descriptors, int64_t channel_id, jboolean exclude_static_outputs, int64_t delay_until_height) {
36316         LDKOutputSweeper this_arg_conv;
36317         this_arg_conv.inner = untag_ptr(this_arg);
36318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36320         this_arg_conv.is_owned = false;
36321         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
36322         output_descriptors_constr.datalen = output_descriptors->arr_len;
36323         if (output_descriptors_constr.datalen > 0)
36324                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
36325         else
36326                 output_descriptors_constr.data = NULL;
36327         int64_t* output_descriptors_vals = output_descriptors->elems;
36328         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
36329                 int64_t output_descriptors_conv_27 = output_descriptors_vals[b];
36330                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
36331                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
36332                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
36333                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
36334                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
36335         }
36336         FREE(output_descriptors);
36337         LDKChannelId channel_id_conv;
36338         channel_id_conv.inner = untag_ptr(channel_id);
36339         channel_id_conv.is_owned = ptr_is_owned(channel_id);
36340         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
36341         channel_id_conv = ChannelId_clone(&channel_id_conv);
36342         void* delay_until_height_ptr = untag_ptr(delay_until_height);
36343         CHECK_ACCESS(delay_until_height_ptr);
36344         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
36345         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
36346         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36347         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
36348         return tag_ptr(ret_conv, true);
36349 }
36350
36351 int64_tArray  CS_LDK_OutputSweeper_tracked_spendable_outputs(int64_t this_arg) {
36352         LDKOutputSweeper this_arg_conv;
36353         this_arg_conv.inner = untag_ptr(this_arg);
36354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36356         this_arg_conv.is_owned = false;
36357         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
36358         int64_tArray ret_arr = NULL;
36359         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36360         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36361         for (size_t y = 0; y < ret_var.datalen; y++) {
36362                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
36363                 int64_t ret_conv_24_ref = 0;
36364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
36365                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
36366                 ret_arr_ptr[y] = ret_conv_24_ref;
36367         }
36368         
36369         FREE(ret_var.data);
36370         return ret_arr;
36371 }
36372
36373 int64_t  CS_LDK_OutputSweeper_current_best_block(int64_t this_arg) {
36374         LDKOutputSweeper this_arg_conv;
36375         this_arg_conv.inner = untag_ptr(this_arg);
36376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36378         this_arg_conv.is_owned = false;
36379         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
36380         int64_t ret_ref = 0;
36381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36383         return ret_ref;
36384 }
36385
36386 int64_t  CS_LDK_OutputSweeper_as_Listen(int64_t this_arg) {
36387         LDKOutputSweeper this_arg_conv;
36388         this_arg_conv.inner = untag_ptr(this_arg);
36389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36391         this_arg_conv.is_owned = false;
36392         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36393         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
36394         return tag_ptr(ret_ret, true);
36395 }
36396
36397 int64_t  CS_LDK_OutputSweeper_as_Confirm(int64_t this_arg) {
36398         LDKOutputSweeper this_arg_conv;
36399         this_arg_conv.inner = untag_ptr(this_arg);
36400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36402         this_arg_conv.is_owned = false;
36403         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36404         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
36405         return tag_ptr(ret_ret, true);
36406 }
36407
36408 void  CS_LDK_SpendingDelay_free(int64_t this_ptr) {
36409         if (!ptr_is_owned(this_ptr)) return;
36410         void* this_ptr_ptr = untag_ptr(this_ptr);
36411         CHECK_ACCESS(this_ptr_ptr);
36412         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
36413         FREE(untag_ptr(this_ptr));
36414         SpendingDelay_free(this_ptr_conv);
36415 }
36416
36417 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
36418         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36419         *ret_copy = SpendingDelay_clone(arg);
36420         int64_t ret_ref = tag_ptr(ret_copy, true);
36421         return ret_ref;
36422 }
36423 int64_t  CS_LDK_SpendingDelay_clone_ptr(int64_t arg) {
36424         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
36425         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
36426         return ret_conv;
36427 }
36428
36429 int64_t  CS_LDK_SpendingDelay_clone(int64_t orig) {
36430         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
36431         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36432         *ret_copy = SpendingDelay_clone(orig_conv);
36433         int64_t ret_ref = tag_ptr(ret_copy, true);
36434         return ret_ref;
36435 }
36436
36437 int64_t  CS_LDK_SpendingDelay_relative(int32_t num_blocks) {
36438         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36439         *ret_copy = SpendingDelay_relative(num_blocks);
36440         int64_t ret_ref = tag_ptr(ret_copy, true);
36441         return ret_ref;
36442 }
36443
36444 int64_t  CS_LDK_SpendingDelay_absolute(int32_t height) {
36445         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36446         *ret_copy = SpendingDelay_absolute(height);
36447         int64_t ret_ref = tag_ptr(ret_copy, true);
36448         return ret_ref;
36449 }
36450
36451 int64_t  CS_LDK_OutputSweeper_read(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) {
36452         LDKu8slice ser_ref;
36453         ser_ref.datalen = ser->arr_len;
36454         ser_ref.data = ser->elems;
36455         void* arg_a_ptr = untag_ptr(arg_a);
36456         CHECK_ACCESS(arg_a_ptr);
36457         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36458         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36459                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36460                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36461         }
36462         void* arg_b_ptr = untag_ptr(arg_b);
36463         CHECK_ACCESS(arg_b_ptr);
36464         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36465         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36466                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36467                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36468         }
36469         void* arg_c_ptr = untag_ptr(arg_c);
36470         CHECK_ACCESS(arg_c_ptr);
36471         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36472         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36473         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36474                 // Manually implement clone for Java trait instances
36475                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36476                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36477                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36478                 }
36479         }
36480         void* arg_d_ptr = untag_ptr(arg_d);
36481         CHECK_ACCESS(arg_d_ptr);
36482         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36483         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36485                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36486         }
36487         void* arg_e_ptr = untag_ptr(arg_e);
36488         CHECK_ACCESS(arg_e_ptr);
36489         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36490         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36492                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36493         }
36494         void* arg_f_ptr = untag_ptr(arg_f);
36495         CHECK_ACCESS(arg_f_ptr);
36496         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36497         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36499                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36500         }
36501         void* arg_g_ptr = untag_ptr(arg_g);
36502         CHECK_ACCESS(arg_g_ptr);
36503         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36504         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36506                 LDKLogger_JCalls_cloned(&arg_g_conv);
36507         }
36508         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
36509         *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);
36510         FREE(ser);
36511         return tag_ptr(ret_conv, true);
36512 }
36513
36514 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_read(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) {
36515         LDKu8slice ser_ref;
36516         ser_ref.datalen = ser->arr_len;
36517         ser_ref.data = ser->elems;
36518         void* arg_a_ptr = untag_ptr(arg_a);
36519         CHECK_ACCESS(arg_a_ptr);
36520         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
36521         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
36522                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36523                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
36524         }
36525         void* arg_b_ptr = untag_ptr(arg_b);
36526         CHECK_ACCESS(arg_b_ptr);
36527         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
36528         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
36529                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36530                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
36531         }
36532         void* arg_c_ptr = untag_ptr(arg_c);
36533         CHECK_ACCESS(arg_c_ptr);
36534         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
36535         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36536         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
36537                 // Manually implement clone for Java trait instances
36538                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
36539                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36540                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
36541                 }
36542         }
36543         void* arg_d_ptr = untag_ptr(arg_d);
36544         CHECK_ACCESS(arg_d_ptr);
36545         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
36546         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
36547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36548                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
36549         }
36550         void* arg_e_ptr = untag_ptr(arg_e);
36551         CHECK_ACCESS(arg_e_ptr);
36552         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
36553         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
36554                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36555                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
36556         }
36557         void* arg_f_ptr = untag_ptr(arg_f);
36558         CHECK_ACCESS(arg_f_ptr);
36559         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
36560         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
36561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36562                 LDKKVStore_JCalls_cloned(&arg_f_conv);
36563         }
36564         void* arg_g_ptr = untag_ptr(arg_g);
36565         CHECK_ACCESS(arg_g_ptr);
36566         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
36567         if (arg_g_conv.free == LDKLogger_JCalls_free) {
36568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36569                 LDKLogger_JCalls_cloned(&arg_g_conv);
36570         }
36571         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
36572         *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);
36573         FREE(ser);
36574         return tag_ptr(ret_conv, true);
36575 }
36576
36577 void  CS_LDK_FutureCallback_free(int64_t this_ptr) {
36578         if (!ptr_is_owned(this_ptr)) return;
36579         void* this_ptr_ptr = untag_ptr(this_ptr);
36580         CHECK_ACCESS(this_ptr_ptr);
36581         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
36582         FREE(untag_ptr(this_ptr));
36583         FutureCallback_free(this_ptr_conv);
36584 }
36585
36586 void  CS_LDK_Future_free(int64_t this_obj) {
36587         LDKFuture this_obj_conv;
36588         this_obj_conv.inner = untag_ptr(this_obj);
36589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36591         Future_free(this_obj_conv);
36592 }
36593
36594 void  CS_LDK_Future_register_callback_fn(int64_t this_arg, int64_t callback) {
36595         LDKFuture this_arg_conv;
36596         this_arg_conv.inner = untag_ptr(this_arg);
36597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36599         this_arg_conv.is_owned = false;
36600         void* callback_ptr = untag_ptr(callback);
36601         CHECK_ACCESS(callback_ptr);
36602         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
36603         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
36604                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36605                 LDKFutureCallback_JCalls_cloned(&callback_conv);
36606         }
36607         Future_register_callback_fn(&this_arg_conv, callback_conv);
36608 }
36609
36610 void  CS_LDK_Future_wait(int64_t this_arg) {
36611         LDKFuture this_arg_conv;
36612         this_arg_conv.inner = untag_ptr(this_arg);
36613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36615         this_arg_conv.is_owned = false;
36616         Future_wait(&this_arg_conv);
36617 }
36618
36619 jboolean  CS_LDK_Future_wait_timeout(int64_t this_arg, int64_t max_wait) {
36620         LDKFuture this_arg_conv;
36621         this_arg_conv.inner = untag_ptr(this_arg);
36622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36624         this_arg_conv.is_owned = false;
36625         jboolean ret_conv = Future_wait_timeout(&this_arg_conv, max_wait);
36626         return ret_conv;
36627 }
36628
36629 void  CS_LDK_Sleeper_free(int64_t this_obj) {
36630         LDKSleeper this_obj_conv;
36631         this_obj_conv.inner = untag_ptr(this_obj);
36632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36634         Sleeper_free(this_obj_conv);
36635 }
36636
36637 int64_t  CS_LDK_Sleeper_from_single_future(int64_t future) {
36638         LDKFuture future_conv;
36639         future_conv.inner = untag_ptr(future);
36640         future_conv.is_owned = ptr_is_owned(future);
36641         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
36642         future_conv.is_owned = false;
36643         LDKSleeper ret_var = Sleeper_from_single_future(&future_conv);
36644         int64_t ret_ref = 0;
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36647         return ret_ref;
36648 }
36649
36650 int64_t  CS_LDK_Sleeper_from_two_futures(int64_t fut_a, int64_t fut_b) {
36651         LDKFuture fut_a_conv;
36652         fut_a_conv.inner = untag_ptr(fut_a);
36653         fut_a_conv.is_owned = ptr_is_owned(fut_a);
36654         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
36655         fut_a_conv.is_owned = false;
36656         LDKFuture fut_b_conv;
36657         fut_b_conv.inner = untag_ptr(fut_b);
36658         fut_b_conv.is_owned = ptr_is_owned(fut_b);
36659         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
36660         fut_b_conv.is_owned = false;
36661         LDKSleeper ret_var = Sleeper_from_two_futures(&fut_a_conv, &fut_b_conv);
36662         int64_t ret_ref = 0;
36663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36665         return ret_ref;
36666 }
36667
36668 int64_t  CS_LDK_Sleeper_new(int64_tArray futures) {
36669         LDKCVec_FutureZ futures_constr;
36670         futures_constr.datalen = futures->arr_len;
36671         if (futures_constr.datalen > 0)
36672                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
36673         else
36674                 futures_constr.data = NULL;
36675         int64_t* futures_vals = futures->elems;
36676         for (size_t i = 0; i < futures_constr.datalen; i++) {
36677                 int64_t futures_conv_8 = futures_vals[i];
36678                 LDKFuture futures_conv_8_conv;
36679                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
36680                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
36681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
36682                 // WARNING: we need a move here but no clone is available for LDKFuture
36683                 
36684                 futures_constr.data[i] = futures_conv_8_conv;
36685         }
36686         FREE(futures);
36687         LDKSleeper ret_var = Sleeper_new(futures_constr);
36688         int64_t ret_ref = 0;
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36691         return ret_ref;
36692 }
36693
36694 void  CS_LDK_Sleeper_wait(int64_t this_arg) {
36695         LDKSleeper this_arg_conv;
36696         this_arg_conv.inner = untag_ptr(this_arg);
36697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36699         this_arg_conv.is_owned = false;
36700         Sleeper_wait(&this_arg_conv);
36701 }
36702
36703 jboolean  CS_LDK_Sleeper_wait_timeout(int64_t this_arg, int64_t max_wait) {
36704         LDKSleeper this_arg_conv;
36705         this_arg_conv.inner = untag_ptr(this_arg);
36706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36708         this_arg_conv.is_owned = false;
36709         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
36710         return ret_conv;
36711 }
36712
36713 int32_t  CS_LDK_Level_clone(int64_t orig) {
36714         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
36715         int32_t ret_conv = LDKLevel_to_cs(Level_clone(orig_conv));
36716         return ret_conv;
36717 }
36718
36719 int32_t  CS_LDK_Level_gossip() {
36720         int32_t ret_conv = LDKLevel_to_cs(Level_gossip());
36721         return ret_conv;
36722 }
36723
36724 int32_t  CS_LDK_Level_trace() {
36725         int32_t ret_conv = LDKLevel_to_cs(Level_trace());
36726         return ret_conv;
36727 }
36728
36729 int32_t  CS_LDK_Level_debug() {
36730         int32_t ret_conv = LDKLevel_to_cs(Level_debug());
36731         return ret_conv;
36732 }
36733
36734 int32_t  CS_LDK_Level_info() {
36735         int32_t ret_conv = LDKLevel_to_cs(Level_info());
36736         return ret_conv;
36737 }
36738
36739 int32_t  CS_LDK_Level_warn() {
36740         int32_t ret_conv = LDKLevel_to_cs(Level_warn());
36741         return ret_conv;
36742 }
36743
36744 int32_t  CS_LDK_Level_error() {
36745         int32_t ret_conv = LDKLevel_to_cs(Level_error());
36746         return ret_conv;
36747 }
36748
36749 jboolean  CS_LDK_Level_eq(int64_t a, int64_t b) {
36750         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
36751         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
36752         jboolean ret_conv = Level_eq(a_conv, b_conv);
36753         return ret_conv;
36754 }
36755
36756 int64_t  CS_LDK_Level_hash(int64_t o) {
36757         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
36758         int64_t ret_conv = Level_hash(o_conv);
36759         return ret_conv;
36760 }
36761
36762 int32_t  CS_LDK_Level_max() {
36763         int32_t ret_conv = LDKLevel_to_cs(Level_max());
36764         return ret_conv;
36765 }
36766
36767 void  CS_LDK_Record_free(int64_t this_obj) {
36768         LDKRecord this_obj_conv;
36769         this_obj_conv.inner = untag_ptr(this_obj);
36770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36772         Record_free(this_obj_conv);
36773 }
36774
36775 int32_t  CS_LDK_Record_get_level(int64_t this_ptr) {
36776         LDKRecord this_ptr_conv;
36777         this_ptr_conv.inner = untag_ptr(this_ptr);
36778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36780         this_ptr_conv.is_owned = false;
36781         int32_t ret_conv = LDKLevel_to_cs(Record_get_level(&this_ptr_conv));
36782         return ret_conv;
36783 }
36784
36785 void  CS_LDK_Record_set_level(int64_t this_ptr, int32_t val) {
36786         LDKRecord this_ptr_conv;
36787         this_ptr_conv.inner = untag_ptr(this_ptr);
36788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36790         this_ptr_conv.is_owned = false;
36791         LDKLevel val_conv = LDKLevel_from_cs(val);
36792         Record_set_level(&this_ptr_conv, val_conv);
36793 }
36794
36795 int8_tArray  CS_LDK_Record_get_peer_id(int64_t this_ptr) {
36796         LDKRecord this_ptr_conv;
36797         this_ptr_conv.inner = untag_ptr(this_ptr);
36798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36800         this_ptr_conv.is_owned = false;
36801         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36802         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
36803         return ret_arr;
36804 }
36805
36806 void  CS_LDK_Record_set_peer_id(int64_t this_ptr, int8_tArray val) {
36807         LDKRecord this_ptr_conv;
36808         this_ptr_conv.inner = untag_ptr(this_ptr);
36809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36811         this_ptr_conv.is_owned = false;
36812         LDKPublicKey val_ref;
36813         CHECK(val->arr_len == 33);
36814         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36815         Record_set_peer_id(&this_ptr_conv, val_ref);
36816 }
36817
36818 int64_t  CS_LDK_Record_get_channel_id(int64_t this_ptr) {
36819         LDKRecord this_ptr_conv;
36820         this_ptr_conv.inner = untag_ptr(this_ptr);
36821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36823         this_ptr_conv.is_owned = false;
36824         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
36825         int64_t ret_ref = 0;
36826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36828         return ret_ref;
36829 }
36830
36831 void  CS_LDK_Record_set_channel_id(int64_t this_ptr, int64_t val) {
36832         LDKRecord this_ptr_conv;
36833         this_ptr_conv.inner = untag_ptr(this_ptr);
36834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36836         this_ptr_conv.is_owned = false;
36837         LDKChannelId val_conv;
36838         val_conv.inner = untag_ptr(val);
36839         val_conv.is_owned = ptr_is_owned(val);
36840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36841         val_conv = ChannelId_clone(&val_conv);
36842         Record_set_channel_id(&this_ptr_conv, val_conv);
36843 }
36844
36845 jstring  CS_LDK_Record_get_args(int64_t this_ptr) {
36846         LDKRecord this_ptr_conv;
36847         this_ptr_conv.inner = untag_ptr(this_ptr);
36848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36850         this_ptr_conv.is_owned = false;
36851         LDKStr ret_str = Record_get_args(&this_ptr_conv);
36852         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36853         Str_free(ret_str);
36854         return ret_conv;
36855 }
36856
36857 void  CS_LDK_Record_set_args(int64_t this_ptr, jstring val) {
36858         LDKRecord this_ptr_conv;
36859         this_ptr_conv.inner = untag_ptr(this_ptr);
36860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36862         this_ptr_conv.is_owned = false;
36863         LDKStr val_conv = str_ref_to_owned_c(val);
36864         Record_set_args(&this_ptr_conv, val_conv);
36865 }
36866
36867 jstring  CS_LDK_Record_get_module_path(int64_t this_ptr) {
36868         LDKRecord this_ptr_conv;
36869         this_ptr_conv.inner = untag_ptr(this_ptr);
36870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36872         this_ptr_conv.is_owned = false;
36873         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
36874         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36875         Str_free(ret_str);
36876         return ret_conv;
36877 }
36878
36879 void  CS_LDK_Record_set_module_path(int64_t this_ptr, jstring val) {
36880         LDKRecord this_ptr_conv;
36881         this_ptr_conv.inner = untag_ptr(this_ptr);
36882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36884         this_ptr_conv.is_owned = false;
36885         LDKStr val_conv = str_ref_to_owned_c(val);
36886         Record_set_module_path(&this_ptr_conv, val_conv);
36887 }
36888
36889 jstring  CS_LDK_Record_get_file(int64_t this_ptr) {
36890         LDKRecord this_ptr_conv;
36891         this_ptr_conv.inner = untag_ptr(this_ptr);
36892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36894         this_ptr_conv.is_owned = false;
36895         LDKStr ret_str = Record_get_file(&this_ptr_conv);
36896         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36897         Str_free(ret_str);
36898         return ret_conv;
36899 }
36900
36901 void  CS_LDK_Record_set_file(int64_t this_ptr, jstring val) {
36902         LDKRecord this_ptr_conv;
36903         this_ptr_conv.inner = untag_ptr(this_ptr);
36904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36906         this_ptr_conv.is_owned = false;
36907         LDKStr val_conv = str_ref_to_owned_c(val);
36908         Record_set_file(&this_ptr_conv, val_conv);
36909 }
36910
36911 int32_t  CS_LDK_Record_get_line(int64_t this_ptr) {
36912         LDKRecord this_ptr_conv;
36913         this_ptr_conv.inner = untag_ptr(this_ptr);
36914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36916         this_ptr_conv.is_owned = false;
36917         int32_t ret_conv = Record_get_line(&this_ptr_conv);
36918         return ret_conv;
36919 }
36920
36921 void  CS_LDK_Record_set_line(int64_t this_ptr, int32_t val) {
36922         LDKRecord this_ptr_conv;
36923         this_ptr_conv.inner = untag_ptr(this_ptr);
36924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36926         this_ptr_conv.is_owned = false;
36927         Record_set_line(&this_ptr_conv, val);
36928 }
36929
36930 int64_t  CS_LDK_Record_new(int32_t 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) {
36931         LDKLevel level_arg_conv = LDKLevel_from_cs(level_arg);
36932         LDKPublicKey peer_id_arg_ref;
36933         CHECK(peer_id_arg->arr_len == 33);
36934         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
36935         LDKChannelId channel_id_arg_conv;
36936         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36937         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36939         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36940         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
36941         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
36942         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
36943         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);
36944         int64_t ret_ref = 0;
36945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36947         return ret_ref;
36948 }
36949
36950 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
36951         LDKRecord ret_var = Record_clone(arg);
36952         int64_t ret_ref = 0;
36953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36955         return ret_ref;
36956 }
36957 int64_t  CS_LDK_Record_clone_ptr(int64_t arg) {
36958         LDKRecord arg_conv;
36959         arg_conv.inner = untag_ptr(arg);
36960         arg_conv.is_owned = ptr_is_owned(arg);
36961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36962         arg_conv.is_owned = false;
36963         int64_t ret_conv = Record_clone_ptr(&arg_conv);
36964         return ret_conv;
36965 }
36966
36967 int64_t  CS_LDK_Record_clone(int64_t orig) {
36968         LDKRecord orig_conv;
36969         orig_conv.inner = untag_ptr(orig);
36970         orig_conv.is_owned = ptr_is_owned(orig);
36971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36972         orig_conv.is_owned = false;
36973         LDKRecord ret_var = Record_clone(&orig_conv);
36974         int64_t ret_ref = 0;
36975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36977         return ret_ref;
36978 }
36979
36980 void  CS_LDK_Logger_free(int64_t this_ptr) {
36981         if (!ptr_is_owned(this_ptr)) return;
36982         void* this_ptr_ptr = untag_ptr(this_ptr);
36983         CHECK_ACCESS(this_ptr_ptr);
36984         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
36985         FREE(untag_ptr(this_ptr));
36986         Logger_free(this_ptr_conv);
36987 }
36988
36989 void  CS_LDK_ChannelHandshakeConfig_free(int64_t this_obj) {
36990         LDKChannelHandshakeConfig this_obj_conv;
36991         this_obj_conv.inner = untag_ptr(this_obj);
36992         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36994         ChannelHandshakeConfig_free(this_obj_conv);
36995 }
36996
36997 int32_t  CS_LDK_ChannelHandshakeConfig_get_minimum_depth(int64_t this_ptr) {
36998         LDKChannelHandshakeConfig this_ptr_conv;
36999         this_ptr_conv.inner = untag_ptr(this_ptr);
37000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37002         this_ptr_conv.is_owned = false;
37003         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
37004         return ret_conv;
37005 }
37006
37007 void  CS_LDK_ChannelHandshakeConfig_set_minimum_depth(int64_t this_ptr, int32_t val) {
37008         LDKChannelHandshakeConfig this_ptr_conv;
37009         this_ptr_conv.inner = untag_ptr(this_ptr);
37010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37012         this_ptr_conv.is_owned = false;
37013         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
37014 }
37015
37016 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_to_self_delay(int64_t this_ptr) {
37017         LDKChannelHandshakeConfig this_ptr_conv;
37018         this_ptr_conv.inner = untag_ptr(this_ptr);
37019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37021         this_ptr_conv.is_owned = false;
37022         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
37023         return ret_conv;
37024 }
37025
37026 void  CS_LDK_ChannelHandshakeConfig_set_our_to_self_delay(int64_t this_ptr, int16_t val) {
37027         LDKChannelHandshakeConfig this_ptr_conv;
37028         this_ptr_conv.inner = untag_ptr(this_ptr);
37029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37031         this_ptr_conv.is_owned = false;
37032         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
37033 }
37034
37035 int64_t  CS_LDK_ChannelHandshakeConfig_get_our_htlc_minimum_msat(int64_t this_ptr) {
37036         LDKChannelHandshakeConfig this_ptr_conv;
37037         this_ptr_conv.inner = untag_ptr(this_ptr);
37038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37040         this_ptr_conv.is_owned = false;
37041         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
37042         return ret_conv;
37043 }
37044
37045 void  CS_LDK_ChannelHandshakeConfig_set_our_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37046         LDKChannelHandshakeConfig this_ptr_conv;
37047         this_ptr_conv.inner = untag_ptr(this_ptr);
37048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37050         this_ptr_conv.is_owned = false;
37051         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
37052 }
37053
37054 int8_t  CS_LDK_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr) {
37055         LDKChannelHandshakeConfig this_ptr_conv;
37056         this_ptr_conv.inner = untag_ptr(this_ptr);
37057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37059         this_ptr_conv.is_owned = false;
37060         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
37061         return ret_conv;
37062 }
37063
37064 void  CS_LDK_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr, int8_t val) {
37065         LDKChannelHandshakeConfig this_ptr_conv;
37066         this_ptr_conv.inner = untag_ptr(this_ptr);
37067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37069         this_ptr_conv.is_owned = false;
37070         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
37071 }
37072
37073 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_scid_privacy(int64_t this_ptr) {
37074         LDKChannelHandshakeConfig this_ptr_conv;
37075         this_ptr_conv.inner = untag_ptr(this_ptr);
37076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37078         this_ptr_conv.is_owned = false;
37079         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
37080         return ret_conv;
37081 }
37082
37083 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_scid_privacy(int64_t this_ptr, jboolean val) {
37084         LDKChannelHandshakeConfig this_ptr_conv;
37085         this_ptr_conv.inner = untag_ptr(this_ptr);
37086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37088         this_ptr_conv.is_owned = false;
37089         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
37090 }
37091
37092 jboolean  CS_LDK_ChannelHandshakeConfig_get_announced_channel(int64_t this_ptr) {
37093         LDKChannelHandshakeConfig this_ptr_conv;
37094         this_ptr_conv.inner = untag_ptr(this_ptr);
37095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37097         this_ptr_conv.is_owned = false;
37098         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
37099         return ret_conv;
37100 }
37101
37102 void  CS_LDK_ChannelHandshakeConfig_set_announced_channel(int64_t this_ptr, jboolean val) {
37103         LDKChannelHandshakeConfig this_ptr_conv;
37104         this_ptr_conv.inner = untag_ptr(this_ptr);
37105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37107         this_ptr_conv.is_owned = false;
37108         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
37109 }
37110
37111 jboolean  CS_LDK_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(int64_t this_ptr) {
37112         LDKChannelHandshakeConfig this_ptr_conv;
37113         this_ptr_conv.inner = untag_ptr(this_ptr);
37114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37116         this_ptr_conv.is_owned = false;
37117         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
37118         return ret_conv;
37119 }
37120
37121 void  CS_LDK_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(int64_t this_ptr, jboolean val) {
37122         LDKChannelHandshakeConfig this_ptr_conv;
37123         this_ptr_conv.inner = untag_ptr(this_ptr);
37124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37126         this_ptr_conv.is_owned = false;
37127         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
37128 }
37129
37130 int32_t  CS_LDK_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(int64_t this_ptr) {
37131         LDKChannelHandshakeConfig this_ptr_conv;
37132         this_ptr_conv.inner = untag_ptr(this_ptr);
37133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37135         this_ptr_conv.is_owned = false;
37136         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
37137         return ret_conv;
37138 }
37139
37140 void  CS_LDK_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(int64_t this_ptr, int32_t val) {
37141         LDKChannelHandshakeConfig this_ptr_conv;
37142         this_ptr_conv.inner = untag_ptr(this_ptr);
37143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37145         this_ptr_conv.is_owned = false;
37146         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
37147 }
37148
37149 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr) {
37150         LDKChannelHandshakeConfig this_ptr_conv;
37151         this_ptr_conv.inner = untag_ptr(this_ptr);
37152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37154         this_ptr_conv.is_owned = false;
37155         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
37156         return ret_conv;
37157 }
37158
37159 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr, jboolean val) {
37160         LDKChannelHandshakeConfig this_ptr_conv;
37161         this_ptr_conv.inner = untag_ptr(this_ptr);
37162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37164         this_ptr_conv.is_owned = false;
37165         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
37166 }
37167
37168 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_max_accepted_htlcs(int64_t this_ptr) {
37169         LDKChannelHandshakeConfig this_ptr_conv;
37170         this_ptr_conv.inner = untag_ptr(this_ptr);
37171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37173         this_ptr_conv.is_owned = false;
37174         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
37175         return ret_conv;
37176 }
37177
37178 void  CS_LDK_ChannelHandshakeConfig_set_our_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
37179         LDKChannelHandshakeConfig this_ptr_conv;
37180         this_ptr_conv.inner = untag_ptr(this_ptr);
37181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37183         this_ptr_conv.is_owned = false;
37184         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
37185 }
37186
37187 int64_t  CS_LDK_ChannelHandshakeConfig_new(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) {
37188         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);
37189         int64_t ret_ref = 0;
37190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37192         return ret_ref;
37193 }
37194
37195 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
37196         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
37197         int64_t ret_ref = 0;
37198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37200         return ret_ref;
37201 }
37202 int64_t  CS_LDK_ChannelHandshakeConfig_clone_ptr(int64_t arg) {
37203         LDKChannelHandshakeConfig arg_conv;
37204         arg_conv.inner = untag_ptr(arg);
37205         arg_conv.is_owned = ptr_is_owned(arg);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37207         arg_conv.is_owned = false;
37208         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
37209         return ret_conv;
37210 }
37211
37212 int64_t  CS_LDK_ChannelHandshakeConfig_clone(int64_t orig) {
37213         LDKChannelHandshakeConfig orig_conv;
37214         orig_conv.inner = untag_ptr(orig);
37215         orig_conv.is_owned = ptr_is_owned(orig);
37216         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37217         orig_conv.is_owned = false;
37218         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
37219         int64_t ret_ref = 0;
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37222         return ret_ref;
37223 }
37224
37225 int64_t  CS_LDK_ChannelHandshakeConfig_default() {
37226         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
37227         int64_t ret_ref = 0;
37228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37230         return ret_ref;
37231 }
37232
37233 void  CS_LDK_ChannelHandshakeLimits_free(int64_t this_obj) {
37234         LDKChannelHandshakeLimits this_obj_conv;
37235         this_obj_conv.inner = untag_ptr(this_obj);
37236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37238         ChannelHandshakeLimits_free(this_obj_conv);
37239 }
37240
37241 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_funding_satoshis(int64_t this_ptr) {
37242         LDKChannelHandshakeLimits this_ptr_conv;
37243         this_ptr_conv.inner = untag_ptr(this_ptr);
37244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37246         this_ptr_conv.is_owned = false;
37247         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
37248         return ret_conv;
37249 }
37250
37251 void  CS_LDK_ChannelHandshakeLimits_set_min_funding_satoshis(int64_t this_ptr, int64_t val) {
37252         LDKChannelHandshakeLimits this_ptr_conv;
37253         this_ptr_conv.inner = untag_ptr(this_ptr);
37254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37256         this_ptr_conv.is_owned = false;
37257         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
37258 }
37259
37260 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_funding_satoshis(int64_t this_ptr) {
37261         LDKChannelHandshakeLimits this_ptr_conv;
37262         this_ptr_conv.inner = untag_ptr(this_ptr);
37263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37265         this_ptr_conv.is_owned = false;
37266         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
37267         return ret_conv;
37268 }
37269
37270 void  CS_LDK_ChannelHandshakeLimits_set_max_funding_satoshis(int64_t this_ptr, int64_t val) {
37271         LDKChannelHandshakeLimits this_ptr_conv;
37272         this_ptr_conv.inner = untag_ptr(this_ptr);
37273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37275         this_ptr_conv.is_owned = false;
37276         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
37277 }
37278
37279 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_htlc_minimum_msat(int64_t this_ptr) {
37280         LDKChannelHandshakeLimits this_ptr_conv;
37281         this_ptr_conv.inner = untag_ptr(this_ptr);
37282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37284         this_ptr_conv.is_owned = false;
37285         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
37286         return ret_conv;
37287 }
37288
37289 void  CS_LDK_ChannelHandshakeLimits_set_max_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37290         LDKChannelHandshakeLimits this_ptr_conv;
37291         this_ptr_conv.inner = untag_ptr(this_ptr);
37292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37294         this_ptr_conv.is_owned = false;
37295         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
37296 }
37297
37298 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(int64_t this_ptr) {
37299         LDKChannelHandshakeLimits this_ptr_conv;
37300         this_ptr_conv.inner = untag_ptr(this_ptr);
37301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37303         this_ptr_conv.is_owned = false;
37304         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
37305         return ret_conv;
37306 }
37307
37308 void  CS_LDK_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
37309         LDKChannelHandshakeLimits this_ptr_conv;
37310         this_ptr_conv.inner = untag_ptr(this_ptr);
37311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37313         this_ptr_conv.is_owned = false;
37314         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37315 }
37316
37317 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(int64_t this_ptr) {
37318         LDKChannelHandshakeLimits this_ptr_conv;
37319         this_ptr_conv.inner = untag_ptr(this_ptr);
37320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37322         this_ptr_conv.is_owned = false;
37323         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
37324         return ret_conv;
37325 }
37326
37327 void  CS_LDK_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
37328         LDKChannelHandshakeLimits this_ptr_conv;
37329         this_ptr_conv.inner = untag_ptr(this_ptr);
37330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37332         this_ptr_conv.is_owned = false;
37333         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
37334 }
37335
37336 int16_t  CS_LDK_ChannelHandshakeLimits_get_min_max_accepted_htlcs(int64_t this_ptr) {
37337         LDKChannelHandshakeLimits this_ptr_conv;
37338         this_ptr_conv.inner = untag_ptr(this_ptr);
37339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37341         this_ptr_conv.is_owned = false;
37342         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
37343         return ret_conv;
37344 }
37345
37346 void  CS_LDK_ChannelHandshakeLimits_set_min_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
37347         LDKChannelHandshakeLimits this_ptr_conv;
37348         this_ptr_conv.inner = untag_ptr(this_ptr);
37349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37351         this_ptr_conv.is_owned = false;
37352         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
37353 }
37354
37355 int32_t  CS_LDK_ChannelHandshakeLimits_get_max_minimum_depth(int64_t this_ptr) {
37356         LDKChannelHandshakeLimits this_ptr_conv;
37357         this_ptr_conv.inner = untag_ptr(this_ptr);
37358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37360         this_ptr_conv.is_owned = false;
37361         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
37362         return ret_conv;
37363 }
37364
37365 void  CS_LDK_ChannelHandshakeLimits_set_max_minimum_depth(int64_t this_ptr, int32_t val) {
37366         LDKChannelHandshakeLimits this_ptr_conv;
37367         this_ptr_conv.inner = untag_ptr(this_ptr);
37368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37370         this_ptr_conv.is_owned = false;
37371         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
37372 }
37373
37374 jboolean  CS_LDK_ChannelHandshakeLimits_get_trust_own_funding_0conf(int64_t this_ptr) {
37375         LDKChannelHandshakeLimits this_ptr_conv;
37376         this_ptr_conv.inner = untag_ptr(this_ptr);
37377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37379         this_ptr_conv.is_owned = false;
37380         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
37381         return ret_conv;
37382 }
37383
37384 void  CS_LDK_ChannelHandshakeLimits_set_trust_own_funding_0conf(int64_t this_ptr, jboolean val) {
37385         LDKChannelHandshakeLimits this_ptr_conv;
37386         this_ptr_conv.inner = untag_ptr(this_ptr);
37387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37389         this_ptr_conv.is_owned = false;
37390         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
37391 }
37392
37393 jboolean  CS_LDK_ChannelHandshakeLimits_get_force_announced_channel_preference(int64_t this_ptr) {
37394         LDKChannelHandshakeLimits this_ptr_conv;
37395         this_ptr_conv.inner = untag_ptr(this_ptr);
37396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37398         this_ptr_conv.is_owned = false;
37399         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
37400         return ret_conv;
37401 }
37402
37403 void  CS_LDK_ChannelHandshakeLimits_set_force_announced_channel_preference(int64_t this_ptr, jboolean val) {
37404         LDKChannelHandshakeLimits this_ptr_conv;
37405         this_ptr_conv.inner = untag_ptr(this_ptr);
37406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37408         this_ptr_conv.is_owned = false;
37409         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
37410 }
37411
37412 int16_t  CS_LDK_ChannelHandshakeLimits_get_their_to_self_delay(int64_t this_ptr) {
37413         LDKChannelHandshakeLimits this_ptr_conv;
37414         this_ptr_conv.inner = untag_ptr(this_ptr);
37415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37417         this_ptr_conv.is_owned = false;
37418         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
37419         return ret_conv;
37420 }
37421
37422 void  CS_LDK_ChannelHandshakeLimits_set_their_to_self_delay(int64_t this_ptr, int16_t val) {
37423         LDKChannelHandshakeLimits this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
37429 }
37430
37431 int64_t  CS_LDK_ChannelHandshakeLimits_new(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) {
37432         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);
37433         int64_t ret_ref = 0;
37434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37436         return ret_ref;
37437 }
37438
37439 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
37440         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
37441         int64_t ret_ref = 0;
37442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37444         return ret_ref;
37445 }
37446 int64_t  CS_LDK_ChannelHandshakeLimits_clone_ptr(int64_t arg) {
37447         LDKChannelHandshakeLimits arg_conv;
37448         arg_conv.inner = untag_ptr(arg);
37449         arg_conv.is_owned = ptr_is_owned(arg);
37450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37451         arg_conv.is_owned = false;
37452         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
37453         return ret_conv;
37454 }
37455
37456 int64_t  CS_LDK_ChannelHandshakeLimits_clone(int64_t orig) {
37457         LDKChannelHandshakeLimits orig_conv;
37458         orig_conv.inner = untag_ptr(orig);
37459         orig_conv.is_owned = ptr_is_owned(orig);
37460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37461         orig_conv.is_owned = false;
37462         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
37463         int64_t ret_ref = 0;
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37466         return ret_ref;
37467 }
37468
37469 int64_t  CS_LDK_ChannelHandshakeLimits_default() {
37470         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
37471         int64_t ret_ref = 0;
37472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37474         return ret_ref;
37475 }
37476
37477 void  CS_LDK_MaxDustHTLCExposure_free(int64_t this_ptr) {
37478         if (!ptr_is_owned(this_ptr)) return;
37479         void* this_ptr_ptr = untag_ptr(this_ptr);
37480         CHECK_ACCESS(this_ptr_ptr);
37481         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
37482         FREE(untag_ptr(this_ptr));
37483         MaxDustHTLCExposure_free(this_ptr_conv);
37484 }
37485
37486 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
37487         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37488         *ret_copy = MaxDustHTLCExposure_clone(arg);
37489         int64_t ret_ref = tag_ptr(ret_copy, true);
37490         return ret_ref;
37491 }
37492 int64_t  CS_LDK_MaxDustHTLCExposure_clone_ptr(int64_t arg) {
37493         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
37494         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
37495         return ret_conv;
37496 }
37497
37498 int64_t  CS_LDK_MaxDustHTLCExposure_clone(int64_t orig) {
37499         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
37500         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37501         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
37502         int64_t ret_ref = tag_ptr(ret_copy, true);
37503         return ret_ref;
37504 }
37505
37506 int64_t  CS_LDK_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
37507         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37508         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
37509         int64_t ret_ref = tag_ptr(ret_copy, true);
37510         return ret_ref;
37511 }
37512
37513 int64_t  CS_LDK_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
37514         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37515         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
37516         int64_t ret_ref = tag_ptr(ret_copy, true);
37517         return ret_ref;
37518 }
37519
37520 jboolean  CS_LDK_MaxDustHTLCExposure_eq(int64_t a, int64_t b) {
37521         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
37522         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
37523         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
37524         return ret_conv;
37525 }
37526
37527 int8_tArray  CS_LDK_MaxDustHTLCExposure_write(int64_t obj) {
37528         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
37529         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
37530         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37531         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37532         CVec_u8Z_free(ret_var);
37533         return ret_arr;
37534 }
37535
37536 int64_t  CS_LDK_MaxDustHTLCExposure_read(int8_tArray ser) {
37537         LDKu8slice ser_ref;
37538         ser_ref.datalen = ser->arr_len;
37539         ser_ref.data = ser->elems;
37540         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
37541         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
37542         FREE(ser);
37543         return tag_ptr(ret_conv, true);
37544 }
37545
37546 void  CS_LDK_ChannelConfig_free(int64_t this_obj) {
37547         LDKChannelConfig this_obj_conv;
37548         this_obj_conv.inner = untag_ptr(this_obj);
37549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37551         ChannelConfig_free(this_obj_conv);
37552 }
37553
37554 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
37555         LDKChannelConfig this_ptr_conv;
37556         this_ptr_conv.inner = untag_ptr(this_ptr);
37557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37559         this_ptr_conv.is_owned = false;
37560         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37561         return ret_conv;
37562 }
37563
37564 void  CS_LDK_ChannelConfig_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
37565         LDKChannelConfig this_ptr_conv;
37566         this_ptr_conv.inner = untag_ptr(this_ptr);
37567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37569         this_ptr_conv.is_owned = false;
37570         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
37571 }
37572
37573 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_base_msat(int64_t this_ptr) {
37574         LDKChannelConfig this_ptr_conv;
37575         this_ptr_conv.inner = untag_ptr(this_ptr);
37576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37578         this_ptr_conv.is_owned = false;
37579         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
37580         return ret_conv;
37581 }
37582
37583 void  CS_LDK_ChannelConfig_set_forwarding_fee_base_msat(int64_t this_ptr, int32_t val) {
37584         LDKChannelConfig this_ptr_conv;
37585         this_ptr_conv.inner = untag_ptr(this_ptr);
37586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37588         this_ptr_conv.is_owned = false;
37589         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
37590 }
37591
37592 int16_t  CS_LDK_ChannelConfig_get_cltv_expiry_delta(int64_t this_ptr) {
37593         LDKChannelConfig this_ptr_conv;
37594         this_ptr_conv.inner = untag_ptr(this_ptr);
37595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37597         this_ptr_conv.is_owned = false;
37598         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
37599         return ret_conv;
37600 }
37601
37602 void  CS_LDK_ChannelConfig_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
37603         LDKChannelConfig this_ptr_conv;
37604         this_ptr_conv.inner = untag_ptr(this_ptr);
37605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37607         this_ptr_conv.is_owned = false;
37608         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
37609 }
37610
37611 int64_t  CS_LDK_ChannelConfig_get_max_dust_htlc_exposure(int64_t this_ptr) {
37612         LDKChannelConfig this_ptr_conv;
37613         this_ptr_conv.inner = untag_ptr(this_ptr);
37614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37616         this_ptr_conv.is_owned = false;
37617         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
37618         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
37619         int64_t ret_ref = tag_ptr(ret_copy, true);
37620         return ret_ref;
37621 }
37622
37623 void  CS_LDK_ChannelConfig_set_max_dust_htlc_exposure(int64_t this_ptr, int64_t val) {
37624         LDKChannelConfig this_ptr_conv;
37625         this_ptr_conv.inner = untag_ptr(this_ptr);
37626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37628         this_ptr_conv.is_owned = false;
37629         void* val_ptr = untag_ptr(val);
37630         CHECK_ACCESS(val_ptr);
37631         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
37632         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
37633         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
37634 }
37635
37636 int64_t  CS_LDK_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
37637         LDKChannelConfig this_ptr_conv;
37638         this_ptr_conv.inner = untag_ptr(this_ptr);
37639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37641         this_ptr_conv.is_owned = false;
37642         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37643         return ret_conv;
37644 }
37645
37646 void  CS_LDK_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
37647         LDKChannelConfig this_ptr_conv;
37648         this_ptr_conv.inner = untag_ptr(this_ptr);
37649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37651         this_ptr_conv.is_owned = false;
37652         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
37653 }
37654
37655 jboolean  CS_LDK_ChannelConfig_get_accept_underpaying_htlcs(int64_t this_ptr) {
37656         LDKChannelConfig this_ptr_conv;
37657         this_ptr_conv.inner = untag_ptr(this_ptr);
37658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37660         this_ptr_conv.is_owned = false;
37661         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
37662         return ret_conv;
37663 }
37664
37665 void  CS_LDK_ChannelConfig_set_accept_underpaying_htlcs(int64_t this_ptr, jboolean val) {
37666         LDKChannelConfig this_ptr_conv;
37667         this_ptr_conv.inner = untag_ptr(this_ptr);
37668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37670         this_ptr_conv.is_owned = false;
37671         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
37672 }
37673
37674 int64_t  CS_LDK_ChannelConfig_new(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) {
37675         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
37676         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
37677         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
37678         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
37679         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);
37680         int64_t ret_ref = 0;
37681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37683         return ret_ref;
37684 }
37685
37686 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
37687         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
37688         int64_t ret_ref = 0;
37689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37691         return ret_ref;
37692 }
37693 int64_t  CS_LDK_ChannelConfig_clone_ptr(int64_t arg) {
37694         LDKChannelConfig arg_conv;
37695         arg_conv.inner = untag_ptr(arg);
37696         arg_conv.is_owned = ptr_is_owned(arg);
37697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37698         arg_conv.is_owned = false;
37699         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
37700         return ret_conv;
37701 }
37702
37703 int64_t  CS_LDK_ChannelConfig_clone(int64_t orig) {
37704         LDKChannelConfig orig_conv;
37705         orig_conv.inner = untag_ptr(orig);
37706         orig_conv.is_owned = ptr_is_owned(orig);
37707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37708         orig_conv.is_owned = false;
37709         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
37710         int64_t ret_ref = 0;
37711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37713         return ret_ref;
37714 }
37715
37716 jboolean  CS_LDK_ChannelConfig_eq(int64_t a, int64_t b) {
37717         LDKChannelConfig a_conv;
37718         a_conv.inner = untag_ptr(a);
37719         a_conv.is_owned = ptr_is_owned(a);
37720         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37721         a_conv.is_owned = false;
37722         LDKChannelConfig b_conv;
37723         b_conv.inner = untag_ptr(b);
37724         b_conv.is_owned = ptr_is_owned(b);
37725         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37726         b_conv.is_owned = false;
37727         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
37728         return ret_conv;
37729 }
37730
37731 void  CS_LDK_ChannelConfig_apply(int64_t this_arg, int64_t update) {
37732         LDKChannelConfig this_arg_conv;
37733         this_arg_conv.inner = untag_ptr(this_arg);
37734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37736         this_arg_conv.is_owned = false;
37737         LDKChannelConfigUpdate update_conv;
37738         update_conv.inner = untag_ptr(update);
37739         update_conv.is_owned = ptr_is_owned(update);
37740         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
37741         update_conv.is_owned = false;
37742         ChannelConfig_apply(&this_arg_conv, &update_conv);
37743 }
37744
37745 int64_t  CS_LDK_ChannelConfig_default() {
37746         LDKChannelConfig ret_var = ChannelConfig_default();
37747         int64_t ret_ref = 0;
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37750         return ret_ref;
37751 }
37752
37753 int8_tArray  CS_LDK_ChannelConfig_write(int64_t obj) {
37754         LDKChannelConfig obj_conv;
37755         obj_conv.inner = untag_ptr(obj);
37756         obj_conv.is_owned = ptr_is_owned(obj);
37757         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37758         obj_conv.is_owned = false;
37759         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
37760         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37761         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37762         CVec_u8Z_free(ret_var);
37763         return ret_arr;
37764 }
37765
37766 int64_t  CS_LDK_ChannelConfig_read(int8_tArray ser) {
37767         LDKu8slice ser_ref;
37768         ser_ref.datalen = ser->arr_len;
37769         ser_ref.data = ser->elems;
37770         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
37771         *ret_conv = ChannelConfig_read(ser_ref);
37772         FREE(ser);
37773         return tag_ptr(ret_conv, true);
37774 }
37775
37776 void  CS_LDK_ChannelConfigUpdate_free(int64_t this_obj) {
37777         LDKChannelConfigUpdate this_obj_conv;
37778         this_obj_conv.inner = untag_ptr(this_obj);
37779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37781         ChannelConfigUpdate_free(this_obj_conv);
37782 }
37783
37784 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
37785         LDKChannelConfigUpdate this_ptr_conv;
37786         this_ptr_conv.inner = untag_ptr(this_ptr);
37787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37789         this_ptr_conv.is_owned = false;
37790         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37791         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
37792         int64_t ret_ref = tag_ptr(ret_copy, true);
37793         return ret_ref;
37794 }
37795
37796 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int64_t val) {
37797         LDKChannelConfigUpdate this_ptr_conv;
37798         this_ptr_conv.inner = untag_ptr(this_ptr);
37799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37801         this_ptr_conv.is_owned = false;
37802         void* val_ptr = untag_ptr(val);
37803         CHECK_ACCESS(val_ptr);
37804         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37805         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37806         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
37807 }
37808
37809 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_base_msat(int64_t this_ptr) {
37810         LDKChannelConfigUpdate this_ptr_conv;
37811         this_ptr_conv.inner = untag_ptr(this_ptr);
37812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37814         this_ptr_conv.is_owned = false;
37815         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37816         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
37817         int64_t ret_ref = tag_ptr(ret_copy, true);
37818         return ret_ref;
37819 }
37820
37821 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_base_msat(int64_t this_ptr, int64_t val) {
37822         LDKChannelConfigUpdate this_ptr_conv;
37823         this_ptr_conv.inner = untag_ptr(this_ptr);
37824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37826         this_ptr_conv.is_owned = false;
37827         void* val_ptr = untag_ptr(val);
37828         CHECK_ACCESS(val_ptr);
37829         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37830         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37831         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
37832 }
37833
37834 int64_t  CS_LDK_ChannelConfigUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
37835         LDKChannelConfigUpdate this_ptr_conv;
37836         this_ptr_conv.inner = untag_ptr(this_ptr);
37837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37839         this_ptr_conv.is_owned = false;
37840         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37841         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
37842         int64_t ret_ref = tag_ptr(ret_copy, true);
37843         return ret_ref;
37844 }
37845
37846 void  CS_LDK_ChannelConfigUpdate_set_cltv_expiry_delta(int64_t this_ptr, int64_t val) {
37847         LDKChannelConfigUpdate this_ptr_conv;
37848         this_ptr_conv.inner = untag_ptr(this_ptr);
37849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37851         this_ptr_conv.is_owned = false;
37852         void* val_ptr = untag_ptr(val);
37853         CHECK_ACCESS(val_ptr);
37854         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37855         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37856         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
37857 }
37858
37859 int64_t  CS_LDK_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(int64_t this_ptr) {
37860         LDKChannelConfigUpdate this_ptr_conv;
37861         this_ptr_conv.inner = untag_ptr(this_ptr);
37862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37864         this_ptr_conv.is_owned = false;
37865         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
37866         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
37867         int64_t ret_ref = tag_ptr(ret_copy, true);
37868         return ret_ref;
37869 }
37870
37871 void  CS_LDK_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(int64_t this_ptr, int64_t val) {
37872         LDKChannelConfigUpdate this_ptr_conv;
37873         this_ptr_conv.inner = untag_ptr(this_ptr);
37874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37876         this_ptr_conv.is_owned = false;
37877         void* val_ptr = untag_ptr(val);
37878         CHECK_ACCESS(val_ptr);
37879         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
37880         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
37881         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
37882 }
37883
37884 int64_t  CS_LDK_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
37885         LDKChannelConfigUpdate this_ptr_conv;
37886         this_ptr_conv.inner = untag_ptr(this_ptr);
37887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37889         this_ptr_conv.is_owned = false;
37890         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37891         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
37892         int64_t ret_ref = tag_ptr(ret_copy, true);
37893         return ret_ref;
37894 }
37895
37896 void  CS_LDK_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
37897         LDKChannelConfigUpdate this_ptr_conv;
37898         this_ptr_conv.inner = untag_ptr(this_ptr);
37899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37901         this_ptr_conv.is_owned = false;
37902         void* val_ptr = untag_ptr(val);
37903         CHECK_ACCESS(val_ptr);
37904         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37905         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37906         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
37907 }
37908
37909 int64_t  CS_LDK_ChannelConfigUpdate_new(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) {
37910         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
37911         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
37912         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
37913         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
37914         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
37915         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
37916         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
37917         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
37918         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
37919         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
37920         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
37921         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
37922         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
37923         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
37924         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
37925         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
37926         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
37927         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
37928         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
37929         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
37930         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);
37931         int64_t ret_ref = 0;
37932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37934         return ret_ref;
37935 }
37936
37937 int64_t  CS_LDK_ChannelConfigUpdate_default() {
37938         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
37939         int64_t ret_ref = 0;
37940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37942         return ret_ref;
37943 }
37944
37945 void  CS_LDK_UserConfig_free(int64_t this_obj) {
37946         LDKUserConfig this_obj_conv;
37947         this_obj_conv.inner = untag_ptr(this_obj);
37948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37950         UserConfig_free(this_obj_conv);
37951 }
37952
37953 int64_t  CS_LDK_UserConfig_get_channel_handshake_config(int64_t this_ptr) {
37954         LDKUserConfig this_ptr_conv;
37955         this_ptr_conv.inner = untag_ptr(this_ptr);
37956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37958         this_ptr_conv.is_owned = false;
37959         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
37960         int64_t ret_ref = 0;
37961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37963         return ret_ref;
37964 }
37965
37966 void  CS_LDK_UserConfig_set_channel_handshake_config(int64_t this_ptr, int64_t val) {
37967         LDKUserConfig this_ptr_conv;
37968         this_ptr_conv.inner = untag_ptr(this_ptr);
37969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37971         this_ptr_conv.is_owned = false;
37972         LDKChannelHandshakeConfig val_conv;
37973         val_conv.inner = untag_ptr(val);
37974         val_conv.is_owned = ptr_is_owned(val);
37975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37976         val_conv = ChannelHandshakeConfig_clone(&val_conv);
37977         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
37978 }
37979
37980 int64_t  CS_LDK_UserConfig_get_channel_handshake_limits(int64_t this_ptr) {
37981         LDKUserConfig this_ptr_conv;
37982         this_ptr_conv.inner = untag_ptr(this_ptr);
37983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37985         this_ptr_conv.is_owned = false;
37986         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
37987         int64_t ret_ref = 0;
37988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37990         return ret_ref;
37991 }
37992
37993 void  CS_LDK_UserConfig_set_channel_handshake_limits(int64_t this_ptr, int64_t val) {
37994         LDKUserConfig this_ptr_conv;
37995         this_ptr_conv.inner = untag_ptr(this_ptr);
37996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37998         this_ptr_conv.is_owned = false;
37999         LDKChannelHandshakeLimits val_conv;
38000         val_conv.inner = untag_ptr(val);
38001         val_conv.is_owned = ptr_is_owned(val);
38002         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38003         val_conv = ChannelHandshakeLimits_clone(&val_conv);
38004         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
38005 }
38006
38007 int64_t  CS_LDK_UserConfig_get_channel_config(int64_t this_ptr) {
38008         LDKUserConfig this_ptr_conv;
38009         this_ptr_conv.inner = untag_ptr(this_ptr);
38010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38012         this_ptr_conv.is_owned = false;
38013         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
38014         int64_t ret_ref = 0;
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38017         return ret_ref;
38018 }
38019
38020 void  CS_LDK_UserConfig_set_channel_config(int64_t this_ptr, int64_t val) {
38021         LDKUserConfig this_ptr_conv;
38022         this_ptr_conv.inner = untag_ptr(this_ptr);
38023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38025         this_ptr_conv.is_owned = false;
38026         LDKChannelConfig val_conv;
38027         val_conv.inner = untag_ptr(val);
38028         val_conv.is_owned = ptr_is_owned(val);
38029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38030         val_conv = ChannelConfig_clone(&val_conv);
38031         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
38032 }
38033
38034 jboolean  CS_LDK_UserConfig_get_accept_forwards_to_priv_channels(int64_t this_ptr) {
38035         LDKUserConfig this_ptr_conv;
38036         this_ptr_conv.inner = untag_ptr(this_ptr);
38037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38039         this_ptr_conv.is_owned = false;
38040         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
38041         return ret_conv;
38042 }
38043
38044 void  CS_LDK_UserConfig_set_accept_forwards_to_priv_channels(int64_t this_ptr, jboolean val) {
38045         LDKUserConfig this_ptr_conv;
38046         this_ptr_conv.inner = untag_ptr(this_ptr);
38047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38049         this_ptr_conv.is_owned = false;
38050         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
38051 }
38052
38053 jboolean  CS_LDK_UserConfig_get_accept_inbound_channels(int64_t this_ptr) {
38054         LDKUserConfig this_ptr_conv;
38055         this_ptr_conv.inner = untag_ptr(this_ptr);
38056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38058         this_ptr_conv.is_owned = false;
38059         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
38060         return ret_conv;
38061 }
38062
38063 void  CS_LDK_UserConfig_set_accept_inbound_channels(int64_t this_ptr, jboolean val) {
38064         LDKUserConfig this_ptr_conv;
38065         this_ptr_conv.inner = untag_ptr(this_ptr);
38066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38068         this_ptr_conv.is_owned = false;
38069         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
38070 }
38071
38072 jboolean  CS_LDK_UserConfig_get_manually_accept_inbound_channels(int64_t this_ptr) {
38073         LDKUserConfig this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
38079         return ret_conv;
38080 }
38081
38082 void  CS_LDK_UserConfig_set_manually_accept_inbound_channels(int64_t this_ptr, jboolean val) {
38083         LDKUserConfig this_ptr_conv;
38084         this_ptr_conv.inner = untag_ptr(this_ptr);
38085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38087         this_ptr_conv.is_owned = false;
38088         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
38089 }
38090
38091 jboolean  CS_LDK_UserConfig_get_accept_intercept_htlcs(int64_t this_ptr) {
38092         LDKUserConfig this_ptr_conv;
38093         this_ptr_conv.inner = untag_ptr(this_ptr);
38094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38096         this_ptr_conv.is_owned = false;
38097         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
38098         return ret_conv;
38099 }
38100
38101 void  CS_LDK_UserConfig_set_accept_intercept_htlcs(int64_t this_ptr, jboolean val) {
38102         LDKUserConfig this_ptr_conv;
38103         this_ptr_conv.inner = untag_ptr(this_ptr);
38104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38106         this_ptr_conv.is_owned = false;
38107         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
38108 }
38109
38110 jboolean  CS_LDK_UserConfig_get_accept_mpp_keysend(int64_t this_ptr) {
38111         LDKUserConfig this_ptr_conv;
38112         this_ptr_conv.inner = untag_ptr(this_ptr);
38113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38115         this_ptr_conv.is_owned = false;
38116         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
38117         return ret_conv;
38118 }
38119
38120 void  CS_LDK_UserConfig_set_accept_mpp_keysend(int64_t this_ptr, jboolean val) {
38121         LDKUserConfig this_ptr_conv;
38122         this_ptr_conv.inner = untag_ptr(this_ptr);
38123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38125         this_ptr_conv.is_owned = false;
38126         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
38127 }
38128
38129 int64_t  CS_LDK_UserConfig_new(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) {
38130         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
38131         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
38132         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
38134         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
38135         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
38136         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
38137         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
38138         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
38139         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
38140         LDKChannelConfig channel_config_arg_conv;
38141         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
38142         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
38143         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
38144         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
38145         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);
38146         int64_t ret_ref = 0;
38147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38149         return ret_ref;
38150 }
38151
38152 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
38153         LDKUserConfig ret_var = UserConfig_clone(arg);
38154         int64_t ret_ref = 0;
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38157         return ret_ref;
38158 }
38159 int64_t  CS_LDK_UserConfig_clone_ptr(int64_t arg) {
38160         LDKUserConfig arg_conv;
38161         arg_conv.inner = untag_ptr(arg);
38162         arg_conv.is_owned = ptr_is_owned(arg);
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38164         arg_conv.is_owned = false;
38165         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
38166         return ret_conv;
38167 }
38168
38169 int64_t  CS_LDK_UserConfig_clone(int64_t orig) {
38170         LDKUserConfig orig_conv;
38171         orig_conv.inner = untag_ptr(orig);
38172         orig_conv.is_owned = ptr_is_owned(orig);
38173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38174         orig_conv.is_owned = false;
38175         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
38176         int64_t ret_ref = 0;
38177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38179         return ret_ref;
38180 }
38181
38182 int64_t  CS_LDK_UserConfig_default() {
38183         LDKUserConfig ret_var = UserConfig_default();
38184         int64_t ret_ref = 0;
38185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38187         return ret_ref;
38188 }
38189
38190 void  CS_LDK_BestBlock_free(int64_t this_obj) {
38191         LDKBestBlock this_obj_conv;
38192         this_obj_conv.inner = untag_ptr(this_obj);
38193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38195         BestBlock_free(this_obj_conv);
38196 }
38197
38198 int8_tArray  CS_LDK_BestBlock_get_block_hash(int64_t this_ptr) {
38199         LDKBestBlock this_ptr_conv;
38200         this_ptr_conv.inner = untag_ptr(this_ptr);
38201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38203         this_ptr_conv.is_owned = false;
38204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38205         memcpy(ret_arr->elems, *BestBlock_get_block_hash(&this_ptr_conv), 32);
38206         return ret_arr;
38207 }
38208
38209 void  CS_LDK_BestBlock_set_block_hash(int64_t this_ptr, int8_tArray val) {
38210         LDKBestBlock this_ptr_conv;
38211         this_ptr_conv.inner = untag_ptr(this_ptr);
38212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38214         this_ptr_conv.is_owned = false;
38215         LDKThirtyTwoBytes val_ref;
38216         CHECK(val->arr_len == 32);
38217         memcpy(val_ref.data, val->elems, 32); FREE(val);
38218         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
38219 }
38220
38221 int32_t  CS_LDK_BestBlock_get_height(int64_t this_ptr) {
38222         LDKBestBlock this_ptr_conv;
38223         this_ptr_conv.inner = untag_ptr(this_ptr);
38224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38226         this_ptr_conv.is_owned = false;
38227         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
38228         return ret_conv;
38229 }
38230
38231 void  CS_LDK_BestBlock_set_height(int64_t this_ptr, int32_t val) {
38232         LDKBestBlock this_ptr_conv;
38233         this_ptr_conv.inner = untag_ptr(this_ptr);
38234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38236         this_ptr_conv.is_owned = false;
38237         BestBlock_set_height(&this_ptr_conv, val);
38238 }
38239
38240 int64_t  CS_LDK_BestBlock_new(int8_tArray block_hash_arg, int32_t height_arg) {
38241         LDKThirtyTwoBytes block_hash_arg_ref;
38242         CHECK(block_hash_arg->arr_len == 32);
38243         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
38244         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
38245         int64_t ret_ref = 0;
38246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38248         return ret_ref;
38249 }
38250
38251 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
38252         LDKBestBlock ret_var = BestBlock_clone(arg);
38253         int64_t ret_ref = 0;
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38256         return ret_ref;
38257 }
38258 int64_t  CS_LDK_BestBlock_clone_ptr(int64_t arg) {
38259         LDKBestBlock arg_conv;
38260         arg_conv.inner = untag_ptr(arg);
38261         arg_conv.is_owned = ptr_is_owned(arg);
38262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38263         arg_conv.is_owned = false;
38264         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
38265         return ret_conv;
38266 }
38267
38268 int64_t  CS_LDK_BestBlock_clone(int64_t orig) {
38269         LDKBestBlock orig_conv;
38270         orig_conv.inner = untag_ptr(orig);
38271         orig_conv.is_owned = ptr_is_owned(orig);
38272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38273         orig_conv.is_owned = false;
38274         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
38275         int64_t ret_ref = 0;
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38278         return ret_ref;
38279 }
38280
38281 int64_t  CS_LDK_BestBlock_hash(int64_t o) {
38282         LDKBestBlock o_conv;
38283         o_conv.inner = untag_ptr(o);
38284         o_conv.is_owned = ptr_is_owned(o);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38286         o_conv.is_owned = false;
38287         int64_t ret_conv = BestBlock_hash(&o_conv);
38288         return ret_conv;
38289 }
38290
38291 jboolean  CS_LDK_BestBlock_eq(int64_t a, int64_t b) {
38292         LDKBestBlock a_conv;
38293         a_conv.inner = untag_ptr(a);
38294         a_conv.is_owned = ptr_is_owned(a);
38295         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38296         a_conv.is_owned = false;
38297         LDKBestBlock b_conv;
38298         b_conv.inner = untag_ptr(b);
38299         b_conv.is_owned = ptr_is_owned(b);
38300         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38301         b_conv.is_owned = false;
38302         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
38303         return ret_conv;
38304 }
38305
38306 int64_t  CS_LDK_BestBlock_from_network(int32_t network) {
38307         LDKNetwork network_conv = LDKNetwork_from_cs(network);
38308         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
38309         int64_t ret_ref = 0;
38310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38312         return ret_ref;
38313 }
38314
38315 int8_tArray  CS_LDK_BestBlock_write(int64_t obj) {
38316         LDKBestBlock obj_conv;
38317         obj_conv.inner = untag_ptr(obj);
38318         obj_conv.is_owned = ptr_is_owned(obj);
38319         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38320         obj_conv.is_owned = false;
38321         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
38322         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38323         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38324         CVec_u8Z_free(ret_var);
38325         return ret_arr;
38326 }
38327
38328 int64_t  CS_LDK_BestBlock_read(int8_tArray ser) {
38329         LDKu8slice ser_ref;
38330         ser_ref.datalen = ser->arr_len;
38331         ser_ref.data = ser->elems;
38332         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
38333         *ret_conv = BestBlock_read(ser_ref);
38334         FREE(ser);
38335         return tag_ptr(ret_conv, true);
38336 }
38337
38338 void  CS_LDK_Listen_free(int64_t this_ptr) {
38339         if (!ptr_is_owned(this_ptr)) return;
38340         void* this_ptr_ptr = untag_ptr(this_ptr);
38341         CHECK_ACCESS(this_ptr_ptr);
38342         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
38343         FREE(untag_ptr(this_ptr));
38344         Listen_free(this_ptr_conv);
38345 }
38346
38347 void  CS_LDK_Confirm_free(int64_t this_ptr) {
38348         if (!ptr_is_owned(this_ptr)) return;
38349         void* this_ptr_ptr = untag_ptr(this_ptr);
38350         CHECK_ACCESS(this_ptr_ptr);
38351         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
38352         FREE(untag_ptr(this_ptr));
38353         Confirm_free(this_ptr_conv);
38354 }
38355
38356 int32_t  CS_LDK_ChannelMonitorUpdateStatus_clone(int64_t orig) {
38357         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
38358         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_clone(orig_conv));
38359         return ret_conv;
38360 }
38361
38362 int32_t  CS_LDK_ChannelMonitorUpdateStatus_completed() {
38363         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_completed());
38364         return ret_conv;
38365 }
38366
38367 int32_t  CS_LDK_ChannelMonitorUpdateStatus_in_progress() {
38368         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_in_progress());
38369         return ret_conv;
38370 }
38371
38372 int32_t  CS_LDK_ChannelMonitorUpdateStatus_unrecoverable_error() {
38373         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_unrecoverable_error());
38374         return ret_conv;
38375 }
38376
38377 jboolean  CS_LDK_ChannelMonitorUpdateStatus_eq(int64_t a, int64_t b) {
38378         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
38379         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
38380         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
38381         return ret_conv;
38382 }
38383
38384 void  CS_LDK_Watch_free(int64_t this_ptr) {
38385         if (!ptr_is_owned(this_ptr)) return;
38386         void* this_ptr_ptr = untag_ptr(this_ptr);
38387         CHECK_ACCESS(this_ptr_ptr);
38388         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
38389         FREE(untag_ptr(this_ptr));
38390         Watch_free(this_ptr_conv);
38391 }
38392
38393 void  CS_LDK_Filter_free(int64_t this_ptr) {
38394         if (!ptr_is_owned(this_ptr)) return;
38395         void* this_ptr_ptr = untag_ptr(this_ptr);
38396         CHECK_ACCESS(this_ptr_ptr);
38397         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
38398         FREE(untag_ptr(this_ptr));
38399         Filter_free(this_ptr_conv);
38400 }
38401
38402 void  CS_LDK_WatchedOutput_free(int64_t this_obj) {
38403         LDKWatchedOutput this_obj_conv;
38404         this_obj_conv.inner = untag_ptr(this_obj);
38405         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38407         WatchedOutput_free(this_obj_conv);
38408 }
38409
38410 int64_t  CS_LDK_WatchedOutput_get_block_hash(int64_t this_ptr) {
38411         LDKWatchedOutput this_ptr_conv;
38412         this_ptr_conv.inner = untag_ptr(this_ptr);
38413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38415         this_ptr_conv.is_owned = false;
38416         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38417         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
38418         int64_t ret_ref = tag_ptr(ret_copy, true);
38419         return ret_ref;
38420 }
38421
38422 void  CS_LDK_WatchedOutput_set_block_hash(int64_t this_ptr, int64_t val) {
38423         LDKWatchedOutput this_ptr_conv;
38424         this_ptr_conv.inner = untag_ptr(this_ptr);
38425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38427         this_ptr_conv.is_owned = false;
38428         void* val_ptr = untag_ptr(val);
38429         CHECK_ACCESS(val_ptr);
38430         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38431         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38432         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
38433 }
38434
38435 int64_t  CS_LDK_WatchedOutput_get_outpoint(int64_t this_ptr) {
38436         LDKWatchedOutput this_ptr_conv;
38437         this_ptr_conv.inner = untag_ptr(this_ptr);
38438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38440         this_ptr_conv.is_owned = false;
38441         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
38442         int64_t ret_ref = 0;
38443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38445         return ret_ref;
38446 }
38447
38448 void  CS_LDK_WatchedOutput_set_outpoint(int64_t this_ptr, int64_t val) {
38449         LDKWatchedOutput this_ptr_conv;
38450         this_ptr_conv.inner = untag_ptr(this_ptr);
38451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38453         this_ptr_conv.is_owned = false;
38454         LDKOutPoint val_conv;
38455         val_conv.inner = untag_ptr(val);
38456         val_conv.is_owned = ptr_is_owned(val);
38457         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38458         val_conv = OutPoint_clone(&val_conv);
38459         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
38460 }
38461
38462 int8_tArray  CS_LDK_WatchedOutput_get_script_pubkey(int64_t this_ptr) {
38463         LDKWatchedOutput this_ptr_conv;
38464         this_ptr_conv.inner = untag_ptr(this_ptr);
38465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38467         this_ptr_conv.is_owned = false;
38468         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
38469         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38470         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38471         CVec_u8Z_free(ret_var);
38472         return ret_arr;
38473 }
38474
38475 void  CS_LDK_WatchedOutput_set_script_pubkey(int64_t this_ptr, int8_tArray val) {
38476         LDKWatchedOutput this_ptr_conv;
38477         this_ptr_conv.inner = untag_ptr(this_ptr);
38478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38480         this_ptr_conv.is_owned = false;
38481         LDKCVec_u8Z val_ref;
38482         val_ref.datalen = val->arr_len;
38483         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38484         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38485         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
38486 }
38487
38488 int64_t  CS_LDK_WatchedOutput_new(int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
38489         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
38490         CHECK_ACCESS(block_hash_arg_ptr);
38491         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
38492         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
38493         LDKOutPoint outpoint_arg_conv;
38494         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
38495         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
38496         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
38497         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
38498         LDKCVec_u8Z script_pubkey_arg_ref;
38499         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
38500         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38501         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
38502         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
38503         int64_t ret_ref = 0;
38504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38506         return ret_ref;
38507 }
38508
38509 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
38510         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
38511         int64_t ret_ref = 0;
38512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38514         return ret_ref;
38515 }
38516 int64_t  CS_LDK_WatchedOutput_clone_ptr(int64_t arg) {
38517         LDKWatchedOutput arg_conv;
38518         arg_conv.inner = untag_ptr(arg);
38519         arg_conv.is_owned = ptr_is_owned(arg);
38520         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38521         arg_conv.is_owned = false;
38522         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
38523         return ret_conv;
38524 }
38525
38526 int64_t  CS_LDK_WatchedOutput_clone(int64_t orig) {
38527         LDKWatchedOutput orig_conv;
38528         orig_conv.inner = untag_ptr(orig);
38529         orig_conv.is_owned = ptr_is_owned(orig);
38530         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38531         orig_conv.is_owned = false;
38532         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
38533         int64_t ret_ref = 0;
38534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38536         return ret_ref;
38537 }
38538
38539 jboolean  CS_LDK_WatchedOutput_eq(int64_t a, int64_t b) {
38540         LDKWatchedOutput a_conv;
38541         a_conv.inner = untag_ptr(a);
38542         a_conv.is_owned = ptr_is_owned(a);
38543         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38544         a_conv.is_owned = false;
38545         LDKWatchedOutput b_conv;
38546         b_conv.inner = untag_ptr(b);
38547         b_conv.is_owned = ptr_is_owned(b);
38548         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38549         b_conv.is_owned = false;
38550         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
38551         return ret_conv;
38552 }
38553
38554 int64_t  CS_LDK_WatchedOutput_hash(int64_t o) {
38555         LDKWatchedOutput o_conv;
38556         o_conv.inner = untag_ptr(o);
38557         o_conv.is_owned = ptr_is_owned(o);
38558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38559         o_conv.is_owned = false;
38560         int64_t ret_conv = WatchedOutput_hash(&o_conv);
38561         return ret_conv;
38562 }
38563
38564 void  CS_LDK_BroadcasterInterface_free(int64_t this_ptr) {
38565         if (!ptr_is_owned(this_ptr)) return;
38566         void* this_ptr_ptr = untag_ptr(this_ptr);
38567         CHECK_ACCESS(this_ptr_ptr);
38568         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
38569         FREE(untag_ptr(this_ptr));
38570         BroadcasterInterface_free(this_ptr_conv);
38571 }
38572
38573 int32_t  CS_LDK_ConfirmationTarget_clone(int64_t orig) {
38574         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
38575         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_clone(orig_conv));
38576         return ret_conv;
38577 }
38578
38579 int32_t  CS_LDK_ConfirmationTarget_on_chain_sweep() {
38580         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_on_chain_sweep());
38581         return ret_conv;
38582 }
38583
38584 int32_t  CS_LDK_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
38585         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
38586         return ret_conv;
38587 }
38588
38589 int32_t  CS_LDK_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
38590         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
38591         return ret_conv;
38592 }
38593
38594 int32_t  CS_LDK_ConfirmationTarget_anchor_channel_fee() {
38595         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_anchor_channel_fee());
38596         return ret_conv;
38597 }
38598
38599 int32_t  CS_LDK_ConfirmationTarget_non_anchor_channel_fee() {
38600         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_non_anchor_channel_fee());
38601         return ret_conv;
38602 }
38603
38604 int32_t  CS_LDK_ConfirmationTarget_channel_close_minimum() {
38605         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_channel_close_minimum());
38606         return ret_conv;
38607 }
38608
38609 int32_t  CS_LDK_ConfirmationTarget_output_spending_fee() {
38610         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_output_spending_fee());
38611         return ret_conv;
38612 }
38613
38614 int64_t  CS_LDK_ConfirmationTarget_hash(int64_t o) {
38615         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
38616         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
38617         return ret_conv;
38618 }
38619
38620 jboolean  CS_LDK_ConfirmationTarget_eq(int64_t a, int64_t b) {
38621         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
38622         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
38623         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
38624         return ret_conv;
38625 }
38626
38627 void  CS_LDK_FeeEstimator_free(int64_t this_ptr) {
38628         if (!ptr_is_owned(this_ptr)) return;
38629         void* this_ptr_ptr = untag_ptr(this_ptr);
38630         CHECK_ACCESS(this_ptr_ptr);
38631         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
38632         FREE(untag_ptr(this_ptr));
38633         FeeEstimator_free(this_ptr_conv);
38634 }
38635
38636 void  CS_LDK_MonitorUpdateId_free(int64_t this_obj) {
38637         LDKMonitorUpdateId this_obj_conv;
38638         this_obj_conv.inner = untag_ptr(this_obj);
38639         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38641         MonitorUpdateId_free(this_obj_conv);
38642 }
38643
38644 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
38645         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
38646         int64_t ret_ref = 0;
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38649         return ret_ref;
38650 }
38651 int64_t  CS_LDK_MonitorUpdateId_clone_ptr(int64_t arg) {
38652         LDKMonitorUpdateId arg_conv;
38653         arg_conv.inner = untag_ptr(arg);
38654         arg_conv.is_owned = ptr_is_owned(arg);
38655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38656         arg_conv.is_owned = false;
38657         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
38658         return ret_conv;
38659 }
38660
38661 int64_t  CS_LDK_MonitorUpdateId_clone(int64_t orig) {
38662         LDKMonitorUpdateId orig_conv;
38663         orig_conv.inner = untag_ptr(orig);
38664         orig_conv.is_owned = ptr_is_owned(orig);
38665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38666         orig_conv.is_owned = false;
38667         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
38668         int64_t ret_ref = 0;
38669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38671         return ret_ref;
38672 }
38673
38674 int64_t  CS_LDK_MonitorUpdateId_hash(int64_t o) {
38675         LDKMonitorUpdateId o_conv;
38676         o_conv.inner = untag_ptr(o);
38677         o_conv.is_owned = ptr_is_owned(o);
38678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38679         o_conv.is_owned = false;
38680         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
38681         return ret_conv;
38682 }
38683
38684 jboolean  CS_LDK_MonitorUpdateId_eq(int64_t a, int64_t b) {
38685         LDKMonitorUpdateId a_conv;
38686         a_conv.inner = untag_ptr(a);
38687         a_conv.is_owned = ptr_is_owned(a);
38688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38689         a_conv.is_owned = false;
38690         LDKMonitorUpdateId b_conv;
38691         b_conv.inner = untag_ptr(b);
38692         b_conv.is_owned = ptr_is_owned(b);
38693         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38694         b_conv.is_owned = false;
38695         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
38696         return ret_conv;
38697 }
38698
38699 void  CS_LDK_Persist_free(int64_t this_ptr) {
38700         if (!ptr_is_owned(this_ptr)) return;
38701         void* this_ptr_ptr = untag_ptr(this_ptr);
38702         CHECK_ACCESS(this_ptr_ptr);
38703         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
38704         FREE(untag_ptr(this_ptr));
38705         Persist_free(this_ptr_conv);
38706 }
38707
38708 void  CS_LDK_LockedChannelMonitor_free(int64_t this_obj) {
38709         LDKLockedChannelMonitor this_obj_conv;
38710         this_obj_conv.inner = untag_ptr(this_obj);
38711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38713         LockedChannelMonitor_free(this_obj_conv);
38714 }
38715
38716 void  CS_LDK_ChainMonitor_free(int64_t this_obj) {
38717         LDKChainMonitor this_obj_conv;
38718         this_obj_conv.inner = untag_ptr(this_obj);
38719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38721         ChainMonitor_free(this_obj_conv);
38722 }
38723
38724 int64_t  CS_LDK_ChainMonitor_new(int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
38725         void* chain_source_ptr = untag_ptr(chain_source);
38726         CHECK_ACCESS(chain_source_ptr);
38727         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
38728         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
38729         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
38730                 // Manually implement clone for Java trait instances
38731                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
38732                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38733                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
38734                 }
38735         }
38736         void* broadcaster_ptr = untag_ptr(broadcaster);
38737         CHECK_ACCESS(broadcaster_ptr);
38738         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
38739         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38741                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
38742         }
38743         void* logger_ptr = untag_ptr(logger);
38744         CHECK_ACCESS(logger_ptr);
38745         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38746         if (logger_conv.free == LDKLogger_JCalls_free) {
38747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38748                 LDKLogger_JCalls_cloned(&logger_conv);
38749         }
38750         void* feeest_ptr = untag_ptr(feeest);
38751         CHECK_ACCESS(feeest_ptr);
38752         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
38753         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
38754                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38755                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
38756         }
38757         void* persister_ptr = untag_ptr(persister);
38758         CHECK_ACCESS(persister_ptr);
38759         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
38760         if (persister_conv.free == LDKPersist_JCalls_free) {
38761                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38762                 LDKPersist_JCalls_cloned(&persister_conv);
38763         }
38764         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
38765         int64_t ret_ref = 0;
38766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38768         return ret_ref;
38769 }
38770
38771 int64_tArray  CS_LDK_ChainMonitor_get_claimable_balances(int64_t this_arg, int64_tArray ignored_channels) {
38772         LDKChainMonitor this_arg_conv;
38773         this_arg_conv.inner = untag_ptr(this_arg);
38774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38776         this_arg_conv.is_owned = false;
38777         LDKCVec_ChannelDetailsZ ignored_channels_constr;
38778         ignored_channels_constr.datalen = ignored_channels->arr_len;
38779         if (ignored_channels_constr.datalen > 0)
38780                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38781         else
38782                 ignored_channels_constr.data = NULL;
38783         int64_t* ignored_channels_vals = ignored_channels->elems;
38784         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
38785                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
38786                 LDKChannelDetails ignored_channels_conv_16_conv;
38787                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
38788                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
38789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
38790                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
38791                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
38792         }
38793         FREE(ignored_channels);
38794         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
38795         int64_tArray ret_arr = NULL;
38796         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38797         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38798         for (size_t j = 0; j < ret_var.datalen; j++) {
38799                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
38800                 *ret_conv_9_copy = ret_var.data[j];
38801                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
38802                 ret_arr_ptr[j] = ret_conv_9_ref;
38803         }
38804         
38805         FREE(ret_var.data);
38806         return ret_arr;
38807 }
38808
38809 int64_t  CS_LDK_ChainMonitor_get_monitor(int64_t this_arg, int64_t funding_txo) {
38810         LDKChainMonitor this_arg_conv;
38811         this_arg_conv.inner = untag_ptr(this_arg);
38812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38814         this_arg_conv.is_owned = false;
38815         LDKOutPoint funding_txo_conv;
38816         funding_txo_conv.inner = untag_ptr(funding_txo);
38817         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38818         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38819         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38820         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
38821         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
38822         return tag_ptr(ret_conv, true);
38823 }
38824
38825 int64_tArray  CS_LDK_ChainMonitor_list_monitors(int64_t this_arg) {
38826         LDKChainMonitor this_arg_conv;
38827         this_arg_conv.inner = untag_ptr(this_arg);
38828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38830         this_arg_conv.is_owned = false;
38831         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
38832         int64_tArray ret_arr = NULL;
38833         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38834         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38835         for (size_t d = 0; d < ret_var.datalen; d++) {
38836                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
38837                 *ret_conv_29_conv = ret_var.data[d];
38838                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
38839         }
38840         
38841         FREE(ret_var.data);
38842         return ret_arr;
38843 }
38844
38845 int64_tArray  CS_LDK_ChainMonitor_list_pending_monitor_updates(int64_t this_arg) {
38846         LDKChainMonitor this_arg_conv;
38847         this_arg_conv.inner = untag_ptr(this_arg);
38848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38850         this_arg_conv.is_owned = false;
38851         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
38852         int64_tArray ret_arr = NULL;
38853         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38854         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38855         for (size_t p = 0; p < ret_var.datalen; p++) {
38856                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
38857                 *ret_conv_41_conv = ret_var.data[p];
38858                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
38859         }
38860         
38861         FREE(ret_var.data);
38862         return ret_arr;
38863 }
38864
38865 int64_t  CS_LDK_ChainMonitor_channel_monitor_updated(int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
38866         LDKChainMonitor this_arg_conv;
38867         this_arg_conv.inner = untag_ptr(this_arg);
38868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38870         this_arg_conv.is_owned = false;
38871         LDKOutPoint funding_txo_conv;
38872         funding_txo_conv.inner = untag_ptr(funding_txo);
38873         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
38875         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
38876         LDKMonitorUpdateId completed_update_id_conv;
38877         completed_update_id_conv.inner = untag_ptr(completed_update_id);
38878         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
38879         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
38880         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
38881         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38882         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
38883         return tag_ptr(ret_conv, true);
38884 }
38885
38886 int64_t  CS_LDK_ChainMonitor_get_update_future(int64_t this_arg) {
38887         LDKChainMonitor this_arg_conv;
38888         this_arg_conv.inner = untag_ptr(this_arg);
38889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38891         this_arg_conv.is_owned = false;
38892         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
38893         int64_t ret_ref = 0;
38894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38896         return ret_ref;
38897 }
38898
38899 void  CS_LDK_ChainMonitor_rebroadcast_pending_claims(int64_t this_arg) {
38900         LDKChainMonitor this_arg_conv;
38901         this_arg_conv.inner = untag_ptr(this_arg);
38902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38904         this_arg_conv.is_owned = false;
38905         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
38906 }
38907
38908 void  CS_LDK_ChainMonitor_signer_unblocked(int64_t this_arg, int64_t monitor_opt) {
38909         LDKChainMonitor this_arg_conv;
38910         this_arg_conv.inner = untag_ptr(this_arg);
38911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38913         this_arg_conv.is_owned = false;
38914         LDKOutPoint monitor_opt_conv;
38915         monitor_opt_conv.inner = untag_ptr(monitor_opt);
38916         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
38917         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
38918         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
38919         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
38920 }
38921
38922 void  CS_LDK_ChainMonitor_archive_fully_resolved_channel_monitors(int64_t this_arg) {
38923         LDKChainMonitor this_arg_conv;
38924         this_arg_conv.inner = untag_ptr(this_arg);
38925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38927         this_arg_conv.is_owned = false;
38928         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
38929 }
38930
38931 int64_t  CS_LDK_ChainMonitor_as_Listen(int64_t this_arg) {
38932         LDKChainMonitor this_arg_conv;
38933         this_arg_conv.inner = untag_ptr(this_arg);
38934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38936         this_arg_conv.is_owned = false;
38937         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38938         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
38939         return tag_ptr(ret_ret, true);
38940 }
38941
38942 int64_t  CS_LDK_ChainMonitor_as_Confirm(int64_t this_arg) {
38943         LDKChainMonitor this_arg_conv;
38944         this_arg_conv.inner = untag_ptr(this_arg);
38945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38947         this_arg_conv.is_owned = false;
38948         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38949         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
38950         return tag_ptr(ret_ret, true);
38951 }
38952
38953 int64_t  CS_LDK_ChainMonitor_as_Watch(int64_t this_arg) {
38954         LDKChainMonitor this_arg_conv;
38955         this_arg_conv.inner = untag_ptr(this_arg);
38956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38958         this_arg_conv.is_owned = false;
38959         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
38960         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
38961         return tag_ptr(ret_ret, true);
38962 }
38963
38964 int64_t  CS_LDK_ChainMonitor_as_EventsProvider(int64_t this_arg) {
38965         LDKChainMonitor this_arg_conv;
38966         this_arg_conv.inner = untag_ptr(this_arg);
38967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38969         this_arg_conv.is_owned = false;
38970         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38971         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
38972         return tag_ptr(ret_ret, true);
38973 }
38974
38975 void  CS_LDK_ChannelMonitorUpdate_free(int64_t this_obj) {
38976         LDKChannelMonitorUpdate this_obj_conv;
38977         this_obj_conv.inner = untag_ptr(this_obj);
38978         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38980         ChannelMonitorUpdate_free(this_obj_conv);
38981 }
38982
38983 int64_t  CS_LDK_ChannelMonitorUpdate_get_update_id(int64_t this_ptr) {
38984         LDKChannelMonitorUpdate this_ptr_conv;
38985         this_ptr_conv.inner = untag_ptr(this_ptr);
38986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38988         this_ptr_conv.is_owned = false;
38989         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
38990         return ret_conv;
38991 }
38992
38993 void  CS_LDK_ChannelMonitorUpdate_set_update_id(int64_t this_ptr, int64_t val) {
38994         LDKChannelMonitorUpdate this_ptr_conv;
38995         this_ptr_conv.inner = untag_ptr(this_ptr);
38996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38998         this_ptr_conv.is_owned = false;
38999         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
39000 }
39001
39002 int64_t  CS_LDK_ChannelMonitorUpdate_get_channel_id(int64_t this_ptr) {
39003         LDKChannelMonitorUpdate this_ptr_conv;
39004         this_ptr_conv.inner = untag_ptr(this_ptr);
39005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39007         this_ptr_conv.is_owned = false;
39008         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
39009         int64_t ret_ref = 0;
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39012         return ret_ref;
39013 }
39014
39015 void  CS_LDK_ChannelMonitorUpdate_set_channel_id(int64_t this_ptr, int64_t val) {
39016         LDKChannelMonitorUpdate this_ptr_conv;
39017         this_ptr_conv.inner = untag_ptr(this_ptr);
39018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39020         this_ptr_conv.is_owned = false;
39021         LDKChannelId val_conv;
39022         val_conv.inner = untag_ptr(val);
39023         val_conv.is_owned = ptr_is_owned(val);
39024         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39025         val_conv = ChannelId_clone(&val_conv);
39026         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
39027 }
39028
39029 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
39030         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
39031         int64_t ret_ref = 0;
39032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39034         return ret_ref;
39035 }
39036 int64_t  CS_LDK_ChannelMonitorUpdate_clone_ptr(int64_t arg) {
39037         LDKChannelMonitorUpdate arg_conv;
39038         arg_conv.inner = untag_ptr(arg);
39039         arg_conv.is_owned = ptr_is_owned(arg);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39041         arg_conv.is_owned = false;
39042         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
39043         return ret_conv;
39044 }
39045
39046 int64_t  CS_LDK_ChannelMonitorUpdate_clone(int64_t orig) {
39047         LDKChannelMonitorUpdate orig_conv;
39048         orig_conv.inner = untag_ptr(orig);
39049         orig_conv.is_owned = ptr_is_owned(orig);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39051         orig_conv.is_owned = false;
39052         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
39053         int64_t ret_ref = 0;
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39056         return ret_ref;
39057 }
39058
39059 jboolean  CS_LDK_ChannelMonitorUpdate_eq(int64_t a, int64_t b) {
39060         LDKChannelMonitorUpdate a_conv;
39061         a_conv.inner = untag_ptr(a);
39062         a_conv.is_owned = ptr_is_owned(a);
39063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39064         a_conv.is_owned = false;
39065         LDKChannelMonitorUpdate b_conv;
39066         b_conv.inner = untag_ptr(b);
39067         b_conv.is_owned = ptr_is_owned(b);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39069         b_conv.is_owned = false;
39070         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
39071         return ret_conv;
39072 }
39073
39074 int8_tArray  CS_LDK_ChannelMonitorUpdate_write(int64_t obj) {
39075         LDKChannelMonitorUpdate obj_conv;
39076         obj_conv.inner = untag_ptr(obj);
39077         obj_conv.is_owned = ptr_is_owned(obj);
39078         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39079         obj_conv.is_owned = false;
39080         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
39081         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39082         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39083         CVec_u8Z_free(ret_var);
39084         return ret_arr;
39085 }
39086
39087 int64_t  CS_LDK_ChannelMonitorUpdate_read(int8_tArray ser) {
39088         LDKu8slice ser_ref;
39089         ser_ref.datalen = ser->arr_len;
39090         ser_ref.data = ser->elems;
39091         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
39092         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
39093         FREE(ser);
39094         return tag_ptr(ret_conv, true);
39095 }
39096
39097 void  CS_LDK_MonitorEvent_free(int64_t this_ptr) {
39098         if (!ptr_is_owned(this_ptr)) return;
39099         void* this_ptr_ptr = untag_ptr(this_ptr);
39100         CHECK_ACCESS(this_ptr_ptr);
39101         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
39102         FREE(untag_ptr(this_ptr));
39103         MonitorEvent_free(this_ptr_conv);
39104 }
39105
39106 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
39107         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39108         *ret_copy = MonitorEvent_clone(arg);
39109         int64_t ret_ref = tag_ptr(ret_copy, true);
39110         return ret_ref;
39111 }
39112 int64_t  CS_LDK_MonitorEvent_clone_ptr(int64_t arg) {
39113         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
39114         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
39115         return ret_conv;
39116 }
39117
39118 int64_t  CS_LDK_MonitorEvent_clone(int64_t orig) {
39119         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
39120         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39121         *ret_copy = MonitorEvent_clone(orig_conv);
39122         int64_t ret_ref = tag_ptr(ret_copy, true);
39123         return ret_ref;
39124 }
39125
39126 int64_t  CS_LDK_MonitorEvent_htlcevent(int64_t a) {
39127         LDKHTLCUpdate a_conv;
39128         a_conv.inner = untag_ptr(a);
39129         a_conv.is_owned = ptr_is_owned(a);
39130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39131         a_conv = HTLCUpdate_clone(&a_conv);
39132         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39133         *ret_copy = MonitorEvent_htlcevent(a_conv);
39134         int64_t ret_ref = tag_ptr(ret_copy, true);
39135         return ret_ref;
39136 }
39137
39138 int64_t  CS_LDK_MonitorEvent_holder_force_closed_with_info(int64_t reason, int64_t outpoint, int64_t channel_id) {
39139         void* reason_ptr = untag_ptr(reason);
39140         CHECK_ACCESS(reason_ptr);
39141         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
39142         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
39143         LDKOutPoint outpoint_conv;
39144         outpoint_conv.inner = untag_ptr(outpoint);
39145         outpoint_conv.is_owned = ptr_is_owned(outpoint);
39146         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
39147         outpoint_conv = OutPoint_clone(&outpoint_conv);
39148         LDKChannelId channel_id_conv;
39149         channel_id_conv.inner = untag_ptr(channel_id);
39150         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39152         channel_id_conv = ChannelId_clone(&channel_id_conv);
39153         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39154         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
39155         int64_t ret_ref = tag_ptr(ret_copy, true);
39156         return ret_ref;
39157 }
39158
39159 int64_t  CS_LDK_MonitorEvent_holder_force_closed(int64_t a) {
39160         LDKOutPoint a_conv;
39161         a_conv.inner = untag_ptr(a);
39162         a_conv.is_owned = ptr_is_owned(a);
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39164         a_conv = OutPoint_clone(&a_conv);
39165         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39166         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
39167         int64_t ret_ref = tag_ptr(ret_copy, true);
39168         return ret_ref;
39169 }
39170
39171 int64_t  CS_LDK_MonitorEvent_completed(int64_t funding_txo, int64_t channel_id, int64_t monitor_update_id) {
39172         LDKOutPoint funding_txo_conv;
39173         funding_txo_conv.inner = untag_ptr(funding_txo);
39174         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39175         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39176         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39177         LDKChannelId channel_id_conv;
39178         channel_id_conv.inner = untag_ptr(channel_id);
39179         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39180         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39181         channel_id_conv = ChannelId_clone(&channel_id_conv);
39182         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39183         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
39184         int64_t ret_ref = tag_ptr(ret_copy, true);
39185         return ret_ref;
39186 }
39187
39188 jboolean  CS_LDK_MonitorEvent_eq(int64_t a, int64_t b) {
39189         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
39190         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
39191         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
39192         return ret_conv;
39193 }
39194
39195 int8_tArray  CS_LDK_MonitorEvent_write(int64_t obj) {
39196         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
39197         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
39198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39200         CVec_u8Z_free(ret_var);
39201         return ret_arr;
39202 }
39203
39204 int64_t  CS_LDK_MonitorEvent_read(int8_tArray ser) {
39205         LDKu8slice ser_ref;
39206         ser_ref.datalen = ser->arr_len;
39207         ser_ref.data = ser->elems;
39208         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
39209         *ret_conv = MonitorEvent_read(ser_ref);
39210         FREE(ser);
39211         return tag_ptr(ret_conv, true);
39212 }
39213
39214 void  CS_LDK_HTLCUpdate_free(int64_t this_obj) {
39215         LDKHTLCUpdate this_obj_conv;
39216         this_obj_conv.inner = untag_ptr(this_obj);
39217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39219         HTLCUpdate_free(this_obj_conv);
39220 }
39221
39222 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
39223         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
39224         int64_t ret_ref = 0;
39225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39227         return ret_ref;
39228 }
39229 int64_t  CS_LDK_HTLCUpdate_clone_ptr(int64_t arg) {
39230         LDKHTLCUpdate arg_conv;
39231         arg_conv.inner = untag_ptr(arg);
39232         arg_conv.is_owned = ptr_is_owned(arg);
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39234         arg_conv.is_owned = false;
39235         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
39236         return ret_conv;
39237 }
39238
39239 int64_t  CS_LDK_HTLCUpdate_clone(int64_t orig) {
39240         LDKHTLCUpdate orig_conv;
39241         orig_conv.inner = untag_ptr(orig);
39242         orig_conv.is_owned = ptr_is_owned(orig);
39243         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39244         orig_conv.is_owned = false;
39245         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
39246         int64_t ret_ref = 0;
39247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39249         return ret_ref;
39250 }
39251
39252 jboolean  CS_LDK_HTLCUpdate_eq(int64_t a, int64_t b) {
39253         LDKHTLCUpdate a_conv;
39254         a_conv.inner = untag_ptr(a);
39255         a_conv.is_owned = ptr_is_owned(a);
39256         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39257         a_conv.is_owned = false;
39258         LDKHTLCUpdate b_conv;
39259         b_conv.inner = untag_ptr(b);
39260         b_conv.is_owned = ptr_is_owned(b);
39261         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39262         b_conv.is_owned = false;
39263         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
39264         return ret_conv;
39265 }
39266
39267 int8_tArray  CS_LDK_HTLCUpdate_write(int64_t obj) {
39268         LDKHTLCUpdate obj_conv;
39269         obj_conv.inner = untag_ptr(obj);
39270         obj_conv.is_owned = ptr_is_owned(obj);
39271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39272         obj_conv.is_owned = false;
39273         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
39274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39276         CVec_u8Z_free(ret_var);
39277         return ret_arr;
39278 }
39279
39280 int64_t  CS_LDK_HTLCUpdate_read(int8_tArray ser) {
39281         LDKu8slice ser_ref;
39282         ser_ref.datalen = ser->arr_len;
39283         ser_ref.data = ser->elems;
39284         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
39285         *ret_conv = HTLCUpdate_read(ser_ref);
39286         FREE(ser);
39287         return tag_ptr(ret_conv, true);
39288 }
39289
39290 void  CS_LDK_Balance_free(int64_t this_ptr) {
39291         if (!ptr_is_owned(this_ptr)) return;
39292         void* this_ptr_ptr = untag_ptr(this_ptr);
39293         CHECK_ACCESS(this_ptr_ptr);
39294         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
39295         FREE(untag_ptr(this_ptr));
39296         Balance_free(this_ptr_conv);
39297 }
39298
39299 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
39300         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39301         *ret_copy = Balance_clone(arg);
39302         int64_t ret_ref = tag_ptr(ret_copy, true);
39303         return ret_ref;
39304 }
39305 int64_t  CS_LDK_Balance_clone_ptr(int64_t arg) {
39306         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
39307         int64_t ret_conv = Balance_clone_ptr(arg_conv);
39308         return ret_conv;
39309 }
39310
39311 int64_t  CS_LDK_Balance_clone(int64_t orig) {
39312         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
39313         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39314         *ret_copy = Balance_clone(orig_conv);
39315         int64_t ret_ref = tag_ptr(ret_copy, true);
39316         return ret_ref;
39317 }
39318
39319 int64_t  CS_LDK_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
39320         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39321         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
39322         int64_t ret_ref = tag_ptr(ret_copy, true);
39323         return ret_ref;
39324 }
39325
39326 int64_t  CS_LDK_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
39327         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39328         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
39329         int64_t ret_ref = tag_ptr(ret_copy, true);
39330         return ret_ref;
39331 }
39332
39333 int64_t  CS_LDK_Balance_contentious_claimable(int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
39334         LDKThirtyTwoBytes payment_hash_ref;
39335         CHECK(payment_hash->arr_len == 32);
39336         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39337         LDKThirtyTwoBytes payment_preimage_ref;
39338         CHECK(payment_preimage->arr_len == 32);
39339         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39340         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39341         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
39342         int64_t ret_ref = tag_ptr(ret_copy, true);
39343         return ret_ref;
39344 }
39345
39346 int64_t  CS_LDK_Balance_maybe_timeout_claimable_htlc(int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
39347         LDKThirtyTwoBytes payment_hash_ref;
39348         CHECK(payment_hash->arr_len == 32);
39349         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39350         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39351         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
39352         int64_t ret_ref = tag_ptr(ret_copy, true);
39353         return ret_ref;
39354 }
39355
39356 int64_t  CS_LDK_Balance_maybe_preimage_claimable_htlc(int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
39357         LDKThirtyTwoBytes payment_hash_ref;
39358         CHECK(payment_hash->arr_len == 32);
39359         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39360         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39361         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
39362         int64_t ret_ref = tag_ptr(ret_copy, true);
39363         return ret_ref;
39364 }
39365
39366 int64_t  CS_LDK_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
39367         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39368         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
39369         int64_t ret_ref = tag_ptr(ret_copy, true);
39370         return ret_ref;
39371 }
39372
39373 jboolean  CS_LDK_Balance_eq(int64_t a, int64_t b) {
39374         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
39375         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
39376         jboolean ret_conv = Balance_eq(a_conv, b_conv);
39377         return ret_conv;
39378 }
39379
39380 int64_t  CS_LDK_Balance_claimable_amount_satoshis(int64_t this_arg) {
39381         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
39382         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
39383         return ret_conv;
39384 }
39385
39386 void  CS_LDK_ChannelMonitor_free(int64_t this_obj) {
39387         LDKChannelMonitor this_obj_conv;
39388         this_obj_conv.inner = untag_ptr(this_obj);
39389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39391         ChannelMonitor_free(this_obj_conv);
39392 }
39393
39394 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
39395         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
39396         int64_t ret_ref = 0;
39397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39399         return ret_ref;
39400 }
39401 int64_t  CS_LDK_ChannelMonitor_clone_ptr(int64_t arg) {
39402         LDKChannelMonitor arg_conv;
39403         arg_conv.inner = untag_ptr(arg);
39404         arg_conv.is_owned = ptr_is_owned(arg);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39406         arg_conv.is_owned = false;
39407         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
39408         return ret_conv;
39409 }
39410
39411 int64_t  CS_LDK_ChannelMonitor_clone(int64_t orig) {
39412         LDKChannelMonitor orig_conv;
39413         orig_conv.inner = untag_ptr(orig);
39414         orig_conv.is_owned = ptr_is_owned(orig);
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39416         orig_conv.is_owned = false;
39417         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
39418         int64_t ret_ref = 0;
39419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39421         return ret_ref;
39422 }
39423
39424 int8_tArray  CS_LDK_ChannelMonitor_write(int64_t obj) {
39425         LDKChannelMonitor obj_conv;
39426         obj_conv.inner = untag_ptr(obj);
39427         obj_conv.is_owned = ptr_is_owned(obj);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39429         obj_conv.is_owned = false;
39430         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
39431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39433         CVec_u8Z_free(ret_var);
39434         return ret_arr;
39435 }
39436
39437 int64_t  CS_LDK_ChannelMonitor_update_monitor(int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39438         LDKChannelMonitor this_arg_conv;
39439         this_arg_conv.inner = untag_ptr(this_arg);
39440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39442         this_arg_conv.is_owned = false;
39443         LDKChannelMonitorUpdate updates_conv;
39444         updates_conv.inner = untag_ptr(updates);
39445         updates_conv.is_owned = ptr_is_owned(updates);
39446         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
39447         updates_conv.is_owned = false;
39448         void* broadcaster_ptr = untag_ptr(broadcaster);
39449         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39450         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39451         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39452         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39453         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39454         void* logger_ptr = untag_ptr(logger);
39455         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39456         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39457         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
39458         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39459         return tag_ptr(ret_conv, true);
39460 }
39461
39462 int64_t  CS_LDK_ChannelMonitor_get_latest_update_id(int64_t this_arg) {
39463         LDKChannelMonitor this_arg_conv;
39464         this_arg_conv.inner = untag_ptr(this_arg);
39465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39467         this_arg_conv.is_owned = false;
39468         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
39469         return ret_conv;
39470 }
39471
39472 int64_t  CS_LDK_ChannelMonitor_get_funding_txo(int64_t this_arg) {
39473         LDKChannelMonitor this_arg_conv;
39474         this_arg_conv.inner = untag_ptr(this_arg);
39475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39477         this_arg_conv.is_owned = false;
39478         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
39479         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
39480         return tag_ptr(ret_conv, true);
39481 }
39482
39483 int64_t  CS_LDK_ChannelMonitor_channel_id(int64_t this_arg) {
39484         LDKChannelMonitor this_arg_conv;
39485         this_arg_conv.inner = untag_ptr(this_arg);
39486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39488         this_arg_conv.is_owned = false;
39489         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
39490         int64_t ret_ref = 0;
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39493         return ret_ref;
39494 }
39495
39496 int64_tArray  CS_LDK_ChannelMonitor_get_outputs_to_watch(int64_t this_arg) {
39497         LDKChannelMonitor this_arg_conv;
39498         this_arg_conv.inner = untag_ptr(this_arg);
39499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39501         this_arg_conv.is_owned = false;
39502         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
39503         int64_tArray ret_arr = NULL;
39504         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39505         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39506         for (size_t a = 0; a < ret_var.datalen; a++) {
39507                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
39508                 *ret_conv_52_conv = ret_var.data[a];
39509                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
39510         }
39511         
39512         FREE(ret_var.data);
39513         return ret_arr;
39514 }
39515
39516 void  CS_LDK_ChannelMonitor_load_outputs_to_watch(int64_t this_arg, int64_t filter, int64_t logger) {
39517         LDKChannelMonitor this_arg_conv;
39518         this_arg_conv.inner = untag_ptr(this_arg);
39519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39521         this_arg_conv.is_owned = false;
39522         void* filter_ptr = untag_ptr(filter);
39523         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
39524         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
39525         void* logger_ptr = untag_ptr(logger);
39526         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39527         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39528         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
39529 }
39530
39531 int64_tArray  CS_LDK_ChannelMonitor_get_and_clear_pending_monitor_events(int64_t this_arg) {
39532         LDKChannelMonitor this_arg_conv;
39533         this_arg_conv.inner = untag_ptr(this_arg);
39534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39536         this_arg_conv.is_owned = false;
39537         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
39538         int64_tArray ret_arr = NULL;
39539         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39540         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39541         for (size_t o = 0; o < ret_var.datalen; o++) {
39542                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39543                 *ret_conv_14_copy = ret_var.data[o];
39544                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
39545                 ret_arr_ptr[o] = ret_conv_14_ref;
39546         }
39547         
39548         FREE(ret_var.data);
39549         return ret_arr;
39550 }
39551
39552 void  CS_LDK_ChannelMonitor_process_pending_events(int64_t this_arg, int64_t handler) {
39553         LDKChannelMonitor this_arg_conv;
39554         this_arg_conv.inner = untag_ptr(this_arg);
39555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39557         this_arg_conv.is_owned = false;
39558         void* handler_ptr = untag_ptr(handler);
39559         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
39560         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
39561         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
39562 }
39563
39564 int64_t  CS_LDK_ChannelMonitor_initial_counterparty_commitment_tx(int64_t this_arg) {
39565         LDKChannelMonitor this_arg_conv;
39566         this_arg_conv.inner = untag_ptr(this_arg);
39567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39569         this_arg_conv.is_owned = false;
39570         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
39571         int64_t ret_ref = 0;
39572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39574         return ret_ref;
39575 }
39576
39577 int64_tArray  CS_LDK_ChannelMonitor_counterparty_commitment_txs_from_update(int64_t this_arg, int64_t update) {
39578         LDKChannelMonitor this_arg_conv;
39579         this_arg_conv.inner = untag_ptr(this_arg);
39580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39582         this_arg_conv.is_owned = false;
39583         LDKChannelMonitorUpdate update_conv;
39584         update_conv.inner = untag_ptr(update);
39585         update_conv.is_owned = ptr_is_owned(update);
39586         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39587         update_conv.is_owned = false;
39588         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
39589         int64_tArray ret_arr = NULL;
39590         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39591         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39592         for (size_t x = 0; x < ret_var.datalen; x++) {
39593                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
39594                 int64_t ret_conv_23_ref = 0;
39595                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
39596                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
39597                 ret_arr_ptr[x] = ret_conv_23_ref;
39598         }
39599         
39600         FREE(ret_var.data);
39601         return ret_arr;
39602 }
39603
39604 int64_t  CS_LDK_ChannelMonitor_sign_to_local_justice_tx(int64_t this_arg, int8_tArray justice_tx, int64_t input_idx, int64_t value, int64_t commitment_number) {
39605         LDKChannelMonitor this_arg_conv;
39606         this_arg_conv.inner = untag_ptr(this_arg);
39607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39609         this_arg_conv.is_owned = false;
39610         LDKTransaction justice_tx_ref;
39611         justice_tx_ref.datalen = justice_tx->arr_len;
39612         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
39613         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
39614         justice_tx_ref.data_is_owned = true;
39615         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
39616         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
39617         return tag_ptr(ret_conv, true);
39618 }
39619
39620 int8_tArray  CS_LDK_ChannelMonitor_get_counterparty_node_id(int64_t this_arg) {
39621         LDKChannelMonitor this_arg_conv;
39622         this_arg_conv.inner = untag_ptr(this_arg);
39623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39625         this_arg_conv.is_owned = false;
39626         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39627         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
39628         return ret_arr;
39629 }
39630
39631 void  CS_LDK_ChannelMonitor_broadcast_latest_holder_commitment_txn(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39632         LDKChannelMonitor this_arg_conv;
39633         this_arg_conv.inner = untag_ptr(this_arg);
39634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39636         this_arg_conv.is_owned = false;
39637         void* broadcaster_ptr = untag_ptr(broadcaster);
39638         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
39639         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
39640         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39641         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
39642         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
39643         void* logger_ptr = untag_ptr(logger);
39644         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39645         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39646         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39647 }
39648
39649 int64_tArray  CS_LDK_ChannelMonitor_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39650         LDKChannelMonitor this_arg_conv;
39651         this_arg_conv.inner = untag_ptr(this_arg);
39652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39654         this_arg_conv.is_owned = false;
39655         uint8_t header_arr[80];
39656         CHECK(header->arr_len == 80);
39657         memcpy(header_arr, header->elems, 80); FREE(header);
39658         uint8_t (*header_ref)[80] = &header_arr;
39659         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39660         txdata_constr.datalen = txdata->arr_len;
39661         if (txdata_constr.datalen > 0)
39662                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39663         else
39664                 txdata_constr.data = NULL;
39665         int64_t* txdata_vals = txdata->elems;
39666         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39667                 int64_t txdata_conv_28 = txdata_vals[c];
39668                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39669                 CHECK_ACCESS(txdata_conv_28_ptr);
39670                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39671                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39672                 txdata_constr.data[c] = txdata_conv_28_conv;
39673         }
39674         FREE(txdata);
39675         void* broadcaster_ptr = untag_ptr(broadcaster);
39676         CHECK_ACCESS(broadcaster_ptr);
39677         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39678         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39679                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39680                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39681         }
39682         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39683         CHECK_ACCESS(fee_estimator_ptr);
39684         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39685         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39686                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39687                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39688         }
39689         void* logger_ptr = untag_ptr(logger);
39690         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39691         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39692         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);
39693         int64_tArray ret_arr = NULL;
39694         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39695         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39696         for (size_t x = 0; x < ret_var.datalen; x++) {
39697                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39698                 *ret_conv_49_conv = ret_var.data[x];
39699                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39700         }
39701         
39702         FREE(ret_var.data);
39703         return ret_arr;
39704 }
39705
39706 void  CS_LDK_ChannelMonitor_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39707         LDKChannelMonitor this_arg_conv;
39708         this_arg_conv.inner = untag_ptr(this_arg);
39709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39711         this_arg_conv.is_owned = false;
39712         uint8_t header_arr[80];
39713         CHECK(header->arr_len == 80);
39714         memcpy(header_arr, header->elems, 80); FREE(header);
39715         uint8_t (*header_ref)[80] = &header_arr;
39716         void* broadcaster_ptr = untag_ptr(broadcaster);
39717         CHECK_ACCESS(broadcaster_ptr);
39718         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39719         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39720                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39721                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39722         }
39723         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39724         CHECK_ACCESS(fee_estimator_ptr);
39725         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39726         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39727                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39728                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39729         }
39730         void* logger_ptr = untag_ptr(logger);
39731         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39732         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39733         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39734 }
39735
39736 int64_tArray  CS_LDK_ChannelMonitor_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39737         LDKChannelMonitor this_arg_conv;
39738         this_arg_conv.inner = untag_ptr(this_arg);
39739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39741         this_arg_conv.is_owned = false;
39742         uint8_t header_arr[80];
39743         CHECK(header->arr_len == 80);
39744         memcpy(header_arr, header->elems, 80); FREE(header);
39745         uint8_t (*header_ref)[80] = &header_arr;
39746         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
39747         txdata_constr.datalen = txdata->arr_len;
39748         if (txdata_constr.datalen > 0)
39749                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
39750         else
39751                 txdata_constr.data = NULL;
39752         int64_t* txdata_vals = txdata->elems;
39753         for (size_t c = 0; c < txdata_constr.datalen; c++) {
39754                 int64_t txdata_conv_28 = txdata_vals[c];
39755                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
39756                 CHECK_ACCESS(txdata_conv_28_ptr);
39757                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
39758                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
39759                 txdata_constr.data[c] = txdata_conv_28_conv;
39760         }
39761         FREE(txdata);
39762         void* broadcaster_ptr = untag_ptr(broadcaster);
39763         CHECK_ACCESS(broadcaster_ptr);
39764         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39765         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39766                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39767                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39768         }
39769         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39770         CHECK_ACCESS(fee_estimator_ptr);
39771         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39772         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39773                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39774                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39775         }
39776         void* logger_ptr = untag_ptr(logger);
39777         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39778         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39779         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);
39780         int64_tArray ret_arr = NULL;
39781         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39782         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39783         for (size_t x = 0; x < ret_var.datalen; x++) {
39784                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39785                 *ret_conv_49_conv = ret_var.data[x];
39786                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39787         }
39788         
39789         FREE(ret_var.data);
39790         return ret_arr;
39791 }
39792
39793 void  CS_LDK_ChannelMonitor_transaction_unconfirmed(int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39794         LDKChannelMonitor this_arg_conv;
39795         this_arg_conv.inner = untag_ptr(this_arg);
39796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39798         this_arg_conv.is_owned = false;
39799         uint8_t txid_arr[32];
39800         CHECK(txid->arr_len == 32);
39801         memcpy(txid_arr, txid->elems, 32); FREE(txid);
39802         uint8_t (*txid_ref)[32] = &txid_arr;
39803         void* broadcaster_ptr = untag_ptr(broadcaster);
39804         CHECK_ACCESS(broadcaster_ptr);
39805         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39806         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39808                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39809         }
39810         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39811         CHECK_ACCESS(fee_estimator_ptr);
39812         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39813         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39814                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39815                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39816         }
39817         void* logger_ptr = untag_ptr(logger);
39818         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39819         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39820         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
39821 }
39822
39823 int64_tArray  CS_LDK_ChannelMonitor_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39824         LDKChannelMonitor this_arg_conv;
39825         this_arg_conv.inner = untag_ptr(this_arg);
39826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39828         this_arg_conv.is_owned = false;
39829         uint8_t header_arr[80];
39830         CHECK(header->arr_len == 80);
39831         memcpy(header_arr, header->elems, 80); FREE(header);
39832         uint8_t (*header_ref)[80] = &header_arr;
39833         void* broadcaster_ptr = untag_ptr(broadcaster);
39834         CHECK_ACCESS(broadcaster_ptr);
39835         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39836         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39837                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39838                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39839         }
39840         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39841         CHECK_ACCESS(fee_estimator_ptr);
39842         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39843         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39845                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39846         }
39847         void* logger_ptr = untag_ptr(logger);
39848         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39849         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39850         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
39851         int64_tArray ret_arr = NULL;
39852         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39853         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39854         for (size_t x = 0; x < ret_var.datalen; x++) {
39855                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
39856                 *ret_conv_49_conv = ret_var.data[x];
39857                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
39858         }
39859         
39860         FREE(ret_var.data);
39861         return ret_arr;
39862 }
39863
39864 int64_tArray  CS_LDK_ChannelMonitor_get_relevant_txids(int64_t this_arg) {
39865         LDKChannelMonitor this_arg_conv;
39866         this_arg_conv.inner = untag_ptr(this_arg);
39867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39869         this_arg_conv.is_owned = false;
39870         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
39871         int64_tArray ret_arr = NULL;
39872         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39873         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39874         for (size_t c = 0; c < ret_var.datalen; c++) {
39875                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
39876                 *ret_conv_54_conv = ret_var.data[c];
39877                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
39878         }
39879         
39880         FREE(ret_var.data);
39881         return ret_arr;
39882 }
39883
39884 int64_t  CS_LDK_ChannelMonitor_current_best_block(int64_t this_arg) {
39885         LDKChannelMonitor this_arg_conv;
39886         this_arg_conv.inner = untag_ptr(this_arg);
39887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39889         this_arg_conv.is_owned = false;
39890         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
39891         int64_t ret_ref = 0;
39892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39894         return ret_ref;
39895 }
39896
39897 void  CS_LDK_ChannelMonitor_rebroadcast_pending_claims(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39898         LDKChannelMonitor this_arg_conv;
39899         this_arg_conv.inner = untag_ptr(this_arg);
39900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39902         this_arg_conv.is_owned = false;
39903         void* broadcaster_ptr = untag_ptr(broadcaster);
39904         CHECK_ACCESS(broadcaster_ptr);
39905         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39906         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39907                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39908                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39909         }
39910         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39911         CHECK_ACCESS(fee_estimator_ptr);
39912         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39913         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39914                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39915                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39916         }
39917         void* logger_ptr = untag_ptr(logger);
39918         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39919         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39920         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39921 }
39922
39923 void  CS_LDK_ChannelMonitor_signer_unblocked(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
39924         LDKChannelMonitor this_arg_conv;
39925         this_arg_conv.inner = untag_ptr(this_arg);
39926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39928         this_arg_conv.is_owned = false;
39929         void* broadcaster_ptr = untag_ptr(broadcaster);
39930         CHECK_ACCESS(broadcaster_ptr);
39931         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39932         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39934                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39935         }
39936         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39937         CHECK_ACCESS(fee_estimator_ptr);
39938         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39939         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39940                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39941                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39942         }
39943         void* logger_ptr = untag_ptr(logger);
39944         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39945         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39946         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
39947 }
39948
39949 int64_tArray  CS_LDK_ChannelMonitor_get_spendable_outputs(int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
39950         LDKChannelMonitor this_arg_conv;
39951         this_arg_conv.inner = untag_ptr(this_arg);
39952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39954         this_arg_conv.is_owned = false;
39955         LDKTransaction tx_ref;
39956         tx_ref.datalen = tx->arr_len;
39957         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
39958         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
39959         tx_ref.data_is_owned = true;
39960         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
39961         int64_tArray ret_arr = NULL;
39962         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39963         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39964         for (size_t b = 0; b < ret_var.datalen; b++) {
39965                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
39966                 *ret_conv_27_copy = ret_var.data[b];
39967                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
39968                 ret_arr_ptr[b] = ret_conv_27_ref;
39969         }
39970         
39971         FREE(ret_var.data);
39972         return ret_arr;
39973 }
39974
39975 jboolean  CS_LDK_ChannelMonitor_is_fully_resolved(int64_t this_arg, int64_t logger) {
39976         LDKChannelMonitor this_arg_conv;
39977         this_arg_conv.inner = untag_ptr(this_arg);
39978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39980         this_arg_conv.is_owned = false;
39981         void* logger_ptr = untag_ptr(logger);
39982         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
39983         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
39984         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
39985         return ret_conv;
39986 }
39987
39988 int64_tArray  CS_LDK_ChannelMonitor_get_claimable_balances(int64_t this_arg) {
39989         LDKChannelMonitor this_arg_conv;
39990         this_arg_conv.inner = untag_ptr(this_arg);
39991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39993         this_arg_conv.is_owned = false;
39994         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
39995         int64_tArray ret_arr = NULL;
39996         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39997         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39998         for (size_t j = 0; j < ret_var.datalen; j++) {
39999                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40000                 *ret_conv_9_copy = ret_var.data[j];
40001                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
40002                 ret_arr_ptr[j] = ret_conv_9_ref;
40003         }
40004         
40005         FREE(ret_var.data);
40006         return ret_arr;
40007 }
40008
40009 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
40010         LDKu8slice ser_ref;
40011         ser_ref.datalen = ser->arr_len;
40012         ser_ref.data = ser->elems;
40013         void* arg_a_ptr = untag_ptr(arg_a);
40014         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
40015         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
40016         void* arg_b_ptr = untag_ptr(arg_b);
40017         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
40018         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
40019         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
40020         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
40021         FREE(ser);
40022         return tag_ptr(ret_conv, true);
40023 }
40024
40025 void  CS_LDK_OutPoint_free(int64_t this_obj) {
40026         LDKOutPoint this_obj_conv;
40027         this_obj_conv.inner = untag_ptr(this_obj);
40028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40030         OutPoint_free(this_obj_conv);
40031 }
40032
40033 int8_tArray  CS_LDK_OutPoint_get_txid(int64_t this_ptr) {
40034         LDKOutPoint this_ptr_conv;
40035         this_ptr_conv.inner = untag_ptr(this_ptr);
40036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40038         this_ptr_conv.is_owned = false;
40039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40040         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
40041         return ret_arr;
40042 }
40043
40044 void  CS_LDK_OutPoint_set_txid(int64_t this_ptr, int8_tArray val) {
40045         LDKOutPoint this_ptr_conv;
40046         this_ptr_conv.inner = untag_ptr(this_ptr);
40047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40049         this_ptr_conv.is_owned = false;
40050         LDKThirtyTwoBytes val_ref;
40051         CHECK(val->arr_len == 32);
40052         memcpy(val_ref.data, val->elems, 32); FREE(val);
40053         OutPoint_set_txid(&this_ptr_conv, val_ref);
40054 }
40055
40056 int16_t  CS_LDK_OutPoint_get_index(int64_t this_ptr) {
40057         LDKOutPoint this_ptr_conv;
40058         this_ptr_conv.inner = untag_ptr(this_ptr);
40059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40061         this_ptr_conv.is_owned = false;
40062         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
40063         return ret_conv;
40064 }
40065
40066 void  CS_LDK_OutPoint_set_index(int64_t this_ptr, int16_t val) {
40067         LDKOutPoint this_ptr_conv;
40068         this_ptr_conv.inner = untag_ptr(this_ptr);
40069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40071         this_ptr_conv.is_owned = false;
40072         OutPoint_set_index(&this_ptr_conv, val);
40073 }
40074
40075 int64_t  CS_LDK_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
40076         LDKThirtyTwoBytes txid_arg_ref;
40077         CHECK(txid_arg->arr_len == 32);
40078         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
40079         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
40080         int64_t ret_ref = 0;
40081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40083         return ret_ref;
40084 }
40085
40086 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
40087         LDKOutPoint ret_var = OutPoint_clone(arg);
40088         int64_t ret_ref = 0;
40089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40091         return ret_ref;
40092 }
40093 int64_t  CS_LDK_OutPoint_clone_ptr(int64_t arg) {
40094         LDKOutPoint arg_conv;
40095         arg_conv.inner = untag_ptr(arg);
40096         arg_conv.is_owned = ptr_is_owned(arg);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40098         arg_conv.is_owned = false;
40099         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
40100         return ret_conv;
40101 }
40102
40103 int64_t  CS_LDK_OutPoint_clone(int64_t orig) {
40104         LDKOutPoint orig_conv;
40105         orig_conv.inner = untag_ptr(orig);
40106         orig_conv.is_owned = ptr_is_owned(orig);
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40108         orig_conv.is_owned = false;
40109         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
40110         int64_t ret_ref = 0;
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40113         return ret_ref;
40114 }
40115
40116 jboolean  CS_LDK_OutPoint_eq(int64_t a, int64_t b) {
40117         LDKOutPoint a_conv;
40118         a_conv.inner = untag_ptr(a);
40119         a_conv.is_owned = ptr_is_owned(a);
40120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40121         a_conv.is_owned = false;
40122         LDKOutPoint b_conv;
40123         b_conv.inner = untag_ptr(b);
40124         b_conv.is_owned = ptr_is_owned(b);
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40126         b_conv.is_owned = false;
40127         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
40128         return ret_conv;
40129 }
40130
40131 int64_t  CS_LDK_OutPoint_hash(int64_t o) {
40132         LDKOutPoint o_conv;
40133         o_conv.inner = untag_ptr(o);
40134         o_conv.is_owned = ptr_is_owned(o);
40135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40136         o_conv.is_owned = false;
40137         int64_t ret_conv = OutPoint_hash(&o_conv);
40138         return ret_conv;
40139 }
40140
40141 int8_tArray  CS_LDK_OutPoint_write(int64_t obj) {
40142         LDKOutPoint obj_conv;
40143         obj_conv.inner = untag_ptr(obj);
40144         obj_conv.is_owned = ptr_is_owned(obj);
40145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40146         obj_conv.is_owned = false;
40147         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
40148         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40149         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40150         CVec_u8Z_free(ret_var);
40151         return ret_arr;
40152 }
40153
40154 int64_t  CS_LDK_OutPoint_read(int8_tArray ser) {
40155         LDKu8slice ser_ref;
40156         ser_ref.datalen = ser->arr_len;
40157         ser_ref.data = ser->elems;
40158         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
40159         *ret_conv = OutPoint_read(ser_ref);
40160         FREE(ser);
40161         return tag_ptr(ret_conv, true);
40162 }
40163
40164 void  CS_LDK_InboundHTLCErr_free(int64_t this_obj) {
40165         LDKInboundHTLCErr this_obj_conv;
40166         this_obj_conv.inner = untag_ptr(this_obj);
40167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40169         InboundHTLCErr_free(this_obj_conv);
40170 }
40171
40172 int16_t  CS_LDK_InboundHTLCErr_get_err_code(int64_t this_ptr) {
40173         LDKInboundHTLCErr this_ptr_conv;
40174         this_ptr_conv.inner = untag_ptr(this_ptr);
40175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40177         this_ptr_conv.is_owned = false;
40178         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
40179         return ret_conv;
40180 }
40181
40182 void  CS_LDK_InboundHTLCErr_set_err_code(int64_t this_ptr, int16_t val) {
40183         LDKInboundHTLCErr this_ptr_conv;
40184         this_ptr_conv.inner = untag_ptr(this_ptr);
40185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40187         this_ptr_conv.is_owned = false;
40188         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
40189 }
40190
40191 int8_tArray  CS_LDK_InboundHTLCErr_get_err_data(int64_t this_ptr) {
40192         LDKInboundHTLCErr this_ptr_conv;
40193         this_ptr_conv.inner = untag_ptr(this_ptr);
40194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40196         this_ptr_conv.is_owned = false;
40197         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
40198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40200         CVec_u8Z_free(ret_var);
40201         return ret_arr;
40202 }
40203
40204 void  CS_LDK_InboundHTLCErr_set_err_data(int64_t this_ptr, int8_tArray val) {
40205         LDKInboundHTLCErr this_ptr_conv;
40206         this_ptr_conv.inner = untag_ptr(this_ptr);
40207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40209         this_ptr_conv.is_owned = false;
40210         LDKCVec_u8Z val_ref;
40211         val_ref.datalen = val->arr_len;
40212         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40213         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40214         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
40215 }
40216
40217 jstring  CS_LDK_InboundHTLCErr_get_msg(int64_t this_ptr) {
40218         LDKInboundHTLCErr this_ptr_conv;
40219         this_ptr_conv.inner = untag_ptr(this_ptr);
40220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40222         this_ptr_conv.is_owned = false;
40223         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
40224         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
40225         Str_free(ret_str);
40226         return ret_conv;
40227 }
40228
40229 void  CS_LDK_InboundHTLCErr_set_msg(int64_t this_ptr, jstring val) {
40230         LDKInboundHTLCErr this_ptr_conv;
40231         this_ptr_conv.inner = untag_ptr(this_ptr);
40232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40234         this_ptr_conv.is_owned = false;
40235         LDKStr val_conv = str_ref_to_owned_c(val);
40236         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
40237 }
40238
40239 int64_t  CS_LDK_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
40240         LDKCVec_u8Z err_data_arg_ref;
40241         err_data_arg_ref.datalen = err_data_arg->arr_len;
40242         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40243         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
40244         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
40245         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
40246         int64_t ret_ref = 0;
40247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40249         return ret_ref;
40250 }
40251
40252 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
40253         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
40254         int64_t ret_ref = 0;
40255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40257         return ret_ref;
40258 }
40259 int64_t  CS_LDK_InboundHTLCErr_clone_ptr(int64_t arg) {
40260         LDKInboundHTLCErr arg_conv;
40261         arg_conv.inner = untag_ptr(arg);
40262         arg_conv.is_owned = ptr_is_owned(arg);
40263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40264         arg_conv.is_owned = false;
40265         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
40266         return ret_conv;
40267 }
40268
40269 int64_t  CS_LDK_InboundHTLCErr_clone(int64_t orig) {
40270         LDKInboundHTLCErr orig_conv;
40271         orig_conv.inner = untag_ptr(orig);
40272         orig_conv.is_owned = ptr_is_owned(orig);
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40274         orig_conv.is_owned = false;
40275         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
40276         int64_t ret_ref = 0;
40277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40279         return ret_ref;
40280 }
40281
40282 int64_t  CS_LDK_InboundHTLCErr_hash(int64_t o) {
40283         LDKInboundHTLCErr o_conv;
40284         o_conv.inner = untag_ptr(o);
40285         o_conv.is_owned = ptr_is_owned(o);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40287         o_conv.is_owned = false;
40288         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
40289         return ret_conv;
40290 }
40291
40292 jboolean  CS_LDK_InboundHTLCErr_eq(int64_t a, int64_t b) {
40293         LDKInboundHTLCErr a_conv;
40294         a_conv.inner = untag_ptr(a);
40295         a_conv.is_owned = ptr_is_owned(a);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40297         a_conv.is_owned = false;
40298         LDKInboundHTLCErr b_conv;
40299         b_conv.inner = untag_ptr(b);
40300         b_conv.is_owned = ptr_is_owned(b);
40301         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40302         b_conv.is_owned = false;
40303         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
40304         return ret_conv;
40305 }
40306
40307 int64_t  CS_LDK_peel_payment_onion(int64_t msg, int64_t node_signer, int64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
40308         LDKUpdateAddHTLC msg_conv;
40309         msg_conv.inner = untag_ptr(msg);
40310         msg_conv.is_owned = ptr_is_owned(msg);
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40312         msg_conv.is_owned = false;
40313         void* node_signer_ptr = untag_ptr(node_signer);
40314         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
40315         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
40316         void* logger_ptr = untag_ptr(logger);
40317         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40318         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40319         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
40320         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
40321         return tag_ptr(ret_conv, true);
40322 }
40323
40324 void  CS_LDK_PendingHTLCRouting_free(int64_t this_ptr) {
40325         if (!ptr_is_owned(this_ptr)) return;
40326         void* this_ptr_ptr = untag_ptr(this_ptr);
40327         CHECK_ACCESS(this_ptr_ptr);
40328         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
40329         FREE(untag_ptr(this_ptr));
40330         PendingHTLCRouting_free(this_ptr_conv);
40331 }
40332
40333 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
40334         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40335         *ret_copy = PendingHTLCRouting_clone(arg);
40336         int64_t ret_ref = tag_ptr(ret_copy, true);
40337         return ret_ref;
40338 }
40339 int64_t  CS_LDK_PendingHTLCRouting_clone_ptr(int64_t arg) {
40340         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
40341         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
40342         return ret_conv;
40343 }
40344
40345 int64_t  CS_LDK_PendingHTLCRouting_clone(int64_t orig) {
40346         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
40347         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40348         *ret_copy = PendingHTLCRouting_clone(orig_conv);
40349         int64_t ret_ref = tag_ptr(ret_copy, true);
40350         return ret_ref;
40351 }
40352
40353 int64_t  CS_LDK_PendingHTLCRouting_forward(int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
40354         LDKOnionPacket onion_packet_conv;
40355         onion_packet_conv.inner = untag_ptr(onion_packet);
40356         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
40357         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
40358         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
40359         LDKBlindedForward blinded_conv;
40360         blinded_conv.inner = untag_ptr(blinded);
40361         blinded_conv.is_owned = ptr_is_owned(blinded);
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
40363         blinded_conv = BlindedForward_clone(&blinded_conv);
40364         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40365         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
40366         int64_t ret_ref = tag_ptr(ret_copy, true);
40367         return ret_ref;
40368 }
40369
40370 int64_t  CS_LDK_PendingHTLCRouting_receive(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) {
40371         LDKFinalOnionHopData payment_data_conv;
40372         payment_data_conv.inner = untag_ptr(payment_data);
40373         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40374         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40375         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40376         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40377         CHECK_ACCESS(payment_metadata_ptr);
40378         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40379         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40380         void* payment_context_ptr = untag_ptr(payment_context);
40381         CHECK_ACCESS(payment_context_ptr);
40382         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
40383         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
40384         LDKThirtyTwoBytes phantom_shared_secret_ref;
40385         CHECK(phantom_shared_secret->arr_len == 32);
40386         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
40387         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40388         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40389         if (custom_tlvs_constr.datalen > 0)
40390                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40391         else
40392                 custom_tlvs_constr.data = NULL;
40393         int64_t* custom_tlvs_vals = custom_tlvs->elems;
40394         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40395                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40396                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40397                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40398                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40399                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40400                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40401         }
40402         FREE(custom_tlvs);
40403         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40404         *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);
40405         int64_t ret_ref = tag_ptr(ret_copy, true);
40406         return ret_ref;
40407 }
40408
40409 int64_t  CS_LDK_PendingHTLCRouting_receive_keysend(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) {
40410         LDKFinalOnionHopData payment_data_conv;
40411         payment_data_conv.inner = untag_ptr(payment_data);
40412         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40413         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40414         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40415         LDKThirtyTwoBytes payment_preimage_ref;
40416         CHECK(payment_preimage->arr_len == 32);
40417         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40418         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40419         CHECK_ACCESS(payment_metadata_ptr);
40420         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40421         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40422         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40423         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40424         if (custom_tlvs_constr.datalen > 0)
40425                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40426         else
40427                 custom_tlvs_constr.data = NULL;
40428         int64_t* custom_tlvs_vals = custom_tlvs->elems;
40429         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40430                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40431                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40432                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40433                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40434                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40435                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40436         }
40437         FREE(custom_tlvs);
40438         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40439         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
40440         int64_t ret_ref = tag_ptr(ret_copy, true);
40441         return ret_ref;
40442 }
40443
40444 void  CS_LDK_BlindedForward_free(int64_t this_obj) {
40445         LDKBlindedForward this_obj_conv;
40446         this_obj_conv.inner = untag_ptr(this_obj);
40447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40449         BlindedForward_free(this_obj_conv);
40450 }
40451
40452 int8_tArray  CS_LDK_BlindedForward_get_inbound_blinding_point(int64_t this_ptr) {
40453         LDKBlindedForward this_ptr_conv;
40454         this_ptr_conv.inner = untag_ptr(this_ptr);
40455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40457         this_ptr_conv.is_owned = false;
40458         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40459         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
40460         return ret_arr;
40461 }
40462
40463 void  CS_LDK_BlindedForward_set_inbound_blinding_point(int64_t this_ptr, int8_tArray val) {
40464         LDKBlindedForward this_ptr_conv;
40465         this_ptr_conv.inner = untag_ptr(this_ptr);
40466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40468         this_ptr_conv.is_owned = false;
40469         LDKPublicKey val_ref;
40470         CHECK(val->arr_len == 33);
40471         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40472         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
40473 }
40474
40475 int32_t  CS_LDK_BlindedForward_get_failure(int64_t this_ptr) {
40476         LDKBlindedForward this_ptr_conv;
40477         this_ptr_conv.inner = untag_ptr(this_ptr);
40478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40480         this_ptr_conv.is_owned = false;
40481         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedForward_get_failure(&this_ptr_conv));
40482         return ret_conv;
40483 }
40484
40485 void  CS_LDK_BlindedForward_set_failure(int64_t this_ptr, int32_t val) {
40486         LDKBlindedForward this_ptr_conv;
40487         this_ptr_conv.inner = untag_ptr(this_ptr);
40488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40490         this_ptr_conv.is_owned = false;
40491         LDKBlindedFailure val_conv = LDKBlindedFailure_from_cs(val);
40492         BlindedForward_set_failure(&this_ptr_conv, val_conv);
40493 }
40494
40495 int64_t  CS_LDK_BlindedForward_new(int8_tArray inbound_blinding_point_arg, int32_t failure_arg) {
40496         LDKPublicKey inbound_blinding_point_arg_ref;
40497         CHECK(inbound_blinding_point_arg->arr_len == 33);
40498         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
40499         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_cs(failure_arg);
40500         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
40501         int64_t ret_ref = 0;
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40504         return ret_ref;
40505 }
40506
40507 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
40508         LDKBlindedForward ret_var = BlindedForward_clone(arg);
40509         int64_t ret_ref = 0;
40510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40512         return ret_ref;
40513 }
40514 int64_t  CS_LDK_BlindedForward_clone_ptr(int64_t arg) {
40515         LDKBlindedForward arg_conv;
40516         arg_conv.inner = untag_ptr(arg);
40517         arg_conv.is_owned = ptr_is_owned(arg);
40518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40519         arg_conv.is_owned = false;
40520         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
40521         return ret_conv;
40522 }
40523
40524 int64_t  CS_LDK_BlindedForward_clone(int64_t orig) {
40525         LDKBlindedForward orig_conv;
40526         orig_conv.inner = untag_ptr(orig);
40527         orig_conv.is_owned = ptr_is_owned(orig);
40528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40529         orig_conv.is_owned = false;
40530         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
40531         int64_t ret_ref = 0;
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40534         return ret_ref;
40535 }
40536
40537 int64_t  CS_LDK_BlindedForward_hash(int64_t o) {
40538         LDKBlindedForward o_conv;
40539         o_conv.inner = untag_ptr(o);
40540         o_conv.is_owned = ptr_is_owned(o);
40541         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40542         o_conv.is_owned = false;
40543         int64_t ret_conv = BlindedForward_hash(&o_conv);
40544         return ret_conv;
40545 }
40546
40547 jboolean  CS_LDK_BlindedForward_eq(int64_t a, int64_t b) {
40548         LDKBlindedForward a_conv;
40549         a_conv.inner = untag_ptr(a);
40550         a_conv.is_owned = ptr_is_owned(a);
40551         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40552         a_conv.is_owned = false;
40553         LDKBlindedForward b_conv;
40554         b_conv.inner = untag_ptr(b);
40555         b_conv.is_owned = ptr_is_owned(b);
40556         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40557         b_conv.is_owned = false;
40558         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
40559         return ret_conv;
40560 }
40561
40562 void  CS_LDK_PendingHTLCInfo_free(int64_t this_obj) {
40563         LDKPendingHTLCInfo this_obj_conv;
40564         this_obj_conv.inner = untag_ptr(this_obj);
40565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40567         PendingHTLCInfo_free(this_obj_conv);
40568 }
40569
40570 int64_t  CS_LDK_PendingHTLCInfo_get_routing(int64_t this_ptr) {
40571         LDKPendingHTLCInfo this_ptr_conv;
40572         this_ptr_conv.inner = untag_ptr(this_ptr);
40573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40575         this_ptr_conv.is_owned = false;
40576         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40577         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
40578         int64_t ret_ref = tag_ptr(ret_copy, true);
40579         return ret_ref;
40580 }
40581
40582 void  CS_LDK_PendingHTLCInfo_set_routing(int64_t this_ptr, int64_t val) {
40583         LDKPendingHTLCInfo this_ptr_conv;
40584         this_ptr_conv.inner = untag_ptr(this_ptr);
40585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40587         this_ptr_conv.is_owned = false;
40588         void* val_ptr = untag_ptr(val);
40589         CHECK_ACCESS(val_ptr);
40590         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
40591         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
40592         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
40593 }
40594
40595 int8_tArray  CS_LDK_PendingHTLCInfo_get_incoming_shared_secret(int64_t this_ptr) {
40596         LDKPendingHTLCInfo this_ptr_conv;
40597         this_ptr_conv.inner = untag_ptr(this_ptr);
40598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40600         this_ptr_conv.is_owned = false;
40601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40602         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
40603         return ret_arr;
40604 }
40605
40606 void  CS_LDK_PendingHTLCInfo_set_incoming_shared_secret(int64_t this_ptr, int8_tArray val) {
40607         LDKPendingHTLCInfo this_ptr_conv;
40608         this_ptr_conv.inner = untag_ptr(this_ptr);
40609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40611         this_ptr_conv.is_owned = false;
40612         LDKThirtyTwoBytes val_ref;
40613         CHECK(val->arr_len == 32);
40614         memcpy(val_ref.data, val->elems, 32); FREE(val);
40615         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
40616 }
40617
40618 int8_tArray  CS_LDK_PendingHTLCInfo_get_payment_hash(int64_t this_ptr) {
40619         LDKPendingHTLCInfo this_ptr_conv;
40620         this_ptr_conv.inner = untag_ptr(this_ptr);
40621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40623         this_ptr_conv.is_owned = false;
40624         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40625         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
40626         return ret_arr;
40627 }
40628
40629 void  CS_LDK_PendingHTLCInfo_set_payment_hash(int64_t this_ptr, int8_tArray val) {
40630         LDKPendingHTLCInfo this_ptr_conv;
40631         this_ptr_conv.inner = untag_ptr(this_ptr);
40632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40634         this_ptr_conv.is_owned = false;
40635         LDKThirtyTwoBytes val_ref;
40636         CHECK(val->arr_len == 32);
40637         memcpy(val_ref.data, val->elems, 32); FREE(val);
40638         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
40639 }
40640
40641 int64_t  CS_LDK_PendingHTLCInfo_get_incoming_amt_msat(int64_t this_ptr) {
40642         LDKPendingHTLCInfo this_ptr_conv;
40643         this_ptr_conv.inner = untag_ptr(this_ptr);
40644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40646         this_ptr_conv.is_owned = false;
40647         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40648         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
40649         int64_t ret_ref = tag_ptr(ret_copy, true);
40650         return ret_ref;
40651 }
40652
40653 void  CS_LDK_PendingHTLCInfo_set_incoming_amt_msat(int64_t this_ptr, int64_t val) {
40654         LDKPendingHTLCInfo this_ptr_conv;
40655         this_ptr_conv.inner = untag_ptr(this_ptr);
40656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40658         this_ptr_conv.is_owned = false;
40659         void* val_ptr = untag_ptr(val);
40660         CHECK_ACCESS(val_ptr);
40661         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40662         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40663         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
40664 }
40665
40666 int64_t  CS_LDK_PendingHTLCInfo_get_outgoing_amt_msat(int64_t this_ptr) {
40667         LDKPendingHTLCInfo this_ptr_conv;
40668         this_ptr_conv.inner = untag_ptr(this_ptr);
40669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40671         this_ptr_conv.is_owned = false;
40672         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
40673         return ret_conv;
40674 }
40675
40676 void  CS_LDK_PendingHTLCInfo_set_outgoing_amt_msat(int64_t this_ptr, int64_t val) {
40677         LDKPendingHTLCInfo this_ptr_conv;
40678         this_ptr_conv.inner = untag_ptr(this_ptr);
40679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40681         this_ptr_conv.is_owned = false;
40682         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
40683 }
40684
40685 int32_t  CS_LDK_PendingHTLCInfo_get_outgoing_cltv_value(int64_t this_ptr) {
40686         LDKPendingHTLCInfo this_ptr_conv;
40687         this_ptr_conv.inner = untag_ptr(this_ptr);
40688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40690         this_ptr_conv.is_owned = false;
40691         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
40692         return ret_conv;
40693 }
40694
40695 void  CS_LDK_PendingHTLCInfo_set_outgoing_cltv_value(int64_t this_ptr, int32_t val) {
40696         LDKPendingHTLCInfo this_ptr_conv;
40697         this_ptr_conv.inner = untag_ptr(this_ptr);
40698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40700         this_ptr_conv.is_owned = false;
40701         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
40702 }
40703
40704 int64_t  CS_LDK_PendingHTLCInfo_get_skimmed_fee_msat(int64_t this_ptr) {
40705         LDKPendingHTLCInfo this_ptr_conv;
40706         this_ptr_conv.inner = untag_ptr(this_ptr);
40707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40709         this_ptr_conv.is_owned = false;
40710         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40711         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
40712         int64_t ret_ref = tag_ptr(ret_copy, true);
40713         return ret_ref;
40714 }
40715
40716 void  CS_LDK_PendingHTLCInfo_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
40717         LDKPendingHTLCInfo this_ptr_conv;
40718         this_ptr_conv.inner = untag_ptr(this_ptr);
40719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40721         this_ptr_conv.is_owned = false;
40722         void* val_ptr = untag_ptr(val);
40723         CHECK_ACCESS(val_ptr);
40724         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40725         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
40726         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
40727 }
40728
40729 int64_t  CS_LDK_PendingHTLCInfo_new(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) {
40730         void* routing_arg_ptr = untag_ptr(routing_arg);
40731         CHECK_ACCESS(routing_arg_ptr);
40732         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
40733         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
40734         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
40735         CHECK(incoming_shared_secret_arg->arr_len == 32);
40736         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
40737         LDKThirtyTwoBytes payment_hash_arg_ref;
40738         CHECK(payment_hash_arg->arr_len == 32);
40739         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
40740         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
40741         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
40742         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
40743         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
40744         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
40745         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
40746         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
40747         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
40748         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);
40749         int64_t ret_ref = 0;
40750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40752         return ret_ref;
40753 }
40754
40755 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
40756         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
40757         int64_t ret_ref = 0;
40758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40760         return ret_ref;
40761 }
40762 int64_t  CS_LDK_PendingHTLCInfo_clone_ptr(int64_t arg) {
40763         LDKPendingHTLCInfo arg_conv;
40764         arg_conv.inner = untag_ptr(arg);
40765         arg_conv.is_owned = ptr_is_owned(arg);
40766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40767         arg_conv.is_owned = false;
40768         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
40769         return ret_conv;
40770 }
40771
40772 int64_t  CS_LDK_PendingHTLCInfo_clone(int64_t orig) {
40773         LDKPendingHTLCInfo orig_conv;
40774         orig_conv.inner = untag_ptr(orig);
40775         orig_conv.is_owned = ptr_is_owned(orig);
40776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40777         orig_conv.is_owned = false;
40778         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
40779         int64_t ret_ref = 0;
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40782         return ret_ref;
40783 }
40784
40785 int32_t  CS_LDK_BlindedFailure_clone(int64_t orig) {
40786         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
40787         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_clone(orig_conv));
40788         return ret_conv;
40789 }
40790
40791 int32_t  CS_LDK_BlindedFailure_from_introduction_node() {
40792         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_introduction_node());
40793         return ret_conv;
40794 }
40795
40796 int32_t  CS_LDK_BlindedFailure_from_blinded_node() {
40797         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_blinded_node());
40798         return ret_conv;
40799 }
40800
40801 int64_t  CS_LDK_BlindedFailure_hash(int64_t o) {
40802         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
40803         int64_t ret_conv = BlindedFailure_hash(o_conv);
40804         return ret_conv;
40805 }
40806
40807 jboolean  CS_LDK_BlindedFailure_eq(int64_t a, int64_t b) {
40808         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
40809         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
40810         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
40811         return ret_conv;
40812 }
40813
40814 void  CS_LDK_FailureCode_free(int64_t this_ptr) {
40815         if (!ptr_is_owned(this_ptr)) return;
40816         void* this_ptr_ptr = untag_ptr(this_ptr);
40817         CHECK_ACCESS(this_ptr_ptr);
40818         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
40819         FREE(untag_ptr(this_ptr));
40820         FailureCode_free(this_ptr_conv);
40821 }
40822
40823 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
40824         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40825         *ret_copy = FailureCode_clone(arg);
40826         int64_t ret_ref = tag_ptr(ret_copy, true);
40827         return ret_ref;
40828 }
40829 int64_t  CS_LDK_FailureCode_clone_ptr(int64_t arg) {
40830         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
40831         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
40832         return ret_conv;
40833 }
40834
40835 int64_t  CS_LDK_FailureCode_clone(int64_t orig) {
40836         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
40837         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40838         *ret_copy = FailureCode_clone(orig_conv);
40839         int64_t ret_ref = tag_ptr(ret_copy, true);
40840         return ret_ref;
40841 }
40842
40843 int64_t  CS_LDK_FailureCode_temporary_node_failure() {
40844         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40845         *ret_copy = FailureCode_temporary_node_failure();
40846         int64_t ret_ref = tag_ptr(ret_copy, true);
40847         return ret_ref;
40848 }
40849
40850 int64_t  CS_LDK_FailureCode_required_node_feature_missing() {
40851         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40852         *ret_copy = FailureCode_required_node_feature_missing();
40853         int64_t ret_ref = tag_ptr(ret_copy, true);
40854         return ret_ref;
40855 }
40856
40857 int64_t  CS_LDK_FailureCode_incorrect_or_unknown_payment_details() {
40858         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40859         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
40860         int64_t ret_ref = tag_ptr(ret_copy, true);
40861         return ret_ref;
40862 }
40863
40864 int64_t  CS_LDK_FailureCode_invalid_onion_payload(int64_t a) {
40865         void* a_ptr = untag_ptr(a);
40866         CHECK_ACCESS(a_ptr);
40867         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
40868         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
40869         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
40870         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
40871         int64_t ret_ref = tag_ptr(ret_copy, true);
40872         return ret_ref;
40873 }
40874
40875 void  CS_LDK_ChannelManager_free(int64_t this_obj) {
40876         LDKChannelManager this_obj_conv;
40877         this_obj_conv.inner = untag_ptr(this_obj);
40878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40880         ChannelManager_free(this_obj_conv);
40881 }
40882
40883 void  CS_LDK_ChainParameters_free(int64_t this_obj) {
40884         LDKChainParameters this_obj_conv;
40885         this_obj_conv.inner = untag_ptr(this_obj);
40886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40888         ChainParameters_free(this_obj_conv);
40889 }
40890
40891 int32_t  CS_LDK_ChainParameters_get_network(int64_t this_ptr) {
40892         LDKChainParameters this_ptr_conv;
40893         this_ptr_conv.inner = untag_ptr(this_ptr);
40894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40896         this_ptr_conv.is_owned = false;
40897         int32_t ret_conv = LDKNetwork_to_cs(ChainParameters_get_network(&this_ptr_conv));
40898         return ret_conv;
40899 }
40900
40901 void  CS_LDK_ChainParameters_set_network(int64_t this_ptr, int32_t val) {
40902         LDKChainParameters this_ptr_conv;
40903         this_ptr_conv.inner = untag_ptr(this_ptr);
40904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40906         this_ptr_conv.is_owned = false;
40907         LDKNetwork val_conv = LDKNetwork_from_cs(val);
40908         ChainParameters_set_network(&this_ptr_conv, val_conv);
40909 }
40910
40911 int64_t  CS_LDK_ChainParameters_get_best_block(int64_t this_ptr) {
40912         LDKChainParameters this_ptr_conv;
40913         this_ptr_conv.inner = untag_ptr(this_ptr);
40914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40916         this_ptr_conv.is_owned = false;
40917         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
40918         int64_t ret_ref = 0;
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40921         return ret_ref;
40922 }
40923
40924 void  CS_LDK_ChainParameters_set_best_block(int64_t this_ptr, int64_t val) {
40925         LDKChainParameters this_ptr_conv;
40926         this_ptr_conv.inner = untag_ptr(this_ptr);
40927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40929         this_ptr_conv.is_owned = false;
40930         LDKBestBlock val_conv;
40931         val_conv.inner = untag_ptr(val);
40932         val_conv.is_owned = ptr_is_owned(val);
40933         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40934         val_conv = BestBlock_clone(&val_conv);
40935         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
40936 }
40937
40938 int64_t  CS_LDK_ChainParameters_new(int32_t network_arg, int64_t best_block_arg) {
40939         LDKNetwork network_arg_conv = LDKNetwork_from_cs(network_arg);
40940         LDKBestBlock best_block_arg_conv;
40941         best_block_arg_conv.inner = untag_ptr(best_block_arg);
40942         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
40943         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
40944         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
40945         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
40946         int64_t ret_ref = 0;
40947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40949         return ret_ref;
40950 }
40951
40952 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
40953         LDKChainParameters ret_var = ChainParameters_clone(arg);
40954         int64_t ret_ref = 0;
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40957         return ret_ref;
40958 }
40959 int64_t  CS_LDK_ChainParameters_clone_ptr(int64_t arg) {
40960         LDKChainParameters arg_conv;
40961         arg_conv.inner = untag_ptr(arg);
40962         arg_conv.is_owned = ptr_is_owned(arg);
40963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40964         arg_conv.is_owned = false;
40965         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
40966         return ret_conv;
40967 }
40968
40969 int64_t  CS_LDK_ChainParameters_clone(int64_t orig) {
40970         LDKChainParameters orig_conv;
40971         orig_conv.inner = untag_ptr(orig);
40972         orig_conv.is_owned = ptr_is_owned(orig);
40973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40974         orig_conv.is_owned = false;
40975         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
40976         int64_t ret_ref = 0;
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40979         return ret_ref;
40980 }
40981
40982 void  CS_LDK_CounterpartyForwardingInfo_free(int64_t this_obj) {
40983         LDKCounterpartyForwardingInfo this_obj_conv;
40984         this_obj_conv.inner = untag_ptr(this_obj);
40985         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40987         CounterpartyForwardingInfo_free(this_obj_conv);
40988 }
40989
40990 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_base_msat(int64_t this_ptr) {
40991         LDKCounterpartyForwardingInfo this_ptr_conv;
40992         this_ptr_conv.inner = untag_ptr(this_ptr);
40993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40995         this_ptr_conv.is_owned = false;
40996         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
40997         return ret_conv;
40998 }
40999
41000 void  CS_LDK_CounterpartyForwardingInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
41001         LDKCounterpartyForwardingInfo this_ptr_conv;
41002         this_ptr_conv.inner = untag_ptr(this_ptr);
41003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41005         this_ptr_conv.is_owned = false;
41006         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
41007 }
41008
41009 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_proportional_millionths(int64_t this_ptr) {
41010         LDKCounterpartyForwardingInfo this_ptr_conv;
41011         this_ptr_conv.inner = untag_ptr(this_ptr);
41012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41014         this_ptr_conv.is_owned = false;
41015         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
41016         return ret_conv;
41017 }
41018
41019 void  CS_LDK_CounterpartyForwardingInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
41020         LDKCounterpartyForwardingInfo this_ptr_conv;
41021         this_ptr_conv.inner = untag_ptr(this_ptr);
41022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41024         this_ptr_conv.is_owned = false;
41025         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
41026 }
41027
41028 int16_t  CS_LDK_CounterpartyForwardingInfo_get_cltv_expiry_delta(int64_t this_ptr) {
41029         LDKCounterpartyForwardingInfo this_ptr_conv;
41030         this_ptr_conv.inner = untag_ptr(this_ptr);
41031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41033         this_ptr_conv.is_owned = false;
41034         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
41035         return ret_conv;
41036 }
41037
41038 void  CS_LDK_CounterpartyForwardingInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
41039         LDKCounterpartyForwardingInfo this_ptr_conv;
41040         this_ptr_conv.inner = untag_ptr(this_ptr);
41041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41043         this_ptr_conv.is_owned = false;
41044         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41045 }
41046
41047 int64_t  CS_LDK_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
41048         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
41049         int64_t ret_ref = 0;
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41052         return ret_ref;
41053 }
41054
41055 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
41056         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
41057         int64_t ret_ref = 0;
41058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41060         return ret_ref;
41061 }
41062 int64_t  CS_LDK_CounterpartyForwardingInfo_clone_ptr(int64_t arg) {
41063         LDKCounterpartyForwardingInfo arg_conv;
41064         arg_conv.inner = untag_ptr(arg);
41065         arg_conv.is_owned = ptr_is_owned(arg);
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41067         arg_conv.is_owned = false;
41068         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
41069         return ret_conv;
41070 }
41071
41072 int64_t  CS_LDK_CounterpartyForwardingInfo_clone(int64_t orig) {
41073         LDKCounterpartyForwardingInfo orig_conv;
41074         orig_conv.inner = untag_ptr(orig);
41075         orig_conv.is_owned = ptr_is_owned(orig);
41076         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41077         orig_conv.is_owned = false;
41078         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
41079         int64_t ret_ref = 0;
41080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41082         return ret_ref;
41083 }
41084
41085 void  CS_LDK_ChannelCounterparty_free(int64_t this_obj) {
41086         LDKChannelCounterparty this_obj_conv;
41087         this_obj_conv.inner = untag_ptr(this_obj);
41088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41090         ChannelCounterparty_free(this_obj_conv);
41091 }
41092
41093 int8_tArray  CS_LDK_ChannelCounterparty_get_node_id(int64_t this_ptr) {
41094         LDKChannelCounterparty this_ptr_conv;
41095         this_ptr_conv.inner = untag_ptr(this_ptr);
41096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41098         this_ptr_conv.is_owned = false;
41099         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41100         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
41101         return ret_arr;
41102 }
41103
41104 void  CS_LDK_ChannelCounterparty_set_node_id(int64_t this_ptr, int8_tArray val) {
41105         LDKChannelCounterparty this_ptr_conv;
41106         this_ptr_conv.inner = untag_ptr(this_ptr);
41107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41109         this_ptr_conv.is_owned = false;
41110         LDKPublicKey val_ref;
41111         CHECK(val->arr_len == 33);
41112         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41113         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
41114 }
41115
41116 int64_t  CS_LDK_ChannelCounterparty_get_features(int64_t this_ptr) {
41117         LDKChannelCounterparty this_ptr_conv;
41118         this_ptr_conv.inner = untag_ptr(this_ptr);
41119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41121         this_ptr_conv.is_owned = false;
41122         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
41123         int64_t ret_ref = 0;
41124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41126         return ret_ref;
41127 }
41128
41129 void  CS_LDK_ChannelCounterparty_set_features(int64_t this_ptr, int64_t val) {
41130         LDKChannelCounterparty this_ptr_conv;
41131         this_ptr_conv.inner = untag_ptr(this_ptr);
41132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41134         this_ptr_conv.is_owned = false;
41135         LDKInitFeatures val_conv;
41136         val_conv.inner = untag_ptr(val);
41137         val_conv.is_owned = ptr_is_owned(val);
41138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41139         val_conv = InitFeatures_clone(&val_conv);
41140         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
41141 }
41142
41143 int64_t  CS_LDK_ChannelCounterparty_get_unspendable_punishment_reserve(int64_t this_ptr) {
41144         LDKChannelCounterparty this_ptr_conv;
41145         this_ptr_conv.inner = untag_ptr(this_ptr);
41146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41148         this_ptr_conv.is_owned = false;
41149         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
41150         return ret_conv;
41151 }
41152
41153 void  CS_LDK_ChannelCounterparty_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
41154         LDKChannelCounterparty this_ptr_conv;
41155         this_ptr_conv.inner = untag_ptr(this_ptr);
41156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41158         this_ptr_conv.is_owned = false;
41159         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
41160 }
41161
41162 int64_t  CS_LDK_ChannelCounterparty_get_forwarding_info(int64_t this_ptr) {
41163         LDKChannelCounterparty this_ptr_conv;
41164         this_ptr_conv.inner = untag_ptr(this_ptr);
41165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41167         this_ptr_conv.is_owned = false;
41168         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
41169         int64_t ret_ref = 0;
41170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41172         return ret_ref;
41173 }
41174
41175 void  CS_LDK_ChannelCounterparty_set_forwarding_info(int64_t this_ptr, int64_t val) {
41176         LDKChannelCounterparty this_ptr_conv;
41177         this_ptr_conv.inner = untag_ptr(this_ptr);
41178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41180         this_ptr_conv.is_owned = false;
41181         LDKCounterpartyForwardingInfo val_conv;
41182         val_conv.inner = untag_ptr(val);
41183         val_conv.is_owned = ptr_is_owned(val);
41184         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41185         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
41186         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
41187 }
41188
41189 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_minimum_msat(int64_t this_ptr) {
41190         LDKChannelCounterparty this_ptr_conv;
41191         this_ptr_conv.inner = untag_ptr(this_ptr);
41192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41194         this_ptr_conv.is_owned = false;
41195         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41196         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
41197         int64_t ret_ref = tag_ptr(ret_copy, true);
41198         return ret_ref;
41199 }
41200
41201 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
41202         LDKChannelCounterparty this_ptr_conv;
41203         this_ptr_conv.inner = untag_ptr(this_ptr);
41204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41206         this_ptr_conv.is_owned = false;
41207         void* val_ptr = untag_ptr(val);
41208         CHECK_ACCESS(val_ptr);
41209         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41210         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41211         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
41212 }
41213
41214 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_maximum_msat(int64_t this_ptr) {
41215         LDKChannelCounterparty this_ptr_conv;
41216         this_ptr_conv.inner = untag_ptr(this_ptr);
41217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41219         this_ptr_conv.is_owned = false;
41220         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41221         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
41222         int64_t ret_ref = tag_ptr(ret_copy, true);
41223         return ret_ref;
41224 }
41225
41226 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
41227         LDKChannelCounterparty this_ptr_conv;
41228         this_ptr_conv.inner = untag_ptr(this_ptr);
41229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41231         this_ptr_conv.is_owned = false;
41232         void* val_ptr = untag_ptr(val);
41233         CHECK_ACCESS(val_ptr);
41234         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41235         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41236         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
41237 }
41238
41239 int64_t  CS_LDK_ChannelCounterparty_new(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) {
41240         LDKPublicKey node_id_arg_ref;
41241         CHECK(node_id_arg->arr_len == 33);
41242         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
41243         LDKInitFeatures features_arg_conv;
41244         features_arg_conv.inner = untag_ptr(features_arg);
41245         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41247         features_arg_conv = InitFeatures_clone(&features_arg_conv);
41248         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
41249         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
41250         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
41252         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
41253         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
41254         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
41255         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
41256         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
41257         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
41258         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
41259         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
41260         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
41261         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);
41262         int64_t ret_ref = 0;
41263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41265         return ret_ref;
41266 }
41267
41268 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
41269         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
41270         int64_t ret_ref = 0;
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41273         return ret_ref;
41274 }
41275 int64_t  CS_LDK_ChannelCounterparty_clone_ptr(int64_t arg) {
41276         LDKChannelCounterparty arg_conv;
41277         arg_conv.inner = untag_ptr(arg);
41278         arg_conv.is_owned = ptr_is_owned(arg);
41279         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41280         arg_conv.is_owned = false;
41281         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
41282         return ret_conv;
41283 }
41284
41285 int64_t  CS_LDK_ChannelCounterparty_clone(int64_t orig) {
41286         LDKChannelCounterparty orig_conv;
41287         orig_conv.inner = untag_ptr(orig);
41288         orig_conv.is_owned = ptr_is_owned(orig);
41289         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41290         orig_conv.is_owned = false;
41291         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
41292         int64_t ret_ref = 0;
41293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41295         return ret_ref;
41296 }
41297
41298 void  CS_LDK_ChannelDetails_free(int64_t this_obj) {
41299         LDKChannelDetails this_obj_conv;
41300         this_obj_conv.inner = untag_ptr(this_obj);
41301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41303         ChannelDetails_free(this_obj_conv);
41304 }
41305
41306 int64_t  CS_LDK_ChannelDetails_get_channel_id(int64_t this_ptr) {
41307         LDKChannelDetails this_ptr_conv;
41308         this_ptr_conv.inner = untag_ptr(this_ptr);
41309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41311         this_ptr_conv.is_owned = false;
41312         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
41313         int64_t ret_ref = 0;
41314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41316         return ret_ref;
41317 }
41318
41319 void  CS_LDK_ChannelDetails_set_channel_id(int64_t this_ptr, int64_t val) {
41320         LDKChannelDetails this_ptr_conv;
41321         this_ptr_conv.inner = untag_ptr(this_ptr);
41322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41324         this_ptr_conv.is_owned = false;
41325         LDKChannelId val_conv;
41326         val_conv.inner = untag_ptr(val);
41327         val_conv.is_owned = ptr_is_owned(val);
41328         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41329         val_conv = ChannelId_clone(&val_conv);
41330         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
41331 }
41332
41333 int64_t  CS_LDK_ChannelDetails_get_counterparty(int64_t this_ptr) {
41334         LDKChannelDetails this_ptr_conv;
41335         this_ptr_conv.inner = untag_ptr(this_ptr);
41336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41338         this_ptr_conv.is_owned = false;
41339         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
41340         int64_t ret_ref = 0;
41341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41343         return ret_ref;
41344 }
41345
41346 void  CS_LDK_ChannelDetails_set_counterparty(int64_t this_ptr, int64_t val) {
41347         LDKChannelDetails this_ptr_conv;
41348         this_ptr_conv.inner = untag_ptr(this_ptr);
41349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41351         this_ptr_conv.is_owned = false;
41352         LDKChannelCounterparty val_conv;
41353         val_conv.inner = untag_ptr(val);
41354         val_conv.is_owned = ptr_is_owned(val);
41355         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41356         val_conv = ChannelCounterparty_clone(&val_conv);
41357         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
41358 }
41359
41360 int64_t  CS_LDK_ChannelDetails_get_funding_txo(int64_t this_ptr) {
41361         LDKChannelDetails this_ptr_conv;
41362         this_ptr_conv.inner = untag_ptr(this_ptr);
41363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41365         this_ptr_conv.is_owned = false;
41366         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
41367         int64_t ret_ref = 0;
41368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41370         return ret_ref;
41371 }
41372
41373 void  CS_LDK_ChannelDetails_set_funding_txo(int64_t this_ptr, int64_t val) {
41374         LDKChannelDetails this_ptr_conv;
41375         this_ptr_conv.inner = untag_ptr(this_ptr);
41376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41378         this_ptr_conv.is_owned = false;
41379         LDKOutPoint val_conv;
41380         val_conv.inner = untag_ptr(val);
41381         val_conv.is_owned = ptr_is_owned(val);
41382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41383         val_conv = OutPoint_clone(&val_conv);
41384         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
41385 }
41386
41387 int64_t  CS_LDK_ChannelDetails_get_channel_type(int64_t this_ptr) {
41388         LDKChannelDetails this_ptr_conv;
41389         this_ptr_conv.inner = untag_ptr(this_ptr);
41390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41392         this_ptr_conv.is_owned = false;
41393         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
41394         int64_t ret_ref = 0;
41395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41397         return ret_ref;
41398 }
41399
41400 void  CS_LDK_ChannelDetails_set_channel_type(int64_t this_ptr, int64_t val) {
41401         LDKChannelDetails this_ptr_conv;
41402         this_ptr_conv.inner = untag_ptr(this_ptr);
41403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41405         this_ptr_conv.is_owned = false;
41406         LDKChannelTypeFeatures val_conv;
41407         val_conv.inner = untag_ptr(val);
41408         val_conv.is_owned = ptr_is_owned(val);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41410         val_conv = ChannelTypeFeatures_clone(&val_conv);
41411         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
41412 }
41413
41414 int64_t  CS_LDK_ChannelDetails_get_short_channel_id(int64_t this_ptr) {
41415         LDKChannelDetails this_ptr_conv;
41416         this_ptr_conv.inner = untag_ptr(this_ptr);
41417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41419         this_ptr_conv.is_owned = false;
41420         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41421         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
41422         int64_t ret_ref = tag_ptr(ret_copy, true);
41423         return ret_ref;
41424 }
41425
41426 void  CS_LDK_ChannelDetails_set_short_channel_id(int64_t this_ptr, int64_t val) {
41427         LDKChannelDetails this_ptr_conv;
41428         this_ptr_conv.inner = untag_ptr(this_ptr);
41429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41431         this_ptr_conv.is_owned = false;
41432         void* val_ptr = untag_ptr(val);
41433         CHECK_ACCESS(val_ptr);
41434         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41435         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41436         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
41437 }
41438
41439 int64_t  CS_LDK_ChannelDetails_get_outbound_scid_alias(int64_t this_ptr) {
41440         LDKChannelDetails this_ptr_conv;
41441         this_ptr_conv.inner = untag_ptr(this_ptr);
41442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41444         this_ptr_conv.is_owned = false;
41445         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41446         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
41447         int64_t ret_ref = tag_ptr(ret_copy, true);
41448         return ret_ref;
41449 }
41450
41451 void  CS_LDK_ChannelDetails_set_outbound_scid_alias(int64_t this_ptr, int64_t val) {
41452         LDKChannelDetails this_ptr_conv;
41453         this_ptr_conv.inner = untag_ptr(this_ptr);
41454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41456         this_ptr_conv.is_owned = false;
41457         void* val_ptr = untag_ptr(val);
41458         CHECK_ACCESS(val_ptr);
41459         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41460         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41461         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
41462 }
41463
41464 int64_t  CS_LDK_ChannelDetails_get_inbound_scid_alias(int64_t this_ptr) {
41465         LDKChannelDetails this_ptr_conv;
41466         this_ptr_conv.inner = untag_ptr(this_ptr);
41467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41469         this_ptr_conv.is_owned = false;
41470         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41471         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
41472         int64_t ret_ref = tag_ptr(ret_copy, true);
41473         return ret_ref;
41474 }
41475
41476 void  CS_LDK_ChannelDetails_set_inbound_scid_alias(int64_t this_ptr, int64_t val) {
41477         LDKChannelDetails this_ptr_conv;
41478         this_ptr_conv.inner = untag_ptr(this_ptr);
41479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41481         this_ptr_conv.is_owned = false;
41482         void* val_ptr = untag_ptr(val);
41483         CHECK_ACCESS(val_ptr);
41484         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41485         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41486         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
41487 }
41488
41489 int64_t  CS_LDK_ChannelDetails_get_channel_value_satoshis(int64_t this_ptr) {
41490         LDKChannelDetails this_ptr_conv;
41491         this_ptr_conv.inner = untag_ptr(this_ptr);
41492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41494         this_ptr_conv.is_owned = false;
41495         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
41496         return ret_conv;
41497 }
41498
41499 void  CS_LDK_ChannelDetails_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
41500         LDKChannelDetails this_ptr_conv;
41501         this_ptr_conv.inner = untag_ptr(this_ptr);
41502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41504         this_ptr_conv.is_owned = false;
41505         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
41506 }
41507
41508 int64_t  CS_LDK_ChannelDetails_get_unspendable_punishment_reserve(int64_t this_ptr) {
41509         LDKChannelDetails this_ptr_conv;
41510         this_ptr_conv.inner = untag_ptr(this_ptr);
41511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41513         this_ptr_conv.is_owned = false;
41514         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41515         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
41516         int64_t ret_ref = tag_ptr(ret_copy, true);
41517         return ret_ref;
41518 }
41519
41520 void  CS_LDK_ChannelDetails_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
41521         LDKChannelDetails this_ptr_conv;
41522         this_ptr_conv.inner = untag_ptr(this_ptr);
41523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525         this_ptr_conv.is_owned = false;
41526         void* val_ptr = untag_ptr(val);
41527         CHECK_ACCESS(val_ptr);
41528         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41529         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41530         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
41531 }
41532
41533 int8_tArray  CS_LDK_ChannelDetails_get_user_channel_id(int64_t this_ptr) {
41534         LDKChannelDetails this_ptr_conv;
41535         this_ptr_conv.inner = untag_ptr(this_ptr);
41536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41538         this_ptr_conv.is_owned = false;
41539         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
41540         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
41541         return ret_arr;
41542 }
41543
41544 void  CS_LDK_ChannelDetails_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
41545         LDKChannelDetails this_ptr_conv;
41546         this_ptr_conv.inner = untag_ptr(this_ptr);
41547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41549         this_ptr_conv.is_owned = false;
41550         LDKU128 val_ref;
41551         CHECK(val->arr_len == 16);
41552         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
41553         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
41554 }
41555
41556 int64_t  CS_LDK_ChannelDetails_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
41557         LDKChannelDetails this_ptr_conv;
41558         this_ptr_conv.inner = untag_ptr(this_ptr);
41559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41561         this_ptr_conv.is_owned = false;
41562         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41563         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
41564         int64_t ret_ref = tag_ptr(ret_copy, true);
41565         return ret_ref;
41566 }
41567
41568 void  CS_LDK_ChannelDetails_set_feerate_sat_per_1000_weight(int64_t this_ptr, int64_t val) {
41569         LDKChannelDetails this_ptr_conv;
41570         this_ptr_conv.inner = untag_ptr(this_ptr);
41571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41573         this_ptr_conv.is_owned = false;
41574         void* val_ptr = untag_ptr(val);
41575         CHECK_ACCESS(val_ptr);
41576         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41577         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41578         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
41579 }
41580
41581 int64_t  CS_LDK_ChannelDetails_get_balance_msat(int64_t this_ptr) {
41582         LDKChannelDetails this_ptr_conv;
41583         this_ptr_conv.inner = untag_ptr(this_ptr);
41584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41586         this_ptr_conv.is_owned = false;
41587         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
41588         return ret_conv;
41589 }
41590
41591 void  CS_LDK_ChannelDetails_set_balance_msat(int64_t this_ptr, int64_t val) {
41592         LDKChannelDetails this_ptr_conv;
41593         this_ptr_conv.inner = untag_ptr(this_ptr);
41594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41596         this_ptr_conv.is_owned = false;
41597         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
41598 }
41599
41600 int64_t  CS_LDK_ChannelDetails_get_outbound_capacity_msat(int64_t this_ptr) {
41601         LDKChannelDetails this_ptr_conv;
41602         this_ptr_conv.inner = untag_ptr(this_ptr);
41603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41605         this_ptr_conv.is_owned = false;
41606         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
41607         return ret_conv;
41608 }
41609
41610 void  CS_LDK_ChannelDetails_set_outbound_capacity_msat(int64_t this_ptr, int64_t val) {
41611         LDKChannelDetails this_ptr_conv;
41612         this_ptr_conv.inner = untag_ptr(this_ptr);
41613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41615         this_ptr_conv.is_owned = false;
41616         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
41617 }
41618
41619 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_limit_msat(int64_t this_ptr) {
41620         LDKChannelDetails this_ptr_conv;
41621         this_ptr_conv.inner = untag_ptr(this_ptr);
41622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41624         this_ptr_conv.is_owned = false;
41625         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
41626         return ret_conv;
41627 }
41628
41629 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_limit_msat(int64_t this_ptr, int64_t val) {
41630         LDKChannelDetails this_ptr_conv;
41631         this_ptr_conv.inner = untag_ptr(this_ptr);
41632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41634         this_ptr_conv.is_owned = false;
41635         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
41636 }
41637
41638 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_minimum_msat(int64_t this_ptr) {
41639         LDKChannelDetails this_ptr_conv;
41640         this_ptr_conv.inner = untag_ptr(this_ptr);
41641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41643         this_ptr_conv.is_owned = false;
41644         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
41645         return ret_conv;
41646 }
41647
41648 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
41649         LDKChannelDetails this_ptr_conv;
41650         this_ptr_conv.inner = untag_ptr(this_ptr);
41651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41653         this_ptr_conv.is_owned = false;
41654         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
41655 }
41656
41657 int64_t  CS_LDK_ChannelDetails_get_inbound_capacity_msat(int64_t this_ptr) {
41658         LDKChannelDetails this_ptr_conv;
41659         this_ptr_conv.inner = untag_ptr(this_ptr);
41660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41662         this_ptr_conv.is_owned = false;
41663         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
41664         return ret_conv;
41665 }
41666
41667 void  CS_LDK_ChannelDetails_set_inbound_capacity_msat(int64_t this_ptr, int64_t val) {
41668         LDKChannelDetails this_ptr_conv;
41669         this_ptr_conv.inner = untag_ptr(this_ptr);
41670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41672         this_ptr_conv.is_owned = false;
41673         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
41674 }
41675
41676 int64_t  CS_LDK_ChannelDetails_get_confirmations_required(int64_t this_ptr) {
41677         LDKChannelDetails this_ptr_conv;
41678         this_ptr_conv.inner = untag_ptr(this_ptr);
41679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41681         this_ptr_conv.is_owned = false;
41682         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41683         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
41684         int64_t ret_ref = tag_ptr(ret_copy, true);
41685         return ret_ref;
41686 }
41687
41688 void  CS_LDK_ChannelDetails_set_confirmations_required(int64_t this_ptr, int64_t val) {
41689         LDKChannelDetails this_ptr_conv;
41690         this_ptr_conv.inner = untag_ptr(this_ptr);
41691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41693         this_ptr_conv.is_owned = false;
41694         void* val_ptr = untag_ptr(val);
41695         CHECK_ACCESS(val_ptr);
41696         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41697         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41698         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
41699 }
41700
41701 int64_t  CS_LDK_ChannelDetails_get_confirmations(int64_t this_ptr) {
41702         LDKChannelDetails this_ptr_conv;
41703         this_ptr_conv.inner = untag_ptr(this_ptr);
41704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41706         this_ptr_conv.is_owned = false;
41707         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
41708         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
41709         int64_t ret_ref = tag_ptr(ret_copy, true);
41710         return ret_ref;
41711 }
41712
41713 void  CS_LDK_ChannelDetails_set_confirmations(int64_t this_ptr, int64_t val) {
41714         LDKChannelDetails this_ptr_conv;
41715         this_ptr_conv.inner = untag_ptr(this_ptr);
41716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41718         this_ptr_conv.is_owned = false;
41719         void* val_ptr = untag_ptr(val);
41720         CHECK_ACCESS(val_ptr);
41721         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
41722         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
41723         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
41724 }
41725
41726 int64_t  CS_LDK_ChannelDetails_get_force_close_spend_delay(int64_t this_ptr) {
41727         LDKChannelDetails this_ptr_conv;
41728         this_ptr_conv.inner = untag_ptr(this_ptr);
41729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41731         this_ptr_conv.is_owned = false;
41732         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
41733         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
41734         int64_t ret_ref = tag_ptr(ret_copy, true);
41735         return ret_ref;
41736 }
41737
41738 void  CS_LDK_ChannelDetails_set_force_close_spend_delay(int64_t this_ptr, int64_t val) {
41739         LDKChannelDetails this_ptr_conv;
41740         this_ptr_conv.inner = untag_ptr(this_ptr);
41741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41743         this_ptr_conv.is_owned = false;
41744         void* val_ptr = untag_ptr(val);
41745         CHECK_ACCESS(val_ptr);
41746         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
41747         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
41748         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
41749 }
41750
41751 jboolean  CS_LDK_ChannelDetails_get_is_outbound(int64_t this_ptr) {
41752         LDKChannelDetails this_ptr_conv;
41753         this_ptr_conv.inner = untag_ptr(this_ptr);
41754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41756         this_ptr_conv.is_owned = false;
41757         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
41758         return ret_conv;
41759 }
41760
41761 void  CS_LDK_ChannelDetails_set_is_outbound(int64_t this_ptr, jboolean val) {
41762         LDKChannelDetails this_ptr_conv;
41763         this_ptr_conv.inner = untag_ptr(this_ptr);
41764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41766         this_ptr_conv.is_owned = false;
41767         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
41768 }
41769
41770 jboolean  CS_LDK_ChannelDetails_get_is_channel_ready(int64_t this_ptr) {
41771         LDKChannelDetails this_ptr_conv;
41772         this_ptr_conv.inner = untag_ptr(this_ptr);
41773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41775         this_ptr_conv.is_owned = false;
41776         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
41777         return ret_conv;
41778 }
41779
41780 void  CS_LDK_ChannelDetails_set_is_channel_ready(int64_t this_ptr, jboolean val) {
41781         LDKChannelDetails this_ptr_conv;
41782         this_ptr_conv.inner = untag_ptr(this_ptr);
41783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41785         this_ptr_conv.is_owned = false;
41786         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
41787 }
41788
41789 int64_t  CS_LDK_ChannelDetails_get_channel_shutdown_state(int64_t this_ptr) {
41790         LDKChannelDetails this_ptr_conv;
41791         this_ptr_conv.inner = untag_ptr(this_ptr);
41792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41794         this_ptr_conv.is_owned = false;
41795         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
41796         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
41797         int64_t ret_ref = tag_ptr(ret_copy, true);
41798         return ret_ref;
41799 }
41800
41801 void  CS_LDK_ChannelDetails_set_channel_shutdown_state(int64_t this_ptr, int64_t val) {
41802         LDKChannelDetails this_ptr_conv;
41803         this_ptr_conv.inner = untag_ptr(this_ptr);
41804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41806         this_ptr_conv.is_owned = false;
41807         void* val_ptr = untag_ptr(val);
41808         CHECK_ACCESS(val_ptr);
41809         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
41810         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
41811         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
41812 }
41813
41814 jboolean  CS_LDK_ChannelDetails_get_is_usable(int64_t this_ptr) {
41815         LDKChannelDetails this_ptr_conv;
41816         this_ptr_conv.inner = untag_ptr(this_ptr);
41817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41819         this_ptr_conv.is_owned = false;
41820         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
41821         return ret_conv;
41822 }
41823
41824 void  CS_LDK_ChannelDetails_set_is_usable(int64_t this_ptr, jboolean val) {
41825         LDKChannelDetails this_ptr_conv;
41826         this_ptr_conv.inner = untag_ptr(this_ptr);
41827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41829         this_ptr_conv.is_owned = false;
41830         ChannelDetails_set_is_usable(&this_ptr_conv, val);
41831 }
41832
41833 jboolean  CS_LDK_ChannelDetails_get_is_public(int64_t this_ptr) {
41834         LDKChannelDetails this_ptr_conv;
41835         this_ptr_conv.inner = untag_ptr(this_ptr);
41836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41838         this_ptr_conv.is_owned = false;
41839         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
41840         return ret_conv;
41841 }
41842
41843 void  CS_LDK_ChannelDetails_set_is_public(int64_t this_ptr, jboolean val) {
41844         LDKChannelDetails this_ptr_conv;
41845         this_ptr_conv.inner = untag_ptr(this_ptr);
41846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41848         this_ptr_conv.is_owned = false;
41849         ChannelDetails_set_is_public(&this_ptr_conv, val);
41850 }
41851
41852 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_minimum_msat(int64_t this_ptr) {
41853         LDKChannelDetails this_ptr_conv;
41854         this_ptr_conv.inner = untag_ptr(this_ptr);
41855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41857         this_ptr_conv.is_owned = false;
41858         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41859         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
41860         int64_t ret_ref = tag_ptr(ret_copy, true);
41861         return ret_ref;
41862 }
41863
41864 void  CS_LDK_ChannelDetails_set_inbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
41865         LDKChannelDetails this_ptr_conv;
41866         this_ptr_conv.inner = untag_ptr(this_ptr);
41867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41869         this_ptr_conv.is_owned = false;
41870         void* val_ptr = untag_ptr(val);
41871         CHECK_ACCESS(val_ptr);
41872         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41873         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41874         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
41875 }
41876
41877 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_maximum_msat(int64_t this_ptr) {
41878         LDKChannelDetails this_ptr_conv;
41879         this_ptr_conv.inner = untag_ptr(this_ptr);
41880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41882         this_ptr_conv.is_owned = false;
41883         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41884         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
41885         int64_t ret_ref = tag_ptr(ret_copy, true);
41886         return ret_ref;
41887 }
41888
41889 void  CS_LDK_ChannelDetails_set_inbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
41890         LDKChannelDetails this_ptr_conv;
41891         this_ptr_conv.inner = untag_ptr(this_ptr);
41892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41894         this_ptr_conv.is_owned = false;
41895         void* val_ptr = untag_ptr(val);
41896         CHECK_ACCESS(val_ptr);
41897         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41898         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41899         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
41900 }
41901
41902 int64_t  CS_LDK_ChannelDetails_get_config(int64_t this_ptr) {
41903         LDKChannelDetails this_ptr_conv;
41904         this_ptr_conv.inner = untag_ptr(this_ptr);
41905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41907         this_ptr_conv.is_owned = false;
41908         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
41909         int64_t ret_ref = 0;
41910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41912         return ret_ref;
41913 }
41914
41915 void  CS_LDK_ChannelDetails_set_config(int64_t this_ptr, int64_t val) {
41916         LDKChannelDetails this_ptr_conv;
41917         this_ptr_conv.inner = untag_ptr(this_ptr);
41918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41920         this_ptr_conv.is_owned = false;
41921         LDKChannelConfig val_conv;
41922         val_conv.inner = untag_ptr(val);
41923         val_conv.is_owned = ptr_is_owned(val);
41924         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41925         val_conv = ChannelConfig_clone(&val_conv);
41926         ChannelDetails_set_config(&this_ptr_conv, val_conv);
41927 }
41928
41929 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
41930         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
41931         int64_t ret_ref = 0;
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41934         return ret_ref;
41935 }
41936 int64_t  CS_LDK_ChannelDetails_clone_ptr(int64_t arg) {
41937         LDKChannelDetails arg_conv;
41938         arg_conv.inner = untag_ptr(arg);
41939         arg_conv.is_owned = ptr_is_owned(arg);
41940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41941         arg_conv.is_owned = false;
41942         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
41943         return ret_conv;
41944 }
41945
41946 int64_t  CS_LDK_ChannelDetails_clone(int64_t orig) {
41947         LDKChannelDetails orig_conv;
41948         orig_conv.inner = untag_ptr(orig);
41949         orig_conv.is_owned = ptr_is_owned(orig);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41951         orig_conv.is_owned = false;
41952         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
41953         int64_t ret_ref = 0;
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41956         return ret_ref;
41957 }
41958
41959 int64_t  CS_LDK_ChannelDetails_get_inbound_payment_scid(int64_t this_arg) {
41960         LDKChannelDetails this_arg_conv;
41961         this_arg_conv.inner = untag_ptr(this_arg);
41962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41964         this_arg_conv.is_owned = false;
41965         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41966         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
41967         int64_t ret_ref = tag_ptr(ret_copy, true);
41968         return ret_ref;
41969 }
41970
41971 int64_t  CS_LDK_ChannelDetails_get_outbound_payment_scid(int64_t this_arg) {
41972         LDKChannelDetails this_arg_conv;
41973         this_arg_conv.inner = untag_ptr(this_arg);
41974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41976         this_arg_conv.is_owned = false;
41977         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41978         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
41979         int64_t ret_ref = tag_ptr(ret_copy, true);
41980         return ret_ref;
41981 }
41982
41983 int32_t  CS_LDK_ChannelShutdownState_clone(int64_t orig) {
41984         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
41985         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_clone(orig_conv));
41986         return ret_conv;
41987 }
41988
41989 int32_t  CS_LDK_ChannelShutdownState_not_shutting_down() {
41990         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_not_shutting_down());
41991         return ret_conv;
41992 }
41993
41994 int32_t  CS_LDK_ChannelShutdownState_shutdown_initiated() {
41995         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_initiated());
41996         return ret_conv;
41997 }
41998
41999 int32_t  CS_LDK_ChannelShutdownState_resolving_htlcs() {
42000         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_resolving_htlcs());
42001         return ret_conv;
42002 }
42003
42004 int32_t  CS_LDK_ChannelShutdownState_negotiating_closing_fee() {
42005         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_negotiating_closing_fee());
42006         return ret_conv;
42007 }
42008
42009 int32_t  CS_LDK_ChannelShutdownState_shutdown_complete() {
42010         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_complete());
42011         return ret_conv;
42012 }
42013
42014 jboolean  CS_LDK_ChannelShutdownState_eq(int64_t a, int64_t b) {
42015         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
42016         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
42017         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
42018         return ret_conv;
42019 }
42020
42021 void  CS_LDK_RecentPaymentDetails_free(int64_t this_ptr) {
42022         if (!ptr_is_owned(this_ptr)) return;
42023         void* this_ptr_ptr = untag_ptr(this_ptr);
42024         CHECK_ACCESS(this_ptr_ptr);
42025         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
42026         FREE(untag_ptr(this_ptr));
42027         RecentPaymentDetails_free(this_ptr_conv);
42028 }
42029
42030 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
42031         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42032         *ret_copy = RecentPaymentDetails_clone(arg);
42033         int64_t ret_ref = tag_ptr(ret_copy, true);
42034         return ret_ref;
42035 }
42036 int64_t  CS_LDK_RecentPaymentDetails_clone_ptr(int64_t arg) {
42037         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
42038         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
42039         return ret_conv;
42040 }
42041
42042 int64_t  CS_LDK_RecentPaymentDetails_clone(int64_t orig) {
42043         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
42044         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42045         *ret_copy = RecentPaymentDetails_clone(orig_conv);
42046         int64_t ret_ref = tag_ptr(ret_copy, true);
42047         return ret_ref;
42048 }
42049
42050 int64_t  CS_LDK_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
42051         LDKThirtyTwoBytes payment_id_ref;
42052         CHECK(payment_id->arr_len == 32);
42053         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42054         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42055         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
42056         int64_t ret_ref = tag_ptr(ret_copy, true);
42057         return ret_ref;
42058 }
42059
42060 int64_t  CS_LDK_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
42061         LDKThirtyTwoBytes payment_id_ref;
42062         CHECK(payment_id->arr_len == 32);
42063         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42064         LDKThirtyTwoBytes payment_hash_ref;
42065         CHECK(payment_hash->arr_len == 32);
42066         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42067         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42068         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
42069         int64_t ret_ref = tag_ptr(ret_copy, true);
42070         return ret_ref;
42071 }
42072
42073 int64_t  CS_LDK_RecentPaymentDetails_fulfilled(int8_tArray payment_id, int64_t payment_hash) {
42074         LDKThirtyTwoBytes payment_id_ref;
42075         CHECK(payment_id->arr_len == 32);
42076         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42077         void* payment_hash_ptr = untag_ptr(payment_hash);
42078         CHECK_ACCESS(payment_hash_ptr);
42079         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
42080         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
42081         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42082         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
42083         int64_t ret_ref = tag_ptr(ret_copy, true);
42084         return ret_ref;
42085 }
42086
42087 int64_t  CS_LDK_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
42088         LDKThirtyTwoBytes payment_id_ref;
42089         CHECK(payment_id->arr_len == 32);
42090         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42091         LDKThirtyTwoBytes payment_hash_ref;
42092         CHECK(payment_hash->arr_len == 32);
42093         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42094         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42095         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
42096         int64_t ret_ref = tag_ptr(ret_copy, true);
42097         return ret_ref;
42098 }
42099
42100 void  CS_LDK_PhantomRouteHints_free(int64_t this_obj) {
42101         LDKPhantomRouteHints this_obj_conv;
42102         this_obj_conv.inner = untag_ptr(this_obj);
42103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42105         PhantomRouteHints_free(this_obj_conv);
42106 }
42107
42108 int64_tArray  CS_LDK_PhantomRouteHints_get_channels(int64_t this_ptr) {
42109         LDKPhantomRouteHints this_ptr_conv;
42110         this_ptr_conv.inner = untag_ptr(this_ptr);
42111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42113         this_ptr_conv.is_owned = false;
42114         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
42115         int64_tArray ret_arr = NULL;
42116         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42117         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42118         for (size_t q = 0; q < ret_var.datalen; q++) {
42119                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42120                 int64_t ret_conv_16_ref = 0;
42121                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42122                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42123                 ret_arr_ptr[q] = ret_conv_16_ref;
42124         }
42125         
42126         FREE(ret_var.data);
42127         return ret_arr;
42128 }
42129
42130 void  CS_LDK_PhantomRouteHints_set_channels(int64_t this_ptr, int64_tArray val) {
42131         LDKPhantomRouteHints this_ptr_conv;
42132         this_ptr_conv.inner = untag_ptr(this_ptr);
42133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42135         this_ptr_conv.is_owned = false;
42136         LDKCVec_ChannelDetailsZ val_constr;
42137         val_constr.datalen = val->arr_len;
42138         if (val_constr.datalen > 0)
42139                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42140         else
42141                 val_constr.data = NULL;
42142         int64_t* val_vals = val->elems;
42143         for (size_t q = 0; q < val_constr.datalen; q++) {
42144                 int64_t val_conv_16 = val_vals[q];
42145                 LDKChannelDetails val_conv_16_conv;
42146                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
42147                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
42148                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
42149                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
42150                 val_constr.data[q] = val_conv_16_conv;
42151         }
42152         FREE(val);
42153         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
42154 }
42155
42156 int64_t  CS_LDK_PhantomRouteHints_get_phantom_scid(int64_t this_ptr) {
42157         LDKPhantomRouteHints this_ptr_conv;
42158         this_ptr_conv.inner = untag_ptr(this_ptr);
42159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42161         this_ptr_conv.is_owned = false;
42162         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
42163         return ret_conv;
42164 }
42165
42166 void  CS_LDK_PhantomRouteHints_set_phantom_scid(int64_t this_ptr, int64_t val) {
42167         LDKPhantomRouteHints this_ptr_conv;
42168         this_ptr_conv.inner = untag_ptr(this_ptr);
42169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42171         this_ptr_conv.is_owned = false;
42172         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
42173 }
42174
42175 int8_tArray  CS_LDK_PhantomRouteHints_get_real_node_pubkey(int64_t this_ptr) {
42176         LDKPhantomRouteHints 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42182         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
42183         return ret_arr;
42184 }
42185
42186 void  CS_LDK_PhantomRouteHints_set_real_node_pubkey(int64_t this_ptr, int8_tArray val) {
42187         LDKPhantomRouteHints this_ptr_conv;
42188         this_ptr_conv.inner = untag_ptr(this_ptr);
42189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42191         this_ptr_conv.is_owned = false;
42192         LDKPublicKey val_ref;
42193         CHECK(val->arr_len == 33);
42194         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42195         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
42196 }
42197
42198 int64_t  CS_LDK_PhantomRouteHints_new(int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
42199         LDKCVec_ChannelDetailsZ channels_arg_constr;
42200         channels_arg_constr.datalen = channels_arg->arr_len;
42201         if (channels_arg_constr.datalen > 0)
42202                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42203         else
42204                 channels_arg_constr.data = NULL;
42205         int64_t* channels_arg_vals = channels_arg->elems;
42206         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
42207                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
42208                 LDKChannelDetails channels_arg_conv_16_conv;
42209                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
42210                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
42211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
42212                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
42213                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
42214         }
42215         FREE(channels_arg);
42216         LDKPublicKey real_node_pubkey_arg_ref;
42217         CHECK(real_node_pubkey_arg->arr_len == 33);
42218         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
42219         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
42220         int64_t ret_ref = 0;
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42223         return ret_ref;
42224 }
42225
42226 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
42227         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
42228         int64_t ret_ref = 0;
42229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42231         return ret_ref;
42232 }
42233 int64_t  CS_LDK_PhantomRouteHints_clone_ptr(int64_t arg) {
42234         LDKPhantomRouteHints arg_conv;
42235         arg_conv.inner = untag_ptr(arg);
42236         arg_conv.is_owned = ptr_is_owned(arg);
42237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42238         arg_conv.is_owned = false;
42239         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
42240         return ret_conv;
42241 }
42242
42243 int64_t  CS_LDK_PhantomRouteHints_clone(int64_t orig) {
42244         LDKPhantomRouteHints orig_conv;
42245         orig_conv.inner = untag_ptr(orig);
42246         orig_conv.is_owned = ptr_is_owned(orig);
42247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42248         orig_conv.is_owned = false;
42249         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
42250         int64_t ret_ref = 0;
42251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42253         return ret_ref;
42254 }
42255
42256 int64_t  CS_LDK_ChannelManager_new(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) {
42257         void* fee_est_ptr = untag_ptr(fee_est);
42258         CHECK_ACCESS(fee_est_ptr);
42259         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
42260         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
42261                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42262                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
42263         }
42264         void* chain_monitor_ptr = untag_ptr(chain_monitor);
42265         CHECK_ACCESS(chain_monitor_ptr);
42266         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
42267         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
42268                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42269                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
42270         }
42271         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
42272         CHECK_ACCESS(tx_broadcaster_ptr);
42273         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
42274         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
42275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42276                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
42277         }
42278         void* router_ptr = untag_ptr(router);
42279         CHECK_ACCESS(router_ptr);
42280         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
42281         if (router_conv.free == LDKRouter_JCalls_free) {
42282                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42283                 LDKRouter_JCalls_cloned(&router_conv);
42284         }
42285         void* logger_ptr = untag_ptr(logger);
42286         CHECK_ACCESS(logger_ptr);
42287         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42288         if (logger_conv.free == LDKLogger_JCalls_free) {
42289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42290                 LDKLogger_JCalls_cloned(&logger_conv);
42291         }
42292         void* entropy_source_ptr = untag_ptr(entropy_source);
42293         CHECK_ACCESS(entropy_source_ptr);
42294         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
42295         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
42296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42297                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
42298         }
42299         void* node_signer_ptr = untag_ptr(node_signer);
42300         CHECK_ACCESS(node_signer_ptr);
42301         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
42302         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
42303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42304                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
42305         }
42306         void* signer_provider_ptr = untag_ptr(signer_provider);
42307         CHECK_ACCESS(signer_provider_ptr);
42308         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
42309         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
42310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42311                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
42312         }
42313         LDKUserConfig config_conv;
42314         config_conv.inner = untag_ptr(config);
42315         config_conv.is_owned = ptr_is_owned(config);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42317         config_conv = UserConfig_clone(&config_conv);
42318         LDKChainParameters params_conv;
42319         params_conv.inner = untag_ptr(params);
42320         params_conv.is_owned = ptr_is_owned(params);
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
42322         params_conv = ChainParameters_clone(&params_conv);
42323         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);
42324         int64_t ret_ref = 0;
42325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42327         return ret_ref;
42328 }
42329
42330 int64_t  CS_LDK_ChannelManager_get_current_default_configuration(int64_t this_arg) {
42331         LDKChannelManager this_arg_conv;
42332         this_arg_conv.inner = untag_ptr(this_arg);
42333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42335         this_arg_conv.is_owned = false;
42336         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
42337         int64_t ret_ref = 0;
42338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42340         return ret_ref;
42341 }
42342
42343 int64_t  CS_LDK_ChannelManager_create_channel(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) {
42344         LDKChannelManager this_arg_conv;
42345         this_arg_conv.inner = untag_ptr(this_arg);
42346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42348         this_arg_conv.is_owned = false;
42349         LDKPublicKey their_network_key_ref;
42350         CHECK(their_network_key->arr_len == 33);
42351         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
42352         LDKU128 user_channel_id_ref;
42353         CHECK(user_channel_id->arr_len == 16);
42354         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42355         LDKChannelId temporary_channel_id_conv;
42356         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42357         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42359         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
42360         LDKUserConfig override_config_conv;
42361         override_config_conv.inner = untag_ptr(override_config);
42362         override_config_conv.is_owned = ptr_is_owned(override_config);
42363         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
42364         override_config_conv = UserConfig_clone(&override_config_conv);
42365         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
42366         *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);
42367         return tag_ptr(ret_conv, true);
42368 }
42369
42370 int64_tArray  CS_LDK_ChannelManager_list_channels(int64_t this_arg) {
42371         LDKChannelManager this_arg_conv;
42372         this_arg_conv.inner = untag_ptr(this_arg);
42373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42375         this_arg_conv.is_owned = false;
42376         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
42377         int64_tArray ret_arr = NULL;
42378         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42379         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42380         for (size_t q = 0; q < ret_var.datalen; q++) {
42381                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42382                 int64_t ret_conv_16_ref = 0;
42383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42384                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42385                 ret_arr_ptr[q] = ret_conv_16_ref;
42386         }
42387         
42388         FREE(ret_var.data);
42389         return ret_arr;
42390 }
42391
42392 int64_tArray  CS_LDK_ChannelManager_list_usable_channels(int64_t this_arg) {
42393         LDKChannelManager this_arg_conv;
42394         this_arg_conv.inner = untag_ptr(this_arg);
42395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42397         this_arg_conv.is_owned = false;
42398         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
42399         int64_tArray ret_arr = NULL;
42400         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42401         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42402         for (size_t q = 0; q < ret_var.datalen; q++) {
42403                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42404                 int64_t ret_conv_16_ref = 0;
42405                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42406                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42407                 ret_arr_ptr[q] = ret_conv_16_ref;
42408         }
42409         
42410         FREE(ret_var.data);
42411         return ret_arr;
42412 }
42413
42414 int64_tArray  CS_LDK_ChannelManager_list_channels_with_counterparty(int64_t this_arg, int8_tArray counterparty_node_id) {
42415         LDKChannelManager this_arg_conv;
42416         this_arg_conv.inner = untag_ptr(this_arg);
42417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42419         this_arg_conv.is_owned = false;
42420         LDKPublicKey counterparty_node_id_ref;
42421         CHECK(counterparty_node_id->arr_len == 33);
42422         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42423         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
42424         int64_tArray ret_arr = NULL;
42425         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42426         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42427         for (size_t q = 0; q < ret_var.datalen; q++) {
42428                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
42429                 int64_t ret_conv_16_ref = 0;
42430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42431                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42432                 ret_arr_ptr[q] = ret_conv_16_ref;
42433         }
42434         
42435         FREE(ret_var.data);
42436         return ret_arr;
42437 }
42438
42439 int64_tArray  CS_LDK_ChannelManager_list_recent_payments(int64_t this_arg) {
42440         LDKChannelManager this_arg_conv;
42441         this_arg_conv.inner = untag_ptr(this_arg);
42442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42444         this_arg_conv.is_owned = false;
42445         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
42446         int64_tArray ret_arr = NULL;
42447         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42448         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42449         for (size_t w = 0; w < ret_var.datalen; w++) {
42450                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
42451                 *ret_conv_22_copy = ret_var.data[w];
42452                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
42453                 ret_arr_ptr[w] = ret_conv_22_ref;
42454         }
42455         
42456         FREE(ret_var.data);
42457         return ret_arr;
42458 }
42459
42460 int64_t  CS_LDK_ChannelManager_close_channel(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
42461         LDKChannelManager this_arg_conv;
42462         this_arg_conv.inner = untag_ptr(this_arg);
42463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42465         this_arg_conv.is_owned = false;
42466         LDKChannelId channel_id_conv;
42467         channel_id_conv.inner = untag_ptr(channel_id);
42468         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42470         channel_id_conv.is_owned = false;
42471         LDKPublicKey counterparty_node_id_ref;
42472         CHECK(counterparty_node_id->arr_len == 33);
42473         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42474         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42475         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42476         return tag_ptr(ret_conv, true);
42477 }
42478
42479 int64_t  CS_LDK_ChannelManager_close_channel_with_feerate_and_script(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) {
42480         LDKChannelManager this_arg_conv;
42481         this_arg_conv.inner = untag_ptr(this_arg);
42482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42484         this_arg_conv.is_owned = false;
42485         LDKChannelId channel_id_conv;
42486         channel_id_conv.inner = untag_ptr(channel_id);
42487         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42488         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42489         channel_id_conv.is_owned = false;
42490         LDKPublicKey counterparty_node_id_ref;
42491         CHECK(counterparty_node_id->arr_len == 33);
42492         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42493         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
42494         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
42495         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
42496         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
42497         LDKShutdownScript shutdown_script_conv;
42498         shutdown_script_conv.inner = untag_ptr(shutdown_script);
42499         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
42501         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
42502         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42503         *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);
42504         return tag_ptr(ret_conv, true);
42505 }
42506
42507 int64_t  CS_LDK_ChannelManager_force_close_broadcasting_latest_txn(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
42508         LDKChannelManager this_arg_conv;
42509         this_arg_conv.inner = untag_ptr(this_arg);
42510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42512         this_arg_conv.is_owned = false;
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.is_owned = false;
42518         LDKPublicKey counterparty_node_id_ref;
42519         CHECK(counterparty_node_id->arr_len == 33);
42520         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42521         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42522         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42523         return tag_ptr(ret_conv, true);
42524 }
42525
42526 int64_t  CS_LDK_ChannelManager_force_close_without_broadcasting_txn(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
42527         LDKChannelManager this_arg_conv;
42528         this_arg_conv.inner = untag_ptr(this_arg);
42529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42531         this_arg_conv.is_owned = false;
42532         LDKChannelId channel_id_conv;
42533         channel_id_conv.inner = untag_ptr(channel_id);
42534         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42535         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42536         channel_id_conv.is_owned = false;
42537         LDKPublicKey counterparty_node_id_ref;
42538         CHECK(counterparty_node_id->arr_len == 33);
42539         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42540         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42541         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42542         return tag_ptr(ret_conv, true);
42543 }
42544
42545 void  CS_LDK_ChannelManager_force_close_all_channels_broadcasting_latest_txn(int64_t this_arg) {
42546         LDKChannelManager this_arg_conv;
42547         this_arg_conv.inner = untag_ptr(this_arg);
42548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42550         this_arg_conv.is_owned = false;
42551         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
42552 }
42553
42554 void  CS_LDK_ChannelManager_force_close_all_channels_without_broadcasting_txn(int64_t this_arg) {
42555         LDKChannelManager this_arg_conv;
42556         this_arg_conv.inner = untag_ptr(this_arg);
42557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42559         this_arg_conv.is_owned = false;
42560         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
42561 }
42562
42563 int64_t  CS_LDK_ChannelManager_send_payment_with_route(int64_t this_arg, int64_t route, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id) {
42564         LDKChannelManager this_arg_conv;
42565         this_arg_conv.inner = untag_ptr(this_arg);
42566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42568         this_arg_conv.is_owned = false;
42569         LDKRoute route_conv;
42570         route_conv.inner = untag_ptr(route);
42571         route_conv.is_owned = ptr_is_owned(route);
42572         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42573         route_conv.is_owned = false;
42574         LDKThirtyTwoBytes payment_hash_ref;
42575         CHECK(payment_hash->arr_len == 32);
42576         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42577         LDKRecipientOnionFields recipient_onion_conv;
42578         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42579         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42580         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42581         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42582         LDKThirtyTwoBytes payment_id_ref;
42583         CHECK(payment_id->arr_len == 32);
42584         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42585         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
42586         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
42587         return tag_ptr(ret_conv, true);
42588 }
42589
42590 int64_t  CS_LDK_ChannelManager_send_payment(int64_t this_arg, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
42591         LDKChannelManager this_arg_conv;
42592         this_arg_conv.inner = untag_ptr(this_arg);
42593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42595         this_arg_conv.is_owned = false;
42596         LDKThirtyTwoBytes payment_hash_ref;
42597         CHECK(payment_hash->arr_len == 32);
42598         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42599         LDKRecipientOnionFields recipient_onion_conv;
42600         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42601         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42602         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42603         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42604         LDKThirtyTwoBytes payment_id_ref;
42605         CHECK(payment_id->arr_len == 32);
42606         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42607         LDKRouteParameters route_params_conv;
42608         route_params_conv.inner = untag_ptr(route_params);
42609         route_params_conv.is_owned = ptr_is_owned(route_params);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42611         route_params_conv = RouteParameters_clone(&route_params_conv);
42612         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42613         CHECK_ACCESS(retry_strategy_ptr);
42614         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42615         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42616         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
42617         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
42618         return tag_ptr(ret_conv, true);
42619 }
42620
42621 void  CS_LDK_ChannelManager_abandon_payment(int64_t this_arg, int8_tArray payment_id) {
42622         LDKChannelManager this_arg_conv;
42623         this_arg_conv.inner = untag_ptr(this_arg);
42624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42626         this_arg_conv.is_owned = false;
42627         LDKThirtyTwoBytes payment_id_ref;
42628         CHECK(payment_id->arr_len == 32);
42629         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42630         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
42631 }
42632
42633 int64_t  CS_LDK_ChannelManager_send_spontaneous_payment(int64_t this_arg, int64_t route, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id) {
42634         LDKChannelManager this_arg_conv;
42635         this_arg_conv.inner = untag_ptr(this_arg);
42636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42638         this_arg_conv.is_owned = false;
42639         LDKRoute route_conv;
42640         route_conv.inner = untag_ptr(route);
42641         route_conv.is_owned = ptr_is_owned(route);
42642         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42643         route_conv.is_owned = false;
42644         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42645         CHECK_ACCESS(payment_preimage_ptr);
42646         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42647         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42648         LDKRecipientOnionFields recipient_onion_conv;
42649         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42650         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42651         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42652         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42653         LDKThirtyTwoBytes payment_id_ref;
42654         CHECK(payment_id->arr_len == 32);
42655         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42656         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
42657         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
42658         return tag_ptr(ret_conv, true);
42659 }
42660
42661 int64_t  CS_LDK_ChannelManager_send_spontaneous_payment_with_retry(int64_t this_arg, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
42662         LDKChannelManager this_arg_conv;
42663         this_arg_conv.inner = untag_ptr(this_arg);
42664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42666         this_arg_conv.is_owned = false;
42667         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42668         CHECK_ACCESS(payment_preimage_ptr);
42669         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42670         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42671         LDKRecipientOnionFields recipient_onion_conv;
42672         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42673         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42675         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42676         LDKThirtyTwoBytes payment_id_ref;
42677         CHECK(payment_id->arr_len == 32);
42678         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42679         LDKRouteParameters route_params_conv;
42680         route_params_conv.inner = untag_ptr(route_params);
42681         route_params_conv.is_owned = ptr_is_owned(route_params);
42682         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42683         route_params_conv = RouteParameters_clone(&route_params_conv);
42684         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42685         CHECK_ACCESS(retry_strategy_ptr);
42686         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42687         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42688         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
42689         *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);
42690         return tag_ptr(ret_conv, true);
42691 }
42692
42693 int64_t  CS_LDK_ChannelManager_send_probe(int64_t this_arg, int64_t path) {
42694         LDKChannelManager this_arg_conv;
42695         this_arg_conv.inner = untag_ptr(this_arg);
42696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42698         this_arg_conv.is_owned = false;
42699         LDKPath path_conv;
42700         path_conv.inner = untag_ptr(path);
42701         path_conv.is_owned = ptr_is_owned(path);
42702         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
42703         path_conv = Path_clone(&path_conv);
42704         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
42705         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
42706         return tag_ptr(ret_conv, true);
42707 }
42708
42709 int64_t  CS_LDK_ChannelManager_send_spontaneous_preflight_probes(int64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, int64_t liquidity_limit_multiplier) {
42710         LDKChannelManager this_arg_conv;
42711         this_arg_conv.inner = untag_ptr(this_arg);
42712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42714         this_arg_conv.is_owned = false;
42715         LDKPublicKey node_id_ref;
42716         CHECK(node_id->arr_len == 33);
42717         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42718         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42719         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42720         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42721         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42722         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42723         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
42724         return tag_ptr(ret_conv, true);
42725 }
42726
42727 int64_t  CS_LDK_ChannelManager_send_preflight_probes(int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
42728         LDKChannelManager this_arg_conv;
42729         this_arg_conv.inner = untag_ptr(this_arg);
42730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42732         this_arg_conv.is_owned = false;
42733         LDKRouteParameters route_params_conv;
42734         route_params_conv.inner = untag_ptr(route_params);
42735         route_params_conv.is_owned = ptr_is_owned(route_params);
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42737         route_params_conv = RouteParameters_clone(&route_params_conv);
42738         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42739         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42740         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42741         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42742         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42743         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
42744         return tag_ptr(ret_conv, true);
42745 }
42746
42747 int64_t  CS_LDK_ChannelManager_funding_transaction_generated(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
42748         LDKChannelManager this_arg_conv;
42749         this_arg_conv.inner = untag_ptr(this_arg);
42750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42752         this_arg_conv.is_owned = false;
42753         LDKChannelId temporary_channel_id_conv;
42754         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42755         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42756         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42757         temporary_channel_id_conv.is_owned = false;
42758         LDKPublicKey counterparty_node_id_ref;
42759         CHECK(counterparty_node_id->arr_len == 33);
42760         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42761         LDKTransaction funding_transaction_ref;
42762         funding_transaction_ref.datalen = funding_transaction->arr_len;
42763         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42764         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42765         funding_transaction_ref.data_is_owned = true;
42766         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42767         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
42768         return tag_ptr(ret_conv, true);
42769 }
42770
42771 int64_t  CS_LDK_ChannelManager_batch_funding_transaction_generated(int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
42772         LDKChannelManager this_arg_conv;
42773         this_arg_conv.inner = untag_ptr(this_arg);
42774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42776         this_arg_conv.is_owned = false;
42777         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
42778         temporary_channels_constr.datalen = temporary_channels->arr_len;
42779         if (temporary_channels_constr.datalen > 0)
42780                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
42781         else
42782                 temporary_channels_constr.data = NULL;
42783         int64_t* temporary_channels_vals = temporary_channels->elems;
42784         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
42785                 int64_t temporary_channels_conv_30 = temporary_channels_vals[e];
42786                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
42787                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
42788                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
42789                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
42790                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
42791         }
42792         FREE(temporary_channels);
42793         LDKTransaction funding_transaction_ref;
42794         funding_transaction_ref.datalen = funding_transaction->arr_len;
42795         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42796         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42797         funding_transaction_ref.data_is_owned = true;
42798         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42799         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
42800         return tag_ptr(ret_conv, true);
42801 }
42802
42803 int64_t  CS_LDK_ChannelManager_update_partial_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config_update) {
42804         LDKChannelManager this_arg_conv;
42805         this_arg_conv.inner = untag_ptr(this_arg);
42806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42808         this_arg_conv.is_owned = false;
42809         LDKPublicKey counterparty_node_id_ref;
42810         CHECK(counterparty_node_id->arr_len == 33);
42811         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42812         LDKCVec_ChannelIdZ channel_ids_constr;
42813         channel_ids_constr.datalen = channel_ids->arr_len;
42814         if (channel_ids_constr.datalen > 0)
42815                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42816         else
42817                 channel_ids_constr.data = NULL;
42818         int64_t* channel_ids_vals = channel_ids->elems;
42819         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42820                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
42821                 LDKChannelId channel_ids_conv_11_conv;
42822                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42823                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42824                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42825                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42826                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42827         }
42828         FREE(channel_ids);
42829         LDKChannelConfigUpdate config_update_conv;
42830         config_update_conv.inner = untag_ptr(config_update);
42831         config_update_conv.is_owned = ptr_is_owned(config_update);
42832         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
42833         config_update_conv.is_owned = false;
42834         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42835         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
42836         return tag_ptr(ret_conv, true);
42837 }
42838
42839 int64_t  CS_LDK_ChannelManager_update_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config) {
42840         LDKChannelManager this_arg_conv;
42841         this_arg_conv.inner = untag_ptr(this_arg);
42842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42844         this_arg_conv.is_owned = false;
42845         LDKPublicKey counterparty_node_id_ref;
42846         CHECK(counterparty_node_id->arr_len == 33);
42847         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42848         LDKCVec_ChannelIdZ channel_ids_constr;
42849         channel_ids_constr.datalen = channel_ids->arr_len;
42850         if (channel_ids_constr.datalen > 0)
42851                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42852         else
42853                 channel_ids_constr.data = NULL;
42854         int64_t* channel_ids_vals = channel_ids->elems;
42855         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42856                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
42857                 LDKChannelId channel_ids_conv_11_conv;
42858                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42859                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42860                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42861                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42862                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42863         }
42864         FREE(channel_ids);
42865         LDKChannelConfig config_conv;
42866         config_conv.inner = untag_ptr(config);
42867         config_conv.is_owned = ptr_is_owned(config);
42868         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42869         config_conv.is_owned = false;
42870         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42871         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
42872         return tag_ptr(ret_conv, true);
42873 }
42874
42875 int64_t  CS_LDK_ChannelManager_forward_intercepted_htlc(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) {
42876         LDKChannelManager this_arg_conv;
42877         this_arg_conv.inner = untag_ptr(this_arg);
42878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42880         this_arg_conv.is_owned = false;
42881         LDKThirtyTwoBytes intercept_id_ref;
42882         CHECK(intercept_id->arr_len == 32);
42883         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42884         LDKChannelId next_hop_channel_id_conv;
42885         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
42886         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
42887         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
42888         next_hop_channel_id_conv.is_owned = false;
42889         LDKPublicKey next_node_id_ref;
42890         CHECK(next_node_id->arr_len == 33);
42891         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
42892         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42893         *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);
42894         return tag_ptr(ret_conv, true);
42895 }
42896
42897 int64_t  CS_LDK_ChannelManager_fail_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id) {
42898         LDKChannelManager this_arg_conv;
42899         this_arg_conv.inner = untag_ptr(this_arg);
42900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42902         this_arg_conv.is_owned = false;
42903         LDKThirtyTwoBytes intercept_id_ref;
42904         CHECK(intercept_id->arr_len == 32);
42905         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42906         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42907         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
42908         return tag_ptr(ret_conv, true);
42909 }
42910
42911 void  CS_LDK_ChannelManager_process_pending_htlc_forwards(int64_t this_arg) {
42912         LDKChannelManager this_arg_conv;
42913         this_arg_conv.inner = untag_ptr(this_arg);
42914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42916         this_arg_conv.is_owned = false;
42917         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
42918 }
42919
42920 void  CS_LDK_ChannelManager_timer_tick_occurred(int64_t this_arg) {
42921         LDKChannelManager this_arg_conv;
42922         this_arg_conv.inner = untag_ptr(this_arg);
42923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42925         this_arg_conv.is_owned = false;
42926         ChannelManager_timer_tick_occurred(&this_arg_conv);
42927 }
42928
42929 void  CS_LDK_ChannelManager_fail_htlc_backwards(int64_t this_arg, int8_tArray payment_hash) {
42930         LDKChannelManager this_arg_conv;
42931         this_arg_conv.inner = untag_ptr(this_arg);
42932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42934         this_arg_conv.is_owned = false;
42935         uint8_t payment_hash_arr[32];
42936         CHECK(payment_hash->arr_len == 32);
42937         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42938         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42939         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
42940 }
42941
42942 void  CS_LDK_ChannelManager_fail_htlc_backwards_with_reason(int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
42943         LDKChannelManager this_arg_conv;
42944         this_arg_conv.inner = untag_ptr(this_arg);
42945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42947         this_arg_conv.is_owned = false;
42948         uint8_t payment_hash_arr[32];
42949         CHECK(payment_hash->arr_len == 32);
42950         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42951         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42952         void* failure_code_ptr = untag_ptr(failure_code);
42953         CHECK_ACCESS(failure_code_ptr);
42954         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
42955         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
42956         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
42957 }
42958
42959 void  CS_LDK_ChannelManager_claim_funds(int64_t this_arg, int8_tArray payment_preimage) {
42960         LDKChannelManager this_arg_conv;
42961         this_arg_conv.inner = untag_ptr(this_arg);
42962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42964         this_arg_conv.is_owned = false;
42965         LDKThirtyTwoBytes payment_preimage_ref;
42966         CHECK(payment_preimage->arr_len == 32);
42967         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42968         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
42969 }
42970
42971 void  CS_LDK_ChannelManager_claim_funds_with_known_custom_tlvs(int64_t this_arg, int8_tArray payment_preimage) {
42972         LDKChannelManager this_arg_conv;
42973         this_arg_conv.inner = untag_ptr(this_arg);
42974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42976         this_arg_conv.is_owned = false;
42977         LDKThirtyTwoBytes payment_preimage_ref;
42978         CHECK(payment_preimage->arr_len == 32);
42979         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42980         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
42981 }
42982
42983 int8_tArray  CS_LDK_ChannelManager_get_our_node_id(int64_t this_arg) {
42984         LDKChannelManager this_arg_conv;
42985         this_arg_conv.inner = untag_ptr(this_arg);
42986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42988         this_arg_conv.is_owned = false;
42989         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42990         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
42991         return ret_arr;
42992 }
42993
42994 int64_t  CS_LDK_ChannelManager_accept_inbound_channel(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
42995         LDKChannelManager this_arg_conv;
42996         this_arg_conv.inner = untag_ptr(this_arg);
42997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42999         this_arg_conv.is_owned = false;
43000         LDKChannelId temporary_channel_id_conv;
43001         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
43002         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
43003         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
43004         temporary_channel_id_conv.is_owned = false;
43005         LDKPublicKey counterparty_node_id_ref;
43006         CHECK(counterparty_node_id->arr_len == 33);
43007         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
43008         LDKU128 user_channel_id_ref;
43009         CHECK(user_channel_id->arr_len == 16);
43010         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
43011         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43012         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
43013         return tag_ptr(ret_conv, true);
43014 }
43015
43016 int64_t  CS_LDK_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
43017         LDKChannelManager this_arg_conv;
43018         this_arg_conv.inner = untag_ptr(this_arg);
43019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43021         this_arg_conv.is_owned = false;
43022         LDKChannelId temporary_channel_id_conv;
43023         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
43024         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
43025         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
43026         temporary_channel_id_conv.is_owned = false;
43027         LDKPublicKey counterparty_node_id_ref;
43028         CHECK(counterparty_node_id->arr_len == 33);
43029         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
43030         LDKU128 user_channel_id_ref;
43031         CHECK(user_channel_id->arr_len == 16);
43032         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
43033         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43034         *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);
43035         return tag_ptr(ret_conv, true);
43036 }
43037
43038 int64_t  CS_LDK_ChannelManager_create_offer_builder(int64_t this_arg) {
43039         LDKChannelManager this_arg_conv;
43040         this_arg_conv.inner = untag_ptr(this_arg);
43041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43043         this_arg_conv.is_owned = false;
43044         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
43045         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
43046         return tag_ptr(ret_conv, true);
43047 }
43048
43049 int64_t  CS_LDK_ChannelManager_create_refund_builder(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) {
43050         LDKChannelManager this_arg_conv;
43051         this_arg_conv.inner = untag_ptr(this_arg);
43052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43054         this_arg_conv.is_owned = false;
43055         LDKThirtyTwoBytes payment_id_ref;
43056         CHECK(payment_id->arr_len == 32);
43057         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
43058         void* retry_strategy_ptr = untag_ptr(retry_strategy);
43059         CHECK_ACCESS(retry_strategy_ptr);
43060         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
43061         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
43062         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
43063         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
43064         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
43065         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
43066         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
43067         *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);
43068         return tag_ptr(ret_conv, true);
43069 }
43070
43071 int64_t  CS_LDK_ChannelManager_pay_for_offer(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) {
43072         LDKChannelManager this_arg_conv;
43073         this_arg_conv.inner = untag_ptr(this_arg);
43074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43076         this_arg_conv.is_owned = false;
43077         LDKOffer offer_conv;
43078         offer_conv.inner = untag_ptr(offer);
43079         offer_conv.is_owned = ptr_is_owned(offer);
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
43081         offer_conv.is_owned = false;
43082         void* quantity_ptr = untag_ptr(quantity);
43083         CHECK_ACCESS(quantity_ptr);
43084         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
43085         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
43086         void* amount_msats_ptr = untag_ptr(amount_msats);
43087         CHECK_ACCESS(amount_msats_ptr);
43088         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
43089         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
43090         void* payer_note_ptr = untag_ptr(payer_note);
43091         CHECK_ACCESS(payer_note_ptr);
43092         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
43093         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
43094         LDKThirtyTwoBytes payment_id_ref;
43095         CHECK(payment_id->arr_len == 32);
43096         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
43097         void* retry_strategy_ptr = untag_ptr(retry_strategy);
43098         CHECK_ACCESS(retry_strategy_ptr);
43099         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
43100         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
43101         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
43102         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
43103         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
43104         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
43105         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
43106         *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);
43107         return tag_ptr(ret_conv, true);
43108 }
43109
43110 int64_t  CS_LDK_ChannelManager_request_refund_payment(int64_t this_arg, int64_t refund) {
43111         LDKChannelManager this_arg_conv;
43112         this_arg_conv.inner = untag_ptr(this_arg);
43113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43115         this_arg_conv.is_owned = false;
43116         LDKRefund refund_conv;
43117         refund_conv.inner = untag_ptr(refund);
43118         refund_conv.is_owned = ptr_is_owned(refund);
43119         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
43120         refund_conv.is_owned = false;
43121         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
43122         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
43123         return tag_ptr(ret_conv, true);
43124 }
43125
43126 int64_t  CS_LDK_ChannelManager_create_inbound_payment(int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
43127         LDKChannelManager this_arg_conv;
43128         this_arg_conv.inner = untag_ptr(this_arg);
43129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43131         this_arg_conv.is_owned = false;
43132         void* min_value_msat_ptr = untag_ptr(min_value_msat);
43133         CHECK_ACCESS(min_value_msat_ptr);
43134         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
43135         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
43136         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
43137         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
43138         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
43139         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
43140         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
43141         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
43142         return tag_ptr(ret_conv, true);
43143 }
43144
43145 int64_t  CS_LDK_ChannelManager_create_inbound_payment_for_hash(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) {
43146         LDKChannelManager this_arg_conv;
43147         this_arg_conv.inner = untag_ptr(this_arg);
43148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43150         this_arg_conv.is_owned = false;
43151         LDKThirtyTwoBytes payment_hash_ref;
43152         CHECK(payment_hash->arr_len == 32);
43153         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
43154         void* min_value_msat_ptr = untag_ptr(min_value_msat);
43155         CHECK_ACCESS(min_value_msat_ptr);
43156         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
43157         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
43158         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
43159         CHECK_ACCESS(min_final_cltv_expiry_ptr);
43160         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
43161         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
43162         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
43163         *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);
43164         return tag_ptr(ret_conv, true);
43165 }
43166
43167 int64_t  CS_LDK_ChannelManager_get_payment_preimage(int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
43168         LDKChannelManager this_arg_conv;
43169         this_arg_conv.inner = untag_ptr(this_arg);
43170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43172         this_arg_conv.is_owned = false;
43173         LDKThirtyTwoBytes payment_hash_ref;
43174         CHECK(payment_hash->arr_len == 32);
43175         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
43176         LDKThirtyTwoBytes payment_secret_ref;
43177         CHECK(payment_secret->arr_len == 32);
43178         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
43179         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
43180         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
43181         return tag_ptr(ret_conv, true);
43182 }
43183
43184 int64_t  CS_LDK_ChannelManager_get_phantom_scid(int64_t this_arg) {
43185         LDKChannelManager this_arg_conv;
43186         this_arg_conv.inner = untag_ptr(this_arg);
43187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43189         this_arg_conv.is_owned = false;
43190         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
43191         return ret_conv;
43192 }
43193
43194 int64_t  CS_LDK_ChannelManager_get_phantom_route_hints(int64_t this_arg) {
43195         LDKChannelManager this_arg_conv;
43196         this_arg_conv.inner = untag_ptr(this_arg);
43197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43199         this_arg_conv.is_owned = false;
43200         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
43201         int64_t ret_ref = 0;
43202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43204         return ret_ref;
43205 }
43206
43207 int64_t  CS_LDK_ChannelManager_get_intercept_scid(int64_t this_arg) {
43208         LDKChannelManager this_arg_conv;
43209         this_arg_conv.inner = untag_ptr(this_arg);
43210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43212         this_arg_conv.is_owned = false;
43213         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
43214         return ret_conv;
43215 }
43216
43217 int64_t  CS_LDK_ChannelManager_compute_inflight_htlcs(int64_t this_arg) {
43218         LDKChannelManager this_arg_conv;
43219         this_arg_conv.inner = untag_ptr(this_arg);
43220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43222         this_arg_conv.is_owned = false;
43223         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
43224         int64_t ret_ref = 0;
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43227         return ret_ref;
43228 }
43229
43230 int64_t  CS_LDK_ChannelManager_as_MessageSendEventsProvider(int64_t this_arg) {
43231         LDKChannelManager this_arg_conv;
43232         this_arg_conv.inner = untag_ptr(this_arg);
43233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43235         this_arg_conv.is_owned = false;
43236         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43237         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
43238         return tag_ptr(ret_ret, true);
43239 }
43240
43241 int64_t  CS_LDK_ChannelManager_as_EventsProvider(int64_t this_arg) {
43242         LDKChannelManager this_arg_conv;
43243         this_arg_conv.inner = untag_ptr(this_arg);
43244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43246         this_arg_conv.is_owned = false;
43247         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
43248         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
43249         return tag_ptr(ret_ret, true);
43250 }
43251
43252 int64_t  CS_LDK_ChannelManager_as_Listen(int64_t this_arg) {
43253         LDKChannelManager this_arg_conv;
43254         this_arg_conv.inner = untag_ptr(this_arg);
43255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43257         this_arg_conv.is_owned = false;
43258         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
43259         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
43260         return tag_ptr(ret_ret, true);
43261 }
43262
43263 int64_t  CS_LDK_ChannelManager_as_Confirm(int64_t this_arg) {
43264         LDKChannelManager this_arg_conv;
43265         this_arg_conv.inner = untag_ptr(this_arg);
43266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43268         this_arg_conv.is_owned = false;
43269         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
43270         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
43271         return tag_ptr(ret_ret, true);
43272 }
43273
43274 int64_t  CS_LDK_ChannelManager_get_event_or_persistence_needed_future(int64_t this_arg) {
43275         LDKChannelManager this_arg_conv;
43276         this_arg_conv.inner = untag_ptr(this_arg);
43277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43279         this_arg_conv.is_owned = false;
43280         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
43281         int64_t ret_ref = 0;
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43284         return ret_ref;
43285 }
43286
43287 jboolean  CS_LDK_ChannelManager_get_and_clear_needs_persistence(int64_t this_arg) {
43288         LDKChannelManager this_arg_conv;
43289         this_arg_conv.inner = untag_ptr(this_arg);
43290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43292         this_arg_conv.is_owned = false;
43293         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
43294         return ret_conv;
43295 }
43296
43297 int64_t  CS_LDK_ChannelManager_current_best_block(int64_t this_arg) {
43298         LDKChannelManager this_arg_conv;
43299         this_arg_conv.inner = untag_ptr(this_arg);
43300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43302         this_arg_conv.is_owned = false;
43303         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
43304         int64_t ret_ref = 0;
43305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43307         return ret_ref;
43308 }
43309
43310 int64_t  CS_LDK_ChannelManager_node_features(int64_t this_arg) {
43311         LDKChannelManager this_arg_conv;
43312         this_arg_conv.inner = untag_ptr(this_arg);
43313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43315         this_arg_conv.is_owned = false;
43316         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
43317         int64_t ret_ref = 0;
43318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43320         return ret_ref;
43321 }
43322
43323 int64_t  CS_LDK_ChannelManager_channel_features(int64_t this_arg) {
43324         LDKChannelManager this_arg_conv;
43325         this_arg_conv.inner = untag_ptr(this_arg);
43326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43328         this_arg_conv.is_owned = false;
43329         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
43330         int64_t ret_ref = 0;
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43333         return ret_ref;
43334 }
43335
43336 int64_t  CS_LDK_ChannelManager_channel_type_features(int64_t this_arg) {
43337         LDKChannelManager this_arg_conv;
43338         this_arg_conv.inner = untag_ptr(this_arg);
43339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43341         this_arg_conv.is_owned = false;
43342         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
43343         int64_t ret_ref = 0;
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43346         return ret_ref;
43347 }
43348
43349 int64_t  CS_LDK_ChannelManager_init_features(int64_t this_arg) {
43350         LDKChannelManager this_arg_conv;
43351         this_arg_conv.inner = untag_ptr(this_arg);
43352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43354         this_arg_conv.is_owned = false;
43355         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
43356         int64_t ret_ref = 0;
43357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43359         return ret_ref;
43360 }
43361
43362 int64_t  CS_LDK_ChannelManager_as_ChannelMessageHandler(int64_t this_arg) {
43363         LDKChannelManager this_arg_conv;
43364         this_arg_conv.inner = untag_ptr(this_arg);
43365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43367         this_arg_conv.is_owned = false;
43368         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
43369         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
43370         return tag_ptr(ret_ret, true);
43371 }
43372
43373 int64_t  CS_LDK_ChannelManager_as_OffersMessageHandler(int64_t this_arg) {
43374         LDKChannelManager this_arg_conv;
43375         this_arg_conv.inner = untag_ptr(this_arg);
43376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43378         this_arg_conv.is_owned = false;
43379         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
43380         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
43381         return tag_ptr(ret_ret, true);
43382 }
43383
43384 int64_t  CS_LDK_ChannelManager_as_NodeIdLookUp(int64_t this_arg) {
43385         LDKChannelManager this_arg_conv;
43386         this_arg_conv.inner = untag_ptr(this_arg);
43387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43389         this_arg_conv.is_owned = false;
43390         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
43391         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
43392         return tag_ptr(ret_ret, true);
43393 }
43394
43395 int64_t  CS_LDK_provided_init_features(int64_t config) {
43396         LDKUserConfig config_conv;
43397         config_conv.inner = untag_ptr(config);
43398         config_conv.is_owned = ptr_is_owned(config);
43399         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
43400         config_conv.is_owned = false;
43401         LDKInitFeatures ret_var = provided_init_features(&config_conv);
43402         int64_t ret_ref = 0;
43403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43405         return ret_ref;
43406 }
43407
43408 int8_tArray  CS_LDK_CounterpartyForwardingInfo_write(int64_t obj) {
43409         LDKCounterpartyForwardingInfo obj_conv;
43410         obj_conv.inner = untag_ptr(obj);
43411         obj_conv.is_owned = ptr_is_owned(obj);
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43413         obj_conv.is_owned = false;
43414         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
43415         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43416         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43417         CVec_u8Z_free(ret_var);
43418         return ret_arr;
43419 }
43420
43421 int64_t  CS_LDK_CounterpartyForwardingInfo_read(int8_tArray ser) {
43422         LDKu8slice ser_ref;
43423         ser_ref.datalen = ser->arr_len;
43424         ser_ref.data = ser->elems;
43425         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
43426         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
43427         FREE(ser);
43428         return tag_ptr(ret_conv, true);
43429 }
43430
43431 int8_tArray  CS_LDK_ChannelCounterparty_write(int64_t obj) {
43432         LDKChannelCounterparty obj_conv;
43433         obj_conv.inner = untag_ptr(obj);
43434         obj_conv.is_owned = ptr_is_owned(obj);
43435         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43436         obj_conv.is_owned = false;
43437         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
43438         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43439         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43440         CVec_u8Z_free(ret_var);
43441         return ret_arr;
43442 }
43443
43444 int64_t  CS_LDK_ChannelCounterparty_read(int8_tArray ser) {
43445         LDKu8slice ser_ref;
43446         ser_ref.datalen = ser->arr_len;
43447         ser_ref.data = ser->elems;
43448         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
43449         *ret_conv = ChannelCounterparty_read(ser_ref);
43450         FREE(ser);
43451         return tag_ptr(ret_conv, true);
43452 }
43453
43454 int8_tArray  CS_LDK_ChannelDetails_write(int64_t obj) {
43455         LDKChannelDetails obj_conv;
43456         obj_conv.inner = untag_ptr(obj);
43457         obj_conv.is_owned = ptr_is_owned(obj);
43458         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43459         obj_conv.is_owned = false;
43460         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
43461         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43462         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43463         CVec_u8Z_free(ret_var);
43464         return ret_arr;
43465 }
43466
43467 int64_t  CS_LDK_ChannelDetails_read(int8_tArray ser) {
43468         LDKu8slice ser_ref;
43469         ser_ref.datalen = ser->arr_len;
43470         ser_ref.data = ser->elems;
43471         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
43472         *ret_conv = ChannelDetails_read(ser_ref);
43473         FREE(ser);
43474         return tag_ptr(ret_conv, true);
43475 }
43476
43477 int8_tArray  CS_LDK_PhantomRouteHints_write(int64_t obj) {
43478         LDKPhantomRouteHints obj_conv;
43479         obj_conv.inner = untag_ptr(obj);
43480         obj_conv.is_owned = ptr_is_owned(obj);
43481         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43482         obj_conv.is_owned = false;
43483         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
43484         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43485         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43486         CVec_u8Z_free(ret_var);
43487         return ret_arr;
43488 }
43489
43490 int64_t  CS_LDK_PhantomRouteHints_read(int8_tArray ser) {
43491         LDKu8slice ser_ref;
43492         ser_ref.datalen = ser->arr_len;
43493         ser_ref.data = ser->elems;
43494         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
43495         *ret_conv = PhantomRouteHints_read(ser_ref);
43496         FREE(ser);
43497         return tag_ptr(ret_conv, true);
43498 }
43499
43500 int8_tArray  CS_LDK_BlindedForward_write(int64_t obj) {
43501         LDKBlindedForward obj_conv;
43502         obj_conv.inner = untag_ptr(obj);
43503         obj_conv.is_owned = ptr_is_owned(obj);
43504         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43505         obj_conv.is_owned = false;
43506         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
43507         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43508         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43509         CVec_u8Z_free(ret_var);
43510         return ret_arr;
43511 }
43512
43513 int64_t  CS_LDK_BlindedForward_read(int8_tArray ser) {
43514         LDKu8slice ser_ref;
43515         ser_ref.datalen = ser->arr_len;
43516         ser_ref.data = ser->elems;
43517         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
43518         *ret_conv = BlindedForward_read(ser_ref);
43519         FREE(ser);
43520         return tag_ptr(ret_conv, true);
43521 }
43522
43523 int8_tArray  CS_LDK_PendingHTLCRouting_write(int64_t obj) {
43524         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
43525         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
43526         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43527         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43528         CVec_u8Z_free(ret_var);
43529         return ret_arr;
43530 }
43531
43532 int64_t  CS_LDK_PendingHTLCRouting_read(int8_tArray ser) {
43533         LDKu8slice ser_ref;
43534         ser_ref.datalen = ser->arr_len;
43535         ser_ref.data = ser->elems;
43536         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
43537         *ret_conv = PendingHTLCRouting_read(ser_ref);
43538         FREE(ser);
43539         return tag_ptr(ret_conv, true);
43540 }
43541
43542 int8_tArray  CS_LDK_PendingHTLCInfo_write(int64_t obj) {
43543         LDKPendingHTLCInfo obj_conv;
43544         obj_conv.inner = untag_ptr(obj);
43545         obj_conv.is_owned = ptr_is_owned(obj);
43546         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43547         obj_conv.is_owned = false;
43548         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
43549         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43550         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43551         CVec_u8Z_free(ret_var);
43552         return ret_arr;
43553 }
43554
43555 int64_t  CS_LDK_PendingHTLCInfo_read(int8_tArray ser) {
43556         LDKu8slice ser_ref;
43557         ser_ref.datalen = ser->arr_len;
43558         ser_ref.data = ser->elems;
43559         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
43560         *ret_conv = PendingHTLCInfo_read(ser_ref);
43561         FREE(ser);
43562         return tag_ptr(ret_conv, true);
43563 }
43564
43565 int8_tArray  CS_LDK_BlindedFailure_write(int64_t obj) {
43566         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
43567         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
43568         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43569         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43570         CVec_u8Z_free(ret_var);
43571         return ret_arr;
43572 }
43573
43574 int64_t  CS_LDK_BlindedFailure_read(int8_tArray ser) {
43575         LDKu8slice ser_ref;
43576         ser_ref.datalen = ser->arr_len;
43577         ser_ref.data = ser->elems;
43578         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
43579         *ret_conv = BlindedFailure_read(ser_ref);
43580         FREE(ser);
43581         return tag_ptr(ret_conv, true);
43582 }
43583
43584 int8_tArray  CS_LDK_ChannelManager_write(int64_t obj) {
43585         LDKChannelManager obj_conv;
43586         obj_conv.inner = untag_ptr(obj);
43587         obj_conv.is_owned = ptr_is_owned(obj);
43588         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43589         obj_conv.is_owned = false;
43590         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
43591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43593         CVec_u8Z_free(ret_var);
43594         return ret_arr;
43595 }
43596
43597 int8_tArray  CS_LDK_ChannelShutdownState_write(int64_t obj) {
43598         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
43599         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
43600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43602         CVec_u8Z_free(ret_var);
43603         return ret_arr;
43604 }
43605
43606 int64_t  CS_LDK_ChannelShutdownState_read(int8_tArray ser) {
43607         LDKu8slice ser_ref;
43608         ser_ref.datalen = ser->arr_len;
43609         ser_ref.data = ser->elems;
43610         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
43611         *ret_conv = ChannelShutdownState_read(ser_ref);
43612         FREE(ser);
43613         return tag_ptr(ret_conv, true);
43614 }
43615
43616 void  CS_LDK_ChannelManagerReadArgs_free(int64_t this_obj) {
43617         LDKChannelManagerReadArgs this_obj_conv;
43618         this_obj_conv.inner = untag_ptr(this_obj);
43619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43621         ChannelManagerReadArgs_free(this_obj_conv);
43622 }
43623
43624 int64_t  CS_LDK_ChannelManagerReadArgs_get_entropy_source(int64_t this_ptr) {
43625         LDKChannelManagerReadArgs this_ptr_conv;
43626         this_ptr_conv.inner = untag_ptr(this_ptr);
43627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43629         this_ptr_conv.is_owned = false;
43630         // WARNING: This object doesn't live past this scope, needs clone!
43631         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
43632         return ret_ret;
43633 }
43634
43635 void  CS_LDK_ChannelManagerReadArgs_set_entropy_source(int64_t this_ptr, int64_t val) {
43636         LDKChannelManagerReadArgs this_ptr_conv;
43637         this_ptr_conv.inner = untag_ptr(this_ptr);
43638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43640         this_ptr_conv.is_owned = false;
43641         void* val_ptr = untag_ptr(val);
43642         CHECK_ACCESS(val_ptr);
43643         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
43644         if (val_conv.free == LDKEntropySource_JCalls_free) {
43645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43646                 LDKEntropySource_JCalls_cloned(&val_conv);
43647         }
43648         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
43649 }
43650
43651 int64_t  CS_LDK_ChannelManagerReadArgs_get_node_signer(int64_t this_ptr) {
43652         LDKChannelManagerReadArgs this_ptr_conv;
43653         this_ptr_conv.inner = untag_ptr(this_ptr);
43654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43656         this_ptr_conv.is_owned = false;
43657         // WARNING: This object doesn't live past this scope, needs clone!
43658         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
43659         return ret_ret;
43660 }
43661
43662 void  CS_LDK_ChannelManagerReadArgs_set_node_signer(int64_t this_ptr, int64_t val) {
43663         LDKChannelManagerReadArgs this_ptr_conv;
43664         this_ptr_conv.inner = untag_ptr(this_ptr);
43665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43667         this_ptr_conv.is_owned = false;
43668         void* val_ptr = untag_ptr(val);
43669         CHECK_ACCESS(val_ptr);
43670         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
43671         if (val_conv.free == LDKNodeSigner_JCalls_free) {
43672                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43673                 LDKNodeSigner_JCalls_cloned(&val_conv);
43674         }
43675         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
43676 }
43677
43678 int64_t  CS_LDK_ChannelManagerReadArgs_get_signer_provider(int64_t this_ptr) {
43679         LDKChannelManagerReadArgs this_ptr_conv;
43680         this_ptr_conv.inner = untag_ptr(this_ptr);
43681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43683         this_ptr_conv.is_owned = false;
43684         // WARNING: This object doesn't live past this scope, needs clone!
43685         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
43686         return ret_ret;
43687 }
43688
43689 void  CS_LDK_ChannelManagerReadArgs_set_signer_provider(int64_t this_ptr, int64_t val) {
43690         LDKChannelManagerReadArgs this_ptr_conv;
43691         this_ptr_conv.inner = untag_ptr(this_ptr);
43692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43694         this_ptr_conv.is_owned = false;
43695         void* val_ptr = untag_ptr(val);
43696         CHECK_ACCESS(val_ptr);
43697         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
43698         if (val_conv.free == LDKSignerProvider_JCalls_free) {
43699                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43700                 LDKSignerProvider_JCalls_cloned(&val_conv);
43701         }
43702         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
43703 }
43704
43705 int64_t  CS_LDK_ChannelManagerReadArgs_get_fee_estimator(int64_t this_ptr) {
43706         LDKChannelManagerReadArgs this_ptr_conv;
43707         this_ptr_conv.inner = untag_ptr(this_ptr);
43708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43710         this_ptr_conv.is_owned = false;
43711         // WARNING: This object doesn't live past this scope, needs clone!
43712         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
43713         return ret_ret;
43714 }
43715
43716 void  CS_LDK_ChannelManagerReadArgs_set_fee_estimator(int64_t this_ptr, int64_t val) {
43717         LDKChannelManagerReadArgs this_ptr_conv;
43718         this_ptr_conv.inner = untag_ptr(this_ptr);
43719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43721         this_ptr_conv.is_owned = false;
43722         void* val_ptr = untag_ptr(val);
43723         CHECK_ACCESS(val_ptr);
43724         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
43725         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
43726                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43727                 LDKFeeEstimator_JCalls_cloned(&val_conv);
43728         }
43729         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
43730 }
43731
43732 int64_t  CS_LDK_ChannelManagerReadArgs_get_chain_monitor(int64_t this_ptr) {
43733         LDKChannelManagerReadArgs this_ptr_conv;
43734         this_ptr_conv.inner = untag_ptr(this_ptr);
43735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43737         this_ptr_conv.is_owned = false;
43738         // WARNING: This object doesn't live past this scope, needs clone!
43739         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
43740         return ret_ret;
43741 }
43742
43743 void  CS_LDK_ChannelManagerReadArgs_set_chain_monitor(int64_t this_ptr, int64_t val) {
43744         LDKChannelManagerReadArgs this_ptr_conv;
43745         this_ptr_conv.inner = untag_ptr(this_ptr);
43746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43748         this_ptr_conv.is_owned = false;
43749         void* val_ptr = untag_ptr(val);
43750         CHECK_ACCESS(val_ptr);
43751         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
43752         if (val_conv.free == LDKWatch_JCalls_free) {
43753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43754                 LDKWatch_JCalls_cloned(&val_conv);
43755         }
43756         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
43757 }
43758
43759 int64_t  CS_LDK_ChannelManagerReadArgs_get_tx_broadcaster(int64_t this_ptr) {
43760         LDKChannelManagerReadArgs this_ptr_conv;
43761         this_ptr_conv.inner = untag_ptr(this_ptr);
43762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43764         this_ptr_conv.is_owned = false;
43765         // WARNING: This object doesn't live past this scope, needs clone!
43766         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
43767         return ret_ret;
43768 }
43769
43770 void  CS_LDK_ChannelManagerReadArgs_set_tx_broadcaster(int64_t this_ptr, int64_t val) {
43771         LDKChannelManagerReadArgs this_ptr_conv;
43772         this_ptr_conv.inner = untag_ptr(this_ptr);
43773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43775         this_ptr_conv.is_owned = false;
43776         void* val_ptr = untag_ptr(val);
43777         CHECK_ACCESS(val_ptr);
43778         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
43779         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
43780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43781                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
43782         }
43783         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
43784 }
43785
43786 int64_t  CS_LDK_ChannelManagerReadArgs_get_router(int64_t this_ptr) {
43787         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
43793         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
43794         return ret_ret;
43795 }
43796
43797 void  CS_LDK_ChannelManagerReadArgs_set_router(int64_t this_ptr, int64_t val) {
43798         LDKChannelManagerReadArgs this_ptr_conv;
43799         this_ptr_conv.inner = untag_ptr(this_ptr);
43800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43802         this_ptr_conv.is_owned = false;
43803         void* val_ptr = untag_ptr(val);
43804         CHECK_ACCESS(val_ptr);
43805         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
43806         if (val_conv.free == LDKRouter_JCalls_free) {
43807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43808                 LDKRouter_JCalls_cloned(&val_conv);
43809         }
43810         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
43811 }
43812
43813 int64_t  CS_LDK_ChannelManagerReadArgs_get_logger(int64_t this_ptr) {
43814         LDKChannelManagerReadArgs this_ptr_conv;
43815         this_ptr_conv.inner = untag_ptr(this_ptr);
43816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43818         this_ptr_conv.is_owned = false;
43819         // WARNING: This object doesn't live past this scope, needs clone!
43820         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
43821         return ret_ret;
43822 }
43823
43824 void  CS_LDK_ChannelManagerReadArgs_set_logger(int64_t this_ptr, int64_t val) {
43825         LDKChannelManagerReadArgs this_ptr_conv;
43826         this_ptr_conv.inner = untag_ptr(this_ptr);
43827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43829         this_ptr_conv.is_owned = false;
43830         void* val_ptr = untag_ptr(val);
43831         CHECK_ACCESS(val_ptr);
43832         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
43833         if (val_conv.free == LDKLogger_JCalls_free) {
43834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43835                 LDKLogger_JCalls_cloned(&val_conv);
43836         }
43837         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
43838 }
43839
43840 int64_t  CS_LDK_ChannelManagerReadArgs_get_default_config(int64_t this_ptr) {
43841         LDKChannelManagerReadArgs this_ptr_conv;
43842         this_ptr_conv.inner = untag_ptr(this_ptr);
43843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43845         this_ptr_conv.is_owned = false;
43846         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
43847         int64_t ret_ref = 0;
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43850         return ret_ref;
43851 }
43852
43853 void  CS_LDK_ChannelManagerReadArgs_set_default_config(int64_t this_ptr, int64_t val) {
43854         LDKChannelManagerReadArgs this_ptr_conv;
43855         this_ptr_conv.inner = untag_ptr(this_ptr);
43856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43858         this_ptr_conv.is_owned = false;
43859         LDKUserConfig val_conv;
43860         val_conv.inner = untag_ptr(val);
43861         val_conv.is_owned = ptr_is_owned(val);
43862         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43863         val_conv = UserConfig_clone(&val_conv);
43864         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
43865 }
43866
43867 int64_t  CS_LDK_ChannelManagerReadArgs_new(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) {
43868         void* entropy_source_ptr = untag_ptr(entropy_source);
43869         CHECK_ACCESS(entropy_source_ptr);
43870         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43871         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43873                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43874         }
43875         void* node_signer_ptr = untag_ptr(node_signer);
43876         CHECK_ACCESS(node_signer_ptr);
43877         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43878         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43880                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43881         }
43882         void* signer_provider_ptr = untag_ptr(signer_provider);
43883         CHECK_ACCESS(signer_provider_ptr);
43884         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43885         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43886                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43887                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43888         }
43889         void* fee_estimator_ptr = untag_ptr(fee_estimator);
43890         CHECK_ACCESS(fee_estimator_ptr);
43891         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
43892         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
43893                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43894                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
43895         }
43896         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43897         CHECK_ACCESS(chain_monitor_ptr);
43898         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43899         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43900                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43901                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43902         }
43903         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43904         CHECK_ACCESS(tx_broadcaster_ptr);
43905         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43906         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43907                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43908                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43909         }
43910         void* router_ptr = untag_ptr(router);
43911         CHECK_ACCESS(router_ptr);
43912         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43913         if (router_conv.free == LDKRouter_JCalls_free) {
43914                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43915                 LDKRouter_JCalls_cloned(&router_conv);
43916         }
43917         void* logger_ptr = untag_ptr(logger);
43918         CHECK_ACCESS(logger_ptr);
43919         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43920         if (logger_conv.free == LDKLogger_JCalls_free) {
43921                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43922                 LDKLogger_JCalls_cloned(&logger_conv);
43923         }
43924         LDKUserConfig default_config_conv;
43925         default_config_conv.inner = untag_ptr(default_config);
43926         default_config_conv.is_owned = ptr_is_owned(default_config);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
43928         default_config_conv = UserConfig_clone(&default_config_conv);
43929         LDKCVec_ChannelMonitorZ channel_monitors_constr;
43930         channel_monitors_constr.datalen = channel_monitors->arr_len;
43931         if (channel_monitors_constr.datalen > 0)
43932                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
43933         else
43934                 channel_monitors_constr.data = NULL;
43935         int64_t* channel_monitors_vals = channel_monitors->elems;
43936         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
43937                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
43938                 LDKChannelMonitor channel_monitors_conv_16_conv;
43939                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
43940                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
43941                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
43942                 channel_monitors_conv_16_conv.is_owned = false;
43943                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
43944         }
43945         FREE(channel_monitors);
43946         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);
43947         int64_t ret_ref = 0;
43948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43950         return ret_ref;
43951 }
43952
43953 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, int64_t arg) {
43954         LDKu8slice ser_ref;
43955         ser_ref.datalen = ser->arr_len;
43956         ser_ref.data = ser->elems;
43957         LDKChannelManagerReadArgs arg_conv;
43958         arg_conv.inner = untag_ptr(arg);
43959         arg_conv.is_owned = ptr_is_owned(arg);
43960         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43961         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
43962         
43963         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
43964         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
43965         FREE(ser);
43966         return tag_ptr(ret_conv, true);
43967 }
43968
43969 void  CS_LDK_DelayedPaymentBasepoint_free(int64_t this_obj) {
43970         LDKDelayedPaymentBasepoint this_obj_conv;
43971         this_obj_conv.inner = untag_ptr(this_obj);
43972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43974         DelayedPaymentBasepoint_free(this_obj_conv);
43975 }
43976
43977 int8_tArray  CS_LDK_DelayedPaymentBasepoint_get_a(int64_t this_ptr) {
43978         LDKDelayedPaymentBasepoint this_ptr_conv;
43979         this_ptr_conv.inner = untag_ptr(this_ptr);
43980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43982         this_ptr_conv.is_owned = false;
43983         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43984         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43985         return ret_arr;
43986 }
43987
43988 void  CS_LDK_DelayedPaymentBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
43989         LDKDelayedPaymentBasepoint this_ptr_conv;
43990         this_ptr_conv.inner = untag_ptr(this_ptr);
43991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43993         this_ptr_conv.is_owned = false;
43994         LDKPublicKey val_ref;
43995         CHECK(val->arr_len == 33);
43996         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43997         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
43998 }
43999
44000 int64_t  CS_LDK_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
44001         LDKPublicKey a_arg_ref;
44002         CHECK(a_arg->arr_len == 33);
44003         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44004         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
44005         int64_t ret_ref = 0;
44006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44008         return ret_ref;
44009 }
44010
44011 jboolean  CS_LDK_DelayedPaymentBasepoint_eq(int64_t a, int64_t b) {
44012         LDKDelayedPaymentBasepoint a_conv;
44013         a_conv.inner = untag_ptr(a);
44014         a_conv.is_owned = ptr_is_owned(a);
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44016         a_conv.is_owned = false;
44017         LDKDelayedPaymentBasepoint b_conv;
44018         b_conv.inner = untag_ptr(b);
44019         b_conv.is_owned = ptr_is_owned(b);
44020         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44021         b_conv.is_owned = false;
44022         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
44023         return ret_conv;
44024 }
44025
44026 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
44027         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
44028         int64_t ret_ref = 0;
44029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44031         return ret_ref;
44032 }
44033 int64_t  CS_LDK_DelayedPaymentBasepoint_clone_ptr(int64_t arg) {
44034         LDKDelayedPaymentBasepoint arg_conv;
44035         arg_conv.inner = untag_ptr(arg);
44036         arg_conv.is_owned = ptr_is_owned(arg);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44038         arg_conv.is_owned = false;
44039         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
44040         return ret_conv;
44041 }
44042
44043 int64_t  CS_LDK_DelayedPaymentBasepoint_clone(int64_t orig) {
44044         LDKDelayedPaymentBasepoint orig_conv;
44045         orig_conv.inner = untag_ptr(orig);
44046         orig_conv.is_owned = ptr_is_owned(orig);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44048         orig_conv.is_owned = false;
44049         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
44050         int64_t ret_ref = 0;
44051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44053         return ret_ref;
44054 }
44055
44056 int64_t  CS_LDK_DelayedPaymentBasepoint_hash(int64_t o) {
44057         LDKDelayedPaymentBasepoint o_conv;
44058         o_conv.inner = untag_ptr(o);
44059         o_conv.is_owned = ptr_is_owned(o);
44060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44061         o_conv.is_owned = false;
44062         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
44063         return ret_conv;
44064 }
44065
44066 int8_tArray  CS_LDK_DelayedPaymentBasepoint_to_public_key(int64_t this_arg) {
44067         LDKDelayedPaymentBasepoint this_arg_conv;
44068         this_arg_conv.inner = untag_ptr(this_arg);
44069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44071         this_arg_conv.is_owned = false;
44072         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44073         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44074         return ret_arr;
44075 }
44076
44077 int8_tArray  CS_LDK_DelayedPaymentBasepoint_derive_add_tweak(int64_t this_arg, int8_tArray per_commitment_point) {
44078         LDKDelayedPaymentBasepoint this_arg_conv;
44079         this_arg_conv.inner = untag_ptr(this_arg);
44080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44082         this_arg_conv.is_owned = false;
44083         LDKPublicKey per_commitment_point_ref;
44084         CHECK(per_commitment_point->arr_len == 33);
44085         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44086         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44087         memcpy(ret_arr->elems, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
44088         return ret_arr;
44089 }
44090
44091 int8_tArray  CS_LDK_DelayedPaymentBasepoint_write(int64_t obj) {
44092         LDKDelayedPaymentBasepoint obj_conv;
44093         obj_conv.inner = untag_ptr(obj);
44094         obj_conv.is_owned = ptr_is_owned(obj);
44095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44096         obj_conv.is_owned = false;
44097         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
44098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44100         CVec_u8Z_free(ret_var);
44101         return ret_arr;
44102 }
44103
44104 int64_t  CS_LDK_DelayedPaymentBasepoint_read(int8_tArray ser) {
44105         LDKu8slice ser_ref;
44106         ser_ref.datalen = ser->arr_len;
44107         ser_ref.data = ser->elems;
44108         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
44109         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
44110         FREE(ser);
44111         return tag_ptr(ret_conv, true);
44112 }
44113
44114 void  CS_LDK_DelayedPaymentKey_free(int64_t this_obj) {
44115         LDKDelayedPaymentKey this_obj_conv;
44116         this_obj_conv.inner = untag_ptr(this_obj);
44117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44119         DelayedPaymentKey_free(this_obj_conv);
44120 }
44121
44122 int8_tArray  CS_LDK_DelayedPaymentKey_get_a(int64_t this_ptr) {
44123         LDKDelayedPaymentKey this_ptr_conv;
44124         this_ptr_conv.inner = untag_ptr(this_ptr);
44125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44127         this_ptr_conv.is_owned = false;
44128         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44129         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
44130         return ret_arr;
44131 }
44132
44133 void  CS_LDK_DelayedPaymentKey_set_a(int64_t this_ptr, int8_tArray val) {
44134         LDKDelayedPaymentKey this_ptr_conv;
44135         this_ptr_conv.inner = untag_ptr(this_ptr);
44136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44138         this_ptr_conv.is_owned = false;
44139         LDKPublicKey val_ref;
44140         CHECK(val->arr_len == 33);
44141         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44142         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
44143 }
44144
44145 int64_t  CS_LDK_DelayedPaymentKey_new(int8_tArray a_arg) {
44146         LDKPublicKey a_arg_ref;
44147         CHECK(a_arg->arr_len == 33);
44148         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44149         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
44150         int64_t ret_ref = 0;
44151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44153         return ret_ref;
44154 }
44155
44156 jboolean  CS_LDK_DelayedPaymentKey_eq(int64_t a, int64_t b) {
44157         LDKDelayedPaymentKey a_conv;
44158         a_conv.inner = untag_ptr(a);
44159         a_conv.is_owned = ptr_is_owned(a);
44160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44161         a_conv.is_owned = false;
44162         LDKDelayedPaymentKey b_conv;
44163         b_conv.inner = untag_ptr(b);
44164         b_conv.is_owned = ptr_is_owned(b);
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44166         b_conv.is_owned = false;
44167         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
44168         return ret_conv;
44169 }
44170
44171 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
44172         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
44173         int64_t ret_ref = 0;
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44176         return ret_ref;
44177 }
44178 int64_t  CS_LDK_DelayedPaymentKey_clone_ptr(int64_t arg) {
44179         LDKDelayedPaymentKey arg_conv;
44180         arg_conv.inner = untag_ptr(arg);
44181         arg_conv.is_owned = ptr_is_owned(arg);
44182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44183         arg_conv.is_owned = false;
44184         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
44185         return ret_conv;
44186 }
44187
44188 int64_t  CS_LDK_DelayedPaymentKey_clone(int64_t orig) {
44189         LDKDelayedPaymentKey orig_conv;
44190         orig_conv.inner = untag_ptr(orig);
44191         orig_conv.is_owned = ptr_is_owned(orig);
44192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44193         orig_conv.is_owned = false;
44194         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
44195         int64_t ret_ref = 0;
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44198         return ret_ref;
44199 }
44200
44201 int64_t  CS_LDK_DelayedPaymentKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44202         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
44203         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44204         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44206         countersignatory_basepoint_conv.is_owned = false;
44207         LDKPublicKey per_commitment_point_ref;
44208         CHECK(per_commitment_point->arr_len == 33);
44209         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44210         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44211         int64_t ret_ref = 0;
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44214         return ret_ref;
44215 }
44216
44217 int64_t  CS_LDK_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
44218         uint8_t sk_arr[32];
44219         CHECK(sk->arr_len == 32);
44220         memcpy(sk_arr, sk->elems, 32); FREE(sk);
44221         uint8_t (*sk_ref)[32] = &sk_arr;
44222         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
44223         int64_t ret_ref = 0;
44224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44226         return ret_ref;
44227 }
44228
44229 int8_tArray  CS_LDK_DelayedPaymentKey_to_public_key(int64_t this_arg) {
44230         LDKDelayedPaymentKey this_arg_conv;
44231         this_arg_conv.inner = untag_ptr(this_arg);
44232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44234         this_arg_conv.is_owned = false;
44235         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44236         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
44237         return ret_arr;
44238 }
44239
44240 int8_tArray  CS_LDK_DelayedPaymentKey_write(int64_t obj) {
44241         LDKDelayedPaymentKey obj_conv;
44242         obj_conv.inner = untag_ptr(obj);
44243         obj_conv.is_owned = ptr_is_owned(obj);
44244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44245         obj_conv.is_owned = false;
44246         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
44247         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44248         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44249         CVec_u8Z_free(ret_var);
44250         return ret_arr;
44251 }
44252
44253 int64_t  CS_LDK_DelayedPaymentKey_read(int8_tArray ser) {
44254         LDKu8slice ser_ref;
44255         ser_ref.datalen = ser->arr_len;
44256         ser_ref.data = ser->elems;
44257         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
44258         *ret_conv = DelayedPaymentKey_read(ser_ref);
44259         FREE(ser);
44260         return tag_ptr(ret_conv, true);
44261 }
44262
44263 void  CS_LDK_HtlcBasepoint_free(int64_t this_obj) {
44264         LDKHtlcBasepoint this_obj_conv;
44265         this_obj_conv.inner = untag_ptr(this_obj);
44266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44268         HtlcBasepoint_free(this_obj_conv);
44269 }
44270
44271 int8_tArray  CS_LDK_HtlcBasepoint_get_a(int64_t this_ptr) {
44272         LDKHtlcBasepoint this_ptr_conv;
44273         this_ptr_conv.inner = untag_ptr(this_ptr);
44274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44276         this_ptr_conv.is_owned = false;
44277         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44278         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
44279         return ret_arr;
44280 }
44281
44282 void  CS_LDK_HtlcBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
44283         LDKHtlcBasepoint this_ptr_conv;
44284         this_ptr_conv.inner = untag_ptr(this_ptr);
44285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44287         this_ptr_conv.is_owned = false;
44288         LDKPublicKey val_ref;
44289         CHECK(val->arr_len == 33);
44290         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44291         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
44292 }
44293
44294 int64_t  CS_LDK_HtlcBasepoint_new(int8_tArray a_arg) {
44295         LDKPublicKey a_arg_ref;
44296         CHECK(a_arg->arr_len == 33);
44297         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44298         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
44299         int64_t ret_ref = 0;
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44302         return ret_ref;
44303 }
44304
44305 jboolean  CS_LDK_HtlcBasepoint_eq(int64_t a, int64_t b) {
44306         LDKHtlcBasepoint a_conv;
44307         a_conv.inner = untag_ptr(a);
44308         a_conv.is_owned = ptr_is_owned(a);
44309         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44310         a_conv.is_owned = false;
44311         LDKHtlcBasepoint b_conv;
44312         b_conv.inner = untag_ptr(b);
44313         b_conv.is_owned = ptr_is_owned(b);
44314         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44315         b_conv.is_owned = false;
44316         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
44317         return ret_conv;
44318 }
44319
44320 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
44321         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
44322         int64_t ret_ref = 0;
44323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44325         return ret_ref;
44326 }
44327 int64_t  CS_LDK_HtlcBasepoint_clone_ptr(int64_t arg) {
44328         LDKHtlcBasepoint arg_conv;
44329         arg_conv.inner = untag_ptr(arg);
44330         arg_conv.is_owned = ptr_is_owned(arg);
44331         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44332         arg_conv.is_owned = false;
44333         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
44334         return ret_conv;
44335 }
44336
44337 int64_t  CS_LDK_HtlcBasepoint_clone(int64_t orig) {
44338         LDKHtlcBasepoint orig_conv;
44339         orig_conv.inner = untag_ptr(orig);
44340         orig_conv.is_owned = ptr_is_owned(orig);
44341         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44342         orig_conv.is_owned = false;
44343         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
44344         int64_t ret_ref = 0;
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44347         return ret_ref;
44348 }
44349
44350 int64_t  CS_LDK_HtlcBasepoint_hash(int64_t o) {
44351         LDKHtlcBasepoint o_conv;
44352         o_conv.inner = untag_ptr(o);
44353         o_conv.is_owned = ptr_is_owned(o);
44354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44355         o_conv.is_owned = false;
44356         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
44357         return ret_conv;
44358 }
44359
44360 int8_tArray  CS_LDK_HtlcBasepoint_to_public_key(int64_t this_arg) {
44361         LDKHtlcBasepoint this_arg_conv;
44362         this_arg_conv.inner = untag_ptr(this_arg);
44363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44365         this_arg_conv.is_owned = false;
44366         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44367         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44368         return ret_arr;
44369 }
44370
44371 int8_tArray  CS_LDK_HtlcBasepoint_derive_add_tweak(int64_t this_arg, int8_tArray per_commitment_point) {
44372         LDKHtlcBasepoint this_arg_conv;
44373         this_arg_conv.inner = untag_ptr(this_arg);
44374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44376         this_arg_conv.is_owned = false;
44377         LDKPublicKey per_commitment_point_ref;
44378         CHECK(per_commitment_point->arr_len == 33);
44379         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44380         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44381         memcpy(ret_arr->elems, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
44382         return ret_arr;
44383 }
44384
44385 int8_tArray  CS_LDK_HtlcBasepoint_write(int64_t obj) {
44386         LDKHtlcBasepoint obj_conv;
44387         obj_conv.inner = untag_ptr(obj);
44388         obj_conv.is_owned = ptr_is_owned(obj);
44389         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44390         obj_conv.is_owned = false;
44391         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
44392         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44393         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44394         CVec_u8Z_free(ret_var);
44395         return ret_arr;
44396 }
44397
44398 int64_t  CS_LDK_HtlcBasepoint_read(int8_tArray ser) {
44399         LDKu8slice ser_ref;
44400         ser_ref.datalen = ser->arr_len;
44401         ser_ref.data = ser->elems;
44402         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
44403         *ret_conv = HtlcBasepoint_read(ser_ref);
44404         FREE(ser);
44405         return tag_ptr(ret_conv, true);
44406 }
44407
44408 void  CS_LDK_HtlcKey_free(int64_t this_obj) {
44409         LDKHtlcKey this_obj_conv;
44410         this_obj_conv.inner = untag_ptr(this_obj);
44411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44413         HtlcKey_free(this_obj_conv);
44414 }
44415
44416 int8_tArray  CS_LDK_HtlcKey_get_a(int64_t this_ptr) {
44417         LDKHtlcKey this_ptr_conv;
44418         this_ptr_conv.inner = untag_ptr(this_ptr);
44419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44421         this_ptr_conv.is_owned = false;
44422         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44423         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
44424         return ret_arr;
44425 }
44426
44427 void  CS_LDK_HtlcKey_set_a(int64_t this_ptr, int8_tArray val) {
44428         LDKHtlcKey this_ptr_conv;
44429         this_ptr_conv.inner = untag_ptr(this_ptr);
44430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44432         this_ptr_conv.is_owned = false;
44433         LDKPublicKey val_ref;
44434         CHECK(val->arr_len == 33);
44435         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44436         HtlcKey_set_a(&this_ptr_conv, val_ref);
44437 }
44438
44439 int64_t  CS_LDK_HtlcKey_new(int8_tArray a_arg) {
44440         LDKPublicKey a_arg_ref;
44441         CHECK(a_arg->arr_len == 33);
44442         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44443         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
44444         int64_t ret_ref = 0;
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44447         return ret_ref;
44448 }
44449
44450 jboolean  CS_LDK_HtlcKey_eq(int64_t a, int64_t b) {
44451         LDKHtlcKey a_conv;
44452         a_conv.inner = untag_ptr(a);
44453         a_conv.is_owned = ptr_is_owned(a);
44454         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44455         a_conv.is_owned = false;
44456         LDKHtlcKey b_conv;
44457         b_conv.inner = untag_ptr(b);
44458         b_conv.is_owned = ptr_is_owned(b);
44459         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44460         b_conv.is_owned = false;
44461         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
44462         return ret_conv;
44463 }
44464
44465 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
44466         LDKHtlcKey ret_var = HtlcKey_clone(arg);
44467         int64_t ret_ref = 0;
44468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44470         return ret_ref;
44471 }
44472 int64_t  CS_LDK_HtlcKey_clone_ptr(int64_t arg) {
44473         LDKHtlcKey arg_conv;
44474         arg_conv.inner = untag_ptr(arg);
44475         arg_conv.is_owned = ptr_is_owned(arg);
44476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44477         arg_conv.is_owned = false;
44478         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
44479         return ret_conv;
44480 }
44481
44482 int64_t  CS_LDK_HtlcKey_clone(int64_t orig) {
44483         LDKHtlcKey orig_conv;
44484         orig_conv.inner = untag_ptr(orig);
44485         orig_conv.is_owned = ptr_is_owned(orig);
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44487         orig_conv.is_owned = false;
44488         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
44489         int64_t ret_ref = 0;
44490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44492         return ret_ref;
44493 }
44494
44495 int64_t  CS_LDK_HtlcKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44496         LDKHtlcBasepoint countersignatory_basepoint_conv;
44497         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44498         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44500         countersignatory_basepoint_conv.is_owned = false;
44501         LDKPublicKey per_commitment_point_ref;
44502         CHECK(per_commitment_point->arr_len == 33);
44503         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44504         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44505         int64_t ret_ref = 0;
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44508         return ret_ref;
44509 }
44510
44511 int64_t  CS_LDK_HtlcKey_from_secret_key(int8_tArray sk) {
44512         uint8_t sk_arr[32];
44513         CHECK(sk->arr_len == 32);
44514         memcpy(sk_arr, sk->elems, 32); FREE(sk);
44515         uint8_t (*sk_ref)[32] = &sk_arr;
44516         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
44517         int64_t ret_ref = 0;
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44520         return ret_ref;
44521 }
44522
44523 int8_tArray  CS_LDK_HtlcKey_to_public_key(int64_t this_arg) {
44524         LDKHtlcKey this_arg_conv;
44525         this_arg_conv.inner = untag_ptr(this_arg);
44526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44528         this_arg_conv.is_owned = false;
44529         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44530         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
44531         return ret_arr;
44532 }
44533
44534 int8_tArray  CS_LDK_HtlcKey_write(int64_t obj) {
44535         LDKHtlcKey obj_conv;
44536         obj_conv.inner = untag_ptr(obj);
44537         obj_conv.is_owned = ptr_is_owned(obj);
44538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44539         obj_conv.is_owned = false;
44540         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
44541         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44542         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44543         CVec_u8Z_free(ret_var);
44544         return ret_arr;
44545 }
44546
44547 int64_t  CS_LDK_HtlcKey_read(int8_tArray ser) {
44548         LDKu8slice ser_ref;
44549         ser_ref.datalen = ser->arr_len;
44550         ser_ref.data = ser->elems;
44551         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
44552         *ret_conv = HtlcKey_read(ser_ref);
44553         FREE(ser);
44554         return tag_ptr(ret_conv, true);
44555 }
44556
44557 int8_tArray  CS_LDK_add_public_key_tweak(int8_tArray base_point, int8_tArray tweak) {
44558         LDKPublicKey base_point_ref;
44559         CHECK(base_point->arr_len == 33);
44560         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44561         uint8_t tweak_arr[32];
44562         CHECK(tweak->arr_len == 32);
44563         memcpy(tweak_arr, tweak->elems, 32); FREE(tweak);
44564         uint8_t (*tweak_ref)[32] = &tweak_arr;
44565         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44566         memcpy(ret_arr->elems, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form, 33);
44567         return ret_arr;
44568 }
44569
44570 void  CS_LDK_RevocationBasepoint_free(int64_t this_obj) {
44571         LDKRevocationBasepoint this_obj_conv;
44572         this_obj_conv.inner = untag_ptr(this_obj);
44573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44575         RevocationBasepoint_free(this_obj_conv);
44576 }
44577
44578 int8_tArray  CS_LDK_RevocationBasepoint_get_a(int64_t this_ptr) {
44579         LDKRevocationBasepoint this_ptr_conv;
44580         this_ptr_conv.inner = untag_ptr(this_ptr);
44581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44583         this_ptr_conv.is_owned = false;
44584         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44585         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
44586         return ret_arr;
44587 }
44588
44589 void  CS_LDK_RevocationBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
44590         LDKRevocationBasepoint this_ptr_conv;
44591         this_ptr_conv.inner = untag_ptr(this_ptr);
44592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44594         this_ptr_conv.is_owned = false;
44595         LDKPublicKey val_ref;
44596         CHECK(val->arr_len == 33);
44597         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44598         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
44599 }
44600
44601 int64_t  CS_LDK_RevocationBasepoint_new(int8_tArray a_arg) {
44602         LDKPublicKey a_arg_ref;
44603         CHECK(a_arg->arr_len == 33);
44604         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44605         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
44606         int64_t ret_ref = 0;
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44609         return ret_ref;
44610 }
44611
44612 jboolean  CS_LDK_RevocationBasepoint_eq(int64_t a, int64_t b) {
44613         LDKRevocationBasepoint a_conv;
44614         a_conv.inner = untag_ptr(a);
44615         a_conv.is_owned = ptr_is_owned(a);
44616         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44617         a_conv.is_owned = false;
44618         LDKRevocationBasepoint b_conv;
44619         b_conv.inner = untag_ptr(b);
44620         b_conv.is_owned = ptr_is_owned(b);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44622         b_conv.is_owned = false;
44623         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
44624         return ret_conv;
44625 }
44626
44627 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
44628         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
44629         int64_t ret_ref = 0;
44630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44632         return ret_ref;
44633 }
44634 int64_t  CS_LDK_RevocationBasepoint_clone_ptr(int64_t arg) {
44635         LDKRevocationBasepoint arg_conv;
44636         arg_conv.inner = untag_ptr(arg);
44637         arg_conv.is_owned = ptr_is_owned(arg);
44638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44639         arg_conv.is_owned = false;
44640         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
44641         return ret_conv;
44642 }
44643
44644 int64_t  CS_LDK_RevocationBasepoint_clone(int64_t orig) {
44645         LDKRevocationBasepoint orig_conv;
44646         orig_conv.inner = untag_ptr(orig);
44647         orig_conv.is_owned = ptr_is_owned(orig);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44649         orig_conv.is_owned = false;
44650         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
44651         int64_t ret_ref = 0;
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44654         return ret_ref;
44655 }
44656
44657 int64_t  CS_LDK_RevocationBasepoint_hash(int64_t o) {
44658         LDKRevocationBasepoint o_conv;
44659         o_conv.inner = untag_ptr(o);
44660         o_conv.is_owned = ptr_is_owned(o);
44661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44662         o_conv.is_owned = false;
44663         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
44664         return ret_conv;
44665 }
44666
44667 int8_tArray  CS_LDK_RevocationBasepoint_to_public_key(int64_t this_arg) {
44668         LDKRevocationBasepoint this_arg_conv;
44669         this_arg_conv.inner = untag_ptr(this_arg);
44670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44672         this_arg_conv.is_owned = false;
44673         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44674         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44675         return ret_arr;
44676 }
44677
44678 int8_tArray  CS_LDK_RevocationBasepoint_write(int64_t obj) {
44679         LDKRevocationBasepoint obj_conv;
44680         obj_conv.inner = untag_ptr(obj);
44681         obj_conv.is_owned = ptr_is_owned(obj);
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44683         obj_conv.is_owned = false;
44684         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
44685         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44686         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44687         CVec_u8Z_free(ret_var);
44688         return ret_arr;
44689 }
44690
44691 int64_t  CS_LDK_RevocationBasepoint_read(int8_tArray ser) {
44692         LDKu8slice ser_ref;
44693         ser_ref.datalen = ser->arr_len;
44694         ser_ref.data = ser->elems;
44695         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
44696         *ret_conv = RevocationBasepoint_read(ser_ref);
44697         FREE(ser);
44698         return tag_ptr(ret_conv, true);
44699 }
44700
44701 void  CS_LDK_RevocationKey_free(int64_t this_obj) {
44702         LDKRevocationKey this_obj_conv;
44703         this_obj_conv.inner = untag_ptr(this_obj);
44704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44706         RevocationKey_free(this_obj_conv);
44707 }
44708
44709 int8_tArray  CS_LDK_RevocationKey_get_a(int64_t this_ptr) {
44710         LDKRevocationKey this_ptr_conv;
44711         this_ptr_conv.inner = untag_ptr(this_ptr);
44712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44714         this_ptr_conv.is_owned = false;
44715         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44716         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
44717         return ret_arr;
44718 }
44719
44720 void  CS_LDK_RevocationKey_set_a(int64_t this_ptr, int8_tArray val) {
44721         LDKRevocationKey this_ptr_conv;
44722         this_ptr_conv.inner = untag_ptr(this_ptr);
44723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44725         this_ptr_conv.is_owned = false;
44726         LDKPublicKey val_ref;
44727         CHECK(val->arr_len == 33);
44728         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44729         RevocationKey_set_a(&this_ptr_conv, val_ref);
44730 }
44731
44732 int64_t  CS_LDK_RevocationKey_new(int8_tArray a_arg) {
44733         LDKPublicKey a_arg_ref;
44734         CHECK(a_arg->arr_len == 33);
44735         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44736         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
44737         int64_t ret_ref = 0;
44738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44740         return ret_ref;
44741 }
44742
44743 jboolean  CS_LDK_RevocationKey_eq(int64_t a, int64_t b) {
44744         LDKRevocationKey a_conv;
44745         a_conv.inner = untag_ptr(a);
44746         a_conv.is_owned = ptr_is_owned(a);
44747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44748         a_conv.is_owned = false;
44749         LDKRevocationKey b_conv;
44750         b_conv.inner = untag_ptr(b);
44751         b_conv.is_owned = ptr_is_owned(b);
44752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44753         b_conv.is_owned = false;
44754         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
44755         return ret_conv;
44756 }
44757
44758 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
44759         LDKRevocationKey ret_var = RevocationKey_clone(arg);
44760         int64_t ret_ref = 0;
44761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44763         return ret_ref;
44764 }
44765 int64_t  CS_LDK_RevocationKey_clone_ptr(int64_t arg) {
44766         LDKRevocationKey arg_conv;
44767         arg_conv.inner = untag_ptr(arg);
44768         arg_conv.is_owned = ptr_is_owned(arg);
44769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44770         arg_conv.is_owned = false;
44771         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
44772         return ret_conv;
44773 }
44774
44775 int64_t  CS_LDK_RevocationKey_clone(int64_t orig) {
44776         LDKRevocationKey orig_conv;
44777         orig_conv.inner = untag_ptr(orig);
44778         orig_conv.is_owned = ptr_is_owned(orig);
44779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44780         orig_conv.is_owned = false;
44781         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
44782         int64_t ret_ref = 0;
44783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44785         return ret_ref;
44786 }
44787
44788 int64_t  CS_LDK_RevocationKey_hash(int64_t o) {
44789         LDKRevocationKey o_conv;
44790         o_conv.inner = untag_ptr(o);
44791         o_conv.is_owned = ptr_is_owned(o);
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44793         o_conv.is_owned = false;
44794         int64_t ret_conv = RevocationKey_hash(&o_conv);
44795         return ret_conv;
44796 }
44797
44798 int64_t  CS_LDK_RevocationKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44799         LDKRevocationBasepoint countersignatory_basepoint_conv;
44800         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44801         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44802         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44803         countersignatory_basepoint_conv.is_owned = false;
44804         LDKPublicKey per_commitment_point_ref;
44805         CHECK(per_commitment_point->arr_len == 33);
44806         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44807         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44808         int64_t ret_ref = 0;
44809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44811         return ret_ref;
44812 }
44813
44814 int8_tArray  CS_LDK_RevocationKey_to_public_key(int64_t this_arg) {
44815         LDKRevocationKey this_arg_conv;
44816         this_arg_conv.inner = untag_ptr(this_arg);
44817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44819         this_arg_conv.is_owned = false;
44820         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44821         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
44822         return ret_arr;
44823 }
44824
44825 int8_tArray  CS_LDK_RevocationKey_write(int64_t obj) {
44826         LDKRevocationKey obj_conv;
44827         obj_conv.inner = untag_ptr(obj);
44828         obj_conv.is_owned = ptr_is_owned(obj);
44829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44830         obj_conv.is_owned = false;
44831         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
44832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44834         CVec_u8Z_free(ret_var);
44835         return ret_arr;
44836 }
44837
44838 int64_t  CS_LDK_RevocationKey_read(int8_tArray ser) {
44839         LDKu8slice ser_ref;
44840         ser_ref.datalen = ser->arr_len;
44841         ser_ref.data = ser->elems;
44842         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
44843         *ret_conv = RevocationKey_read(ser_ref);
44844         FREE(ser);
44845         return tag_ptr(ret_conv, true);
44846 }
44847
44848 void  CS_LDK_ExpandedKey_free(int64_t this_obj) {
44849         LDKExpandedKey this_obj_conv;
44850         this_obj_conv.inner = untag_ptr(this_obj);
44851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44853         ExpandedKey_free(this_obj_conv);
44854 }
44855
44856 int64_t  CS_LDK_ExpandedKey_new(int8_tArray key_material) {
44857         uint8_t key_material_arr[32];
44858         CHECK(key_material->arr_len == 32);
44859         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
44860         uint8_t (*key_material_ref)[32] = &key_material_arr;
44861         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
44862         int64_t ret_ref = 0;
44863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44865         return ret_ref;
44866 }
44867
44868 int64_t  CS_LDK_create(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) {
44869         LDKExpandedKey keys_conv;
44870         keys_conv.inner = untag_ptr(keys);
44871         keys_conv.is_owned = ptr_is_owned(keys);
44872         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44873         keys_conv.is_owned = false;
44874         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44875         CHECK_ACCESS(min_value_msat_ptr);
44876         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44877         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44878         void* entropy_source_ptr = untag_ptr(entropy_source);
44879         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
44880         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
44881         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44882         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44883         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44884         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44885         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
44886         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
44887         return tag_ptr(ret_conv, true);
44888 }
44889
44890 int64_t  CS_LDK_create_from_hash(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) {
44891         LDKExpandedKey keys_conv;
44892         keys_conv.inner = untag_ptr(keys);
44893         keys_conv.is_owned = ptr_is_owned(keys);
44894         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
44895         keys_conv.is_owned = false;
44896         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44897         CHECK_ACCESS(min_value_msat_ptr);
44898         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44899         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44900         LDKThirtyTwoBytes payment_hash_ref;
44901         CHECK(payment_hash->arr_len == 32);
44902         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
44903         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44904         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44905         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44906         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44907         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
44908         *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);
44909         return tag_ptr(ret_conv, true);
44910 }
44911
44912 void  CS_LDK_DecodeError_free(int64_t this_ptr) {
44913         if (!ptr_is_owned(this_ptr)) return;
44914         void* this_ptr_ptr = untag_ptr(this_ptr);
44915         CHECK_ACCESS(this_ptr_ptr);
44916         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
44917         FREE(untag_ptr(this_ptr));
44918         DecodeError_free(this_ptr_conv);
44919 }
44920
44921 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
44922         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44923         *ret_copy = DecodeError_clone(arg);
44924         int64_t ret_ref = tag_ptr(ret_copy, true);
44925         return ret_ref;
44926 }
44927 int64_t  CS_LDK_DecodeError_clone_ptr(int64_t arg) {
44928         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
44929         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
44930         return ret_conv;
44931 }
44932
44933 int64_t  CS_LDK_DecodeError_clone(int64_t orig) {
44934         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
44935         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44936         *ret_copy = DecodeError_clone(orig_conv);
44937         int64_t ret_ref = tag_ptr(ret_copy, true);
44938         return ret_ref;
44939 }
44940
44941 int64_t  CS_LDK_DecodeError_unknown_version() {
44942         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44943         *ret_copy = DecodeError_unknown_version();
44944         int64_t ret_ref = tag_ptr(ret_copy, true);
44945         return ret_ref;
44946 }
44947
44948 int64_t  CS_LDK_DecodeError_unknown_required_feature() {
44949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44950         *ret_copy = DecodeError_unknown_required_feature();
44951         int64_t ret_ref = tag_ptr(ret_copy, true);
44952         return ret_ref;
44953 }
44954
44955 int64_t  CS_LDK_DecodeError_invalid_value() {
44956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44957         *ret_copy = DecodeError_invalid_value();
44958         int64_t ret_ref = tag_ptr(ret_copy, true);
44959         return ret_ref;
44960 }
44961
44962 int64_t  CS_LDK_DecodeError_short_read() {
44963         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44964         *ret_copy = DecodeError_short_read();
44965         int64_t ret_ref = tag_ptr(ret_copy, true);
44966         return ret_ref;
44967 }
44968
44969 int64_t  CS_LDK_DecodeError_bad_length_descriptor() {
44970         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44971         *ret_copy = DecodeError_bad_length_descriptor();
44972         int64_t ret_ref = tag_ptr(ret_copy, true);
44973         return ret_ref;
44974 }
44975
44976 int64_t  CS_LDK_DecodeError_io(int32_t a) {
44977         LDKIOError a_conv = LDKIOError_from_cs(a);
44978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44979         *ret_copy = DecodeError_io(a_conv);
44980         int64_t ret_ref = tag_ptr(ret_copy, true);
44981         return ret_ref;
44982 }
44983
44984 int64_t  CS_LDK_DecodeError_unsupported_compression() {
44985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44986         *ret_copy = DecodeError_unsupported_compression();
44987         int64_t ret_ref = tag_ptr(ret_copy, true);
44988         return ret_ref;
44989 }
44990
44991 int64_t  CS_LDK_DecodeError_dangerous_value() {
44992         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
44993         *ret_copy = DecodeError_dangerous_value();
44994         int64_t ret_ref = tag_ptr(ret_copy, true);
44995         return ret_ref;
44996 }
44997
44998 int64_t  CS_LDK_DecodeError_hash(int64_t o) {
44999         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
45000         int64_t ret_conv = DecodeError_hash(o_conv);
45001         return ret_conv;
45002 }
45003
45004 jboolean  CS_LDK_DecodeError_eq(int64_t a, int64_t b) {
45005         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
45006         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
45007         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
45008         return ret_conv;
45009 }
45010
45011 void  CS_LDK_Init_free(int64_t this_obj) {
45012         LDKInit this_obj_conv;
45013         this_obj_conv.inner = untag_ptr(this_obj);
45014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45016         Init_free(this_obj_conv);
45017 }
45018
45019 int64_t  CS_LDK_Init_get_features(int64_t this_ptr) {
45020         LDKInit this_ptr_conv;
45021         this_ptr_conv.inner = untag_ptr(this_ptr);
45022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45024         this_ptr_conv.is_owned = false;
45025         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
45026         int64_t ret_ref = 0;
45027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45029         return ret_ref;
45030 }
45031
45032 void  CS_LDK_Init_set_features(int64_t this_ptr, int64_t val) {
45033         LDKInit this_ptr_conv;
45034         this_ptr_conv.inner = untag_ptr(this_ptr);
45035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45037         this_ptr_conv.is_owned = false;
45038         LDKInitFeatures val_conv;
45039         val_conv.inner = untag_ptr(val);
45040         val_conv.is_owned = ptr_is_owned(val);
45041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45042         val_conv = InitFeatures_clone(&val_conv);
45043         Init_set_features(&this_ptr_conv, val_conv);
45044 }
45045
45046 int64_t  CS_LDK_Init_get_networks(int64_t this_ptr) {
45047         LDKInit this_ptr_conv;
45048         this_ptr_conv.inner = untag_ptr(this_ptr);
45049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45051         this_ptr_conv.is_owned = false;
45052         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
45053         *ret_copy = Init_get_networks(&this_ptr_conv);
45054         int64_t ret_ref = tag_ptr(ret_copy, true);
45055         return ret_ref;
45056 }
45057
45058 void  CS_LDK_Init_set_networks(int64_t this_ptr, int64_t val) {
45059         LDKInit this_ptr_conv;
45060         this_ptr_conv.inner = untag_ptr(this_ptr);
45061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45063         this_ptr_conv.is_owned = false;
45064         void* val_ptr = untag_ptr(val);
45065         CHECK_ACCESS(val_ptr);
45066         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
45067         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
45068         Init_set_networks(&this_ptr_conv, val_conv);
45069 }
45070
45071 int64_t  CS_LDK_Init_get_remote_network_address(int64_t this_ptr) {
45072         LDKInit this_ptr_conv;
45073         this_ptr_conv.inner = untag_ptr(this_ptr);
45074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45076         this_ptr_conv.is_owned = false;
45077         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
45078         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
45079         int64_t ret_ref = tag_ptr(ret_copy, true);
45080         return ret_ref;
45081 }
45082
45083 void  CS_LDK_Init_set_remote_network_address(int64_t this_ptr, int64_t val) {
45084         LDKInit this_ptr_conv;
45085         this_ptr_conv.inner = untag_ptr(this_ptr);
45086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45088         this_ptr_conv.is_owned = false;
45089         void* val_ptr = untag_ptr(val);
45090         CHECK_ACCESS(val_ptr);
45091         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
45092         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
45093         Init_set_remote_network_address(&this_ptr_conv, val_conv);
45094 }
45095
45096 int64_t  CS_LDK_Init_new(int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
45097         LDKInitFeatures features_arg_conv;
45098         features_arg_conv.inner = untag_ptr(features_arg);
45099         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45100         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45101         features_arg_conv = InitFeatures_clone(&features_arg_conv);
45102         void* networks_arg_ptr = untag_ptr(networks_arg);
45103         CHECK_ACCESS(networks_arg_ptr);
45104         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
45105         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
45106         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
45107         CHECK_ACCESS(remote_network_address_arg_ptr);
45108         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
45109         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
45110         int64_t ret_ref = 0;
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45113         return ret_ref;
45114 }
45115
45116 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
45117         LDKInit ret_var = Init_clone(arg);
45118         int64_t ret_ref = 0;
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45121         return ret_ref;
45122 }
45123 int64_t  CS_LDK_Init_clone_ptr(int64_t arg) {
45124         LDKInit arg_conv;
45125         arg_conv.inner = untag_ptr(arg);
45126         arg_conv.is_owned = ptr_is_owned(arg);
45127         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45128         arg_conv.is_owned = false;
45129         int64_t ret_conv = Init_clone_ptr(&arg_conv);
45130         return ret_conv;
45131 }
45132
45133 int64_t  CS_LDK_Init_clone(int64_t orig) {
45134         LDKInit orig_conv;
45135         orig_conv.inner = untag_ptr(orig);
45136         orig_conv.is_owned = ptr_is_owned(orig);
45137         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45138         orig_conv.is_owned = false;
45139         LDKInit ret_var = Init_clone(&orig_conv);
45140         int64_t ret_ref = 0;
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45143         return ret_ref;
45144 }
45145
45146 int64_t  CS_LDK_Init_hash(int64_t o) {
45147         LDKInit o_conv;
45148         o_conv.inner = untag_ptr(o);
45149         o_conv.is_owned = ptr_is_owned(o);
45150         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45151         o_conv.is_owned = false;
45152         int64_t ret_conv = Init_hash(&o_conv);
45153         return ret_conv;
45154 }
45155
45156 jboolean  CS_LDK_Init_eq(int64_t a, int64_t b) {
45157         LDKInit a_conv;
45158         a_conv.inner = untag_ptr(a);
45159         a_conv.is_owned = ptr_is_owned(a);
45160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45161         a_conv.is_owned = false;
45162         LDKInit b_conv;
45163         b_conv.inner = untag_ptr(b);
45164         b_conv.is_owned = ptr_is_owned(b);
45165         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45166         b_conv.is_owned = false;
45167         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
45168         return ret_conv;
45169 }
45170
45171 void  CS_LDK_ErrorMessage_free(int64_t this_obj) {
45172         LDKErrorMessage this_obj_conv;
45173         this_obj_conv.inner = untag_ptr(this_obj);
45174         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45176         ErrorMessage_free(this_obj_conv);
45177 }
45178
45179 int64_t  CS_LDK_ErrorMessage_get_channel_id(int64_t this_ptr) {
45180         LDKErrorMessage this_ptr_conv;
45181         this_ptr_conv.inner = untag_ptr(this_ptr);
45182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45184         this_ptr_conv.is_owned = false;
45185         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
45186         int64_t ret_ref = 0;
45187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45189         return ret_ref;
45190 }
45191
45192 void  CS_LDK_ErrorMessage_set_channel_id(int64_t this_ptr, int64_t val) {
45193         LDKErrorMessage this_ptr_conv;
45194         this_ptr_conv.inner = untag_ptr(this_ptr);
45195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45197         this_ptr_conv.is_owned = false;
45198         LDKChannelId val_conv;
45199         val_conv.inner = untag_ptr(val);
45200         val_conv.is_owned = ptr_is_owned(val);
45201         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45202         val_conv = ChannelId_clone(&val_conv);
45203         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
45204 }
45205
45206 jstring  CS_LDK_ErrorMessage_get_data(int64_t this_ptr) {
45207         LDKErrorMessage this_ptr_conv;
45208         this_ptr_conv.inner = untag_ptr(this_ptr);
45209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45211         this_ptr_conv.is_owned = false;
45212         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
45213         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
45214         Str_free(ret_str);
45215         return ret_conv;
45216 }
45217
45218 void  CS_LDK_ErrorMessage_set_data(int64_t this_ptr, jstring val) {
45219         LDKErrorMessage this_ptr_conv;
45220         this_ptr_conv.inner = untag_ptr(this_ptr);
45221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45223         this_ptr_conv.is_owned = false;
45224         LDKStr val_conv = str_ref_to_owned_c(val);
45225         ErrorMessage_set_data(&this_ptr_conv, val_conv);
45226 }
45227
45228 int64_t  CS_LDK_ErrorMessage_new(int64_t channel_id_arg, jstring data_arg) {
45229         LDKChannelId channel_id_arg_conv;
45230         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
45231         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
45232         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
45233         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
45234         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
45235         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
45236         int64_t ret_ref = 0;
45237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45239         return ret_ref;
45240 }
45241
45242 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
45243         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
45244         int64_t ret_ref = 0;
45245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45247         return ret_ref;
45248 }
45249 int64_t  CS_LDK_ErrorMessage_clone_ptr(int64_t arg) {
45250         LDKErrorMessage arg_conv;
45251         arg_conv.inner = untag_ptr(arg);
45252         arg_conv.is_owned = ptr_is_owned(arg);
45253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45254         arg_conv.is_owned = false;
45255         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
45256         return ret_conv;
45257 }
45258
45259 int64_t  CS_LDK_ErrorMessage_clone(int64_t orig) {
45260         LDKErrorMessage orig_conv;
45261         orig_conv.inner = untag_ptr(orig);
45262         orig_conv.is_owned = ptr_is_owned(orig);
45263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45264         orig_conv.is_owned = false;
45265         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
45266         int64_t ret_ref = 0;
45267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45269         return ret_ref;
45270 }
45271
45272 int64_t  CS_LDK_ErrorMessage_hash(int64_t o) {
45273         LDKErrorMessage o_conv;
45274         o_conv.inner = untag_ptr(o);
45275         o_conv.is_owned = ptr_is_owned(o);
45276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45277         o_conv.is_owned = false;
45278         int64_t ret_conv = ErrorMessage_hash(&o_conv);
45279         return ret_conv;
45280 }
45281
45282 jboolean  CS_LDK_ErrorMessage_eq(int64_t a, int64_t b) {
45283         LDKErrorMessage a_conv;
45284         a_conv.inner = untag_ptr(a);
45285         a_conv.is_owned = ptr_is_owned(a);
45286         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45287         a_conv.is_owned = false;
45288         LDKErrorMessage b_conv;
45289         b_conv.inner = untag_ptr(b);
45290         b_conv.is_owned = ptr_is_owned(b);
45291         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45292         b_conv.is_owned = false;
45293         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
45294         return ret_conv;
45295 }
45296
45297 void  CS_LDK_WarningMessage_free(int64_t this_obj) {
45298         LDKWarningMessage this_obj_conv;
45299         this_obj_conv.inner = untag_ptr(this_obj);
45300         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45302         WarningMessage_free(this_obj_conv);
45303 }
45304
45305 int64_t  CS_LDK_WarningMessage_get_channel_id(int64_t this_ptr) {
45306         LDKWarningMessage this_ptr_conv;
45307         this_ptr_conv.inner = untag_ptr(this_ptr);
45308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45310         this_ptr_conv.is_owned = false;
45311         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
45312         int64_t ret_ref = 0;
45313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45315         return ret_ref;
45316 }
45317
45318 void  CS_LDK_WarningMessage_set_channel_id(int64_t this_ptr, int64_t val) {
45319         LDKWarningMessage this_ptr_conv;
45320         this_ptr_conv.inner = untag_ptr(this_ptr);
45321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45323         this_ptr_conv.is_owned = false;
45324         LDKChannelId val_conv;
45325         val_conv.inner = untag_ptr(val);
45326         val_conv.is_owned = ptr_is_owned(val);
45327         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45328         val_conv = ChannelId_clone(&val_conv);
45329         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
45330 }
45331
45332 jstring  CS_LDK_WarningMessage_get_data(int64_t this_ptr) {
45333         LDKWarningMessage this_ptr_conv;
45334         this_ptr_conv.inner = untag_ptr(this_ptr);
45335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45337         this_ptr_conv.is_owned = false;
45338         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
45339         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
45340         Str_free(ret_str);
45341         return ret_conv;
45342 }
45343
45344 void  CS_LDK_WarningMessage_set_data(int64_t this_ptr, jstring val) {
45345         LDKWarningMessage this_ptr_conv;
45346         this_ptr_conv.inner = untag_ptr(this_ptr);
45347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45349         this_ptr_conv.is_owned = false;
45350         LDKStr val_conv = str_ref_to_owned_c(val);
45351         WarningMessage_set_data(&this_ptr_conv, val_conv);
45352 }
45353
45354 int64_t  CS_LDK_WarningMessage_new(int64_t channel_id_arg, jstring data_arg) {
45355         LDKChannelId channel_id_arg_conv;
45356         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
45357         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
45359         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
45360         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
45361         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
45362         int64_t ret_ref = 0;
45363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45365         return ret_ref;
45366 }
45367
45368 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
45369         LDKWarningMessage ret_var = WarningMessage_clone(arg);
45370         int64_t ret_ref = 0;
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45373         return ret_ref;
45374 }
45375 int64_t  CS_LDK_WarningMessage_clone_ptr(int64_t arg) {
45376         LDKWarningMessage arg_conv;
45377         arg_conv.inner = untag_ptr(arg);
45378         arg_conv.is_owned = ptr_is_owned(arg);
45379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45380         arg_conv.is_owned = false;
45381         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
45382         return ret_conv;
45383 }
45384
45385 int64_t  CS_LDK_WarningMessage_clone(int64_t orig) {
45386         LDKWarningMessage orig_conv;
45387         orig_conv.inner = untag_ptr(orig);
45388         orig_conv.is_owned = ptr_is_owned(orig);
45389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45390         orig_conv.is_owned = false;
45391         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
45392         int64_t ret_ref = 0;
45393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45395         return ret_ref;
45396 }
45397
45398 int64_t  CS_LDK_WarningMessage_hash(int64_t o) {
45399         LDKWarningMessage o_conv;
45400         o_conv.inner = untag_ptr(o);
45401         o_conv.is_owned = ptr_is_owned(o);
45402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45403         o_conv.is_owned = false;
45404         int64_t ret_conv = WarningMessage_hash(&o_conv);
45405         return ret_conv;
45406 }
45407
45408 jboolean  CS_LDK_WarningMessage_eq(int64_t a, int64_t b) {
45409         LDKWarningMessage a_conv;
45410         a_conv.inner = untag_ptr(a);
45411         a_conv.is_owned = ptr_is_owned(a);
45412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45413         a_conv.is_owned = false;
45414         LDKWarningMessage b_conv;
45415         b_conv.inner = untag_ptr(b);
45416         b_conv.is_owned = ptr_is_owned(b);
45417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45418         b_conv.is_owned = false;
45419         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
45420         return ret_conv;
45421 }
45422
45423 void  CS_LDK_Ping_free(int64_t this_obj) {
45424         LDKPing this_obj_conv;
45425         this_obj_conv.inner = untag_ptr(this_obj);
45426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45428         Ping_free(this_obj_conv);
45429 }
45430
45431 int16_t  CS_LDK_Ping_get_ponglen(int64_t this_ptr) {
45432         LDKPing this_ptr_conv;
45433         this_ptr_conv.inner = untag_ptr(this_ptr);
45434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45436         this_ptr_conv.is_owned = false;
45437         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
45438         return ret_conv;
45439 }
45440
45441 void  CS_LDK_Ping_set_ponglen(int64_t this_ptr, int16_t val) {
45442         LDKPing this_ptr_conv;
45443         this_ptr_conv.inner = untag_ptr(this_ptr);
45444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45446         this_ptr_conv.is_owned = false;
45447         Ping_set_ponglen(&this_ptr_conv, val);
45448 }
45449
45450 int16_t  CS_LDK_Ping_get_byteslen(int64_t this_ptr) {
45451         LDKPing this_ptr_conv;
45452         this_ptr_conv.inner = untag_ptr(this_ptr);
45453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45455         this_ptr_conv.is_owned = false;
45456         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
45457         return ret_conv;
45458 }
45459
45460 void  CS_LDK_Ping_set_byteslen(int64_t this_ptr, int16_t val) {
45461         LDKPing this_ptr_conv;
45462         this_ptr_conv.inner = untag_ptr(this_ptr);
45463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45465         this_ptr_conv.is_owned = false;
45466         Ping_set_byteslen(&this_ptr_conv, val);
45467 }
45468
45469 int64_t  CS_LDK_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
45470         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
45471         int64_t ret_ref = 0;
45472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45474         return ret_ref;
45475 }
45476
45477 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
45478         LDKPing ret_var = Ping_clone(arg);
45479         int64_t ret_ref = 0;
45480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45482         return ret_ref;
45483 }
45484 int64_t  CS_LDK_Ping_clone_ptr(int64_t arg) {
45485         LDKPing arg_conv;
45486         arg_conv.inner = untag_ptr(arg);
45487         arg_conv.is_owned = ptr_is_owned(arg);
45488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45489         arg_conv.is_owned = false;
45490         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
45491         return ret_conv;
45492 }
45493
45494 int64_t  CS_LDK_Ping_clone(int64_t orig) {
45495         LDKPing orig_conv;
45496         orig_conv.inner = untag_ptr(orig);
45497         orig_conv.is_owned = ptr_is_owned(orig);
45498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45499         orig_conv.is_owned = false;
45500         LDKPing ret_var = Ping_clone(&orig_conv);
45501         int64_t ret_ref = 0;
45502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45504         return ret_ref;
45505 }
45506
45507 int64_t  CS_LDK_Ping_hash(int64_t o) {
45508         LDKPing o_conv;
45509         o_conv.inner = untag_ptr(o);
45510         o_conv.is_owned = ptr_is_owned(o);
45511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45512         o_conv.is_owned = false;
45513         int64_t ret_conv = Ping_hash(&o_conv);
45514         return ret_conv;
45515 }
45516
45517 jboolean  CS_LDK_Ping_eq(int64_t a, int64_t b) {
45518         LDKPing a_conv;
45519         a_conv.inner = untag_ptr(a);
45520         a_conv.is_owned = ptr_is_owned(a);
45521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45522         a_conv.is_owned = false;
45523         LDKPing b_conv;
45524         b_conv.inner = untag_ptr(b);
45525         b_conv.is_owned = ptr_is_owned(b);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45527         b_conv.is_owned = false;
45528         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
45529         return ret_conv;
45530 }
45531
45532 void  CS_LDK_Pong_free(int64_t this_obj) {
45533         LDKPong this_obj_conv;
45534         this_obj_conv.inner = untag_ptr(this_obj);
45535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45537         Pong_free(this_obj_conv);
45538 }
45539
45540 int16_t  CS_LDK_Pong_get_byteslen(int64_t this_ptr) {
45541         LDKPong this_ptr_conv;
45542         this_ptr_conv.inner = untag_ptr(this_ptr);
45543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45545         this_ptr_conv.is_owned = false;
45546         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
45547         return ret_conv;
45548 }
45549
45550 void  CS_LDK_Pong_set_byteslen(int64_t this_ptr, int16_t val) {
45551         LDKPong this_ptr_conv;
45552         this_ptr_conv.inner = untag_ptr(this_ptr);
45553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45555         this_ptr_conv.is_owned = false;
45556         Pong_set_byteslen(&this_ptr_conv, val);
45557 }
45558
45559 int64_t  CS_LDK_Pong_new(int16_t byteslen_arg) {
45560         LDKPong ret_var = Pong_new(byteslen_arg);
45561         int64_t ret_ref = 0;
45562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45564         return ret_ref;
45565 }
45566
45567 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
45568         LDKPong ret_var = Pong_clone(arg);
45569         int64_t ret_ref = 0;
45570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45572         return ret_ref;
45573 }
45574 int64_t  CS_LDK_Pong_clone_ptr(int64_t arg) {
45575         LDKPong arg_conv;
45576         arg_conv.inner = untag_ptr(arg);
45577         arg_conv.is_owned = ptr_is_owned(arg);
45578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45579         arg_conv.is_owned = false;
45580         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
45581         return ret_conv;
45582 }
45583
45584 int64_t  CS_LDK_Pong_clone(int64_t orig) {
45585         LDKPong orig_conv;
45586         orig_conv.inner = untag_ptr(orig);
45587         orig_conv.is_owned = ptr_is_owned(orig);
45588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45589         orig_conv.is_owned = false;
45590         LDKPong ret_var = Pong_clone(&orig_conv);
45591         int64_t ret_ref = 0;
45592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45594         return ret_ref;
45595 }
45596
45597 int64_t  CS_LDK_Pong_hash(int64_t o) {
45598         LDKPong o_conv;
45599         o_conv.inner = untag_ptr(o);
45600         o_conv.is_owned = ptr_is_owned(o);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45602         o_conv.is_owned = false;
45603         int64_t ret_conv = Pong_hash(&o_conv);
45604         return ret_conv;
45605 }
45606
45607 jboolean  CS_LDK_Pong_eq(int64_t a, int64_t b) {
45608         LDKPong a_conv;
45609         a_conv.inner = untag_ptr(a);
45610         a_conv.is_owned = ptr_is_owned(a);
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45612         a_conv.is_owned = false;
45613         LDKPong b_conv;
45614         b_conv.inner = untag_ptr(b);
45615         b_conv.is_owned = ptr_is_owned(b);
45616         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45617         b_conv.is_owned = false;
45618         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
45619         return ret_conv;
45620 }
45621
45622 void  CS_LDK_CommonOpenChannelFields_free(int64_t this_obj) {
45623         LDKCommonOpenChannelFields this_obj_conv;
45624         this_obj_conv.inner = untag_ptr(this_obj);
45625         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45627         CommonOpenChannelFields_free(this_obj_conv);
45628 }
45629
45630 int8_tArray  CS_LDK_CommonOpenChannelFields_get_chain_hash(int64_t this_ptr) {
45631         LDKCommonOpenChannelFields this_ptr_conv;
45632         this_ptr_conv.inner = untag_ptr(this_ptr);
45633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45635         this_ptr_conv.is_owned = false;
45636         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45637         memcpy(ret_arr->elems, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv), 32);
45638         return ret_arr;
45639 }
45640
45641 void  CS_LDK_CommonOpenChannelFields_set_chain_hash(int64_t this_ptr, int8_tArray val) {
45642         LDKCommonOpenChannelFields this_ptr_conv;
45643         this_ptr_conv.inner = untag_ptr(this_ptr);
45644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45646         this_ptr_conv.is_owned = false;
45647         LDKThirtyTwoBytes val_ref;
45648         CHECK(val->arr_len == 32);
45649         memcpy(val_ref.data, val->elems, 32); FREE(val);
45650         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
45651 }
45652
45653 int64_t  CS_LDK_CommonOpenChannelFields_get_temporary_channel_id(int64_t this_ptr) {
45654         LDKCommonOpenChannelFields this_ptr_conv;
45655         this_ptr_conv.inner = untag_ptr(this_ptr);
45656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45658         this_ptr_conv.is_owned = false;
45659         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
45660         int64_t ret_ref = 0;
45661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45663         return ret_ref;
45664 }
45665
45666 void  CS_LDK_CommonOpenChannelFields_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
45667         LDKCommonOpenChannelFields this_ptr_conv;
45668         this_ptr_conv.inner = untag_ptr(this_ptr);
45669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45671         this_ptr_conv.is_owned = false;
45672         LDKChannelId val_conv;
45673         val_conv.inner = untag_ptr(val);
45674         val_conv.is_owned = ptr_is_owned(val);
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45676         val_conv = ChannelId_clone(&val_conv);
45677         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
45678 }
45679
45680 int64_t  CS_LDK_CommonOpenChannelFields_get_funding_satoshis(int64_t this_ptr) {
45681         LDKCommonOpenChannelFields this_ptr_conv;
45682         this_ptr_conv.inner = untag_ptr(this_ptr);
45683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45685         this_ptr_conv.is_owned = false;
45686         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
45687         return ret_conv;
45688 }
45689
45690 void  CS_LDK_CommonOpenChannelFields_set_funding_satoshis(int64_t this_ptr, int64_t val) {
45691         LDKCommonOpenChannelFields this_ptr_conv;
45692         this_ptr_conv.inner = untag_ptr(this_ptr);
45693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45695         this_ptr_conv.is_owned = false;
45696         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
45697 }
45698
45699 int64_t  CS_LDK_CommonOpenChannelFields_get_dust_limit_satoshis(int64_t this_ptr) {
45700         LDKCommonOpenChannelFields this_ptr_conv;
45701         this_ptr_conv.inner = untag_ptr(this_ptr);
45702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45704         this_ptr_conv.is_owned = false;
45705         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
45706         return ret_conv;
45707 }
45708
45709 void  CS_LDK_CommonOpenChannelFields_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
45710         LDKCommonOpenChannelFields this_ptr_conv;
45711         this_ptr_conv.inner = untag_ptr(this_ptr);
45712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45714         this_ptr_conv.is_owned = false;
45715         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
45716 }
45717
45718 int64_t  CS_LDK_CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
45719         LDKCommonOpenChannelFields this_ptr_conv;
45720         this_ptr_conv.inner = untag_ptr(this_ptr);
45721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45723         this_ptr_conv.is_owned = false;
45724         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
45725         return ret_conv;
45726 }
45727
45728 void  CS_LDK_CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
45729         LDKCommonOpenChannelFields this_ptr_conv;
45730         this_ptr_conv.inner = untag_ptr(this_ptr);
45731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45733         this_ptr_conv.is_owned = false;
45734         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
45735 }
45736
45737 int64_t  CS_LDK_CommonOpenChannelFields_get_htlc_minimum_msat(int64_t this_ptr) {
45738         LDKCommonOpenChannelFields this_ptr_conv;
45739         this_ptr_conv.inner = untag_ptr(this_ptr);
45740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45742         this_ptr_conv.is_owned = false;
45743         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
45744         return ret_conv;
45745 }
45746
45747 void  CS_LDK_CommonOpenChannelFields_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
45748         LDKCommonOpenChannelFields this_ptr_conv;
45749         this_ptr_conv.inner = untag_ptr(this_ptr);
45750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45752         this_ptr_conv.is_owned = false;
45753         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
45754 }
45755
45756 int32_t  CS_LDK_CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(int64_t this_ptr) {
45757         LDKCommonOpenChannelFields this_ptr_conv;
45758         this_ptr_conv.inner = untag_ptr(this_ptr);
45759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45761         this_ptr_conv.is_owned = false;
45762         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
45763         return ret_conv;
45764 }
45765
45766 void  CS_LDK_CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
45767         LDKCommonOpenChannelFields this_ptr_conv;
45768         this_ptr_conv.inner = untag_ptr(this_ptr);
45769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45771         this_ptr_conv.is_owned = false;
45772         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45773 }
45774
45775 int16_t  CS_LDK_CommonOpenChannelFields_get_to_self_delay(int64_t this_ptr) {
45776         LDKCommonOpenChannelFields this_ptr_conv;
45777         this_ptr_conv.inner = untag_ptr(this_ptr);
45778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45780         this_ptr_conv.is_owned = false;
45781         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
45782         return ret_conv;
45783 }
45784
45785 void  CS_LDK_CommonOpenChannelFields_set_to_self_delay(int64_t this_ptr, int16_t val) {
45786         LDKCommonOpenChannelFields this_ptr_conv;
45787         this_ptr_conv.inner = untag_ptr(this_ptr);
45788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45790         this_ptr_conv.is_owned = false;
45791         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
45792 }
45793
45794 int16_t  CS_LDK_CommonOpenChannelFields_get_max_accepted_htlcs(int64_t this_ptr) {
45795         LDKCommonOpenChannelFields this_ptr_conv;
45796         this_ptr_conv.inner = untag_ptr(this_ptr);
45797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45799         this_ptr_conv.is_owned = false;
45800         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
45801         return ret_conv;
45802 }
45803
45804 void  CS_LDK_CommonOpenChannelFields_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
45805         LDKCommonOpenChannelFields this_ptr_conv;
45806         this_ptr_conv.inner = untag_ptr(this_ptr);
45807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45809         this_ptr_conv.is_owned = false;
45810         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
45811 }
45812
45813 int8_tArray  CS_LDK_CommonOpenChannelFields_get_funding_pubkey(int64_t this_ptr) {
45814         LDKCommonOpenChannelFields this_ptr_conv;
45815         this_ptr_conv.inner = untag_ptr(this_ptr);
45816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45818         this_ptr_conv.is_owned = false;
45819         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45820         memcpy(ret_arr->elems, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
45821         return ret_arr;
45822 }
45823
45824 void  CS_LDK_CommonOpenChannelFields_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
45825         LDKCommonOpenChannelFields this_ptr_conv;
45826         this_ptr_conv.inner = untag_ptr(this_ptr);
45827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45829         this_ptr_conv.is_owned = false;
45830         LDKPublicKey val_ref;
45831         CHECK(val->arr_len == 33);
45832         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45833         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
45834 }
45835
45836 int8_tArray  CS_LDK_CommonOpenChannelFields_get_revocation_basepoint(int64_t this_ptr) {
45837         LDKCommonOpenChannelFields this_ptr_conv;
45838         this_ptr_conv.inner = untag_ptr(this_ptr);
45839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45841         this_ptr_conv.is_owned = false;
45842         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45843         memcpy(ret_arr->elems, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
45844         return ret_arr;
45845 }
45846
45847 void  CS_LDK_CommonOpenChannelFields_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
45848         LDKCommonOpenChannelFields this_ptr_conv;
45849         this_ptr_conv.inner = untag_ptr(this_ptr);
45850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45852         this_ptr_conv.is_owned = false;
45853         LDKPublicKey val_ref;
45854         CHECK(val->arr_len == 33);
45855         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45856         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
45857 }
45858
45859 int8_tArray  CS_LDK_CommonOpenChannelFields_get_payment_basepoint(int64_t this_ptr) {
45860         LDKCommonOpenChannelFields this_ptr_conv;
45861         this_ptr_conv.inner = untag_ptr(this_ptr);
45862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45864         this_ptr_conv.is_owned = false;
45865         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45866         memcpy(ret_arr->elems, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45867         return ret_arr;
45868 }
45869
45870 void  CS_LDK_CommonOpenChannelFields_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
45871         LDKCommonOpenChannelFields this_ptr_conv;
45872         this_ptr_conv.inner = untag_ptr(this_ptr);
45873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45875         this_ptr_conv.is_owned = false;
45876         LDKPublicKey val_ref;
45877         CHECK(val->arr_len == 33);
45878         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45879         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
45880 }
45881
45882 int8_tArray  CS_LDK_CommonOpenChannelFields_get_delayed_payment_basepoint(int64_t this_ptr) {
45883         LDKCommonOpenChannelFields this_ptr_conv;
45884         this_ptr_conv.inner = untag_ptr(this_ptr);
45885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45887         this_ptr_conv.is_owned = false;
45888         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45889         memcpy(ret_arr->elems, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45890         return ret_arr;
45891 }
45892
45893 void  CS_LDK_CommonOpenChannelFields_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
45894         LDKCommonOpenChannelFields this_ptr_conv;
45895         this_ptr_conv.inner = untag_ptr(this_ptr);
45896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45898         this_ptr_conv.is_owned = false;
45899         LDKPublicKey val_ref;
45900         CHECK(val->arr_len == 33);
45901         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45902         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
45903 }
45904
45905 int8_tArray  CS_LDK_CommonOpenChannelFields_get_htlc_basepoint(int64_t this_ptr) {
45906         LDKCommonOpenChannelFields this_ptr_conv;
45907         this_ptr_conv.inner = untag_ptr(this_ptr);
45908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45910         this_ptr_conv.is_owned = false;
45911         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45912         memcpy(ret_arr->elems, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
45913         return ret_arr;
45914 }
45915
45916 void  CS_LDK_CommonOpenChannelFields_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
45917         LDKCommonOpenChannelFields this_ptr_conv;
45918         this_ptr_conv.inner = untag_ptr(this_ptr);
45919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45921         this_ptr_conv.is_owned = false;
45922         LDKPublicKey val_ref;
45923         CHECK(val->arr_len == 33);
45924         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45925         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
45926 }
45927
45928 int8_tArray  CS_LDK_CommonOpenChannelFields_get_first_per_commitment_point(int64_t this_ptr) {
45929         LDKCommonOpenChannelFields this_ptr_conv;
45930         this_ptr_conv.inner = untag_ptr(this_ptr);
45931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45933         this_ptr_conv.is_owned = false;
45934         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45935         memcpy(ret_arr->elems, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
45936         return ret_arr;
45937 }
45938
45939 void  CS_LDK_CommonOpenChannelFields_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
45940         LDKCommonOpenChannelFields this_ptr_conv;
45941         this_ptr_conv.inner = untag_ptr(this_ptr);
45942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45944         this_ptr_conv.is_owned = false;
45945         LDKPublicKey val_ref;
45946         CHECK(val->arr_len == 33);
45947         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45948         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
45949 }
45950
45951 int8_t  CS_LDK_CommonOpenChannelFields_get_channel_flags(int64_t this_ptr) {
45952         LDKCommonOpenChannelFields this_ptr_conv;
45953         this_ptr_conv.inner = untag_ptr(this_ptr);
45954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45956         this_ptr_conv.is_owned = false;
45957         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
45958         return ret_conv;
45959 }
45960
45961 void  CS_LDK_CommonOpenChannelFields_set_channel_flags(int64_t this_ptr, int8_t val) {
45962         LDKCommonOpenChannelFields this_ptr_conv;
45963         this_ptr_conv.inner = untag_ptr(this_ptr);
45964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45966         this_ptr_conv.is_owned = false;
45967         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
45968 }
45969
45970 int64_t  CS_LDK_CommonOpenChannelFields_get_shutdown_scriptpubkey(int64_t this_ptr) {
45971         LDKCommonOpenChannelFields this_ptr_conv;
45972         this_ptr_conv.inner = untag_ptr(this_ptr);
45973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45975         this_ptr_conv.is_owned = false;
45976         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
45977         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
45978         int64_t ret_ref = tag_ptr(ret_copy, true);
45979         return ret_ref;
45980 }
45981
45982 void  CS_LDK_CommonOpenChannelFields_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
45983         LDKCommonOpenChannelFields this_ptr_conv;
45984         this_ptr_conv.inner = untag_ptr(this_ptr);
45985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45987         this_ptr_conv.is_owned = false;
45988         void* val_ptr = untag_ptr(val);
45989         CHECK_ACCESS(val_ptr);
45990         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
45991         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
45992         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
45993 }
45994
45995 int64_t  CS_LDK_CommonOpenChannelFields_get_channel_type(int64_t this_ptr) {
45996         LDKCommonOpenChannelFields this_ptr_conv;
45997         this_ptr_conv.inner = untag_ptr(this_ptr);
45998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46000         this_ptr_conv.is_owned = false;
46001         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
46002         int64_t ret_ref = 0;
46003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46005         return ret_ref;
46006 }
46007
46008 void  CS_LDK_CommonOpenChannelFields_set_channel_type(int64_t this_ptr, int64_t val) {
46009         LDKCommonOpenChannelFields this_ptr_conv;
46010         this_ptr_conv.inner = untag_ptr(this_ptr);
46011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46013         this_ptr_conv.is_owned = false;
46014         LDKChannelTypeFeatures val_conv;
46015         val_conv.inner = untag_ptr(val);
46016         val_conv.is_owned = ptr_is_owned(val);
46017         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46018         val_conv = ChannelTypeFeatures_clone(&val_conv);
46019         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
46020 }
46021
46022 int64_t  CS_LDK_CommonOpenChannelFields_new(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) {
46023         LDKThirtyTwoBytes chain_hash_arg_ref;
46024         CHECK(chain_hash_arg->arr_len == 32);
46025         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
46026         LDKChannelId temporary_channel_id_arg_conv;
46027         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46028         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46029         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46030         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46031         LDKPublicKey funding_pubkey_arg_ref;
46032         CHECK(funding_pubkey_arg->arr_len == 33);
46033         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
46034         LDKPublicKey revocation_basepoint_arg_ref;
46035         CHECK(revocation_basepoint_arg->arr_len == 33);
46036         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
46037         LDKPublicKey payment_basepoint_arg_ref;
46038         CHECK(payment_basepoint_arg->arr_len == 33);
46039         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
46040         LDKPublicKey delayed_payment_basepoint_arg_ref;
46041         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
46042         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
46043         LDKPublicKey htlc_basepoint_arg_ref;
46044         CHECK(htlc_basepoint_arg->arr_len == 33);
46045         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
46046         LDKPublicKey first_per_commitment_point_arg_ref;
46047         CHECK(first_per_commitment_point_arg->arr_len == 33);
46048         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
46049         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
46050         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
46051         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
46052         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
46053         LDKChannelTypeFeatures channel_type_arg_conv;
46054         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
46055         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
46056         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
46057         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
46058         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);
46059         int64_t ret_ref = 0;
46060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46062         return ret_ref;
46063 }
46064
46065 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
46066         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
46067         int64_t ret_ref = 0;
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46070         return ret_ref;
46071 }
46072 int64_t  CS_LDK_CommonOpenChannelFields_clone_ptr(int64_t arg) {
46073         LDKCommonOpenChannelFields arg_conv;
46074         arg_conv.inner = untag_ptr(arg);
46075         arg_conv.is_owned = ptr_is_owned(arg);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46077         arg_conv.is_owned = false;
46078         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
46079         return ret_conv;
46080 }
46081
46082 int64_t  CS_LDK_CommonOpenChannelFields_clone(int64_t orig) {
46083         LDKCommonOpenChannelFields orig_conv;
46084         orig_conv.inner = untag_ptr(orig);
46085         orig_conv.is_owned = ptr_is_owned(orig);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46087         orig_conv.is_owned = false;
46088         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
46089         int64_t ret_ref = 0;
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46092         return ret_ref;
46093 }
46094
46095 int64_t  CS_LDK_CommonOpenChannelFields_hash(int64_t o) {
46096         LDKCommonOpenChannelFields o_conv;
46097         o_conv.inner = untag_ptr(o);
46098         o_conv.is_owned = ptr_is_owned(o);
46099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46100         o_conv.is_owned = false;
46101         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
46102         return ret_conv;
46103 }
46104
46105 jboolean  CS_LDK_CommonOpenChannelFields_eq(int64_t a, int64_t b) {
46106         LDKCommonOpenChannelFields a_conv;
46107         a_conv.inner = untag_ptr(a);
46108         a_conv.is_owned = ptr_is_owned(a);
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46110         a_conv.is_owned = false;
46111         LDKCommonOpenChannelFields b_conv;
46112         b_conv.inner = untag_ptr(b);
46113         b_conv.is_owned = ptr_is_owned(b);
46114         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46115         b_conv.is_owned = false;
46116         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
46117         return ret_conv;
46118 }
46119
46120 void  CS_LDK_OpenChannel_free(int64_t this_obj) {
46121         LDKOpenChannel this_obj_conv;
46122         this_obj_conv.inner = untag_ptr(this_obj);
46123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46125         OpenChannel_free(this_obj_conv);
46126 }
46127
46128 int64_t  CS_LDK_OpenChannel_get_common_fields(int64_t this_ptr) {
46129         LDKOpenChannel this_ptr_conv;
46130         this_ptr_conv.inner = untag_ptr(this_ptr);
46131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46133         this_ptr_conv.is_owned = false;
46134         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
46135         int64_t ret_ref = 0;
46136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46138         return ret_ref;
46139 }
46140
46141 void  CS_LDK_OpenChannel_set_common_fields(int64_t this_ptr, int64_t val) {
46142         LDKOpenChannel this_ptr_conv;
46143         this_ptr_conv.inner = untag_ptr(this_ptr);
46144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46146         this_ptr_conv.is_owned = false;
46147         LDKCommonOpenChannelFields val_conv;
46148         val_conv.inner = untag_ptr(val);
46149         val_conv.is_owned = ptr_is_owned(val);
46150         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46151         val_conv = CommonOpenChannelFields_clone(&val_conv);
46152         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
46153 }
46154
46155 int64_t  CS_LDK_OpenChannel_get_push_msat(int64_t this_ptr) {
46156         LDKOpenChannel this_ptr_conv;
46157         this_ptr_conv.inner = untag_ptr(this_ptr);
46158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46160         this_ptr_conv.is_owned = false;
46161         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
46162         return ret_conv;
46163 }
46164
46165 void  CS_LDK_OpenChannel_set_push_msat(int64_t this_ptr, int64_t val) {
46166         LDKOpenChannel this_ptr_conv;
46167         this_ptr_conv.inner = untag_ptr(this_ptr);
46168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46170         this_ptr_conv.is_owned = false;
46171         OpenChannel_set_push_msat(&this_ptr_conv, val);
46172 }
46173
46174 int64_t  CS_LDK_OpenChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
46175         LDKOpenChannel this_ptr_conv;
46176         this_ptr_conv.inner = untag_ptr(this_ptr);
46177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46179         this_ptr_conv.is_owned = false;
46180         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
46181         return ret_conv;
46182 }
46183
46184 void  CS_LDK_OpenChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
46185         LDKOpenChannel this_ptr_conv;
46186         this_ptr_conv.inner = untag_ptr(this_ptr);
46187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46189         this_ptr_conv.is_owned = false;
46190         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
46191 }
46192
46193 int64_t  CS_LDK_OpenChannel_new(int64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
46194         LDKCommonOpenChannelFields common_fields_arg_conv;
46195         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46196         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46197         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46198         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
46199         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
46200         int64_t ret_ref = 0;
46201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46203         return ret_ref;
46204 }
46205
46206 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
46207         LDKOpenChannel ret_var = OpenChannel_clone(arg);
46208         int64_t ret_ref = 0;
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46211         return ret_ref;
46212 }
46213 int64_t  CS_LDK_OpenChannel_clone_ptr(int64_t arg) {
46214         LDKOpenChannel arg_conv;
46215         arg_conv.inner = untag_ptr(arg);
46216         arg_conv.is_owned = ptr_is_owned(arg);
46217         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46218         arg_conv.is_owned = false;
46219         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
46220         return ret_conv;
46221 }
46222
46223 int64_t  CS_LDK_OpenChannel_clone(int64_t orig) {
46224         LDKOpenChannel orig_conv;
46225         orig_conv.inner = untag_ptr(orig);
46226         orig_conv.is_owned = ptr_is_owned(orig);
46227         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46228         orig_conv.is_owned = false;
46229         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
46230         int64_t ret_ref = 0;
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46233         return ret_ref;
46234 }
46235
46236 int64_t  CS_LDK_OpenChannel_hash(int64_t o) {
46237         LDKOpenChannel o_conv;
46238         o_conv.inner = untag_ptr(o);
46239         o_conv.is_owned = ptr_is_owned(o);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46241         o_conv.is_owned = false;
46242         int64_t ret_conv = OpenChannel_hash(&o_conv);
46243         return ret_conv;
46244 }
46245
46246 jboolean  CS_LDK_OpenChannel_eq(int64_t a, int64_t b) {
46247         LDKOpenChannel a_conv;
46248         a_conv.inner = untag_ptr(a);
46249         a_conv.is_owned = ptr_is_owned(a);
46250         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46251         a_conv.is_owned = false;
46252         LDKOpenChannel b_conv;
46253         b_conv.inner = untag_ptr(b);
46254         b_conv.is_owned = ptr_is_owned(b);
46255         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46256         b_conv.is_owned = false;
46257         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
46258         return ret_conv;
46259 }
46260
46261 void  CS_LDK_OpenChannelV2_free(int64_t this_obj) {
46262         LDKOpenChannelV2 this_obj_conv;
46263         this_obj_conv.inner = untag_ptr(this_obj);
46264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46266         OpenChannelV2_free(this_obj_conv);
46267 }
46268
46269 int64_t  CS_LDK_OpenChannelV2_get_common_fields(int64_t this_ptr) {
46270         LDKOpenChannelV2 this_ptr_conv;
46271         this_ptr_conv.inner = untag_ptr(this_ptr);
46272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46274         this_ptr_conv.is_owned = false;
46275         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
46276         int64_t ret_ref = 0;
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46279         return ret_ref;
46280 }
46281
46282 void  CS_LDK_OpenChannelV2_set_common_fields(int64_t this_ptr, int64_t val) {
46283         LDKOpenChannelV2 this_ptr_conv;
46284         this_ptr_conv.inner = untag_ptr(this_ptr);
46285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46287         this_ptr_conv.is_owned = false;
46288         LDKCommonOpenChannelFields val_conv;
46289         val_conv.inner = untag_ptr(val);
46290         val_conv.is_owned = ptr_is_owned(val);
46291         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46292         val_conv = CommonOpenChannelFields_clone(&val_conv);
46293         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
46294 }
46295
46296 int32_t  CS_LDK_OpenChannelV2_get_funding_feerate_sat_per_1000_weight(int64_t this_ptr) {
46297         LDKOpenChannelV2 this_ptr_conv;
46298         this_ptr_conv.inner = untag_ptr(this_ptr);
46299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46301         this_ptr_conv.is_owned = false;
46302         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
46303         return ret_conv;
46304 }
46305
46306 void  CS_LDK_OpenChannelV2_set_funding_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
46307         LDKOpenChannelV2 this_ptr_conv;
46308         this_ptr_conv.inner = untag_ptr(this_ptr);
46309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46311         this_ptr_conv.is_owned = false;
46312         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
46313 }
46314
46315 int32_t  CS_LDK_OpenChannelV2_get_locktime(int64_t this_ptr) {
46316         LDKOpenChannelV2 this_ptr_conv;
46317         this_ptr_conv.inner = untag_ptr(this_ptr);
46318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46320         this_ptr_conv.is_owned = false;
46321         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
46322         return ret_conv;
46323 }
46324
46325 void  CS_LDK_OpenChannelV2_set_locktime(int64_t this_ptr, int32_t val) {
46326         LDKOpenChannelV2 this_ptr_conv;
46327         this_ptr_conv.inner = untag_ptr(this_ptr);
46328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46330         this_ptr_conv.is_owned = false;
46331         OpenChannelV2_set_locktime(&this_ptr_conv, val);
46332 }
46333
46334 int8_tArray  CS_LDK_OpenChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
46335         LDKOpenChannelV2 this_ptr_conv;
46336         this_ptr_conv.inner = untag_ptr(this_ptr);
46337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46339         this_ptr_conv.is_owned = false;
46340         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46341         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46342         return ret_arr;
46343 }
46344
46345 void  CS_LDK_OpenChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
46346         LDKOpenChannelV2 this_ptr_conv;
46347         this_ptr_conv.inner = untag_ptr(this_ptr);
46348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46350         this_ptr_conv.is_owned = false;
46351         LDKPublicKey val_ref;
46352         CHECK(val->arr_len == 33);
46353         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46354         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
46355 }
46356
46357 int32_t  CS_LDK_OpenChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
46358         LDKOpenChannelV2 this_ptr_conv;
46359         this_ptr_conv.inner = untag_ptr(this_ptr);
46360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46362         this_ptr_conv.is_owned = false;
46363         int32_t ret_conv = LDKCOption_NoneZ_to_cs(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
46364         return ret_conv;
46365 }
46366
46367 void  CS_LDK_OpenChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
46368         LDKOpenChannelV2 this_ptr_conv;
46369         this_ptr_conv.inner = untag_ptr(this_ptr);
46370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46372         this_ptr_conv.is_owned = false;
46373         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
46374         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
46375 }
46376
46377 int64_t  CS_LDK_OpenChannelV2_new(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, int32_t require_confirmed_inputs_arg) {
46378         LDKCommonOpenChannelFields common_fields_arg_conv;
46379         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46380         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46381         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46382         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
46383         LDKPublicKey second_per_commitment_point_arg_ref;
46384         CHECK(second_per_commitment_point_arg->arr_len == 33);
46385         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
46386         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
46387         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);
46388         int64_t ret_ref = 0;
46389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46391         return ret_ref;
46392 }
46393
46394 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
46395         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
46396         int64_t ret_ref = 0;
46397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46399         return ret_ref;
46400 }
46401 int64_t  CS_LDK_OpenChannelV2_clone_ptr(int64_t arg) {
46402         LDKOpenChannelV2 arg_conv;
46403         arg_conv.inner = untag_ptr(arg);
46404         arg_conv.is_owned = ptr_is_owned(arg);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46406         arg_conv.is_owned = false;
46407         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
46408         return ret_conv;
46409 }
46410
46411 int64_t  CS_LDK_OpenChannelV2_clone(int64_t orig) {
46412         LDKOpenChannelV2 orig_conv;
46413         orig_conv.inner = untag_ptr(orig);
46414         orig_conv.is_owned = ptr_is_owned(orig);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46416         orig_conv.is_owned = false;
46417         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
46418         int64_t ret_ref = 0;
46419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46421         return ret_ref;
46422 }
46423
46424 int64_t  CS_LDK_OpenChannelV2_hash(int64_t o) {
46425         LDKOpenChannelV2 o_conv;
46426         o_conv.inner = untag_ptr(o);
46427         o_conv.is_owned = ptr_is_owned(o);
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46429         o_conv.is_owned = false;
46430         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
46431         return ret_conv;
46432 }
46433
46434 jboolean  CS_LDK_OpenChannelV2_eq(int64_t a, int64_t b) {
46435         LDKOpenChannelV2 a_conv;
46436         a_conv.inner = untag_ptr(a);
46437         a_conv.is_owned = ptr_is_owned(a);
46438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46439         a_conv.is_owned = false;
46440         LDKOpenChannelV2 b_conv;
46441         b_conv.inner = untag_ptr(b);
46442         b_conv.is_owned = ptr_is_owned(b);
46443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46444         b_conv.is_owned = false;
46445         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
46446         return ret_conv;
46447 }
46448
46449 void  CS_LDK_CommonAcceptChannelFields_free(int64_t this_obj) {
46450         LDKCommonAcceptChannelFields this_obj_conv;
46451         this_obj_conv.inner = untag_ptr(this_obj);
46452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46454         CommonAcceptChannelFields_free(this_obj_conv);
46455 }
46456
46457 int64_t  CS_LDK_CommonAcceptChannelFields_get_temporary_channel_id(int64_t this_ptr) {
46458         LDKCommonAcceptChannelFields this_ptr_conv;
46459         this_ptr_conv.inner = untag_ptr(this_ptr);
46460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46462         this_ptr_conv.is_owned = false;
46463         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
46464         int64_t ret_ref = 0;
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46467         return ret_ref;
46468 }
46469
46470 void  CS_LDK_CommonAcceptChannelFields_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
46471         LDKCommonAcceptChannelFields this_ptr_conv;
46472         this_ptr_conv.inner = untag_ptr(this_ptr);
46473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46475         this_ptr_conv.is_owned = false;
46476         LDKChannelId val_conv;
46477         val_conv.inner = untag_ptr(val);
46478         val_conv.is_owned = ptr_is_owned(val);
46479         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46480         val_conv = ChannelId_clone(&val_conv);
46481         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
46482 }
46483
46484 int64_t  CS_LDK_CommonAcceptChannelFields_get_dust_limit_satoshis(int64_t this_ptr) {
46485         LDKCommonAcceptChannelFields this_ptr_conv;
46486         this_ptr_conv.inner = untag_ptr(this_ptr);
46487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46489         this_ptr_conv.is_owned = false;
46490         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
46491         return ret_conv;
46492 }
46493
46494 void  CS_LDK_CommonAcceptChannelFields_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
46495         LDKCommonAcceptChannelFields this_ptr_conv;
46496         this_ptr_conv.inner = untag_ptr(this_ptr);
46497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46499         this_ptr_conv.is_owned = false;
46500         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
46501 }
46502
46503 int64_t  CS_LDK_CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
46504         LDKCommonAcceptChannelFields this_ptr_conv;
46505         this_ptr_conv.inner = untag_ptr(this_ptr);
46506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46508         this_ptr_conv.is_owned = false;
46509         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46510         return ret_conv;
46511 }
46512
46513 void  CS_LDK_CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
46514         LDKCommonAcceptChannelFields this_ptr_conv;
46515         this_ptr_conv.inner = untag_ptr(this_ptr);
46516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46518         this_ptr_conv.is_owned = false;
46519         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46520 }
46521
46522 int64_t  CS_LDK_CommonAcceptChannelFields_get_htlc_minimum_msat(int64_t this_ptr) {
46523         LDKCommonAcceptChannelFields this_ptr_conv;
46524         this_ptr_conv.inner = untag_ptr(this_ptr);
46525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46527         this_ptr_conv.is_owned = false;
46528         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
46529         return ret_conv;
46530 }
46531
46532 void  CS_LDK_CommonAcceptChannelFields_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
46533         LDKCommonAcceptChannelFields this_ptr_conv;
46534         this_ptr_conv.inner = untag_ptr(this_ptr);
46535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46537         this_ptr_conv.is_owned = false;
46538         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
46539 }
46540
46541 int32_t  CS_LDK_CommonAcceptChannelFields_get_minimum_depth(int64_t this_ptr) {
46542         LDKCommonAcceptChannelFields this_ptr_conv;
46543         this_ptr_conv.inner = untag_ptr(this_ptr);
46544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46546         this_ptr_conv.is_owned = false;
46547         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
46548         return ret_conv;
46549 }
46550
46551 void  CS_LDK_CommonAcceptChannelFields_set_minimum_depth(int64_t this_ptr, int32_t val) {
46552         LDKCommonAcceptChannelFields this_ptr_conv;
46553         this_ptr_conv.inner = untag_ptr(this_ptr);
46554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46556         this_ptr_conv.is_owned = false;
46557         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
46558 }
46559
46560 int16_t  CS_LDK_CommonAcceptChannelFields_get_to_self_delay(int64_t this_ptr) {
46561         LDKCommonAcceptChannelFields this_ptr_conv;
46562         this_ptr_conv.inner = untag_ptr(this_ptr);
46563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46565         this_ptr_conv.is_owned = false;
46566         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
46567         return ret_conv;
46568 }
46569
46570 void  CS_LDK_CommonAcceptChannelFields_set_to_self_delay(int64_t this_ptr, int16_t val) {
46571         LDKCommonAcceptChannelFields this_ptr_conv;
46572         this_ptr_conv.inner = untag_ptr(this_ptr);
46573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46575         this_ptr_conv.is_owned = false;
46576         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
46577 }
46578
46579 int16_t  CS_LDK_CommonAcceptChannelFields_get_max_accepted_htlcs(int64_t this_ptr) {
46580         LDKCommonAcceptChannelFields this_ptr_conv;
46581         this_ptr_conv.inner = untag_ptr(this_ptr);
46582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46584         this_ptr_conv.is_owned = false;
46585         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
46586         return ret_conv;
46587 }
46588
46589 void  CS_LDK_CommonAcceptChannelFields_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
46590         LDKCommonAcceptChannelFields this_ptr_conv;
46591         this_ptr_conv.inner = untag_ptr(this_ptr);
46592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46594         this_ptr_conv.is_owned = false;
46595         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
46596 }
46597
46598 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_funding_pubkey(int64_t this_ptr) {
46599         LDKCommonAcceptChannelFields this_ptr_conv;
46600         this_ptr_conv.inner = untag_ptr(this_ptr);
46601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46603         this_ptr_conv.is_owned = false;
46604         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46605         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
46606         return ret_arr;
46607 }
46608
46609 void  CS_LDK_CommonAcceptChannelFields_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
46610         LDKCommonAcceptChannelFields this_ptr_conv;
46611         this_ptr_conv.inner = untag_ptr(this_ptr);
46612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46614         this_ptr_conv.is_owned = false;
46615         LDKPublicKey val_ref;
46616         CHECK(val->arr_len == 33);
46617         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46618         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
46619 }
46620
46621 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_revocation_basepoint(int64_t this_ptr) {
46622         LDKCommonAcceptChannelFields this_ptr_conv;
46623         this_ptr_conv.inner = untag_ptr(this_ptr);
46624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46626         this_ptr_conv.is_owned = false;
46627         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46628         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
46629         return ret_arr;
46630 }
46631
46632 void  CS_LDK_CommonAcceptChannelFields_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
46633         LDKCommonAcceptChannelFields this_ptr_conv;
46634         this_ptr_conv.inner = untag_ptr(this_ptr);
46635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46637         this_ptr_conv.is_owned = false;
46638         LDKPublicKey val_ref;
46639         CHECK(val->arr_len == 33);
46640         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46641         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
46642 }
46643
46644 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_payment_basepoint(int64_t this_ptr) {
46645         LDKCommonAcceptChannelFields this_ptr_conv;
46646         this_ptr_conv.inner = untag_ptr(this_ptr);
46647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46649         this_ptr_conv.is_owned = false;
46650         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46651         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46652         return ret_arr;
46653 }
46654
46655 void  CS_LDK_CommonAcceptChannelFields_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
46656         LDKCommonAcceptChannelFields this_ptr_conv;
46657         this_ptr_conv.inner = untag_ptr(this_ptr);
46658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46660         this_ptr_conv.is_owned = false;
46661         LDKPublicKey val_ref;
46662         CHECK(val->arr_len == 33);
46663         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46664         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
46665 }
46666
46667 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_delayed_payment_basepoint(int64_t this_ptr) {
46668         LDKCommonAcceptChannelFields this_ptr_conv;
46669         this_ptr_conv.inner = untag_ptr(this_ptr);
46670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46672         this_ptr_conv.is_owned = false;
46673         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46674         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
46675         return ret_arr;
46676 }
46677
46678 void  CS_LDK_CommonAcceptChannelFields_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
46679         LDKCommonAcceptChannelFields this_ptr_conv;
46680         this_ptr_conv.inner = untag_ptr(this_ptr);
46681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46683         this_ptr_conv.is_owned = false;
46684         LDKPublicKey val_ref;
46685         CHECK(val->arr_len == 33);
46686         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46687         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
46688 }
46689
46690 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_htlc_basepoint(int64_t this_ptr) {
46691         LDKCommonAcceptChannelFields this_ptr_conv;
46692         this_ptr_conv.inner = untag_ptr(this_ptr);
46693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46695         this_ptr_conv.is_owned = false;
46696         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46697         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
46698         return ret_arr;
46699 }
46700
46701 void  CS_LDK_CommonAcceptChannelFields_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
46702         LDKCommonAcceptChannelFields this_ptr_conv;
46703         this_ptr_conv.inner = untag_ptr(this_ptr);
46704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46706         this_ptr_conv.is_owned = false;
46707         LDKPublicKey val_ref;
46708         CHECK(val->arr_len == 33);
46709         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46710         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
46711 }
46712
46713 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_first_per_commitment_point(int64_t this_ptr) {
46714         LDKCommonAcceptChannelFields this_ptr_conv;
46715         this_ptr_conv.inner = untag_ptr(this_ptr);
46716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46718         this_ptr_conv.is_owned = false;
46719         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46720         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
46721         return ret_arr;
46722 }
46723
46724 void  CS_LDK_CommonAcceptChannelFields_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
46725         LDKCommonAcceptChannelFields this_ptr_conv;
46726         this_ptr_conv.inner = untag_ptr(this_ptr);
46727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46729         this_ptr_conv.is_owned = false;
46730         LDKPublicKey val_ref;
46731         CHECK(val->arr_len == 33);
46732         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46733         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
46734 }
46735
46736 int64_t  CS_LDK_CommonAcceptChannelFields_get_shutdown_scriptpubkey(int64_t this_ptr) {
46737         LDKCommonAcceptChannelFields this_ptr_conv;
46738         this_ptr_conv.inner = untag_ptr(this_ptr);
46739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46741         this_ptr_conv.is_owned = false;
46742         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
46743         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
46744         int64_t ret_ref = tag_ptr(ret_copy, true);
46745         return ret_ref;
46746 }
46747
46748 void  CS_LDK_CommonAcceptChannelFields_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
46749         LDKCommonAcceptChannelFields this_ptr_conv;
46750         this_ptr_conv.inner = untag_ptr(this_ptr);
46751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46753         this_ptr_conv.is_owned = false;
46754         void* val_ptr = untag_ptr(val);
46755         CHECK_ACCESS(val_ptr);
46756         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
46757         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
46758         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
46759 }
46760
46761 int64_t  CS_LDK_CommonAcceptChannelFields_get_channel_type(int64_t this_ptr) {
46762         LDKCommonAcceptChannelFields this_ptr_conv;
46763         this_ptr_conv.inner = untag_ptr(this_ptr);
46764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46766         this_ptr_conv.is_owned = false;
46767         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
46768         int64_t ret_ref = 0;
46769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46771         return ret_ref;
46772 }
46773
46774 void  CS_LDK_CommonAcceptChannelFields_set_channel_type(int64_t this_ptr, int64_t val) {
46775         LDKCommonAcceptChannelFields this_ptr_conv;
46776         this_ptr_conv.inner = untag_ptr(this_ptr);
46777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46779         this_ptr_conv.is_owned = false;
46780         LDKChannelTypeFeatures val_conv;
46781         val_conv.inner = untag_ptr(val);
46782         val_conv.is_owned = ptr_is_owned(val);
46783         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46784         val_conv = ChannelTypeFeatures_clone(&val_conv);
46785         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
46786 }
46787
46788 int64_t  CS_LDK_CommonAcceptChannelFields_new(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) {
46789         LDKChannelId temporary_channel_id_arg_conv;
46790         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
46791         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
46792         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
46793         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
46794         LDKPublicKey funding_pubkey_arg_ref;
46795         CHECK(funding_pubkey_arg->arr_len == 33);
46796         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
46797         LDKPublicKey revocation_basepoint_arg_ref;
46798         CHECK(revocation_basepoint_arg->arr_len == 33);
46799         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
46800         LDKPublicKey payment_basepoint_arg_ref;
46801         CHECK(payment_basepoint_arg->arr_len == 33);
46802         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
46803         LDKPublicKey delayed_payment_basepoint_arg_ref;
46804         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
46805         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
46806         LDKPublicKey htlc_basepoint_arg_ref;
46807         CHECK(htlc_basepoint_arg->arr_len == 33);
46808         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
46809         LDKPublicKey first_per_commitment_point_arg_ref;
46810         CHECK(first_per_commitment_point_arg->arr_len == 33);
46811         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
46812         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
46813         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
46814         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
46815         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
46816         LDKChannelTypeFeatures channel_type_arg_conv;
46817         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
46818         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
46819         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
46820         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
46821         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);
46822         int64_t ret_ref = 0;
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46825         return ret_ref;
46826 }
46827
46828 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
46829         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
46830         int64_t ret_ref = 0;
46831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46833         return ret_ref;
46834 }
46835 int64_t  CS_LDK_CommonAcceptChannelFields_clone_ptr(int64_t arg) {
46836         LDKCommonAcceptChannelFields arg_conv;
46837         arg_conv.inner = untag_ptr(arg);
46838         arg_conv.is_owned = ptr_is_owned(arg);
46839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46840         arg_conv.is_owned = false;
46841         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
46842         return ret_conv;
46843 }
46844
46845 int64_t  CS_LDK_CommonAcceptChannelFields_clone(int64_t orig) {
46846         LDKCommonAcceptChannelFields orig_conv;
46847         orig_conv.inner = untag_ptr(orig);
46848         orig_conv.is_owned = ptr_is_owned(orig);
46849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46850         orig_conv.is_owned = false;
46851         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
46852         int64_t ret_ref = 0;
46853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46855         return ret_ref;
46856 }
46857
46858 int64_t  CS_LDK_CommonAcceptChannelFields_hash(int64_t o) {
46859         LDKCommonAcceptChannelFields o_conv;
46860         o_conv.inner = untag_ptr(o);
46861         o_conv.is_owned = ptr_is_owned(o);
46862         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46863         o_conv.is_owned = false;
46864         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
46865         return ret_conv;
46866 }
46867
46868 jboolean  CS_LDK_CommonAcceptChannelFields_eq(int64_t a, int64_t b) {
46869         LDKCommonAcceptChannelFields a_conv;
46870         a_conv.inner = untag_ptr(a);
46871         a_conv.is_owned = ptr_is_owned(a);
46872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46873         a_conv.is_owned = false;
46874         LDKCommonAcceptChannelFields b_conv;
46875         b_conv.inner = untag_ptr(b);
46876         b_conv.is_owned = ptr_is_owned(b);
46877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46878         b_conv.is_owned = false;
46879         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
46880         return ret_conv;
46881 }
46882
46883 void  CS_LDK_AcceptChannel_free(int64_t this_obj) {
46884         LDKAcceptChannel this_obj_conv;
46885         this_obj_conv.inner = untag_ptr(this_obj);
46886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46888         AcceptChannel_free(this_obj_conv);
46889 }
46890
46891 int64_t  CS_LDK_AcceptChannel_get_common_fields(int64_t this_ptr) {
46892         LDKAcceptChannel 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         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
46898         int64_t ret_ref = 0;
46899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46901         return ret_ref;
46902 }
46903
46904 void  CS_LDK_AcceptChannel_set_common_fields(int64_t this_ptr, int64_t val) {
46905         LDKAcceptChannel this_ptr_conv;
46906         this_ptr_conv.inner = untag_ptr(this_ptr);
46907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46909         this_ptr_conv.is_owned = false;
46910         LDKCommonAcceptChannelFields val_conv;
46911         val_conv.inner = untag_ptr(val);
46912         val_conv.is_owned = ptr_is_owned(val);
46913         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46914         val_conv = CommonAcceptChannelFields_clone(&val_conv);
46915         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
46916 }
46917
46918 int64_t  CS_LDK_AcceptChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
46919         LDKAcceptChannel this_ptr_conv;
46920         this_ptr_conv.inner = untag_ptr(this_ptr);
46921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46923         this_ptr_conv.is_owned = false;
46924         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
46925         return ret_conv;
46926 }
46927
46928 void  CS_LDK_AcceptChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
46929         LDKAcceptChannel this_ptr_conv;
46930         this_ptr_conv.inner = untag_ptr(this_ptr);
46931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46933         this_ptr_conv.is_owned = false;
46934         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
46935 }
46936
46937 int64_t  CS_LDK_AcceptChannel_new(int64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
46938         LDKCommonAcceptChannelFields common_fields_arg_conv;
46939         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
46940         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
46941         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
46942         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
46943         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
46944         int64_t ret_ref = 0;
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46947         return ret_ref;
46948 }
46949
46950 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
46951         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
46952         int64_t ret_ref = 0;
46953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46955         return ret_ref;
46956 }
46957 int64_t  CS_LDK_AcceptChannel_clone_ptr(int64_t arg) {
46958         LDKAcceptChannel arg_conv;
46959         arg_conv.inner = untag_ptr(arg);
46960         arg_conv.is_owned = ptr_is_owned(arg);
46961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46962         arg_conv.is_owned = false;
46963         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
46964         return ret_conv;
46965 }
46966
46967 int64_t  CS_LDK_AcceptChannel_clone(int64_t orig) {
46968         LDKAcceptChannel orig_conv;
46969         orig_conv.inner = untag_ptr(orig);
46970         orig_conv.is_owned = ptr_is_owned(orig);
46971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46972         orig_conv.is_owned = false;
46973         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
46974         int64_t ret_ref = 0;
46975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46977         return ret_ref;
46978 }
46979
46980 int64_t  CS_LDK_AcceptChannel_hash(int64_t o) {
46981         LDKAcceptChannel o_conv;
46982         o_conv.inner = untag_ptr(o);
46983         o_conv.is_owned = ptr_is_owned(o);
46984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46985         o_conv.is_owned = false;
46986         int64_t ret_conv = AcceptChannel_hash(&o_conv);
46987         return ret_conv;
46988 }
46989
46990 jboolean  CS_LDK_AcceptChannel_eq(int64_t a, int64_t b) {
46991         LDKAcceptChannel a_conv;
46992         a_conv.inner = untag_ptr(a);
46993         a_conv.is_owned = ptr_is_owned(a);
46994         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46995         a_conv.is_owned = false;
46996         LDKAcceptChannel b_conv;
46997         b_conv.inner = untag_ptr(b);
46998         b_conv.is_owned = ptr_is_owned(b);
46999         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47000         b_conv.is_owned = false;
47001         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
47002         return ret_conv;
47003 }
47004
47005 void  CS_LDK_AcceptChannelV2_free(int64_t this_obj) {
47006         LDKAcceptChannelV2 this_obj_conv;
47007         this_obj_conv.inner = untag_ptr(this_obj);
47008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47010         AcceptChannelV2_free(this_obj_conv);
47011 }
47012
47013 int64_t  CS_LDK_AcceptChannelV2_get_common_fields(int64_t this_ptr) {
47014         LDKAcceptChannelV2 this_ptr_conv;
47015         this_ptr_conv.inner = untag_ptr(this_ptr);
47016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47018         this_ptr_conv.is_owned = false;
47019         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
47020         int64_t ret_ref = 0;
47021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47023         return ret_ref;
47024 }
47025
47026 void  CS_LDK_AcceptChannelV2_set_common_fields(int64_t this_ptr, int64_t val) {
47027         LDKAcceptChannelV2 this_ptr_conv;
47028         this_ptr_conv.inner = untag_ptr(this_ptr);
47029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47031         this_ptr_conv.is_owned = false;
47032         LDKCommonAcceptChannelFields val_conv;
47033         val_conv.inner = untag_ptr(val);
47034         val_conv.is_owned = ptr_is_owned(val);
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47036         val_conv = CommonAcceptChannelFields_clone(&val_conv);
47037         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
47038 }
47039
47040 int64_t  CS_LDK_AcceptChannelV2_get_funding_satoshis(int64_t this_ptr) {
47041         LDKAcceptChannelV2 this_ptr_conv;
47042         this_ptr_conv.inner = untag_ptr(this_ptr);
47043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47045         this_ptr_conv.is_owned = false;
47046         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
47047         return ret_conv;
47048 }
47049
47050 void  CS_LDK_AcceptChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
47051         LDKAcceptChannelV2 this_ptr_conv;
47052         this_ptr_conv.inner = untag_ptr(this_ptr);
47053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47055         this_ptr_conv.is_owned = false;
47056         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
47057 }
47058
47059 int8_tArray  CS_LDK_AcceptChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
47060         LDKAcceptChannelV2 this_ptr_conv;
47061         this_ptr_conv.inner = untag_ptr(this_ptr);
47062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47064         this_ptr_conv.is_owned = false;
47065         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47066         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47067         return ret_arr;
47068 }
47069
47070 void  CS_LDK_AcceptChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47071         LDKAcceptChannelV2 this_ptr_conv;
47072         this_ptr_conv.inner = untag_ptr(this_ptr);
47073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47075         this_ptr_conv.is_owned = false;
47076         LDKPublicKey val_ref;
47077         CHECK(val->arr_len == 33);
47078         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47079         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
47080 }
47081
47082 int32_t  CS_LDK_AcceptChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
47083         LDKAcceptChannelV2 this_ptr_conv;
47084         this_ptr_conv.inner = untag_ptr(this_ptr);
47085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47087         this_ptr_conv.is_owned = false;
47088         int32_t ret_conv = LDKCOption_NoneZ_to_cs(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
47089         return ret_conv;
47090 }
47091
47092 void  CS_LDK_AcceptChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
47093         LDKAcceptChannelV2 this_ptr_conv;
47094         this_ptr_conv.inner = untag_ptr(this_ptr);
47095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47097         this_ptr_conv.is_owned = false;
47098         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
47099         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
47100 }
47101
47102 int64_t  CS_LDK_AcceptChannelV2_new(int64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, int32_t require_confirmed_inputs_arg) {
47103         LDKCommonAcceptChannelFields common_fields_arg_conv;
47104         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47105         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47107         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
47108         LDKPublicKey second_per_commitment_point_arg_ref;
47109         CHECK(second_per_commitment_point_arg->arr_len == 33);
47110         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
47111         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
47112         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
47113         int64_t ret_ref = 0;
47114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47116         return ret_ref;
47117 }
47118
47119 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
47120         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
47121         int64_t ret_ref = 0;
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47124         return ret_ref;
47125 }
47126 int64_t  CS_LDK_AcceptChannelV2_clone_ptr(int64_t arg) {
47127         LDKAcceptChannelV2 arg_conv;
47128         arg_conv.inner = untag_ptr(arg);
47129         arg_conv.is_owned = ptr_is_owned(arg);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47131         arg_conv.is_owned = false;
47132         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
47133         return ret_conv;
47134 }
47135
47136 int64_t  CS_LDK_AcceptChannelV2_clone(int64_t orig) {
47137         LDKAcceptChannelV2 orig_conv;
47138         orig_conv.inner = untag_ptr(orig);
47139         orig_conv.is_owned = ptr_is_owned(orig);
47140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47141         orig_conv.is_owned = false;
47142         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
47143         int64_t ret_ref = 0;
47144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47146         return ret_ref;
47147 }
47148
47149 int64_t  CS_LDK_AcceptChannelV2_hash(int64_t o) {
47150         LDKAcceptChannelV2 o_conv;
47151         o_conv.inner = untag_ptr(o);
47152         o_conv.is_owned = ptr_is_owned(o);
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47154         o_conv.is_owned = false;
47155         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
47156         return ret_conv;
47157 }
47158
47159 jboolean  CS_LDK_AcceptChannelV2_eq(int64_t a, int64_t b) {
47160         LDKAcceptChannelV2 a_conv;
47161         a_conv.inner = untag_ptr(a);
47162         a_conv.is_owned = ptr_is_owned(a);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47164         a_conv.is_owned = false;
47165         LDKAcceptChannelV2 b_conv;
47166         b_conv.inner = untag_ptr(b);
47167         b_conv.is_owned = ptr_is_owned(b);
47168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47169         b_conv.is_owned = false;
47170         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
47171         return ret_conv;
47172 }
47173
47174 void  CS_LDK_FundingCreated_free(int64_t this_obj) {
47175         LDKFundingCreated this_obj_conv;
47176         this_obj_conv.inner = untag_ptr(this_obj);
47177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47179         FundingCreated_free(this_obj_conv);
47180 }
47181
47182 int64_t  CS_LDK_FundingCreated_get_temporary_channel_id(int64_t this_ptr) {
47183         LDKFundingCreated this_ptr_conv;
47184         this_ptr_conv.inner = untag_ptr(this_ptr);
47185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47187         this_ptr_conv.is_owned = false;
47188         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
47189         int64_t ret_ref = 0;
47190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47192         return ret_ref;
47193 }
47194
47195 void  CS_LDK_FundingCreated_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
47196         LDKFundingCreated this_ptr_conv;
47197         this_ptr_conv.inner = untag_ptr(this_ptr);
47198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47200         this_ptr_conv.is_owned = false;
47201         LDKChannelId val_conv;
47202         val_conv.inner = untag_ptr(val);
47203         val_conv.is_owned = ptr_is_owned(val);
47204         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47205         val_conv = ChannelId_clone(&val_conv);
47206         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
47207 }
47208
47209 int8_tArray  CS_LDK_FundingCreated_get_funding_txid(int64_t this_ptr) {
47210         LDKFundingCreated this_ptr_conv;
47211         this_ptr_conv.inner = untag_ptr(this_ptr);
47212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47214         this_ptr_conv.is_owned = false;
47215         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47216         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
47217         return ret_arr;
47218 }
47219
47220 void  CS_LDK_FundingCreated_set_funding_txid(int64_t this_ptr, int8_tArray val) {
47221         LDKFundingCreated this_ptr_conv;
47222         this_ptr_conv.inner = untag_ptr(this_ptr);
47223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47225         this_ptr_conv.is_owned = false;
47226         LDKThirtyTwoBytes val_ref;
47227         CHECK(val->arr_len == 32);
47228         memcpy(val_ref.data, val->elems, 32); FREE(val);
47229         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
47230 }
47231
47232 int16_t  CS_LDK_FundingCreated_get_funding_output_index(int64_t this_ptr) {
47233         LDKFundingCreated this_ptr_conv;
47234         this_ptr_conv.inner = untag_ptr(this_ptr);
47235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47237         this_ptr_conv.is_owned = false;
47238         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
47239         return ret_conv;
47240 }
47241
47242 void  CS_LDK_FundingCreated_set_funding_output_index(int64_t this_ptr, int16_t val) {
47243         LDKFundingCreated this_ptr_conv;
47244         this_ptr_conv.inner = untag_ptr(this_ptr);
47245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47247         this_ptr_conv.is_owned = false;
47248         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
47249 }
47250
47251 int8_tArray  CS_LDK_FundingCreated_get_signature(int64_t this_ptr) {
47252         LDKFundingCreated this_ptr_conv;
47253         this_ptr_conv.inner = untag_ptr(this_ptr);
47254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47256         this_ptr_conv.is_owned = false;
47257         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47258         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
47259         return ret_arr;
47260 }
47261
47262 void  CS_LDK_FundingCreated_set_signature(int64_t this_ptr, int8_tArray val) {
47263         LDKFundingCreated this_ptr_conv;
47264         this_ptr_conv.inner = untag_ptr(this_ptr);
47265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47267         this_ptr_conv.is_owned = false;
47268         LDKECDSASignature val_ref;
47269         CHECK(val->arr_len == 64);
47270         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47271         FundingCreated_set_signature(&this_ptr_conv, val_ref);
47272 }
47273
47274 int64_t  CS_LDK_FundingCreated_new(int64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
47275         LDKChannelId temporary_channel_id_arg_conv;
47276         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
47277         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
47279         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
47280         LDKThirtyTwoBytes funding_txid_arg_ref;
47281         CHECK(funding_txid_arg->arr_len == 32);
47282         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
47283         LDKECDSASignature signature_arg_ref;
47284         CHECK(signature_arg->arr_len == 64);
47285         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47286         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
47287         int64_t ret_ref = 0;
47288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47290         return ret_ref;
47291 }
47292
47293 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
47294         LDKFundingCreated ret_var = FundingCreated_clone(arg);
47295         int64_t ret_ref = 0;
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47298         return ret_ref;
47299 }
47300 int64_t  CS_LDK_FundingCreated_clone_ptr(int64_t arg) {
47301         LDKFundingCreated arg_conv;
47302         arg_conv.inner = untag_ptr(arg);
47303         arg_conv.is_owned = ptr_is_owned(arg);
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47305         arg_conv.is_owned = false;
47306         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
47307         return ret_conv;
47308 }
47309
47310 int64_t  CS_LDK_FundingCreated_clone(int64_t orig) {
47311         LDKFundingCreated orig_conv;
47312         orig_conv.inner = untag_ptr(orig);
47313         orig_conv.is_owned = ptr_is_owned(orig);
47314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47315         orig_conv.is_owned = false;
47316         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
47317         int64_t ret_ref = 0;
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47320         return ret_ref;
47321 }
47322
47323 int64_t  CS_LDK_FundingCreated_hash(int64_t o) {
47324         LDKFundingCreated o_conv;
47325         o_conv.inner = untag_ptr(o);
47326         o_conv.is_owned = ptr_is_owned(o);
47327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47328         o_conv.is_owned = false;
47329         int64_t ret_conv = FundingCreated_hash(&o_conv);
47330         return ret_conv;
47331 }
47332
47333 jboolean  CS_LDK_FundingCreated_eq(int64_t a, int64_t b) {
47334         LDKFundingCreated a_conv;
47335         a_conv.inner = untag_ptr(a);
47336         a_conv.is_owned = ptr_is_owned(a);
47337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47338         a_conv.is_owned = false;
47339         LDKFundingCreated b_conv;
47340         b_conv.inner = untag_ptr(b);
47341         b_conv.is_owned = ptr_is_owned(b);
47342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47343         b_conv.is_owned = false;
47344         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
47345         return ret_conv;
47346 }
47347
47348 void  CS_LDK_FundingSigned_free(int64_t this_obj) {
47349         LDKFundingSigned this_obj_conv;
47350         this_obj_conv.inner = untag_ptr(this_obj);
47351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47353         FundingSigned_free(this_obj_conv);
47354 }
47355
47356 int64_t  CS_LDK_FundingSigned_get_channel_id(int64_t this_ptr) {
47357         LDKFundingSigned this_ptr_conv;
47358         this_ptr_conv.inner = untag_ptr(this_ptr);
47359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47361         this_ptr_conv.is_owned = false;
47362         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
47363         int64_t ret_ref = 0;
47364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47366         return ret_ref;
47367 }
47368
47369 void  CS_LDK_FundingSigned_set_channel_id(int64_t this_ptr, int64_t val) {
47370         LDKFundingSigned this_ptr_conv;
47371         this_ptr_conv.inner = untag_ptr(this_ptr);
47372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47374         this_ptr_conv.is_owned = false;
47375         LDKChannelId val_conv;
47376         val_conv.inner = untag_ptr(val);
47377         val_conv.is_owned = ptr_is_owned(val);
47378         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47379         val_conv = ChannelId_clone(&val_conv);
47380         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
47381 }
47382
47383 int8_tArray  CS_LDK_FundingSigned_get_signature(int64_t this_ptr) {
47384         LDKFundingSigned this_ptr_conv;
47385         this_ptr_conv.inner = untag_ptr(this_ptr);
47386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47388         this_ptr_conv.is_owned = false;
47389         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47390         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
47391         return ret_arr;
47392 }
47393
47394 void  CS_LDK_FundingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
47395         LDKFundingSigned this_ptr_conv;
47396         this_ptr_conv.inner = untag_ptr(this_ptr);
47397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47399         this_ptr_conv.is_owned = false;
47400         LDKECDSASignature val_ref;
47401         CHECK(val->arr_len == 64);
47402         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47403         FundingSigned_set_signature(&this_ptr_conv, val_ref);
47404 }
47405
47406 int64_t  CS_LDK_FundingSigned_new(int64_t channel_id_arg, int8_tArray signature_arg) {
47407         LDKChannelId channel_id_arg_conv;
47408         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47409         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47410         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47411         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47412         LDKECDSASignature signature_arg_ref;
47413         CHECK(signature_arg->arr_len == 64);
47414         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47415         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
47416         int64_t ret_ref = 0;
47417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47419         return ret_ref;
47420 }
47421
47422 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
47423         LDKFundingSigned ret_var = FundingSigned_clone(arg);
47424         int64_t ret_ref = 0;
47425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47427         return ret_ref;
47428 }
47429 int64_t  CS_LDK_FundingSigned_clone_ptr(int64_t arg) {
47430         LDKFundingSigned arg_conv;
47431         arg_conv.inner = untag_ptr(arg);
47432         arg_conv.is_owned = ptr_is_owned(arg);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47434         arg_conv.is_owned = false;
47435         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
47436         return ret_conv;
47437 }
47438
47439 int64_t  CS_LDK_FundingSigned_clone(int64_t orig) {
47440         LDKFundingSigned orig_conv;
47441         orig_conv.inner = untag_ptr(orig);
47442         orig_conv.is_owned = ptr_is_owned(orig);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47444         orig_conv.is_owned = false;
47445         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
47446         int64_t ret_ref = 0;
47447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47449         return ret_ref;
47450 }
47451
47452 int64_t  CS_LDK_FundingSigned_hash(int64_t o) {
47453         LDKFundingSigned o_conv;
47454         o_conv.inner = untag_ptr(o);
47455         o_conv.is_owned = ptr_is_owned(o);
47456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47457         o_conv.is_owned = false;
47458         int64_t ret_conv = FundingSigned_hash(&o_conv);
47459         return ret_conv;
47460 }
47461
47462 jboolean  CS_LDK_FundingSigned_eq(int64_t a, int64_t b) {
47463         LDKFundingSigned a_conv;
47464         a_conv.inner = untag_ptr(a);
47465         a_conv.is_owned = ptr_is_owned(a);
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47467         a_conv.is_owned = false;
47468         LDKFundingSigned b_conv;
47469         b_conv.inner = untag_ptr(b);
47470         b_conv.is_owned = ptr_is_owned(b);
47471         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47472         b_conv.is_owned = false;
47473         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
47474         return ret_conv;
47475 }
47476
47477 void  CS_LDK_ChannelReady_free(int64_t this_obj) {
47478         LDKChannelReady this_obj_conv;
47479         this_obj_conv.inner = untag_ptr(this_obj);
47480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47482         ChannelReady_free(this_obj_conv);
47483 }
47484
47485 int64_t  CS_LDK_ChannelReady_get_channel_id(int64_t this_ptr) {
47486         LDKChannelReady this_ptr_conv;
47487         this_ptr_conv.inner = untag_ptr(this_ptr);
47488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47490         this_ptr_conv.is_owned = false;
47491         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
47492         int64_t ret_ref = 0;
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47495         return ret_ref;
47496 }
47497
47498 void  CS_LDK_ChannelReady_set_channel_id(int64_t this_ptr, int64_t val) {
47499         LDKChannelReady this_ptr_conv;
47500         this_ptr_conv.inner = untag_ptr(this_ptr);
47501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47503         this_ptr_conv.is_owned = false;
47504         LDKChannelId val_conv;
47505         val_conv.inner = untag_ptr(val);
47506         val_conv.is_owned = ptr_is_owned(val);
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47508         val_conv = ChannelId_clone(&val_conv);
47509         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
47510 }
47511
47512 int8_tArray  CS_LDK_ChannelReady_get_next_per_commitment_point(int64_t this_ptr) {
47513         LDKChannelReady this_ptr_conv;
47514         this_ptr_conv.inner = untag_ptr(this_ptr);
47515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47517         this_ptr_conv.is_owned = false;
47518         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47519         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47520         return ret_arr;
47521 }
47522
47523 void  CS_LDK_ChannelReady_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47524         LDKChannelReady this_ptr_conv;
47525         this_ptr_conv.inner = untag_ptr(this_ptr);
47526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47528         this_ptr_conv.is_owned = false;
47529         LDKPublicKey val_ref;
47530         CHECK(val->arr_len == 33);
47531         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47532         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47533 }
47534
47535 int64_t  CS_LDK_ChannelReady_get_short_channel_id_alias(int64_t this_ptr) {
47536         LDKChannelReady this_ptr_conv;
47537         this_ptr_conv.inner = untag_ptr(this_ptr);
47538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47540         this_ptr_conv.is_owned = false;
47541         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47542         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
47543         int64_t ret_ref = tag_ptr(ret_copy, true);
47544         return ret_ref;
47545 }
47546
47547 void  CS_LDK_ChannelReady_set_short_channel_id_alias(int64_t this_ptr, int64_t val) {
47548         LDKChannelReady this_ptr_conv;
47549         this_ptr_conv.inner = untag_ptr(this_ptr);
47550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47552         this_ptr_conv.is_owned = false;
47553         void* val_ptr = untag_ptr(val);
47554         CHECK_ACCESS(val_ptr);
47555         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47556         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47557         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
47558 }
47559
47560 int64_t  CS_LDK_ChannelReady_new(int64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
47561         LDKChannelId channel_id_arg_conv;
47562         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47563         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47564         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47565         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47566         LDKPublicKey next_per_commitment_point_arg_ref;
47567         CHECK(next_per_commitment_point_arg->arr_len == 33);
47568         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
47569         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
47570         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
47571         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
47572         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
47573         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
47574         int64_t ret_ref = 0;
47575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47577         return ret_ref;
47578 }
47579
47580 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
47581         LDKChannelReady ret_var = ChannelReady_clone(arg);
47582         int64_t ret_ref = 0;
47583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47585         return ret_ref;
47586 }
47587 int64_t  CS_LDK_ChannelReady_clone_ptr(int64_t arg) {
47588         LDKChannelReady arg_conv;
47589         arg_conv.inner = untag_ptr(arg);
47590         arg_conv.is_owned = ptr_is_owned(arg);
47591         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47592         arg_conv.is_owned = false;
47593         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
47594         return ret_conv;
47595 }
47596
47597 int64_t  CS_LDK_ChannelReady_clone(int64_t orig) {
47598         LDKChannelReady orig_conv;
47599         orig_conv.inner = untag_ptr(orig);
47600         orig_conv.is_owned = ptr_is_owned(orig);
47601         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47602         orig_conv.is_owned = false;
47603         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
47604         int64_t ret_ref = 0;
47605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47607         return ret_ref;
47608 }
47609
47610 int64_t  CS_LDK_ChannelReady_hash(int64_t o) {
47611         LDKChannelReady o_conv;
47612         o_conv.inner = untag_ptr(o);
47613         o_conv.is_owned = ptr_is_owned(o);
47614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47615         o_conv.is_owned = false;
47616         int64_t ret_conv = ChannelReady_hash(&o_conv);
47617         return ret_conv;
47618 }
47619
47620 jboolean  CS_LDK_ChannelReady_eq(int64_t a, int64_t b) {
47621         LDKChannelReady a_conv;
47622         a_conv.inner = untag_ptr(a);
47623         a_conv.is_owned = ptr_is_owned(a);
47624         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47625         a_conv.is_owned = false;
47626         LDKChannelReady b_conv;
47627         b_conv.inner = untag_ptr(b);
47628         b_conv.is_owned = ptr_is_owned(b);
47629         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47630         b_conv.is_owned = false;
47631         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
47632         return ret_conv;
47633 }
47634
47635 void  CS_LDK_Stfu_free(int64_t this_obj) {
47636         LDKStfu this_obj_conv;
47637         this_obj_conv.inner = untag_ptr(this_obj);
47638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47640         Stfu_free(this_obj_conv);
47641 }
47642
47643 int64_t  CS_LDK_Stfu_get_channel_id(int64_t this_ptr) {
47644         LDKStfu this_ptr_conv;
47645         this_ptr_conv.inner = untag_ptr(this_ptr);
47646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47648         this_ptr_conv.is_owned = false;
47649         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
47650         int64_t ret_ref = 0;
47651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47653         return ret_ref;
47654 }
47655
47656 void  CS_LDK_Stfu_set_channel_id(int64_t this_ptr, int64_t val) {
47657         LDKStfu this_ptr_conv;
47658         this_ptr_conv.inner = untag_ptr(this_ptr);
47659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47661         this_ptr_conv.is_owned = false;
47662         LDKChannelId val_conv;
47663         val_conv.inner = untag_ptr(val);
47664         val_conv.is_owned = ptr_is_owned(val);
47665         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47666         val_conv = ChannelId_clone(&val_conv);
47667         Stfu_set_channel_id(&this_ptr_conv, val_conv);
47668 }
47669
47670 int8_t  CS_LDK_Stfu_get_initiator(int64_t this_ptr) {
47671         LDKStfu this_ptr_conv;
47672         this_ptr_conv.inner = untag_ptr(this_ptr);
47673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47675         this_ptr_conv.is_owned = false;
47676         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
47677         return ret_conv;
47678 }
47679
47680 void  CS_LDK_Stfu_set_initiator(int64_t this_ptr, int8_t val) {
47681         LDKStfu this_ptr_conv;
47682         this_ptr_conv.inner = untag_ptr(this_ptr);
47683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47685         this_ptr_conv.is_owned = false;
47686         Stfu_set_initiator(&this_ptr_conv, val);
47687 }
47688
47689 int64_t  CS_LDK_Stfu_new(int64_t channel_id_arg, int8_t initiator_arg) {
47690         LDKChannelId channel_id_arg_conv;
47691         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47692         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47693         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47694         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47695         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
47696         int64_t ret_ref = 0;
47697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47699         return ret_ref;
47700 }
47701
47702 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
47703         LDKStfu ret_var = Stfu_clone(arg);
47704         int64_t ret_ref = 0;
47705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47707         return ret_ref;
47708 }
47709 int64_t  CS_LDK_Stfu_clone_ptr(int64_t arg) {
47710         LDKStfu arg_conv;
47711         arg_conv.inner = untag_ptr(arg);
47712         arg_conv.is_owned = ptr_is_owned(arg);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47714         arg_conv.is_owned = false;
47715         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
47716         return ret_conv;
47717 }
47718
47719 int64_t  CS_LDK_Stfu_clone(int64_t orig) {
47720         LDKStfu orig_conv;
47721         orig_conv.inner = untag_ptr(orig);
47722         orig_conv.is_owned = ptr_is_owned(orig);
47723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47724         orig_conv.is_owned = false;
47725         LDKStfu ret_var = Stfu_clone(&orig_conv);
47726         int64_t ret_ref = 0;
47727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47729         return ret_ref;
47730 }
47731
47732 jboolean  CS_LDK_Stfu_eq(int64_t a, int64_t b) {
47733         LDKStfu a_conv;
47734         a_conv.inner = untag_ptr(a);
47735         a_conv.is_owned = ptr_is_owned(a);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47737         a_conv.is_owned = false;
47738         LDKStfu b_conv;
47739         b_conv.inner = untag_ptr(b);
47740         b_conv.is_owned = ptr_is_owned(b);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47742         b_conv.is_owned = false;
47743         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
47744         return ret_conv;
47745 }
47746
47747 void  CS_LDK_Splice_free(int64_t this_obj) {
47748         LDKSplice this_obj_conv;
47749         this_obj_conv.inner = untag_ptr(this_obj);
47750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47752         Splice_free(this_obj_conv);
47753 }
47754
47755 int64_t  CS_LDK_Splice_get_channel_id(int64_t this_ptr) {
47756         LDKSplice this_ptr_conv;
47757         this_ptr_conv.inner = untag_ptr(this_ptr);
47758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47760         this_ptr_conv.is_owned = false;
47761         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
47762         int64_t ret_ref = 0;
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47765         return ret_ref;
47766 }
47767
47768 void  CS_LDK_Splice_set_channel_id(int64_t this_ptr, int64_t val) {
47769         LDKSplice this_ptr_conv;
47770         this_ptr_conv.inner = untag_ptr(this_ptr);
47771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47773         this_ptr_conv.is_owned = false;
47774         LDKChannelId val_conv;
47775         val_conv.inner = untag_ptr(val);
47776         val_conv.is_owned = ptr_is_owned(val);
47777         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47778         val_conv = ChannelId_clone(&val_conv);
47779         Splice_set_channel_id(&this_ptr_conv, val_conv);
47780 }
47781
47782 int8_tArray  CS_LDK_Splice_get_chain_hash(int64_t this_ptr) {
47783         LDKSplice this_ptr_conv;
47784         this_ptr_conv.inner = untag_ptr(this_ptr);
47785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47787         this_ptr_conv.is_owned = false;
47788         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47789         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
47790         return ret_arr;
47791 }
47792
47793 void  CS_LDK_Splice_set_chain_hash(int64_t this_ptr, int8_tArray val) {
47794         LDKSplice this_ptr_conv;
47795         this_ptr_conv.inner = untag_ptr(this_ptr);
47796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47798         this_ptr_conv.is_owned = false;
47799         LDKThirtyTwoBytes val_ref;
47800         CHECK(val->arr_len == 32);
47801         memcpy(val_ref.data, val->elems, 32); FREE(val);
47802         Splice_set_chain_hash(&this_ptr_conv, val_ref);
47803 }
47804
47805 int64_t  CS_LDK_Splice_get_relative_satoshis(int64_t this_ptr) {
47806         LDKSplice this_ptr_conv;
47807         this_ptr_conv.inner = untag_ptr(this_ptr);
47808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47810         this_ptr_conv.is_owned = false;
47811         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
47812         return ret_conv;
47813 }
47814
47815 void  CS_LDK_Splice_set_relative_satoshis(int64_t this_ptr, int64_t val) {
47816         LDKSplice this_ptr_conv;
47817         this_ptr_conv.inner = untag_ptr(this_ptr);
47818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47820         this_ptr_conv.is_owned = false;
47821         Splice_set_relative_satoshis(&this_ptr_conv, val);
47822 }
47823
47824 int32_t  CS_LDK_Splice_get_funding_feerate_perkw(int64_t this_ptr) {
47825         LDKSplice this_ptr_conv;
47826         this_ptr_conv.inner = untag_ptr(this_ptr);
47827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47829         this_ptr_conv.is_owned = false;
47830         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
47831         return ret_conv;
47832 }
47833
47834 void  CS_LDK_Splice_set_funding_feerate_perkw(int64_t this_ptr, int32_t val) {
47835         LDKSplice this_ptr_conv;
47836         this_ptr_conv.inner = untag_ptr(this_ptr);
47837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47839         this_ptr_conv.is_owned = false;
47840         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
47841 }
47842
47843 int32_t  CS_LDK_Splice_get_locktime(int64_t this_ptr) {
47844         LDKSplice this_ptr_conv;
47845         this_ptr_conv.inner = untag_ptr(this_ptr);
47846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47848         this_ptr_conv.is_owned = false;
47849         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
47850         return ret_conv;
47851 }
47852
47853 void  CS_LDK_Splice_set_locktime(int64_t this_ptr, int32_t val) {
47854         LDKSplice this_ptr_conv;
47855         this_ptr_conv.inner = untag_ptr(this_ptr);
47856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47858         this_ptr_conv.is_owned = false;
47859         Splice_set_locktime(&this_ptr_conv, val);
47860 }
47861
47862 int8_tArray  CS_LDK_Splice_get_funding_pubkey(int64_t this_ptr) {
47863         LDKSplice this_ptr_conv;
47864         this_ptr_conv.inner = untag_ptr(this_ptr);
47865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47867         this_ptr_conv.is_owned = false;
47868         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47869         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47870         return ret_arr;
47871 }
47872
47873 void  CS_LDK_Splice_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
47874         LDKSplice this_ptr_conv;
47875         this_ptr_conv.inner = untag_ptr(this_ptr);
47876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47878         this_ptr_conv.is_owned = false;
47879         LDKPublicKey val_ref;
47880         CHECK(val->arr_len == 33);
47881         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47882         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
47883 }
47884
47885 int64_t  CS_LDK_Splice_new(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) {
47886         LDKChannelId channel_id_arg_conv;
47887         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
47888         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
47890         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
47891         LDKThirtyTwoBytes chain_hash_arg_ref;
47892         CHECK(chain_hash_arg->arr_len == 32);
47893         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47894         LDKPublicKey funding_pubkey_arg_ref;
47895         CHECK(funding_pubkey_arg->arr_len == 33);
47896         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47897         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);
47898         int64_t ret_ref = 0;
47899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47901         return ret_ref;
47902 }
47903
47904 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
47905         LDKSplice ret_var = Splice_clone(arg);
47906         int64_t ret_ref = 0;
47907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47909         return ret_ref;
47910 }
47911 int64_t  CS_LDK_Splice_clone_ptr(int64_t arg) {
47912         LDKSplice arg_conv;
47913         arg_conv.inner = untag_ptr(arg);
47914         arg_conv.is_owned = ptr_is_owned(arg);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47916         arg_conv.is_owned = false;
47917         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
47918         return ret_conv;
47919 }
47920
47921 int64_t  CS_LDK_Splice_clone(int64_t orig) {
47922         LDKSplice orig_conv;
47923         orig_conv.inner = untag_ptr(orig);
47924         orig_conv.is_owned = ptr_is_owned(orig);
47925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47926         orig_conv.is_owned = false;
47927         LDKSplice ret_var = Splice_clone(&orig_conv);
47928         int64_t ret_ref = 0;
47929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47931         return ret_ref;
47932 }
47933
47934 jboolean  CS_LDK_Splice_eq(int64_t a, int64_t b) {
47935         LDKSplice a_conv;
47936         a_conv.inner = untag_ptr(a);
47937         a_conv.is_owned = ptr_is_owned(a);
47938         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47939         a_conv.is_owned = false;
47940         LDKSplice b_conv;
47941         b_conv.inner = untag_ptr(b);
47942         b_conv.is_owned = ptr_is_owned(b);
47943         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47944         b_conv.is_owned = false;
47945         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
47946         return ret_conv;
47947 }
47948
47949 void  CS_LDK_SpliceAck_free(int64_t this_obj) {
47950         LDKSpliceAck this_obj_conv;
47951         this_obj_conv.inner = untag_ptr(this_obj);
47952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47954         SpliceAck_free(this_obj_conv);
47955 }
47956
47957 int64_t  CS_LDK_SpliceAck_get_channel_id(int64_t this_ptr) {
47958         LDKSpliceAck this_ptr_conv;
47959         this_ptr_conv.inner = untag_ptr(this_ptr);
47960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47962         this_ptr_conv.is_owned = false;
47963         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
47964         int64_t ret_ref = 0;
47965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47967         return ret_ref;
47968 }
47969
47970 void  CS_LDK_SpliceAck_set_channel_id(int64_t this_ptr, int64_t val) {
47971         LDKSpliceAck this_ptr_conv;
47972         this_ptr_conv.inner = untag_ptr(this_ptr);
47973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47975         this_ptr_conv.is_owned = false;
47976         LDKChannelId val_conv;
47977         val_conv.inner = untag_ptr(val);
47978         val_conv.is_owned = ptr_is_owned(val);
47979         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47980         val_conv = ChannelId_clone(&val_conv);
47981         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
47982 }
47983
47984 int8_tArray  CS_LDK_SpliceAck_get_chain_hash(int64_t this_ptr) {
47985         LDKSpliceAck this_ptr_conv;
47986         this_ptr_conv.inner = untag_ptr(this_ptr);
47987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47989         this_ptr_conv.is_owned = false;
47990         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47991         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
47992         return ret_arr;
47993 }
47994
47995 void  CS_LDK_SpliceAck_set_chain_hash(int64_t this_ptr, int8_tArray val) {
47996         LDKSpliceAck this_ptr_conv;
47997         this_ptr_conv.inner = untag_ptr(this_ptr);
47998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48000         this_ptr_conv.is_owned = false;
48001         LDKThirtyTwoBytes val_ref;
48002         CHECK(val->arr_len == 32);
48003         memcpy(val_ref.data, val->elems, 32); FREE(val);
48004         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
48005 }
48006
48007 int64_t  CS_LDK_SpliceAck_get_relative_satoshis(int64_t this_ptr) {
48008         LDKSpliceAck this_ptr_conv;
48009         this_ptr_conv.inner = untag_ptr(this_ptr);
48010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48012         this_ptr_conv.is_owned = false;
48013         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
48014         return ret_conv;
48015 }
48016
48017 void  CS_LDK_SpliceAck_set_relative_satoshis(int64_t this_ptr, int64_t val) {
48018         LDKSpliceAck this_ptr_conv;
48019         this_ptr_conv.inner = untag_ptr(this_ptr);
48020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48022         this_ptr_conv.is_owned = false;
48023         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
48024 }
48025
48026 int8_tArray  CS_LDK_SpliceAck_get_funding_pubkey(int64_t this_ptr) {
48027         LDKSpliceAck this_ptr_conv;
48028         this_ptr_conv.inner = untag_ptr(this_ptr);
48029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48031         this_ptr_conv.is_owned = false;
48032         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48033         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
48034         return ret_arr;
48035 }
48036
48037 void  CS_LDK_SpliceAck_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
48038         LDKSpliceAck this_ptr_conv;
48039         this_ptr_conv.inner = untag_ptr(this_ptr);
48040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48042         this_ptr_conv.is_owned = false;
48043         LDKPublicKey val_ref;
48044         CHECK(val->arr_len == 33);
48045         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48046         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
48047 }
48048
48049 int64_t  CS_LDK_SpliceAck_new(int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
48050         LDKChannelId channel_id_arg_conv;
48051         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48052         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48053         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48054         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48055         LDKThirtyTwoBytes chain_hash_arg_ref;
48056         CHECK(chain_hash_arg->arr_len == 32);
48057         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48058         LDKPublicKey funding_pubkey_arg_ref;
48059         CHECK(funding_pubkey_arg->arr_len == 33);
48060         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
48061         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
48062         int64_t ret_ref = 0;
48063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48065         return ret_ref;
48066 }
48067
48068 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
48069         LDKSpliceAck ret_var = SpliceAck_clone(arg);
48070         int64_t ret_ref = 0;
48071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48073         return ret_ref;
48074 }
48075 int64_t  CS_LDK_SpliceAck_clone_ptr(int64_t arg) {
48076         LDKSpliceAck arg_conv;
48077         arg_conv.inner = untag_ptr(arg);
48078         arg_conv.is_owned = ptr_is_owned(arg);
48079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48080         arg_conv.is_owned = false;
48081         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
48082         return ret_conv;
48083 }
48084
48085 int64_t  CS_LDK_SpliceAck_clone(int64_t orig) {
48086         LDKSpliceAck orig_conv;
48087         orig_conv.inner = untag_ptr(orig);
48088         orig_conv.is_owned = ptr_is_owned(orig);
48089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48090         orig_conv.is_owned = false;
48091         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
48092         int64_t ret_ref = 0;
48093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48095         return ret_ref;
48096 }
48097
48098 jboolean  CS_LDK_SpliceAck_eq(int64_t a, int64_t b) {
48099         LDKSpliceAck a_conv;
48100         a_conv.inner = untag_ptr(a);
48101         a_conv.is_owned = ptr_is_owned(a);
48102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48103         a_conv.is_owned = false;
48104         LDKSpliceAck b_conv;
48105         b_conv.inner = untag_ptr(b);
48106         b_conv.is_owned = ptr_is_owned(b);
48107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48108         b_conv.is_owned = false;
48109         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
48110         return ret_conv;
48111 }
48112
48113 void  CS_LDK_SpliceLocked_free(int64_t this_obj) {
48114         LDKSpliceLocked this_obj_conv;
48115         this_obj_conv.inner = untag_ptr(this_obj);
48116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48118         SpliceLocked_free(this_obj_conv);
48119 }
48120
48121 int64_t  CS_LDK_SpliceLocked_get_channel_id(int64_t this_ptr) {
48122         LDKSpliceLocked this_ptr_conv;
48123         this_ptr_conv.inner = untag_ptr(this_ptr);
48124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48126         this_ptr_conv.is_owned = false;
48127         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
48128         int64_t ret_ref = 0;
48129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48131         return ret_ref;
48132 }
48133
48134 void  CS_LDK_SpliceLocked_set_channel_id(int64_t this_ptr, int64_t val) {
48135         LDKSpliceLocked this_ptr_conv;
48136         this_ptr_conv.inner = untag_ptr(this_ptr);
48137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48139         this_ptr_conv.is_owned = false;
48140         LDKChannelId val_conv;
48141         val_conv.inner = untag_ptr(val);
48142         val_conv.is_owned = ptr_is_owned(val);
48143         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48144         val_conv = ChannelId_clone(&val_conv);
48145         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
48146 }
48147
48148 int64_t  CS_LDK_SpliceLocked_new(int64_t channel_id_arg) {
48149         LDKChannelId channel_id_arg_conv;
48150         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48151         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48152         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48153         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48154         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
48155         int64_t ret_ref = 0;
48156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48158         return ret_ref;
48159 }
48160
48161 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
48162         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
48163         int64_t ret_ref = 0;
48164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48166         return ret_ref;
48167 }
48168 int64_t  CS_LDK_SpliceLocked_clone_ptr(int64_t arg) {
48169         LDKSpliceLocked arg_conv;
48170         arg_conv.inner = untag_ptr(arg);
48171         arg_conv.is_owned = ptr_is_owned(arg);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48173         arg_conv.is_owned = false;
48174         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
48175         return ret_conv;
48176 }
48177
48178 int64_t  CS_LDK_SpliceLocked_clone(int64_t orig) {
48179         LDKSpliceLocked orig_conv;
48180         orig_conv.inner = untag_ptr(orig);
48181         orig_conv.is_owned = ptr_is_owned(orig);
48182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48183         orig_conv.is_owned = false;
48184         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
48185         int64_t ret_ref = 0;
48186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48188         return ret_ref;
48189 }
48190
48191 jboolean  CS_LDK_SpliceLocked_eq(int64_t a, int64_t b) {
48192         LDKSpliceLocked a_conv;
48193         a_conv.inner = untag_ptr(a);
48194         a_conv.is_owned = ptr_is_owned(a);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48196         a_conv.is_owned = false;
48197         LDKSpliceLocked b_conv;
48198         b_conv.inner = untag_ptr(b);
48199         b_conv.is_owned = ptr_is_owned(b);
48200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48201         b_conv.is_owned = false;
48202         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
48203         return ret_conv;
48204 }
48205
48206 void  CS_LDK_TxAddInput_free(int64_t this_obj) {
48207         LDKTxAddInput this_obj_conv;
48208         this_obj_conv.inner = untag_ptr(this_obj);
48209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48211         TxAddInput_free(this_obj_conv);
48212 }
48213
48214 int64_t  CS_LDK_TxAddInput_get_channel_id(int64_t this_ptr) {
48215         LDKTxAddInput this_ptr_conv;
48216         this_ptr_conv.inner = untag_ptr(this_ptr);
48217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48219         this_ptr_conv.is_owned = false;
48220         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
48221         int64_t ret_ref = 0;
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48224         return ret_ref;
48225 }
48226
48227 void  CS_LDK_TxAddInput_set_channel_id(int64_t this_ptr, int64_t val) {
48228         LDKTxAddInput this_ptr_conv;
48229         this_ptr_conv.inner = untag_ptr(this_ptr);
48230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48232         this_ptr_conv.is_owned = false;
48233         LDKChannelId val_conv;
48234         val_conv.inner = untag_ptr(val);
48235         val_conv.is_owned = ptr_is_owned(val);
48236         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48237         val_conv = ChannelId_clone(&val_conv);
48238         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
48239 }
48240
48241 int64_t  CS_LDK_TxAddInput_get_serial_id(int64_t this_ptr) {
48242         LDKTxAddInput this_ptr_conv;
48243         this_ptr_conv.inner = untag_ptr(this_ptr);
48244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48246         this_ptr_conv.is_owned = false;
48247         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
48248         return ret_conv;
48249 }
48250
48251 void  CS_LDK_TxAddInput_set_serial_id(int64_t this_ptr, int64_t val) {
48252         LDKTxAddInput this_ptr_conv;
48253         this_ptr_conv.inner = untag_ptr(this_ptr);
48254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48256         this_ptr_conv.is_owned = false;
48257         TxAddInput_set_serial_id(&this_ptr_conv, val);
48258 }
48259
48260 int64_t  CS_LDK_TxAddInput_get_prevtx(int64_t this_ptr) {
48261         LDKTxAddInput this_ptr_conv;
48262         this_ptr_conv.inner = untag_ptr(this_ptr);
48263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48265         this_ptr_conv.is_owned = false;
48266         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
48267         int64_t ret_ref = 0;
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48270         return ret_ref;
48271 }
48272
48273 void  CS_LDK_TxAddInput_set_prevtx(int64_t this_ptr, int64_t val) {
48274         LDKTxAddInput this_ptr_conv;
48275         this_ptr_conv.inner = untag_ptr(this_ptr);
48276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48278         this_ptr_conv.is_owned = false;
48279         LDKTransactionU16LenLimited val_conv;
48280         val_conv.inner = untag_ptr(val);
48281         val_conv.is_owned = ptr_is_owned(val);
48282         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48283         val_conv = TransactionU16LenLimited_clone(&val_conv);
48284         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
48285 }
48286
48287 int32_t  CS_LDK_TxAddInput_get_prevtx_out(int64_t this_ptr) {
48288         LDKTxAddInput this_ptr_conv;
48289         this_ptr_conv.inner = untag_ptr(this_ptr);
48290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48292         this_ptr_conv.is_owned = false;
48293         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
48294         return ret_conv;
48295 }
48296
48297 void  CS_LDK_TxAddInput_set_prevtx_out(int64_t this_ptr, int32_t val) {
48298         LDKTxAddInput this_ptr_conv;
48299         this_ptr_conv.inner = untag_ptr(this_ptr);
48300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48302         this_ptr_conv.is_owned = false;
48303         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
48304 }
48305
48306 int32_t  CS_LDK_TxAddInput_get_sequence(int64_t this_ptr) {
48307         LDKTxAddInput this_ptr_conv;
48308         this_ptr_conv.inner = untag_ptr(this_ptr);
48309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48311         this_ptr_conv.is_owned = false;
48312         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
48313         return ret_conv;
48314 }
48315
48316 void  CS_LDK_TxAddInput_set_sequence(int64_t this_ptr, int32_t val) {
48317         LDKTxAddInput this_ptr_conv;
48318         this_ptr_conv.inner = untag_ptr(this_ptr);
48319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48321         this_ptr_conv.is_owned = false;
48322         TxAddInput_set_sequence(&this_ptr_conv, val);
48323 }
48324
48325 int64_t  CS_LDK_TxAddInput_new(int64_t channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
48326         LDKChannelId channel_id_arg_conv;
48327         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48328         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48329         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48330         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48331         LDKTransactionU16LenLimited prevtx_arg_conv;
48332         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
48333         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
48334         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
48335         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
48336         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
48337         int64_t ret_ref = 0;
48338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48340         return ret_ref;
48341 }
48342
48343 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
48344         LDKTxAddInput ret_var = TxAddInput_clone(arg);
48345         int64_t ret_ref = 0;
48346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48348         return ret_ref;
48349 }
48350 int64_t  CS_LDK_TxAddInput_clone_ptr(int64_t arg) {
48351         LDKTxAddInput arg_conv;
48352         arg_conv.inner = untag_ptr(arg);
48353         arg_conv.is_owned = ptr_is_owned(arg);
48354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48355         arg_conv.is_owned = false;
48356         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
48357         return ret_conv;
48358 }
48359
48360 int64_t  CS_LDK_TxAddInput_clone(int64_t orig) {
48361         LDKTxAddInput orig_conv;
48362         orig_conv.inner = untag_ptr(orig);
48363         orig_conv.is_owned = ptr_is_owned(orig);
48364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48365         orig_conv.is_owned = false;
48366         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
48367         int64_t ret_ref = 0;
48368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48370         return ret_ref;
48371 }
48372
48373 int64_t  CS_LDK_TxAddInput_hash(int64_t o) {
48374         LDKTxAddInput o_conv;
48375         o_conv.inner = untag_ptr(o);
48376         o_conv.is_owned = ptr_is_owned(o);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48378         o_conv.is_owned = false;
48379         int64_t ret_conv = TxAddInput_hash(&o_conv);
48380         return ret_conv;
48381 }
48382
48383 jboolean  CS_LDK_TxAddInput_eq(int64_t a, int64_t b) {
48384         LDKTxAddInput a_conv;
48385         a_conv.inner = untag_ptr(a);
48386         a_conv.is_owned = ptr_is_owned(a);
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48388         a_conv.is_owned = false;
48389         LDKTxAddInput b_conv;
48390         b_conv.inner = untag_ptr(b);
48391         b_conv.is_owned = ptr_is_owned(b);
48392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48393         b_conv.is_owned = false;
48394         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
48395         return ret_conv;
48396 }
48397
48398 void  CS_LDK_TxAddOutput_free(int64_t this_obj) {
48399         LDKTxAddOutput this_obj_conv;
48400         this_obj_conv.inner = untag_ptr(this_obj);
48401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48403         TxAddOutput_free(this_obj_conv);
48404 }
48405
48406 int64_t  CS_LDK_TxAddOutput_get_channel_id(int64_t this_ptr) {
48407         LDKTxAddOutput this_ptr_conv;
48408         this_ptr_conv.inner = untag_ptr(this_ptr);
48409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48411         this_ptr_conv.is_owned = false;
48412         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
48413         int64_t ret_ref = 0;
48414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48416         return ret_ref;
48417 }
48418
48419 void  CS_LDK_TxAddOutput_set_channel_id(int64_t this_ptr, int64_t val) {
48420         LDKTxAddOutput this_ptr_conv;
48421         this_ptr_conv.inner = untag_ptr(this_ptr);
48422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48424         this_ptr_conv.is_owned = false;
48425         LDKChannelId val_conv;
48426         val_conv.inner = untag_ptr(val);
48427         val_conv.is_owned = ptr_is_owned(val);
48428         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48429         val_conv = ChannelId_clone(&val_conv);
48430         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
48431 }
48432
48433 int64_t  CS_LDK_TxAddOutput_get_serial_id(int64_t this_ptr) {
48434         LDKTxAddOutput this_ptr_conv;
48435         this_ptr_conv.inner = untag_ptr(this_ptr);
48436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48438         this_ptr_conv.is_owned = false;
48439         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
48440         return ret_conv;
48441 }
48442
48443 void  CS_LDK_TxAddOutput_set_serial_id(int64_t this_ptr, int64_t val) {
48444         LDKTxAddOutput this_ptr_conv;
48445         this_ptr_conv.inner = untag_ptr(this_ptr);
48446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48448         this_ptr_conv.is_owned = false;
48449         TxAddOutput_set_serial_id(&this_ptr_conv, val);
48450 }
48451
48452 int64_t  CS_LDK_TxAddOutput_get_sats(int64_t this_ptr) {
48453         LDKTxAddOutput this_ptr_conv;
48454         this_ptr_conv.inner = untag_ptr(this_ptr);
48455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48457         this_ptr_conv.is_owned = false;
48458         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
48459         return ret_conv;
48460 }
48461
48462 void  CS_LDK_TxAddOutput_set_sats(int64_t this_ptr, int64_t val) {
48463         LDKTxAddOutput this_ptr_conv;
48464         this_ptr_conv.inner = untag_ptr(this_ptr);
48465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48467         this_ptr_conv.is_owned = false;
48468         TxAddOutput_set_sats(&this_ptr_conv, val);
48469 }
48470
48471 int8_tArray  CS_LDK_TxAddOutput_get_script(int64_t this_ptr) {
48472         LDKTxAddOutput this_ptr_conv;
48473         this_ptr_conv.inner = untag_ptr(this_ptr);
48474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48476         this_ptr_conv.is_owned = false;
48477         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
48478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48480         CVec_u8Z_free(ret_var);
48481         return ret_arr;
48482 }
48483
48484 void  CS_LDK_TxAddOutput_set_script(int64_t this_ptr, int8_tArray val) {
48485         LDKTxAddOutput this_ptr_conv;
48486         this_ptr_conv.inner = untag_ptr(this_ptr);
48487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48489         this_ptr_conv.is_owned = false;
48490         LDKCVec_u8Z val_ref;
48491         val_ref.datalen = val->arr_len;
48492         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48493         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48494         TxAddOutput_set_script(&this_ptr_conv, val_ref);
48495 }
48496
48497 int64_t  CS_LDK_TxAddOutput_new(int64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
48498         LDKChannelId channel_id_arg_conv;
48499         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48500         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48502         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48503         LDKCVec_u8Z script_arg_ref;
48504         script_arg_ref.datalen = script_arg->arr_len;
48505         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48506         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
48507         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
48508         int64_t ret_ref = 0;
48509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48511         return ret_ref;
48512 }
48513
48514 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
48515         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
48516         int64_t ret_ref = 0;
48517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48519         return ret_ref;
48520 }
48521 int64_t  CS_LDK_TxAddOutput_clone_ptr(int64_t arg) {
48522         LDKTxAddOutput arg_conv;
48523         arg_conv.inner = untag_ptr(arg);
48524         arg_conv.is_owned = ptr_is_owned(arg);
48525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48526         arg_conv.is_owned = false;
48527         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
48528         return ret_conv;
48529 }
48530
48531 int64_t  CS_LDK_TxAddOutput_clone(int64_t orig) {
48532         LDKTxAddOutput orig_conv;
48533         orig_conv.inner = untag_ptr(orig);
48534         orig_conv.is_owned = ptr_is_owned(orig);
48535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48536         orig_conv.is_owned = false;
48537         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
48538         int64_t ret_ref = 0;
48539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48541         return ret_ref;
48542 }
48543
48544 int64_t  CS_LDK_TxAddOutput_hash(int64_t o) {
48545         LDKTxAddOutput o_conv;
48546         o_conv.inner = untag_ptr(o);
48547         o_conv.is_owned = ptr_is_owned(o);
48548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48549         o_conv.is_owned = false;
48550         int64_t ret_conv = TxAddOutput_hash(&o_conv);
48551         return ret_conv;
48552 }
48553
48554 jboolean  CS_LDK_TxAddOutput_eq(int64_t a, int64_t b) {
48555         LDKTxAddOutput a_conv;
48556         a_conv.inner = untag_ptr(a);
48557         a_conv.is_owned = ptr_is_owned(a);
48558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48559         a_conv.is_owned = false;
48560         LDKTxAddOutput b_conv;
48561         b_conv.inner = untag_ptr(b);
48562         b_conv.is_owned = ptr_is_owned(b);
48563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48564         b_conv.is_owned = false;
48565         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
48566         return ret_conv;
48567 }
48568
48569 void  CS_LDK_TxRemoveInput_free(int64_t this_obj) {
48570         LDKTxRemoveInput this_obj_conv;
48571         this_obj_conv.inner = untag_ptr(this_obj);
48572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48574         TxRemoveInput_free(this_obj_conv);
48575 }
48576
48577 int64_t  CS_LDK_TxRemoveInput_get_channel_id(int64_t this_ptr) {
48578         LDKTxRemoveInput this_ptr_conv;
48579         this_ptr_conv.inner = untag_ptr(this_ptr);
48580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48582         this_ptr_conv.is_owned = false;
48583         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
48584         int64_t ret_ref = 0;
48585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48587         return ret_ref;
48588 }
48589
48590 void  CS_LDK_TxRemoveInput_set_channel_id(int64_t this_ptr, int64_t val) {
48591         LDKTxRemoveInput this_ptr_conv;
48592         this_ptr_conv.inner = untag_ptr(this_ptr);
48593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48595         this_ptr_conv.is_owned = false;
48596         LDKChannelId val_conv;
48597         val_conv.inner = untag_ptr(val);
48598         val_conv.is_owned = ptr_is_owned(val);
48599         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48600         val_conv = ChannelId_clone(&val_conv);
48601         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
48602 }
48603
48604 int64_t  CS_LDK_TxRemoveInput_get_serial_id(int64_t this_ptr) {
48605         LDKTxRemoveInput this_ptr_conv;
48606         this_ptr_conv.inner = untag_ptr(this_ptr);
48607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48609         this_ptr_conv.is_owned = false;
48610         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
48611         return ret_conv;
48612 }
48613
48614 void  CS_LDK_TxRemoveInput_set_serial_id(int64_t this_ptr, int64_t val) {
48615         LDKTxRemoveInput this_ptr_conv;
48616         this_ptr_conv.inner = untag_ptr(this_ptr);
48617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48619         this_ptr_conv.is_owned = false;
48620         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
48621 }
48622
48623 int64_t  CS_LDK_TxRemoveInput_new(int64_t channel_id_arg, int64_t serial_id_arg) {
48624         LDKChannelId channel_id_arg_conv;
48625         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48626         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48627         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48628         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48629         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
48630         int64_t ret_ref = 0;
48631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48633         return ret_ref;
48634 }
48635
48636 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
48637         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
48638         int64_t ret_ref = 0;
48639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48641         return ret_ref;
48642 }
48643 int64_t  CS_LDK_TxRemoveInput_clone_ptr(int64_t arg) {
48644         LDKTxRemoveInput arg_conv;
48645         arg_conv.inner = untag_ptr(arg);
48646         arg_conv.is_owned = ptr_is_owned(arg);
48647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48648         arg_conv.is_owned = false;
48649         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
48650         return ret_conv;
48651 }
48652
48653 int64_t  CS_LDK_TxRemoveInput_clone(int64_t orig) {
48654         LDKTxRemoveInput orig_conv;
48655         orig_conv.inner = untag_ptr(orig);
48656         orig_conv.is_owned = ptr_is_owned(orig);
48657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48658         orig_conv.is_owned = false;
48659         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
48660         int64_t ret_ref = 0;
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48663         return ret_ref;
48664 }
48665
48666 int64_t  CS_LDK_TxRemoveInput_hash(int64_t o) {
48667         LDKTxRemoveInput o_conv;
48668         o_conv.inner = untag_ptr(o);
48669         o_conv.is_owned = ptr_is_owned(o);
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48671         o_conv.is_owned = false;
48672         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
48673         return ret_conv;
48674 }
48675
48676 jboolean  CS_LDK_TxRemoveInput_eq(int64_t a, int64_t b) {
48677         LDKTxRemoveInput a_conv;
48678         a_conv.inner = untag_ptr(a);
48679         a_conv.is_owned = ptr_is_owned(a);
48680         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48681         a_conv.is_owned = false;
48682         LDKTxRemoveInput b_conv;
48683         b_conv.inner = untag_ptr(b);
48684         b_conv.is_owned = ptr_is_owned(b);
48685         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48686         b_conv.is_owned = false;
48687         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
48688         return ret_conv;
48689 }
48690
48691 void  CS_LDK_TxRemoveOutput_free(int64_t this_obj) {
48692         LDKTxRemoveOutput this_obj_conv;
48693         this_obj_conv.inner = untag_ptr(this_obj);
48694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48696         TxRemoveOutput_free(this_obj_conv);
48697 }
48698
48699 int64_t  CS_LDK_TxRemoveOutput_get_channel_id(int64_t this_ptr) {
48700         LDKTxRemoveOutput this_ptr_conv;
48701         this_ptr_conv.inner = untag_ptr(this_ptr);
48702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48704         this_ptr_conv.is_owned = false;
48705         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
48706         int64_t ret_ref = 0;
48707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48709         return ret_ref;
48710 }
48711
48712 void  CS_LDK_TxRemoveOutput_set_channel_id(int64_t this_ptr, int64_t val) {
48713         LDKTxRemoveOutput this_ptr_conv;
48714         this_ptr_conv.inner = untag_ptr(this_ptr);
48715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48717         this_ptr_conv.is_owned = false;
48718         LDKChannelId val_conv;
48719         val_conv.inner = untag_ptr(val);
48720         val_conv.is_owned = ptr_is_owned(val);
48721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48722         val_conv = ChannelId_clone(&val_conv);
48723         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
48724 }
48725
48726 int64_t  CS_LDK_TxRemoveOutput_get_serial_id(int64_t this_ptr) {
48727         LDKTxRemoveOutput this_ptr_conv;
48728         this_ptr_conv.inner = untag_ptr(this_ptr);
48729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48731         this_ptr_conv.is_owned = false;
48732         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
48733         return ret_conv;
48734 }
48735
48736 void  CS_LDK_TxRemoveOutput_set_serial_id(int64_t this_ptr, int64_t val) {
48737         LDKTxRemoveOutput this_ptr_conv;
48738         this_ptr_conv.inner = untag_ptr(this_ptr);
48739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48741         this_ptr_conv.is_owned = false;
48742         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
48743 }
48744
48745 int64_t  CS_LDK_TxRemoveOutput_new(int64_t channel_id_arg, int64_t serial_id_arg) {
48746         LDKChannelId channel_id_arg_conv;
48747         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48748         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48749         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48750         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48751         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
48752         int64_t ret_ref = 0;
48753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48755         return ret_ref;
48756 }
48757
48758 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
48759         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
48760         int64_t ret_ref = 0;
48761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48763         return ret_ref;
48764 }
48765 int64_t  CS_LDK_TxRemoveOutput_clone_ptr(int64_t arg) {
48766         LDKTxRemoveOutput arg_conv;
48767         arg_conv.inner = untag_ptr(arg);
48768         arg_conv.is_owned = ptr_is_owned(arg);
48769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48770         arg_conv.is_owned = false;
48771         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
48772         return ret_conv;
48773 }
48774
48775 int64_t  CS_LDK_TxRemoveOutput_clone(int64_t orig) {
48776         LDKTxRemoveOutput orig_conv;
48777         orig_conv.inner = untag_ptr(orig);
48778         orig_conv.is_owned = ptr_is_owned(orig);
48779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48780         orig_conv.is_owned = false;
48781         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
48782         int64_t ret_ref = 0;
48783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48785         return ret_ref;
48786 }
48787
48788 int64_t  CS_LDK_TxRemoveOutput_hash(int64_t o) {
48789         LDKTxRemoveOutput o_conv;
48790         o_conv.inner = untag_ptr(o);
48791         o_conv.is_owned = ptr_is_owned(o);
48792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48793         o_conv.is_owned = false;
48794         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
48795         return ret_conv;
48796 }
48797
48798 jboolean  CS_LDK_TxRemoveOutput_eq(int64_t a, int64_t b) {
48799         LDKTxRemoveOutput a_conv;
48800         a_conv.inner = untag_ptr(a);
48801         a_conv.is_owned = ptr_is_owned(a);
48802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48803         a_conv.is_owned = false;
48804         LDKTxRemoveOutput b_conv;
48805         b_conv.inner = untag_ptr(b);
48806         b_conv.is_owned = ptr_is_owned(b);
48807         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48808         b_conv.is_owned = false;
48809         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
48810         return ret_conv;
48811 }
48812
48813 void  CS_LDK_TxComplete_free(int64_t this_obj) {
48814         LDKTxComplete this_obj_conv;
48815         this_obj_conv.inner = untag_ptr(this_obj);
48816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48818         TxComplete_free(this_obj_conv);
48819 }
48820
48821 int64_t  CS_LDK_TxComplete_get_channel_id(int64_t this_ptr) {
48822         LDKTxComplete this_ptr_conv;
48823         this_ptr_conv.inner = untag_ptr(this_ptr);
48824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48826         this_ptr_conv.is_owned = false;
48827         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
48828         int64_t ret_ref = 0;
48829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48831         return ret_ref;
48832 }
48833
48834 void  CS_LDK_TxComplete_set_channel_id(int64_t this_ptr, int64_t val) {
48835         LDKTxComplete this_ptr_conv;
48836         this_ptr_conv.inner = untag_ptr(this_ptr);
48837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48839         this_ptr_conv.is_owned = false;
48840         LDKChannelId val_conv;
48841         val_conv.inner = untag_ptr(val);
48842         val_conv.is_owned = ptr_is_owned(val);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48844         val_conv = ChannelId_clone(&val_conv);
48845         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
48846 }
48847
48848 int64_t  CS_LDK_TxComplete_new(int64_t channel_id_arg) {
48849         LDKChannelId channel_id_arg_conv;
48850         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48851         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48852         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48853         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48854         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
48855         int64_t ret_ref = 0;
48856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48858         return ret_ref;
48859 }
48860
48861 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
48862         LDKTxComplete ret_var = TxComplete_clone(arg);
48863         int64_t ret_ref = 0;
48864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48866         return ret_ref;
48867 }
48868 int64_t  CS_LDK_TxComplete_clone_ptr(int64_t arg) {
48869         LDKTxComplete arg_conv;
48870         arg_conv.inner = untag_ptr(arg);
48871         arg_conv.is_owned = ptr_is_owned(arg);
48872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48873         arg_conv.is_owned = false;
48874         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
48875         return ret_conv;
48876 }
48877
48878 int64_t  CS_LDK_TxComplete_clone(int64_t orig) {
48879         LDKTxComplete orig_conv;
48880         orig_conv.inner = untag_ptr(orig);
48881         orig_conv.is_owned = ptr_is_owned(orig);
48882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48883         orig_conv.is_owned = false;
48884         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
48885         int64_t ret_ref = 0;
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48888         return ret_ref;
48889 }
48890
48891 int64_t  CS_LDK_TxComplete_hash(int64_t o) {
48892         LDKTxComplete o_conv;
48893         o_conv.inner = untag_ptr(o);
48894         o_conv.is_owned = ptr_is_owned(o);
48895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48896         o_conv.is_owned = false;
48897         int64_t ret_conv = TxComplete_hash(&o_conv);
48898         return ret_conv;
48899 }
48900
48901 jboolean  CS_LDK_TxComplete_eq(int64_t a, int64_t b) {
48902         LDKTxComplete a_conv;
48903         a_conv.inner = untag_ptr(a);
48904         a_conv.is_owned = ptr_is_owned(a);
48905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48906         a_conv.is_owned = false;
48907         LDKTxComplete b_conv;
48908         b_conv.inner = untag_ptr(b);
48909         b_conv.is_owned = ptr_is_owned(b);
48910         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48911         b_conv.is_owned = false;
48912         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
48913         return ret_conv;
48914 }
48915
48916 void  CS_LDK_TxSignatures_free(int64_t this_obj) {
48917         LDKTxSignatures this_obj_conv;
48918         this_obj_conv.inner = untag_ptr(this_obj);
48919         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48921         TxSignatures_free(this_obj_conv);
48922 }
48923
48924 int64_t  CS_LDK_TxSignatures_get_channel_id(int64_t this_ptr) {
48925         LDKTxSignatures this_ptr_conv;
48926         this_ptr_conv.inner = untag_ptr(this_ptr);
48927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48929         this_ptr_conv.is_owned = false;
48930         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
48931         int64_t ret_ref = 0;
48932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48934         return ret_ref;
48935 }
48936
48937 void  CS_LDK_TxSignatures_set_channel_id(int64_t this_ptr, int64_t val) {
48938         LDKTxSignatures this_ptr_conv;
48939         this_ptr_conv.inner = untag_ptr(this_ptr);
48940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48942         this_ptr_conv.is_owned = false;
48943         LDKChannelId val_conv;
48944         val_conv.inner = untag_ptr(val);
48945         val_conv.is_owned = ptr_is_owned(val);
48946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48947         val_conv = ChannelId_clone(&val_conv);
48948         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
48949 }
48950
48951 int8_tArray  CS_LDK_TxSignatures_get_tx_hash(int64_t this_ptr) {
48952         LDKTxSignatures this_ptr_conv;
48953         this_ptr_conv.inner = untag_ptr(this_ptr);
48954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48956         this_ptr_conv.is_owned = false;
48957         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48958         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
48959         return ret_arr;
48960 }
48961
48962 void  CS_LDK_TxSignatures_set_tx_hash(int64_t this_ptr, int8_tArray val) {
48963         LDKTxSignatures this_ptr_conv;
48964         this_ptr_conv.inner = untag_ptr(this_ptr);
48965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48967         this_ptr_conv.is_owned = false;
48968         LDKThirtyTwoBytes val_ref;
48969         CHECK(val->arr_len == 32);
48970         memcpy(val_ref.data, val->elems, 32); FREE(val);
48971         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
48972 }
48973
48974 ptrArray  CS_LDK_TxSignatures_get_witnesses(int64_t this_ptr) {
48975         LDKTxSignatures this_ptr_conv;
48976         this_ptr_conv.inner = untag_ptr(this_ptr);
48977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48979         this_ptr_conv.is_owned = false;
48980         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
48981         ptrArray ret_arr = NULL;
48982         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
48983         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
48984         for (size_t i = 0; i < ret_var.datalen; i++) {
48985                 LDKWitness ret_conv_8_var = ret_var.data[i];
48986                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
48987                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
48988                 Witness_free(ret_conv_8_var);
48989                 ret_arr_ptr[i] = ret_conv_8_arr;
48990         }
48991         
48992         FREE(ret_var.data);
48993         return ret_arr;
48994 }
48995
48996 void  CS_LDK_TxSignatures_set_witnesses(int64_t this_ptr, ptrArray val) {
48997         LDKTxSignatures this_ptr_conv;
48998         this_ptr_conv.inner = untag_ptr(this_ptr);
48999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49001         this_ptr_conv.is_owned = false;
49002         LDKCVec_WitnessZ val_constr;
49003         val_constr.datalen = val->arr_len;
49004         if (val_constr.datalen > 0)
49005                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
49006         else
49007                 val_constr.data = NULL;
49008         int8_tArray* val_vals = (void*) val->elems;
49009         for (size_t i = 0; i < val_constr.datalen; i++) {
49010                 int8_tArray val_conv_8 = val_vals[i];
49011                 LDKWitness val_conv_8_ref;
49012                 val_conv_8_ref.datalen = val_conv_8->arr_len;
49013                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
49014                 memcpy(val_conv_8_ref.data, val_conv_8->elems, val_conv_8_ref.datalen); FREE(val_conv_8);
49015                 val_conv_8_ref.data_is_owned = true;
49016                 val_constr.data[i] = val_conv_8_ref;
49017         }
49018         FREE(val);
49019         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
49020 }
49021
49022 int64_t  CS_LDK_TxSignatures_get_funding_outpoint_sig(int64_t this_ptr) {
49023         LDKTxSignatures this_ptr_conv;
49024         this_ptr_conv.inner = untag_ptr(this_ptr);
49025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49027         this_ptr_conv.is_owned = false;
49028         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
49029         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
49030         int64_t ret_ref = tag_ptr(ret_copy, true);
49031         return ret_ref;
49032 }
49033
49034 void  CS_LDK_TxSignatures_set_funding_outpoint_sig(int64_t this_ptr, int64_t val) {
49035         LDKTxSignatures this_ptr_conv;
49036         this_ptr_conv.inner = untag_ptr(this_ptr);
49037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49039         this_ptr_conv.is_owned = false;
49040         void* val_ptr = untag_ptr(val);
49041         CHECK_ACCESS(val_ptr);
49042         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
49043         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
49044         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
49045 }
49046
49047 int64_t  CS_LDK_TxSignatures_new(int64_t channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg, int64_t funding_outpoint_sig_arg) {
49048         LDKChannelId channel_id_arg_conv;
49049         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49050         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49051         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49052         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49053         LDKThirtyTwoBytes tx_hash_arg_ref;
49054         CHECK(tx_hash_arg->arr_len == 32);
49055         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
49056         LDKCVec_WitnessZ witnesses_arg_constr;
49057         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
49058         if (witnesses_arg_constr.datalen > 0)
49059                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
49060         else
49061                 witnesses_arg_constr.data = NULL;
49062         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
49063         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
49064                 int8_tArray witnesses_arg_conv_8 = witnesses_arg_vals[i];
49065                 LDKWitness witnesses_arg_conv_8_ref;
49066                 witnesses_arg_conv_8_ref.datalen = witnesses_arg_conv_8->arr_len;
49067                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
49068                 memcpy(witnesses_arg_conv_8_ref.data, witnesses_arg_conv_8->elems, witnesses_arg_conv_8_ref.datalen); FREE(witnesses_arg_conv_8);
49069                 witnesses_arg_conv_8_ref.data_is_owned = true;
49070                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
49071         }
49072         FREE(witnesses_arg);
49073         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
49074         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
49075         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
49076         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
49077         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
49078         int64_t ret_ref = 0;
49079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49081         return ret_ref;
49082 }
49083
49084 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
49085         LDKTxSignatures ret_var = TxSignatures_clone(arg);
49086         int64_t ret_ref = 0;
49087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49089         return ret_ref;
49090 }
49091 int64_t  CS_LDK_TxSignatures_clone_ptr(int64_t arg) {
49092         LDKTxSignatures arg_conv;
49093         arg_conv.inner = untag_ptr(arg);
49094         arg_conv.is_owned = ptr_is_owned(arg);
49095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49096         arg_conv.is_owned = false;
49097         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
49098         return ret_conv;
49099 }
49100
49101 int64_t  CS_LDK_TxSignatures_clone(int64_t orig) {
49102         LDKTxSignatures orig_conv;
49103         orig_conv.inner = untag_ptr(orig);
49104         orig_conv.is_owned = ptr_is_owned(orig);
49105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49106         orig_conv.is_owned = false;
49107         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
49108         int64_t ret_ref = 0;
49109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49111         return ret_ref;
49112 }
49113
49114 int64_t  CS_LDK_TxSignatures_hash(int64_t o) {
49115         LDKTxSignatures o_conv;
49116         o_conv.inner = untag_ptr(o);
49117         o_conv.is_owned = ptr_is_owned(o);
49118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49119         o_conv.is_owned = false;
49120         int64_t ret_conv = TxSignatures_hash(&o_conv);
49121         return ret_conv;
49122 }
49123
49124 jboolean  CS_LDK_TxSignatures_eq(int64_t a, int64_t b) {
49125         LDKTxSignatures a_conv;
49126         a_conv.inner = untag_ptr(a);
49127         a_conv.is_owned = ptr_is_owned(a);
49128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49129         a_conv.is_owned = false;
49130         LDKTxSignatures b_conv;
49131         b_conv.inner = untag_ptr(b);
49132         b_conv.is_owned = ptr_is_owned(b);
49133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49134         b_conv.is_owned = false;
49135         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
49136         return ret_conv;
49137 }
49138
49139 void  CS_LDK_TxInitRbf_free(int64_t this_obj) {
49140         LDKTxInitRbf this_obj_conv;
49141         this_obj_conv.inner = untag_ptr(this_obj);
49142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49144         TxInitRbf_free(this_obj_conv);
49145 }
49146
49147 int64_t  CS_LDK_TxInitRbf_get_channel_id(int64_t this_ptr) {
49148         LDKTxInitRbf this_ptr_conv;
49149         this_ptr_conv.inner = untag_ptr(this_ptr);
49150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49152         this_ptr_conv.is_owned = false;
49153         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
49154         int64_t ret_ref = 0;
49155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49157         return ret_ref;
49158 }
49159
49160 void  CS_LDK_TxInitRbf_set_channel_id(int64_t this_ptr, int64_t val) {
49161         LDKTxInitRbf this_ptr_conv;
49162         this_ptr_conv.inner = untag_ptr(this_ptr);
49163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49165         this_ptr_conv.is_owned = false;
49166         LDKChannelId val_conv;
49167         val_conv.inner = untag_ptr(val);
49168         val_conv.is_owned = ptr_is_owned(val);
49169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49170         val_conv = ChannelId_clone(&val_conv);
49171         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
49172 }
49173
49174 int32_t  CS_LDK_TxInitRbf_get_locktime(int64_t this_ptr) {
49175         LDKTxInitRbf this_ptr_conv;
49176         this_ptr_conv.inner = untag_ptr(this_ptr);
49177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49179         this_ptr_conv.is_owned = false;
49180         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
49181         return ret_conv;
49182 }
49183
49184 void  CS_LDK_TxInitRbf_set_locktime(int64_t this_ptr, int32_t val) {
49185         LDKTxInitRbf this_ptr_conv;
49186         this_ptr_conv.inner = untag_ptr(this_ptr);
49187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49189         this_ptr_conv.is_owned = false;
49190         TxInitRbf_set_locktime(&this_ptr_conv, val);
49191 }
49192
49193 int32_t  CS_LDK_TxInitRbf_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
49194         LDKTxInitRbf this_ptr_conv;
49195         this_ptr_conv.inner = untag_ptr(this_ptr);
49196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49198         this_ptr_conv.is_owned = false;
49199         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
49200         return ret_conv;
49201 }
49202
49203 void  CS_LDK_TxInitRbf_set_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
49204         LDKTxInitRbf this_ptr_conv;
49205         this_ptr_conv.inner = untag_ptr(this_ptr);
49206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49208         this_ptr_conv.is_owned = false;
49209         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
49210 }
49211
49212 int64_t  CS_LDK_TxInitRbf_get_funding_output_contribution(int64_t this_ptr) {
49213         LDKTxInitRbf this_ptr_conv;
49214         this_ptr_conv.inner = untag_ptr(this_ptr);
49215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49217         this_ptr_conv.is_owned = false;
49218         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
49219         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
49220         int64_t ret_ref = tag_ptr(ret_copy, true);
49221         return ret_ref;
49222 }
49223
49224 void  CS_LDK_TxInitRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
49225         LDKTxInitRbf this_ptr_conv;
49226         this_ptr_conv.inner = untag_ptr(this_ptr);
49227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49229         this_ptr_conv.is_owned = false;
49230         void* val_ptr = untag_ptr(val);
49231         CHECK_ACCESS(val_ptr);
49232         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
49233         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
49234         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
49235 }
49236
49237 int64_t  CS_LDK_TxInitRbf_new(int64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
49238         LDKChannelId channel_id_arg_conv;
49239         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49240         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49241         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49242         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49243         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
49244         CHECK_ACCESS(funding_output_contribution_arg_ptr);
49245         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
49246         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
49247         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
49248         int64_t ret_ref = 0;
49249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49251         return ret_ref;
49252 }
49253
49254 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
49255         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
49256         int64_t ret_ref = 0;
49257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49259         return ret_ref;
49260 }
49261 int64_t  CS_LDK_TxInitRbf_clone_ptr(int64_t arg) {
49262         LDKTxInitRbf arg_conv;
49263         arg_conv.inner = untag_ptr(arg);
49264         arg_conv.is_owned = ptr_is_owned(arg);
49265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49266         arg_conv.is_owned = false;
49267         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
49268         return ret_conv;
49269 }
49270
49271 int64_t  CS_LDK_TxInitRbf_clone(int64_t orig) {
49272         LDKTxInitRbf orig_conv;
49273         orig_conv.inner = untag_ptr(orig);
49274         orig_conv.is_owned = ptr_is_owned(orig);
49275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49276         orig_conv.is_owned = false;
49277         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
49278         int64_t ret_ref = 0;
49279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49281         return ret_ref;
49282 }
49283
49284 int64_t  CS_LDK_TxInitRbf_hash(int64_t o) {
49285         LDKTxInitRbf o_conv;
49286         o_conv.inner = untag_ptr(o);
49287         o_conv.is_owned = ptr_is_owned(o);
49288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49289         o_conv.is_owned = false;
49290         int64_t ret_conv = TxInitRbf_hash(&o_conv);
49291         return ret_conv;
49292 }
49293
49294 jboolean  CS_LDK_TxInitRbf_eq(int64_t a, int64_t b) {
49295         LDKTxInitRbf a_conv;
49296         a_conv.inner = untag_ptr(a);
49297         a_conv.is_owned = ptr_is_owned(a);
49298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49299         a_conv.is_owned = false;
49300         LDKTxInitRbf b_conv;
49301         b_conv.inner = untag_ptr(b);
49302         b_conv.is_owned = ptr_is_owned(b);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49304         b_conv.is_owned = false;
49305         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
49306         return ret_conv;
49307 }
49308
49309 void  CS_LDK_TxAckRbf_free(int64_t this_obj) {
49310         LDKTxAckRbf this_obj_conv;
49311         this_obj_conv.inner = untag_ptr(this_obj);
49312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49314         TxAckRbf_free(this_obj_conv);
49315 }
49316
49317 int64_t  CS_LDK_TxAckRbf_get_channel_id(int64_t this_ptr) {
49318         LDKTxAckRbf this_ptr_conv;
49319         this_ptr_conv.inner = untag_ptr(this_ptr);
49320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49322         this_ptr_conv.is_owned = false;
49323         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
49324         int64_t ret_ref = 0;
49325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49327         return ret_ref;
49328 }
49329
49330 void  CS_LDK_TxAckRbf_set_channel_id(int64_t this_ptr, int64_t val) {
49331         LDKTxAckRbf this_ptr_conv;
49332         this_ptr_conv.inner = untag_ptr(this_ptr);
49333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49335         this_ptr_conv.is_owned = false;
49336         LDKChannelId val_conv;
49337         val_conv.inner = untag_ptr(val);
49338         val_conv.is_owned = ptr_is_owned(val);
49339         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49340         val_conv = ChannelId_clone(&val_conv);
49341         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
49342 }
49343
49344 int64_t  CS_LDK_TxAckRbf_get_funding_output_contribution(int64_t this_ptr) {
49345         LDKTxAckRbf this_ptr_conv;
49346         this_ptr_conv.inner = untag_ptr(this_ptr);
49347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49349         this_ptr_conv.is_owned = false;
49350         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
49351         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
49352         int64_t ret_ref = tag_ptr(ret_copy, true);
49353         return ret_ref;
49354 }
49355
49356 void  CS_LDK_TxAckRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
49357         LDKTxAckRbf this_ptr_conv;
49358         this_ptr_conv.inner = untag_ptr(this_ptr);
49359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49361         this_ptr_conv.is_owned = false;
49362         void* val_ptr = untag_ptr(val);
49363         CHECK_ACCESS(val_ptr);
49364         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
49365         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
49366         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
49367 }
49368
49369 int64_t  CS_LDK_TxAckRbf_new(int64_t channel_id_arg, int64_t funding_output_contribution_arg) {
49370         LDKChannelId channel_id_arg_conv;
49371         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49372         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49373         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49374         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49375         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
49376         CHECK_ACCESS(funding_output_contribution_arg_ptr);
49377         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
49378         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
49379         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
49380         int64_t ret_ref = 0;
49381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49383         return ret_ref;
49384 }
49385
49386 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
49387         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
49388         int64_t ret_ref = 0;
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49391         return ret_ref;
49392 }
49393 int64_t  CS_LDK_TxAckRbf_clone_ptr(int64_t arg) {
49394         LDKTxAckRbf arg_conv;
49395         arg_conv.inner = untag_ptr(arg);
49396         arg_conv.is_owned = ptr_is_owned(arg);
49397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49398         arg_conv.is_owned = false;
49399         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
49400         return ret_conv;
49401 }
49402
49403 int64_t  CS_LDK_TxAckRbf_clone(int64_t orig) {
49404         LDKTxAckRbf orig_conv;
49405         orig_conv.inner = untag_ptr(orig);
49406         orig_conv.is_owned = ptr_is_owned(orig);
49407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49408         orig_conv.is_owned = false;
49409         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
49410         int64_t ret_ref = 0;
49411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49413         return ret_ref;
49414 }
49415
49416 int64_t  CS_LDK_TxAckRbf_hash(int64_t o) {
49417         LDKTxAckRbf o_conv;
49418         o_conv.inner = untag_ptr(o);
49419         o_conv.is_owned = ptr_is_owned(o);
49420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49421         o_conv.is_owned = false;
49422         int64_t ret_conv = TxAckRbf_hash(&o_conv);
49423         return ret_conv;
49424 }
49425
49426 jboolean  CS_LDK_TxAckRbf_eq(int64_t a, int64_t b) {
49427         LDKTxAckRbf a_conv;
49428         a_conv.inner = untag_ptr(a);
49429         a_conv.is_owned = ptr_is_owned(a);
49430         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49431         a_conv.is_owned = false;
49432         LDKTxAckRbf b_conv;
49433         b_conv.inner = untag_ptr(b);
49434         b_conv.is_owned = ptr_is_owned(b);
49435         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49436         b_conv.is_owned = false;
49437         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
49438         return ret_conv;
49439 }
49440
49441 void  CS_LDK_TxAbort_free(int64_t this_obj) {
49442         LDKTxAbort this_obj_conv;
49443         this_obj_conv.inner = untag_ptr(this_obj);
49444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49446         TxAbort_free(this_obj_conv);
49447 }
49448
49449 int64_t  CS_LDK_TxAbort_get_channel_id(int64_t this_ptr) {
49450         LDKTxAbort this_ptr_conv;
49451         this_ptr_conv.inner = untag_ptr(this_ptr);
49452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49454         this_ptr_conv.is_owned = false;
49455         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
49456         int64_t ret_ref = 0;
49457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49459         return ret_ref;
49460 }
49461
49462 void  CS_LDK_TxAbort_set_channel_id(int64_t this_ptr, int64_t val) {
49463         LDKTxAbort this_ptr_conv;
49464         this_ptr_conv.inner = untag_ptr(this_ptr);
49465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49467         this_ptr_conv.is_owned = false;
49468         LDKChannelId val_conv;
49469         val_conv.inner = untag_ptr(val);
49470         val_conv.is_owned = ptr_is_owned(val);
49471         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49472         val_conv = ChannelId_clone(&val_conv);
49473         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
49474 }
49475
49476 int8_tArray  CS_LDK_TxAbort_get_data(int64_t this_ptr) {
49477         LDKTxAbort this_ptr_conv;
49478         this_ptr_conv.inner = untag_ptr(this_ptr);
49479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49481         this_ptr_conv.is_owned = false;
49482         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
49483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49485         CVec_u8Z_free(ret_var);
49486         return ret_arr;
49487 }
49488
49489 void  CS_LDK_TxAbort_set_data(int64_t this_ptr, int8_tArray val) {
49490         LDKTxAbort this_ptr_conv;
49491         this_ptr_conv.inner = untag_ptr(this_ptr);
49492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49494         this_ptr_conv.is_owned = false;
49495         LDKCVec_u8Z val_ref;
49496         val_ref.datalen = val->arr_len;
49497         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49498         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49499         TxAbort_set_data(&this_ptr_conv, val_ref);
49500 }
49501
49502 int64_t  CS_LDK_TxAbort_new(int64_t channel_id_arg, int8_tArray data_arg) {
49503         LDKChannelId channel_id_arg_conv;
49504         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49505         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49507         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49508         LDKCVec_u8Z data_arg_ref;
49509         data_arg_ref.datalen = data_arg->arr_len;
49510         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49511         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
49512         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_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 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
49520         LDKTxAbort ret_var = TxAbort_clone(arg);
49521         int64_t ret_ref = 0;
49522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49524         return ret_ref;
49525 }
49526 int64_t  CS_LDK_TxAbort_clone_ptr(int64_t arg) {
49527         LDKTxAbort arg_conv;
49528         arg_conv.inner = untag_ptr(arg);
49529         arg_conv.is_owned = ptr_is_owned(arg);
49530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49531         arg_conv.is_owned = false;
49532         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
49533         return ret_conv;
49534 }
49535
49536 int64_t  CS_LDK_TxAbort_clone(int64_t orig) {
49537         LDKTxAbort orig_conv;
49538         orig_conv.inner = untag_ptr(orig);
49539         orig_conv.is_owned = ptr_is_owned(orig);
49540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49541         orig_conv.is_owned = false;
49542         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
49543         int64_t ret_ref = 0;
49544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49546         return ret_ref;
49547 }
49548
49549 int64_t  CS_LDK_TxAbort_hash(int64_t o) {
49550         LDKTxAbort o_conv;
49551         o_conv.inner = untag_ptr(o);
49552         o_conv.is_owned = ptr_is_owned(o);
49553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49554         o_conv.is_owned = false;
49555         int64_t ret_conv = TxAbort_hash(&o_conv);
49556         return ret_conv;
49557 }
49558
49559 jboolean  CS_LDK_TxAbort_eq(int64_t a, int64_t b) {
49560         LDKTxAbort a_conv;
49561         a_conv.inner = untag_ptr(a);
49562         a_conv.is_owned = ptr_is_owned(a);
49563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49564         a_conv.is_owned = false;
49565         LDKTxAbort b_conv;
49566         b_conv.inner = untag_ptr(b);
49567         b_conv.is_owned = ptr_is_owned(b);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49569         b_conv.is_owned = false;
49570         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
49571         return ret_conv;
49572 }
49573
49574 void  CS_LDK_Shutdown_free(int64_t this_obj) {
49575         LDKShutdown this_obj_conv;
49576         this_obj_conv.inner = untag_ptr(this_obj);
49577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49579         Shutdown_free(this_obj_conv);
49580 }
49581
49582 int64_t  CS_LDK_Shutdown_get_channel_id(int64_t this_ptr) {
49583         LDKShutdown this_ptr_conv;
49584         this_ptr_conv.inner = untag_ptr(this_ptr);
49585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49587         this_ptr_conv.is_owned = false;
49588         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
49589         int64_t ret_ref = 0;
49590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49592         return ret_ref;
49593 }
49594
49595 void  CS_LDK_Shutdown_set_channel_id(int64_t this_ptr, int64_t val) {
49596         LDKShutdown this_ptr_conv;
49597         this_ptr_conv.inner = untag_ptr(this_ptr);
49598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49600         this_ptr_conv.is_owned = false;
49601         LDKChannelId val_conv;
49602         val_conv.inner = untag_ptr(val);
49603         val_conv.is_owned = ptr_is_owned(val);
49604         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49605         val_conv = ChannelId_clone(&val_conv);
49606         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
49607 }
49608
49609 int8_tArray  CS_LDK_Shutdown_get_scriptpubkey(int64_t this_ptr) {
49610         LDKShutdown this_ptr_conv;
49611         this_ptr_conv.inner = untag_ptr(this_ptr);
49612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49614         this_ptr_conv.is_owned = false;
49615         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
49616         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49617         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49618         CVec_u8Z_free(ret_var);
49619         return ret_arr;
49620 }
49621
49622 void  CS_LDK_Shutdown_set_scriptpubkey(int64_t this_ptr, int8_tArray val) {
49623         LDKShutdown this_ptr_conv;
49624         this_ptr_conv.inner = untag_ptr(this_ptr);
49625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49627         this_ptr_conv.is_owned = false;
49628         LDKCVec_u8Z val_ref;
49629         val_ref.datalen = val->arr_len;
49630         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49631         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49632         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
49633 }
49634
49635 int64_t  CS_LDK_Shutdown_new(int64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
49636         LDKChannelId channel_id_arg_conv;
49637         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49638         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49639         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49640         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49641         LDKCVec_u8Z scriptpubkey_arg_ref;
49642         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
49643         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49644         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
49645         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
49646         int64_t ret_ref = 0;
49647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49649         return ret_ref;
49650 }
49651
49652 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
49653         LDKShutdown ret_var = Shutdown_clone(arg);
49654         int64_t ret_ref = 0;
49655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49657         return ret_ref;
49658 }
49659 int64_t  CS_LDK_Shutdown_clone_ptr(int64_t arg) {
49660         LDKShutdown arg_conv;
49661         arg_conv.inner = untag_ptr(arg);
49662         arg_conv.is_owned = ptr_is_owned(arg);
49663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49664         arg_conv.is_owned = false;
49665         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
49666         return ret_conv;
49667 }
49668
49669 int64_t  CS_LDK_Shutdown_clone(int64_t orig) {
49670         LDKShutdown orig_conv;
49671         orig_conv.inner = untag_ptr(orig);
49672         orig_conv.is_owned = ptr_is_owned(orig);
49673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49674         orig_conv.is_owned = false;
49675         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
49676         int64_t ret_ref = 0;
49677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49679         return ret_ref;
49680 }
49681
49682 int64_t  CS_LDK_Shutdown_hash(int64_t o) {
49683         LDKShutdown o_conv;
49684         o_conv.inner = untag_ptr(o);
49685         o_conv.is_owned = ptr_is_owned(o);
49686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49687         o_conv.is_owned = false;
49688         int64_t ret_conv = Shutdown_hash(&o_conv);
49689         return ret_conv;
49690 }
49691
49692 jboolean  CS_LDK_Shutdown_eq(int64_t a, int64_t b) {
49693         LDKShutdown a_conv;
49694         a_conv.inner = untag_ptr(a);
49695         a_conv.is_owned = ptr_is_owned(a);
49696         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49697         a_conv.is_owned = false;
49698         LDKShutdown b_conv;
49699         b_conv.inner = untag_ptr(b);
49700         b_conv.is_owned = ptr_is_owned(b);
49701         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49702         b_conv.is_owned = false;
49703         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
49704         return ret_conv;
49705 }
49706
49707 void  CS_LDK_ClosingSignedFeeRange_free(int64_t this_obj) {
49708         LDKClosingSignedFeeRange this_obj_conv;
49709         this_obj_conv.inner = untag_ptr(this_obj);
49710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49712         ClosingSignedFeeRange_free(this_obj_conv);
49713 }
49714
49715 int64_t  CS_LDK_ClosingSignedFeeRange_get_min_fee_satoshis(int64_t this_ptr) {
49716         LDKClosingSignedFeeRange this_ptr_conv;
49717         this_ptr_conv.inner = untag_ptr(this_ptr);
49718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49720         this_ptr_conv.is_owned = false;
49721         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
49722         return ret_conv;
49723 }
49724
49725 void  CS_LDK_ClosingSignedFeeRange_set_min_fee_satoshis(int64_t this_ptr, int64_t val) {
49726         LDKClosingSignedFeeRange this_ptr_conv;
49727         this_ptr_conv.inner = untag_ptr(this_ptr);
49728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49730         this_ptr_conv.is_owned = false;
49731         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
49732 }
49733
49734 int64_t  CS_LDK_ClosingSignedFeeRange_get_max_fee_satoshis(int64_t this_ptr) {
49735         LDKClosingSignedFeeRange this_ptr_conv;
49736         this_ptr_conv.inner = untag_ptr(this_ptr);
49737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49739         this_ptr_conv.is_owned = false;
49740         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
49741         return ret_conv;
49742 }
49743
49744 void  CS_LDK_ClosingSignedFeeRange_set_max_fee_satoshis(int64_t this_ptr, int64_t val) {
49745         LDKClosingSignedFeeRange this_ptr_conv;
49746         this_ptr_conv.inner = untag_ptr(this_ptr);
49747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49749         this_ptr_conv.is_owned = false;
49750         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
49751 }
49752
49753 int64_t  CS_LDK_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
49754         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
49755         int64_t ret_ref = 0;
49756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49758         return ret_ref;
49759 }
49760
49761 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
49762         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
49763         int64_t ret_ref = 0;
49764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49766         return ret_ref;
49767 }
49768 int64_t  CS_LDK_ClosingSignedFeeRange_clone_ptr(int64_t arg) {
49769         LDKClosingSignedFeeRange arg_conv;
49770         arg_conv.inner = untag_ptr(arg);
49771         arg_conv.is_owned = ptr_is_owned(arg);
49772         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49773         arg_conv.is_owned = false;
49774         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
49775         return ret_conv;
49776 }
49777
49778 int64_t  CS_LDK_ClosingSignedFeeRange_clone(int64_t orig) {
49779         LDKClosingSignedFeeRange orig_conv;
49780         orig_conv.inner = untag_ptr(orig);
49781         orig_conv.is_owned = ptr_is_owned(orig);
49782         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49783         orig_conv.is_owned = false;
49784         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
49785         int64_t ret_ref = 0;
49786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49788         return ret_ref;
49789 }
49790
49791 int64_t  CS_LDK_ClosingSignedFeeRange_hash(int64_t o) {
49792         LDKClosingSignedFeeRange o_conv;
49793         o_conv.inner = untag_ptr(o);
49794         o_conv.is_owned = ptr_is_owned(o);
49795         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49796         o_conv.is_owned = false;
49797         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
49798         return ret_conv;
49799 }
49800
49801 jboolean  CS_LDK_ClosingSignedFeeRange_eq(int64_t a, int64_t b) {
49802         LDKClosingSignedFeeRange a_conv;
49803         a_conv.inner = untag_ptr(a);
49804         a_conv.is_owned = ptr_is_owned(a);
49805         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49806         a_conv.is_owned = false;
49807         LDKClosingSignedFeeRange b_conv;
49808         b_conv.inner = untag_ptr(b);
49809         b_conv.is_owned = ptr_is_owned(b);
49810         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49811         b_conv.is_owned = false;
49812         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
49813         return ret_conv;
49814 }
49815
49816 void  CS_LDK_ClosingSigned_free(int64_t this_obj) {
49817         LDKClosingSigned this_obj_conv;
49818         this_obj_conv.inner = untag_ptr(this_obj);
49819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49821         ClosingSigned_free(this_obj_conv);
49822 }
49823
49824 int64_t  CS_LDK_ClosingSigned_get_channel_id(int64_t this_ptr) {
49825         LDKClosingSigned this_ptr_conv;
49826         this_ptr_conv.inner = untag_ptr(this_ptr);
49827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49829         this_ptr_conv.is_owned = false;
49830         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
49831         int64_t ret_ref = 0;
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49834         return ret_ref;
49835 }
49836
49837 void  CS_LDK_ClosingSigned_set_channel_id(int64_t this_ptr, int64_t val) {
49838         LDKClosingSigned this_ptr_conv;
49839         this_ptr_conv.inner = untag_ptr(this_ptr);
49840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49842         this_ptr_conv.is_owned = false;
49843         LDKChannelId val_conv;
49844         val_conv.inner = untag_ptr(val);
49845         val_conv.is_owned = ptr_is_owned(val);
49846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49847         val_conv = ChannelId_clone(&val_conv);
49848         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
49849 }
49850
49851 int64_t  CS_LDK_ClosingSigned_get_fee_satoshis(int64_t this_ptr) {
49852         LDKClosingSigned this_ptr_conv;
49853         this_ptr_conv.inner = untag_ptr(this_ptr);
49854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49856         this_ptr_conv.is_owned = false;
49857         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
49858         return ret_conv;
49859 }
49860
49861 void  CS_LDK_ClosingSigned_set_fee_satoshis(int64_t this_ptr, int64_t val) {
49862         LDKClosingSigned this_ptr_conv;
49863         this_ptr_conv.inner = untag_ptr(this_ptr);
49864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49866         this_ptr_conv.is_owned = false;
49867         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
49868 }
49869
49870 int8_tArray  CS_LDK_ClosingSigned_get_signature(int64_t this_ptr) {
49871         LDKClosingSigned this_ptr_conv;
49872         this_ptr_conv.inner = untag_ptr(this_ptr);
49873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49875         this_ptr_conv.is_owned = false;
49876         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49877         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
49878         return ret_arr;
49879 }
49880
49881 void  CS_LDK_ClosingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
49882         LDKClosingSigned this_ptr_conv;
49883         this_ptr_conv.inner = untag_ptr(this_ptr);
49884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49886         this_ptr_conv.is_owned = false;
49887         LDKECDSASignature val_ref;
49888         CHECK(val->arr_len == 64);
49889         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
49890         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
49891 }
49892
49893 int64_t  CS_LDK_ClosingSigned_get_fee_range(int64_t this_ptr) {
49894         LDKClosingSigned this_ptr_conv;
49895         this_ptr_conv.inner = untag_ptr(this_ptr);
49896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49898         this_ptr_conv.is_owned = false;
49899         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
49900         int64_t ret_ref = 0;
49901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49903         return ret_ref;
49904 }
49905
49906 void  CS_LDK_ClosingSigned_set_fee_range(int64_t this_ptr, int64_t val) {
49907         LDKClosingSigned this_ptr_conv;
49908         this_ptr_conv.inner = untag_ptr(this_ptr);
49909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49911         this_ptr_conv.is_owned = false;
49912         LDKClosingSignedFeeRange val_conv;
49913         val_conv.inner = untag_ptr(val);
49914         val_conv.is_owned = ptr_is_owned(val);
49915         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49916         val_conv = ClosingSignedFeeRange_clone(&val_conv);
49917         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
49918 }
49919
49920 int64_t  CS_LDK_ClosingSigned_new(int64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
49921         LDKChannelId channel_id_arg_conv;
49922         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49923         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49924         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49925         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49926         LDKECDSASignature signature_arg_ref;
49927         CHECK(signature_arg->arr_len == 64);
49928         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49929         LDKClosingSignedFeeRange fee_range_arg_conv;
49930         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
49931         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
49932         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
49933         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
49934         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
49935         int64_t ret_ref = 0;
49936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49938         return ret_ref;
49939 }
49940
49941 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
49942         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
49943         int64_t ret_ref = 0;
49944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49946         return ret_ref;
49947 }
49948 int64_t  CS_LDK_ClosingSigned_clone_ptr(int64_t arg) {
49949         LDKClosingSigned arg_conv;
49950         arg_conv.inner = untag_ptr(arg);
49951         arg_conv.is_owned = ptr_is_owned(arg);
49952         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49953         arg_conv.is_owned = false;
49954         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
49955         return ret_conv;
49956 }
49957
49958 int64_t  CS_LDK_ClosingSigned_clone(int64_t orig) {
49959         LDKClosingSigned orig_conv;
49960         orig_conv.inner = untag_ptr(orig);
49961         orig_conv.is_owned = ptr_is_owned(orig);
49962         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49963         orig_conv.is_owned = false;
49964         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
49965         int64_t ret_ref = 0;
49966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49968         return ret_ref;
49969 }
49970
49971 int64_t  CS_LDK_ClosingSigned_hash(int64_t o) {
49972         LDKClosingSigned o_conv;
49973         o_conv.inner = untag_ptr(o);
49974         o_conv.is_owned = ptr_is_owned(o);
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49976         o_conv.is_owned = false;
49977         int64_t ret_conv = ClosingSigned_hash(&o_conv);
49978         return ret_conv;
49979 }
49980
49981 jboolean  CS_LDK_ClosingSigned_eq(int64_t a, int64_t b) {
49982         LDKClosingSigned a_conv;
49983         a_conv.inner = untag_ptr(a);
49984         a_conv.is_owned = ptr_is_owned(a);
49985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49986         a_conv.is_owned = false;
49987         LDKClosingSigned b_conv;
49988         b_conv.inner = untag_ptr(b);
49989         b_conv.is_owned = ptr_is_owned(b);
49990         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49991         b_conv.is_owned = false;
49992         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
49993         return ret_conv;
49994 }
49995
49996 void  CS_LDK_UpdateAddHTLC_free(int64_t this_obj) {
49997         LDKUpdateAddHTLC this_obj_conv;
49998         this_obj_conv.inner = untag_ptr(this_obj);
49999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50001         UpdateAddHTLC_free(this_obj_conv);
50002 }
50003
50004 int64_t  CS_LDK_UpdateAddHTLC_get_channel_id(int64_t this_ptr) {
50005         LDKUpdateAddHTLC this_ptr_conv;
50006         this_ptr_conv.inner = untag_ptr(this_ptr);
50007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50009         this_ptr_conv.is_owned = false;
50010         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
50011         int64_t ret_ref = 0;
50012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50014         return ret_ref;
50015 }
50016
50017 void  CS_LDK_UpdateAddHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
50018         LDKUpdateAddHTLC this_ptr_conv;
50019         this_ptr_conv.inner = untag_ptr(this_ptr);
50020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50022         this_ptr_conv.is_owned = false;
50023         LDKChannelId val_conv;
50024         val_conv.inner = untag_ptr(val);
50025         val_conv.is_owned = ptr_is_owned(val);
50026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50027         val_conv = ChannelId_clone(&val_conv);
50028         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
50029 }
50030
50031 int64_t  CS_LDK_UpdateAddHTLC_get_htlc_id(int64_t this_ptr) {
50032         LDKUpdateAddHTLC this_ptr_conv;
50033         this_ptr_conv.inner = untag_ptr(this_ptr);
50034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50036         this_ptr_conv.is_owned = false;
50037         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
50038         return ret_conv;
50039 }
50040
50041 void  CS_LDK_UpdateAddHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
50042         LDKUpdateAddHTLC this_ptr_conv;
50043         this_ptr_conv.inner = untag_ptr(this_ptr);
50044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50046         this_ptr_conv.is_owned = false;
50047         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
50048 }
50049
50050 int64_t  CS_LDK_UpdateAddHTLC_get_amount_msat(int64_t this_ptr) {
50051         LDKUpdateAddHTLC 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         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
50057         return ret_conv;
50058 }
50059
50060 void  CS_LDK_UpdateAddHTLC_set_amount_msat(int64_t this_ptr, int64_t val) {
50061         LDKUpdateAddHTLC this_ptr_conv;
50062         this_ptr_conv.inner = untag_ptr(this_ptr);
50063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50065         this_ptr_conv.is_owned = false;
50066         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
50067 }
50068
50069 int8_tArray  CS_LDK_UpdateAddHTLC_get_payment_hash(int64_t this_ptr) {
50070         LDKUpdateAddHTLC this_ptr_conv;
50071         this_ptr_conv.inner = untag_ptr(this_ptr);
50072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50074         this_ptr_conv.is_owned = false;
50075         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50076         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
50077         return ret_arr;
50078 }
50079
50080 void  CS_LDK_UpdateAddHTLC_set_payment_hash(int64_t this_ptr, int8_tArray val) {
50081         LDKUpdateAddHTLC this_ptr_conv;
50082         this_ptr_conv.inner = untag_ptr(this_ptr);
50083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50085         this_ptr_conv.is_owned = false;
50086         LDKThirtyTwoBytes val_ref;
50087         CHECK(val->arr_len == 32);
50088         memcpy(val_ref.data, val->elems, 32); FREE(val);
50089         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
50090 }
50091
50092 int32_t  CS_LDK_UpdateAddHTLC_get_cltv_expiry(int64_t this_ptr) {
50093         LDKUpdateAddHTLC this_ptr_conv;
50094         this_ptr_conv.inner = untag_ptr(this_ptr);
50095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50097         this_ptr_conv.is_owned = false;
50098         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
50099         return ret_conv;
50100 }
50101
50102 void  CS_LDK_UpdateAddHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
50103         LDKUpdateAddHTLC this_ptr_conv;
50104         this_ptr_conv.inner = untag_ptr(this_ptr);
50105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50107         this_ptr_conv.is_owned = false;
50108         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
50109 }
50110
50111 int64_t  CS_LDK_UpdateAddHTLC_get_skimmed_fee_msat(int64_t this_ptr) {
50112         LDKUpdateAddHTLC this_ptr_conv;
50113         this_ptr_conv.inner = untag_ptr(this_ptr);
50114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50116         this_ptr_conv.is_owned = false;
50117         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50118         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
50119         int64_t ret_ref = tag_ptr(ret_copy, true);
50120         return ret_ref;
50121 }
50122
50123 void  CS_LDK_UpdateAddHTLC_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
50124         LDKUpdateAddHTLC this_ptr_conv;
50125         this_ptr_conv.inner = untag_ptr(this_ptr);
50126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50128         this_ptr_conv.is_owned = false;
50129         void* val_ptr = untag_ptr(val);
50130         CHECK_ACCESS(val_ptr);
50131         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
50132         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
50133         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
50134 }
50135
50136 int64_t  CS_LDK_UpdateAddHTLC_get_onion_routing_packet(int64_t this_ptr) {
50137         LDKUpdateAddHTLC this_ptr_conv;
50138         this_ptr_conv.inner = untag_ptr(this_ptr);
50139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50141         this_ptr_conv.is_owned = false;
50142         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
50143         int64_t ret_ref = 0;
50144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50146         return ret_ref;
50147 }
50148
50149 void  CS_LDK_UpdateAddHTLC_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
50150         LDKUpdateAddHTLC this_ptr_conv;
50151         this_ptr_conv.inner = untag_ptr(this_ptr);
50152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50154         this_ptr_conv.is_owned = false;
50155         LDKOnionPacket val_conv;
50156         val_conv.inner = untag_ptr(val);
50157         val_conv.is_owned = ptr_is_owned(val);
50158         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50159         val_conv = OnionPacket_clone(&val_conv);
50160         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
50161 }
50162
50163 int8_tArray  CS_LDK_UpdateAddHTLC_get_blinding_point(int64_t this_ptr) {
50164         LDKUpdateAddHTLC this_ptr_conv;
50165         this_ptr_conv.inner = untag_ptr(this_ptr);
50166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50168         this_ptr_conv.is_owned = false;
50169         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50170         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
50171         return ret_arr;
50172 }
50173
50174 void  CS_LDK_UpdateAddHTLC_set_blinding_point(int64_t this_ptr, int8_tArray val) {
50175         LDKUpdateAddHTLC this_ptr_conv;
50176         this_ptr_conv.inner = untag_ptr(this_ptr);
50177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50179         this_ptr_conv.is_owned = false;
50180         LDKPublicKey val_ref;
50181         CHECK(val->arr_len == 33);
50182         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50183         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
50184 }
50185
50186 int64_t  CS_LDK_UpdateAddHTLC_new(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) {
50187         LDKChannelId channel_id_arg_conv;
50188         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50189         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50191         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50192         LDKThirtyTwoBytes payment_hash_arg_ref;
50193         CHECK(payment_hash_arg->arr_len == 32);
50194         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
50195         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
50196         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
50197         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
50198         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
50199         LDKOnionPacket onion_routing_packet_arg_conv;
50200         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
50201         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
50202         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
50203         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
50204         LDKPublicKey blinding_point_arg_ref;
50205         CHECK(blinding_point_arg->arr_len == 33);
50206         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
50207         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);
50208         int64_t ret_ref = 0;
50209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50211         return ret_ref;
50212 }
50213
50214 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
50215         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
50216         int64_t ret_ref = 0;
50217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50219         return ret_ref;
50220 }
50221 int64_t  CS_LDK_UpdateAddHTLC_clone_ptr(int64_t arg) {
50222         LDKUpdateAddHTLC arg_conv;
50223         arg_conv.inner = untag_ptr(arg);
50224         arg_conv.is_owned = ptr_is_owned(arg);
50225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50226         arg_conv.is_owned = false;
50227         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
50228         return ret_conv;
50229 }
50230
50231 int64_t  CS_LDK_UpdateAddHTLC_clone(int64_t orig) {
50232         LDKUpdateAddHTLC orig_conv;
50233         orig_conv.inner = untag_ptr(orig);
50234         orig_conv.is_owned = ptr_is_owned(orig);
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50236         orig_conv.is_owned = false;
50237         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
50238         int64_t ret_ref = 0;
50239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50241         return ret_ref;
50242 }
50243
50244 int64_t  CS_LDK_UpdateAddHTLC_hash(int64_t o) {
50245         LDKUpdateAddHTLC o_conv;
50246         o_conv.inner = untag_ptr(o);
50247         o_conv.is_owned = ptr_is_owned(o);
50248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50249         o_conv.is_owned = false;
50250         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
50251         return ret_conv;
50252 }
50253
50254 jboolean  CS_LDK_UpdateAddHTLC_eq(int64_t a, int64_t b) {
50255         LDKUpdateAddHTLC a_conv;
50256         a_conv.inner = untag_ptr(a);
50257         a_conv.is_owned = ptr_is_owned(a);
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50259         a_conv.is_owned = false;
50260         LDKUpdateAddHTLC b_conv;
50261         b_conv.inner = untag_ptr(b);
50262         b_conv.is_owned = ptr_is_owned(b);
50263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50264         b_conv.is_owned = false;
50265         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
50266         return ret_conv;
50267 }
50268
50269 void  CS_LDK_OnionMessage_free(int64_t this_obj) {
50270         LDKOnionMessage this_obj_conv;
50271         this_obj_conv.inner = untag_ptr(this_obj);
50272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50274         OnionMessage_free(this_obj_conv);
50275 }
50276
50277 int8_tArray  CS_LDK_OnionMessage_get_blinding_point(int64_t this_ptr) {
50278         LDKOnionMessage this_ptr_conv;
50279         this_ptr_conv.inner = untag_ptr(this_ptr);
50280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50282         this_ptr_conv.is_owned = false;
50283         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50284         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
50285         return ret_arr;
50286 }
50287
50288 void  CS_LDK_OnionMessage_set_blinding_point(int64_t this_ptr, int8_tArray val) {
50289         LDKOnionMessage this_ptr_conv;
50290         this_ptr_conv.inner = untag_ptr(this_ptr);
50291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50293         this_ptr_conv.is_owned = false;
50294         LDKPublicKey val_ref;
50295         CHECK(val->arr_len == 33);
50296         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
50297         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
50298 }
50299
50300 int64_t  CS_LDK_OnionMessage_get_onion_routing_packet(int64_t this_ptr) {
50301         LDKOnionMessage this_ptr_conv;
50302         this_ptr_conv.inner = untag_ptr(this_ptr);
50303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50305         this_ptr_conv.is_owned = false;
50306         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
50307         int64_t ret_ref = 0;
50308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50310         return ret_ref;
50311 }
50312
50313 void  CS_LDK_OnionMessage_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
50314         LDKOnionMessage 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         LDKPacket val_conv;
50320         val_conv.inner = untag_ptr(val);
50321         val_conv.is_owned = ptr_is_owned(val);
50322         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50323         val_conv = Packet_clone(&val_conv);
50324         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
50325 }
50326
50327 int64_t  CS_LDK_OnionMessage_new(int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
50328         LDKPublicKey blinding_point_arg_ref;
50329         CHECK(blinding_point_arg->arr_len == 33);
50330         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
50331         LDKPacket onion_routing_packet_arg_conv;
50332         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
50333         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
50334         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
50335         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
50336         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
50337         int64_t ret_ref = 0;
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50340         return ret_ref;
50341 }
50342
50343 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
50344         LDKOnionMessage ret_var = OnionMessage_clone(arg);
50345         int64_t ret_ref = 0;
50346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50348         return ret_ref;
50349 }
50350 int64_t  CS_LDK_OnionMessage_clone_ptr(int64_t arg) {
50351         LDKOnionMessage arg_conv;
50352         arg_conv.inner = untag_ptr(arg);
50353         arg_conv.is_owned = ptr_is_owned(arg);
50354         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50355         arg_conv.is_owned = false;
50356         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
50357         return ret_conv;
50358 }
50359
50360 int64_t  CS_LDK_OnionMessage_clone(int64_t orig) {
50361         LDKOnionMessage orig_conv;
50362         orig_conv.inner = untag_ptr(orig);
50363         orig_conv.is_owned = ptr_is_owned(orig);
50364         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50365         orig_conv.is_owned = false;
50366         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
50367         int64_t ret_ref = 0;
50368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50370         return ret_ref;
50371 }
50372
50373 int64_t  CS_LDK_OnionMessage_hash(int64_t o) {
50374         LDKOnionMessage o_conv;
50375         o_conv.inner = untag_ptr(o);
50376         o_conv.is_owned = ptr_is_owned(o);
50377         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50378         o_conv.is_owned = false;
50379         int64_t ret_conv = OnionMessage_hash(&o_conv);
50380         return ret_conv;
50381 }
50382
50383 jboolean  CS_LDK_OnionMessage_eq(int64_t a, int64_t b) {
50384         LDKOnionMessage a_conv;
50385         a_conv.inner = untag_ptr(a);
50386         a_conv.is_owned = ptr_is_owned(a);
50387         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50388         a_conv.is_owned = false;
50389         LDKOnionMessage b_conv;
50390         b_conv.inner = untag_ptr(b);
50391         b_conv.is_owned = ptr_is_owned(b);
50392         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50393         b_conv.is_owned = false;
50394         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
50395         return ret_conv;
50396 }
50397
50398 void  CS_LDK_UpdateFulfillHTLC_free(int64_t this_obj) {
50399         LDKUpdateFulfillHTLC this_obj_conv;
50400         this_obj_conv.inner = untag_ptr(this_obj);
50401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50403         UpdateFulfillHTLC_free(this_obj_conv);
50404 }
50405
50406 int64_t  CS_LDK_UpdateFulfillHTLC_get_channel_id(int64_t this_ptr) {
50407         LDKUpdateFulfillHTLC this_ptr_conv;
50408         this_ptr_conv.inner = untag_ptr(this_ptr);
50409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50411         this_ptr_conv.is_owned = false;
50412         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
50413         int64_t ret_ref = 0;
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50416         return ret_ref;
50417 }
50418
50419 void  CS_LDK_UpdateFulfillHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
50420         LDKUpdateFulfillHTLC this_ptr_conv;
50421         this_ptr_conv.inner = untag_ptr(this_ptr);
50422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50424         this_ptr_conv.is_owned = false;
50425         LDKChannelId val_conv;
50426         val_conv.inner = untag_ptr(val);
50427         val_conv.is_owned = ptr_is_owned(val);
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50429         val_conv = ChannelId_clone(&val_conv);
50430         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
50431 }
50432
50433 int64_t  CS_LDK_UpdateFulfillHTLC_get_htlc_id(int64_t this_ptr) {
50434         LDKUpdateFulfillHTLC this_ptr_conv;
50435         this_ptr_conv.inner = untag_ptr(this_ptr);
50436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50438         this_ptr_conv.is_owned = false;
50439         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
50440         return ret_conv;
50441 }
50442
50443 void  CS_LDK_UpdateFulfillHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
50444         LDKUpdateFulfillHTLC this_ptr_conv;
50445         this_ptr_conv.inner = untag_ptr(this_ptr);
50446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50448         this_ptr_conv.is_owned = false;
50449         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
50450 }
50451
50452 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_payment_preimage(int64_t this_ptr) {
50453         LDKUpdateFulfillHTLC this_ptr_conv;
50454         this_ptr_conv.inner = untag_ptr(this_ptr);
50455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50457         this_ptr_conv.is_owned = false;
50458         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50459         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
50460         return ret_arr;
50461 }
50462
50463 void  CS_LDK_UpdateFulfillHTLC_set_payment_preimage(int64_t this_ptr, int8_tArray val) {
50464         LDKUpdateFulfillHTLC this_ptr_conv;
50465         this_ptr_conv.inner = untag_ptr(this_ptr);
50466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50468         this_ptr_conv.is_owned = false;
50469         LDKThirtyTwoBytes val_ref;
50470         CHECK(val->arr_len == 32);
50471         memcpy(val_ref.data, val->elems, 32); FREE(val);
50472         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
50473 }
50474
50475 int64_t  CS_LDK_UpdateFulfillHTLC_new(int64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
50476         LDKChannelId channel_id_arg_conv;
50477         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50478         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50479         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50480         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50481         LDKThirtyTwoBytes payment_preimage_arg_ref;
50482         CHECK(payment_preimage_arg->arr_len == 32);
50483         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
50484         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
50485         int64_t ret_ref = 0;
50486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50488         return ret_ref;
50489 }
50490
50491 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
50492         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
50493         int64_t ret_ref = 0;
50494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50496         return ret_ref;
50497 }
50498 int64_t  CS_LDK_UpdateFulfillHTLC_clone_ptr(int64_t arg) {
50499         LDKUpdateFulfillHTLC arg_conv;
50500         arg_conv.inner = untag_ptr(arg);
50501         arg_conv.is_owned = ptr_is_owned(arg);
50502         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50503         arg_conv.is_owned = false;
50504         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
50505         return ret_conv;
50506 }
50507
50508 int64_t  CS_LDK_UpdateFulfillHTLC_clone(int64_t orig) {
50509         LDKUpdateFulfillHTLC orig_conv;
50510         orig_conv.inner = untag_ptr(orig);
50511         orig_conv.is_owned = ptr_is_owned(orig);
50512         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50513         orig_conv.is_owned = false;
50514         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
50515         int64_t ret_ref = 0;
50516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50518         return ret_ref;
50519 }
50520
50521 int64_t  CS_LDK_UpdateFulfillHTLC_hash(int64_t o) {
50522         LDKUpdateFulfillHTLC o_conv;
50523         o_conv.inner = untag_ptr(o);
50524         o_conv.is_owned = ptr_is_owned(o);
50525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50526         o_conv.is_owned = false;
50527         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
50528         return ret_conv;
50529 }
50530
50531 jboolean  CS_LDK_UpdateFulfillHTLC_eq(int64_t a, int64_t b) {
50532         LDKUpdateFulfillHTLC a_conv;
50533         a_conv.inner = untag_ptr(a);
50534         a_conv.is_owned = ptr_is_owned(a);
50535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50536         a_conv.is_owned = false;
50537         LDKUpdateFulfillHTLC b_conv;
50538         b_conv.inner = untag_ptr(b);
50539         b_conv.is_owned = ptr_is_owned(b);
50540         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50541         b_conv.is_owned = false;
50542         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
50543         return ret_conv;
50544 }
50545
50546 void  CS_LDK_UpdateFailHTLC_free(int64_t this_obj) {
50547         LDKUpdateFailHTLC this_obj_conv;
50548         this_obj_conv.inner = untag_ptr(this_obj);
50549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50551         UpdateFailHTLC_free(this_obj_conv);
50552 }
50553
50554 int64_t  CS_LDK_UpdateFailHTLC_get_channel_id(int64_t this_ptr) {
50555         LDKUpdateFailHTLC this_ptr_conv;
50556         this_ptr_conv.inner = untag_ptr(this_ptr);
50557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50559         this_ptr_conv.is_owned = false;
50560         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
50561         int64_t ret_ref = 0;
50562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50564         return ret_ref;
50565 }
50566
50567 void  CS_LDK_UpdateFailHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
50568         LDKUpdateFailHTLC this_ptr_conv;
50569         this_ptr_conv.inner = untag_ptr(this_ptr);
50570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50572         this_ptr_conv.is_owned = false;
50573         LDKChannelId val_conv;
50574         val_conv.inner = untag_ptr(val);
50575         val_conv.is_owned = ptr_is_owned(val);
50576         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50577         val_conv = ChannelId_clone(&val_conv);
50578         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
50579 }
50580
50581 int64_t  CS_LDK_UpdateFailHTLC_get_htlc_id(int64_t this_ptr) {
50582         LDKUpdateFailHTLC this_ptr_conv;
50583         this_ptr_conv.inner = untag_ptr(this_ptr);
50584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50586         this_ptr_conv.is_owned = false;
50587         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
50588         return ret_conv;
50589 }
50590
50591 void  CS_LDK_UpdateFailHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
50592         LDKUpdateFailHTLC 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         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
50598 }
50599
50600 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
50601         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
50602         int64_t ret_ref = 0;
50603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50605         return ret_ref;
50606 }
50607 int64_t  CS_LDK_UpdateFailHTLC_clone_ptr(int64_t arg) {
50608         LDKUpdateFailHTLC arg_conv;
50609         arg_conv.inner = untag_ptr(arg);
50610         arg_conv.is_owned = ptr_is_owned(arg);
50611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50612         arg_conv.is_owned = false;
50613         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
50614         return ret_conv;
50615 }
50616
50617 int64_t  CS_LDK_UpdateFailHTLC_clone(int64_t orig) {
50618         LDKUpdateFailHTLC orig_conv;
50619         orig_conv.inner = untag_ptr(orig);
50620         orig_conv.is_owned = ptr_is_owned(orig);
50621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50622         orig_conv.is_owned = false;
50623         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
50624         int64_t ret_ref = 0;
50625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50627         return ret_ref;
50628 }
50629
50630 int64_t  CS_LDK_UpdateFailHTLC_hash(int64_t o) {
50631         LDKUpdateFailHTLC o_conv;
50632         o_conv.inner = untag_ptr(o);
50633         o_conv.is_owned = ptr_is_owned(o);
50634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50635         o_conv.is_owned = false;
50636         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
50637         return ret_conv;
50638 }
50639
50640 jboolean  CS_LDK_UpdateFailHTLC_eq(int64_t a, int64_t b) {
50641         LDKUpdateFailHTLC a_conv;
50642         a_conv.inner = untag_ptr(a);
50643         a_conv.is_owned = ptr_is_owned(a);
50644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50645         a_conv.is_owned = false;
50646         LDKUpdateFailHTLC b_conv;
50647         b_conv.inner = untag_ptr(b);
50648         b_conv.is_owned = ptr_is_owned(b);
50649         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50650         b_conv.is_owned = false;
50651         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
50652         return ret_conv;
50653 }
50654
50655 void  CS_LDK_UpdateFailMalformedHTLC_free(int64_t this_obj) {
50656         LDKUpdateFailMalformedHTLC this_obj_conv;
50657         this_obj_conv.inner = untag_ptr(this_obj);
50658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50660         UpdateFailMalformedHTLC_free(this_obj_conv);
50661 }
50662
50663 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_channel_id(int64_t this_ptr) {
50664         LDKUpdateFailMalformedHTLC this_ptr_conv;
50665         this_ptr_conv.inner = untag_ptr(this_ptr);
50666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50668         this_ptr_conv.is_owned = false;
50669         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
50670         int64_t ret_ref = 0;
50671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50673         return ret_ref;
50674 }
50675
50676 void  CS_LDK_UpdateFailMalformedHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
50677         LDKUpdateFailMalformedHTLC 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         LDKChannelId val_conv;
50683         val_conv.inner = untag_ptr(val);
50684         val_conv.is_owned = ptr_is_owned(val);
50685         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50686         val_conv = ChannelId_clone(&val_conv);
50687         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
50688 }
50689
50690 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_htlc_id(int64_t this_ptr) {
50691         LDKUpdateFailMalformedHTLC this_ptr_conv;
50692         this_ptr_conv.inner = untag_ptr(this_ptr);
50693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50695         this_ptr_conv.is_owned = false;
50696         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
50697         return ret_conv;
50698 }
50699
50700 void  CS_LDK_UpdateFailMalformedHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
50701         LDKUpdateFailMalformedHTLC this_ptr_conv;
50702         this_ptr_conv.inner = untag_ptr(this_ptr);
50703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50705         this_ptr_conv.is_owned = false;
50706         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
50707 }
50708
50709 int16_t  CS_LDK_UpdateFailMalformedHTLC_get_failure_code(int64_t this_ptr) {
50710         LDKUpdateFailMalformedHTLC this_ptr_conv;
50711         this_ptr_conv.inner = untag_ptr(this_ptr);
50712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50714         this_ptr_conv.is_owned = false;
50715         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
50716         return ret_conv;
50717 }
50718
50719 void  CS_LDK_UpdateFailMalformedHTLC_set_failure_code(int64_t this_ptr, int16_t val) {
50720         LDKUpdateFailMalformedHTLC this_ptr_conv;
50721         this_ptr_conv.inner = untag_ptr(this_ptr);
50722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50724         this_ptr_conv.is_owned = false;
50725         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
50726 }
50727
50728 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
50729         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
50730         int64_t ret_ref = 0;
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50733         return ret_ref;
50734 }
50735 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone_ptr(int64_t arg) {
50736         LDKUpdateFailMalformedHTLC arg_conv;
50737         arg_conv.inner = untag_ptr(arg);
50738         arg_conv.is_owned = ptr_is_owned(arg);
50739         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50740         arg_conv.is_owned = false;
50741         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
50742         return ret_conv;
50743 }
50744
50745 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone(int64_t orig) {
50746         LDKUpdateFailMalformedHTLC orig_conv;
50747         orig_conv.inner = untag_ptr(orig);
50748         orig_conv.is_owned = ptr_is_owned(orig);
50749         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50750         orig_conv.is_owned = false;
50751         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
50752         int64_t ret_ref = 0;
50753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50755         return ret_ref;
50756 }
50757
50758 int64_t  CS_LDK_UpdateFailMalformedHTLC_hash(int64_t o) {
50759         LDKUpdateFailMalformedHTLC o_conv;
50760         o_conv.inner = untag_ptr(o);
50761         o_conv.is_owned = ptr_is_owned(o);
50762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50763         o_conv.is_owned = false;
50764         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
50765         return ret_conv;
50766 }
50767
50768 jboolean  CS_LDK_UpdateFailMalformedHTLC_eq(int64_t a, int64_t b) {
50769         LDKUpdateFailMalformedHTLC a_conv;
50770         a_conv.inner = untag_ptr(a);
50771         a_conv.is_owned = ptr_is_owned(a);
50772         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50773         a_conv.is_owned = false;
50774         LDKUpdateFailMalformedHTLC b_conv;
50775         b_conv.inner = untag_ptr(b);
50776         b_conv.is_owned = ptr_is_owned(b);
50777         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50778         b_conv.is_owned = false;
50779         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
50780         return ret_conv;
50781 }
50782
50783 void  CS_LDK_CommitmentSigned_free(int64_t this_obj) {
50784         LDKCommitmentSigned this_obj_conv;
50785         this_obj_conv.inner = untag_ptr(this_obj);
50786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50788         CommitmentSigned_free(this_obj_conv);
50789 }
50790
50791 int64_t  CS_LDK_CommitmentSigned_get_channel_id(int64_t this_ptr) {
50792         LDKCommitmentSigned this_ptr_conv;
50793         this_ptr_conv.inner = untag_ptr(this_ptr);
50794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50796         this_ptr_conv.is_owned = false;
50797         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
50798         int64_t ret_ref = 0;
50799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50801         return ret_ref;
50802 }
50803
50804 void  CS_LDK_CommitmentSigned_set_channel_id(int64_t this_ptr, int64_t val) {
50805         LDKCommitmentSigned this_ptr_conv;
50806         this_ptr_conv.inner = untag_ptr(this_ptr);
50807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50809         this_ptr_conv.is_owned = false;
50810         LDKChannelId val_conv;
50811         val_conv.inner = untag_ptr(val);
50812         val_conv.is_owned = ptr_is_owned(val);
50813         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50814         val_conv = ChannelId_clone(&val_conv);
50815         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
50816 }
50817
50818 int8_tArray  CS_LDK_CommitmentSigned_get_signature(int64_t this_ptr) {
50819         LDKCommitmentSigned this_ptr_conv;
50820         this_ptr_conv.inner = untag_ptr(this_ptr);
50821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50823         this_ptr_conv.is_owned = false;
50824         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
50825         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
50826         return ret_arr;
50827 }
50828
50829 void  CS_LDK_CommitmentSigned_set_signature(int64_t this_ptr, int8_tArray val) {
50830         LDKCommitmentSigned 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         LDKECDSASignature val_ref;
50836         CHECK(val->arr_len == 64);
50837         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
50838         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
50839 }
50840
50841 ptrArray  CS_LDK_CommitmentSigned_get_htlc_signatures(int64_t this_ptr) {
50842         LDKCommitmentSigned this_ptr_conv;
50843         this_ptr_conv.inner = untag_ptr(this_ptr);
50844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50846         this_ptr_conv.is_owned = false;
50847         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
50848         ptrArray ret_arr = NULL;
50849         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50850         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50851         for (size_t i = 0; i < ret_var.datalen; i++) {
50852                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
50853                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
50854                 ret_arr_ptr[i] = ret_conv_8_arr;
50855         }
50856         
50857         FREE(ret_var.data);
50858         return ret_arr;
50859 }
50860
50861 void  CS_LDK_CommitmentSigned_set_htlc_signatures(int64_t this_ptr, ptrArray val) {
50862         LDKCommitmentSigned this_ptr_conv;
50863         this_ptr_conv.inner = untag_ptr(this_ptr);
50864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50866         this_ptr_conv.is_owned = false;
50867         LDKCVec_ECDSASignatureZ val_constr;
50868         val_constr.datalen = val->arr_len;
50869         if (val_constr.datalen > 0)
50870                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50871         else
50872                 val_constr.data = NULL;
50873         int8_tArray* val_vals = (void*) val->elems;
50874         for (size_t i = 0; i < val_constr.datalen; i++) {
50875                 int8_tArray val_conv_8 = val_vals[i];
50876                 LDKECDSASignature val_conv_8_ref;
50877                 CHECK(val_conv_8->arr_len == 64);
50878                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
50879                 val_constr.data[i] = val_conv_8_ref;
50880         }
50881         FREE(val);
50882         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
50883 }
50884
50885 int64_t  CS_LDK_CommitmentSigned_new(int64_t channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
50886         LDKChannelId channel_id_arg_conv;
50887         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50888         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50889         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50890         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50891         LDKECDSASignature signature_arg_ref;
50892         CHECK(signature_arg->arr_len == 64);
50893         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
50894         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
50895         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
50896         if (htlc_signatures_arg_constr.datalen > 0)
50897                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
50898         else
50899                 htlc_signatures_arg_constr.data = NULL;
50900         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
50901         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
50902                 int8_tArray htlc_signatures_arg_conv_8 = htlc_signatures_arg_vals[i];
50903                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
50904                 CHECK(htlc_signatures_arg_conv_8->arr_len == 64);
50905                 memcpy(htlc_signatures_arg_conv_8_ref.compact_form, htlc_signatures_arg_conv_8->elems, 64); FREE(htlc_signatures_arg_conv_8);
50906                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
50907         }
50908         FREE(htlc_signatures_arg);
50909         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
50910         int64_t ret_ref = 0;
50911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50913         return ret_ref;
50914 }
50915
50916 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
50917         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
50918         int64_t ret_ref = 0;
50919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50921         return ret_ref;
50922 }
50923 int64_t  CS_LDK_CommitmentSigned_clone_ptr(int64_t arg) {
50924         LDKCommitmentSigned arg_conv;
50925         arg_conv.inner = untag_ptr(arg);
50926         arg_conv.is_owned = ptr_is_owned(arg);
50927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50928         arg_conv.is_owned = false;
50929         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
50930         return ret_conv;
50931 }
50932
50933 int64_t  CS_LDK_CommitmentSigned_clone(int64_t orig) {
50934         LDKCommitmentSigned orig_conv;
50935         orig_conv.inner = untag_ptr(orig);
50936         orig_conv.is_owned = ptr_is_owned(orig);
50937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50938         orig_conv.is_owned = false;
50939         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
50940         int64_t ret_ref = 0;
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50943         return ret_ref;
50944 }
50945
50946 int64_t  CS_LDK_CommitmentSigned_hash(int64_t o) {
50947         LDKCommitmentSigned o_conv;
50948         o_conv.inner = untag_ptr(o);
50949         o_conv.is_owned = ptr_is_owned(o);
50950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50951         o_conv.is_owned = false;
50952         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
50953         return ret_conv;
50954 }
50955
50956 jboolean  CS_LDK_CommitmentSigned_eq(int64_t a, int64_t b) {
50957         LDKCommitmentSigned a_conv;
50958         a_conv.inner = untag_ptr(a);
50959         a_conv.is_owned = ptr_is_owned(a);
50960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50961         a_conv.is_owned = false;
50962         LDKCommitmentSigned b_conv;
50963         b_conv.inner = untag_ptr(b);
50964         b_conv.is_owned = ptr_is_owned(b);
50965         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50966         b_conv.is_owned = false;
50967         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
50968         return ret_conv;
50969 }
50970
50971 void  CS_LDK_RevokeAndACK_free(int64_t this_obj) {
50972         LDKRevokeAndACK this_obj_conv;
50973         this_obj_conv.inner = untag_ptr(this_obj);
50974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50976         RevokeAndACK_free(this_obj_conv);
50977 }
50978
50979 int64_t  CS_LDK_RevokeAndACK_get_channel_id(int64_t this_ptr) {
50980         LDKRevokeAndACK this_ptr_conv;
50981         this_ptr_conv.inner = untag_ptr(this_ptr);
50982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50984         this_ptr_conv.is_owned = false;
50985         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
50986         int64_t ret_ref = 0;
50987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50989         return ret_ref;
50990 }
50991
50992 void  CS_LDK_RevokeAndACK_set_channel_id(int64_t this_ptr, int64_t val) {
50993         LDKRevokeAndACK this_ptr_conv;
50994         this_ptr_conv.inner = untag_ptr(this_ptr);
50995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50997         this_ptr_conv.is_owned = false;
50998         LDKChannelId val_conv;
50999         val_conv.inner = untag_ptr(val);
51000         val_conv.is_owned = ptr_is_owned(val);
51001         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51002         val_conv = ChannelId_clone(&val_conv);
51003         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
51004 }
51005
51006 int8_tArray  CS_LDK_RevokeAndACK_get_per_commitment_secret(int64_t this_ptr) {
51007         LDKRevokeAndACK this_ptr_conv;
51008         this_ptr_conv.inner = untag_ptr(this_ptr);
51009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51011         this_ptr_conv.is_owned = false;
51012         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51013         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
51014         return ret_arr;
51015 }
51016
51017 void  CS_LDK_RevokeAndACK_set_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
51018         LDKRevokeAndACK this_ptr_conv;
51019         this_ptr_conv.inner = untag_ptr(this_ptr);
51020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51022         this_ptr_conv.is_owned = false;
51023         LDKThirtyTwoBytes val_ref;
51024         CHECK(val->arr_len == 32);
51025         memcpy(val_ref.data, val->elems, 32); FREE(val);
51026         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
51027 }
51028
51029 int8_tArray  CS_LDK_RevokeAndACK_get_next_per_commitment_point(int64_t this_ptr) {
51030         LDKRevokeAndACK this_ptr_conv;
51031         this_ptr_conv.inner = untag_ptr(this_ptr);
51032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51034         this_ptr_conv.is_owned = false;
51035         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51036         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
51037         return ret_arr;
51038 }
51039
51040 void  CS_LDK_RevokeAndACK_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
51041         LDKRevokeAndACK this_ptr_conv;
51042         this_ptr_conv.inner = untag_ptr(this_ptr);
51043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51045         this_ptr_conv.is_owned = false;
51046         LDKPublicKey val_ref;
51047         CHECK(val->arr_len == 33);
51048         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51049         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
51050 }
51051
51052 int64_t  CS_LDK_RevokeAndACK_new(int64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
51053         LDKChannelId channel_id_arg_conv;
51054         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51055         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51056         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51057         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51058         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
51059         CHECK(per_commitment_secret_arg->arr_len == 32);
51060         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
51061         LDKPublicKey next_per_commitment_point_arg_ref;
51062         CHECK(next_per_commitment_point_arg->arr_len == 33);
51063         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
51064         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
51065         int64_t ret_ref = 0;
51066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51068         return ret_ref;
51069 }
51070
51071 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
51072         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
51073         int64_t ret_ref = 0;
51074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51076         return ret_ref;
51077 }
51078 int64_t  CS_LDK_RevokeAndACK_clone_ptr(int64_t arg) {
51079         LDKRevokeAndACK arg_conv;
51080         arg_conv.inner = untag_ptr(arg);
51081         arg_conv.is_owned = ptr_is_owned(arg);
51082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51083         arg_conv.is_owned = false;
51084         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
51085         return ret_conv;
51086 }
51087
51088 int64_t  CS_LDK_RevokeAndACK_clone(int64_t orig) {
51089         LDKRevokeAndACK orig_conv;
51090         orig_conv.inner = untag_ptr(orig);
51091         orig_conv.is_owned = ptr_is_owned(orig);
51092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51093         orig_conv.is_owned = false;
51094         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
51095         int64_t ret_ref = 0;
51096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51098         return ret_ref;
51099 }
51100
51101 int64_t  CS_LDK_RevokeAndACK_hash(int64_t o) {
51102         LDKRevokeAndACK o_conv;
51103         o_conv.inner = untag_ptr(o);
51104         o_conv.is_owned = ptr_is_owned(o);
51105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51106         o_conv.is_owned = false;
51107         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
51108         return ret_conv;
51109 }
51110
51111 jboolean  CS_LDK_RevokeAndACK_eq(int64_t a, int64_t b) {
51112         LDKRevokeAndACK a_conv;
51113         a_conv.inner = untag_ptr(a);
51114         a_conv.is_owned = ptr_is_owned(a);
51115         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51116         a_conv.is_owned = false;
51117         LDKRevokeAndACK b_conv;
51118         b_conv.inner = untag_ptr(b);
51119         b_conv.is_owned = ptr_is_owned(b);
51120         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51121         b_conv.is_owned = false;
51122         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
51123         return ret_conv;
51124 }
51125
51126 void  CS_LDK_UpdateFee_free(int64_t this_obj) {
51127         LDKUpdateFee this_obj_conv;
51128         this_obj_conv.inner = untag_ptr(this_obj);
51129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51131         UpdateFee_free(this_obj_conv);
51132 }
51133
51134 int64_t  CS_LDK_UpdateFee_get_channel_id(int64_t this_ptr) {
51135         LDKUpdateFee this_ptr_conv;
51136         this_ptr_conv.inner = untag_ptr(this_ptr);
51137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51139         this_ptr_conv.is_owned = false;
51140         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
51141         int64_t ret_ref = 0;
51142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51144         return ret_ref;
51145 }
51146
51147 void  CS_LDK_UpdateFee_set_channel_id(int64_t this_ptr, int64_t val) {
51148         LDKUpdateFee this_ptr_conv;
51149         this_ptr_conv.inner = untag_ptr(this_ptr);
51150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51152         this_ptr_conv.is_owned = false;
51153         LDKChannelId val_conv;
51154         val_conv.inner = untag_ptr(val);
51155         val_conv.is_owned = ptr_is_owned(val);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51157         val_conv = ChannelId_clone(&val_conv);
51158         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
51159 }
51160
51161 int32_t  CS_LDK_UpdateFee_get_feerate_per_kw(int64_t this_ptr) {
51162         LDKUpdateFee this_ptr_conv;
51163         this_ptr_conv.inner = untag_ptr(this_ptr);
51164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51166         this_ptr_conv.is_owned = false;
51167         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
51168         return ret_conv;
51169 }
51170
51171 void  CS_LDK_UpdateFee_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
51172         LDKUpdateFee this_ptr_conv;
51173         this_ptr_conv.inner = untag_ptr(this_ptr);
51174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51176         this_ptr_conv.is_owned = false;
51177         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
51178 }
51179
51180 int64_t  CS_LDK_UpdateFee_new(int64_t channel_id_arg, int32_t feerate_per_kw_arg) {
51181         LDKChannelId channel_id_arg_conv;
51182         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51183         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51184         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51185         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51186         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
51187         int64_t ret_ref = 0;
51188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51190         return ret_ref;
51191 }
51192
51193 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
51194         LDKUpdateFee ret_var = UpdateFee_clone(arg);
51195         int64_t ret_ref = 0;
51196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51198         return ret_ref;
51199 }
51200 int64_t  CS_LDK_UpdateFee_clone_ptr(int64_t arg) {
51201         LDKUpdateFee arg_conv;
51202         arg_conv.inner = untag_ptr(arg);
51203         arg_conv.is_owned = ptr_is_owned(arg);
51204         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51205         arg_conv.is_owned = false;
51206         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
51207         return ret_conv;
51208 }
51209
51210 int64_t  CS_LDK_UpdateFee_clone(int64_t orig) {
51211         LDKUpdateFee orig_conv;
51212         orig_conv.inner = untag_ptr(orig);
51213         orig_conv.is_owned = ptr_is_owned(orig);
51214         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51215         orig_conv.is_owned = false;
51216         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
51217         int64_t ret_ref = 0;
51218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51220         return ret_ref;
51221 }
51222
51223 int64_t  CS_LDK_UpdateFee_hash(int64_t o) {
51224         LDKUpdateFee o_conv;
51225         o_conv.inner = untag_ptr(o);
51226         o_conv.is_owned = ptr_is_owned(o);
51227         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51228         o_conv.is_owned = false;
51229         int64_t ret_conv = UpdateFee_hash(&o_conv);
51230         return ret_conv;
51231 }
51232
51233 jboolean  CS_LDK_UpdateFee_eq(int64_t a, int64_t b) {
51234         LDKUpdateFee a_conv;
51235         a_conv.inner = untag_ptr(a);
51236         a_conv.is_owned = ptr_is_owned(a);
51237         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51238         a_conv.is_owned = false;
51239         LDKUpdateFee b_conv;
51240         b_conv.inner = untag_ptr(b);
51241         b_conv.is_owned = ptr_is_owned(b);
51242         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51243         b_conv.is_owned = false;
51244         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
51245         return ret_conv;
51246 }
51247
51248 void  CS_LDK_ChannelReestablish_free(int64_t this_obj) {
51249         LDKChannelReestablish this_obj_conv;
51250         this_obj_conv.inner = untag_ptr(this_obj);
51251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51253         ChannelReestablish_free(this_obj_conv);
51254 }
51255
51256 int64_t  CS_LDK_ChannelReestablish_get_channel_id(int64_t this_ptr) {
51257         LDKChannelReestablish this_ptr_conv;
51258         this_ptr_conv.inner = untag_ptr(this_ptr);
51259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51261         this_ptr_conv.is_owned = false;
51262         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
51263         int64_t ret_ref = 0;
51264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51266         return ret_ref;
51267 }
51268
51269 void  CS_LDK_ChannelReestablish_set_channel_id(int64_t this_ptr, int64_t val) {
51270         LDKChannelReestablish this_ptr_conv;
51271         this_ptr_conv.inner = untag_ptr(this_ptr);
51272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51274         this_ptr_conv.is_owned = false;
51275         LDKChannelId val_conv;
51276         val_conv.inner = untag_ptr(val);
51277         val_conv.is_owned = ptr_is_owned(val);
51278         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51279         val_conv = ChannelId_clone(&val_conv);
51280         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
51281 }
51282
51283 int64_t  CS_LDK_ChannelReestablish_get_next_local_commitment_number(int64_t this_ptr) {
51284         LDKChannelReestablish this_ptr_conv;
51285         this_ptr_conv.inner = untag_ptr(this_ptr);
51286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51288         this_ptr_conv.is_owned = false;
51289         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
51290         return ret_conv;
51291 }
51292
51293 void  CS_LDK_ChannelReestablish_set_next_local_commitment_number(int64_t this_ptr, int64_t val) {
51294         LDKChannelReestablish this_ptr_conv;
51295         this_ptr_conv.inner = untag_ptr(this_ptr);
51296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51298         this_ptr_conv.is_owned = false;
51299         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
51300 }
51301
51302 int64_t  CS_LDK_ChannelReestablish_get_next_remote_commitment_number(int64_t this_ptr) {
51303         LDKChannelReestablish this_ptr_conv;
51304         this_ptr_conv.inner = untag_ptr(this_ptr);
51305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51307         this_ptr_conv.is_owned = false;
51308         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
51309         return ret_conv;
51310 }
51311
51312 void  CS_LDK_ChannelReestablish_set_next_remote_commitment_number(int64_t this_ptr, int64_t val) {
51313         LDKChannelReestablish this_ptr_conv;
51314         this_ptr_conv.inner = untag_ptr(this_ptr);
51315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51317         this_ptr_conv.is_owned = false;
51318         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
51319 }
51320
51321 int8_tArray  CS_LDK_ChannelReestablish_get_your_last_per_commitment_secret(int64_t this_ptr) {
51322         LDKChannelReestablish this_ptr_conv;
51323         this_ptr_conv.inner = untag_ptr(this_ptr);
51324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51326         this_ptr_conv.is_owned = false;
51327         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51328         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
51329         return ret_arr;
51330 }
51331
51332 void  CS_LDK_ChannelReestablish_set_your_last_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
51333         LDKChannelReestablish this_ptr_conv;
51334         this_ptr_conv.inner = untag_ptr(this_ptr);
51335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51337         this_ptr_conv.is_owned = false;
51338         LDKThirtyTwoBytes val_ref;
51339         CHECK(val->arr_len == 32);
51340         memcpy(val_ref.data, val->elems, 32); FREE(val);
51341         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
51342 }
51343
51344 int8_tArray  CS_LDK_ChannelReestablish_get_my_current_per_commitment_point(int64_t this_ptr) {
51345         LDKChannelReestablish this_ptr_conv;
51346         this_ptr_conv.inner = untag_ptr(this_ptr);
51347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51349         this_ptr_conv.is_owned = false;
51350         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51351         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
51352         return ret_arr;
51353 }
51354
51355 void  CS_LDK_ChannelReestablish_set_my_current_per_commitment_point(int64_t this_ptr, int8_tArray val) {
51356         LDKChannelReestablish this_ptr_conv;
51357         this_ptr_conv.inner = untag_ptr(this_ptr);
51358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51360         this_ptr_conv.is_owned = false;
51361         LDKPublicKey val_ref;
51362         CHECK(val->arr_len == 33);
51363         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51364         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
51365 }
51366
51367 int64_t  CS_LDK_ChannelReestablish_get_next_funding_txid(int64_t this_ptr) {
51368         LDKChannelReestablish this_ptr_conv;
51369         this_ptr_conv.inner = untag_ptr(this_ptr);
51370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51372         this_ptr_conv.is_owned = false;
51373         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
51374         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
51375         int64_t ret_ref = tag_ptr(ret_copy, true);
51376         return ret_ref;
51377 }
51378
51379 void  CS_LDK_ChannelReestablish_set_next_funding_txid(int64_t this_ptr, int64_t val) {
51380         LDKChannelReestablish this_ptr_conv;
51381         this_ptr_conv.inner = untag_ptr(this_ptr);
51382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51384         this_ptr_conv.is_owned = false;
51385         void* val_ptr = untag_ptr(val);
51386         CHECK_ACCESS(val_ptr);
51387         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
51388         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
51389         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
51390 }
51391
51392 int64_t  CS_LDK_ChannelReestablish_new(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) {
51393         LDKChannelId channel_id_arg_conv;
51394         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51395         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51396         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51397         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51398         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
51399         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
51400         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
51401         LDKPublicKey my_current_per_commitment_point_arg_ref;
51402         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
51403         memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33); FREE(my_current_per_commitment_point_arg);
51404         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
51405         CHECK_ACCESS(next_funding_txid_arg_ptr);
51406         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
51407         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
51408         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);
51409         int64_t ret_ref = 0;
51410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51412         return ret_ref;
51413 }
51414
51415 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
51416         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
51417         int64_t ret_ref = 0;
51418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51420         return ret_ref;
51421 }
51422 int64_t  CS_LDK_ChannelReestablish_clone_ptr(int64_t arg) {
51423         LDKChannelReestablish arg_conv;
51424         arg_conv.inner = untag_ptr(arg);
51425         arg_conv.is_owned = ptr_is_owned(arg);
51426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51427         arg_conv.is_owned = false;
51428         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
51429         return ret_conv;
51430 }
51431
51432 int64_t  CS_LDK_ChannelReestablish_clone(int64_t orig) {
51433         LDKChannelReestablish orig_conv;
51434         orig_conv.inner = untag_ptr(orig);
51435         orig_conv.is_owned = ptr_is_owned(orig);
51436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51437         orig_conv.is_owned = false;
51438         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
51439         int64_t ret_ref = 0;
51440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51442         return ret_ref;
51443 }
51444
51445 int64_t  CS_LDK_ChannelReestablish_hash(int64_t o) {
51446         LDKChannelReestablish o_conv;
51447         o_conv.inner = untag_ptr(o);
51448         o_conv.is_owned = ptr_is_owned(o);
51449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51450         o_conv.is_owned = false;
51451         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
51452         return ret_conv;
51453 }
51454
51455 jboolean  CS_LDK_ChannelReestablish_eq(int64_t a, int64_t b) {
51456         LDKChannelReestablish a_conv;
51457         a_conv.inner = untag_ptr(a);
51458         a_conv.is_owned = ptr_is_owned(a);
51459         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51460         a_conv.is_owned = false;
51461         LDKChannelReestablish b_conv;
51462         b_conv.inner = untag_ptr(b);
51463         b_conv.is_owned = ptr_is_owned(b);
51464         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51465         b_conv.is_owned = false;
51466         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
51467         return ret_conv;
51468 }
51469
51470 void  CS_LDK_AnnouncementSignatures_free(int64_t this_obj) {
51471         LDKAnnouncementSignatures this_obj_conv;
51472         this_obj_conv.inner = untag_ptr(this_obj);
51473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51475         AnnouncementSignatures_free(this_obj_conv);
51476 }
51477
51478 int64_t  CS_LDK_AnnouncementSignatures_get_channel_id(int64_t this_ptr) {
51479         LDKAnnouncementSignatures this_ptr_conv;
51480         this_ptr_conv.inner = untag_ptr(this_ptr);
51481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51483         this_ptr_conv.is_owned = false;
51484         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
51485         int64_t ret_ref = 0;
51486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51488         return ret_ref;
51489 }
51490
51491 void  CS_LDK_AnnouncementSignatures_set_channel_id(int64_t this_ptr, int64_t val) {
51492         LDKAnnouncementSignatures this_ptr_conv;
51493         this_ptr_conv.inner = untag_ptr(this_ptr);
51494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51496         this_ptr_conv.is_owned = false;
51497         LDKChannelId val_conv;
51498         val_conv.inner = untag_ptr(val);
51499         val_conv.is_owned = ptr_is_owned(val);
51500         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51501         val_conv = ChannelId_clone(&val_conv);
51502         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
51503 }
51504
51505 int64_t  CS_LDK_AnnouncementSignatures_get_short_channel_id(int64_t this_ptr) {
51506         LDKAnnouncementSignatures this_ptr_conv;
51507         this_ptr_conv.inner = untag_ptr(this_ptr);
51508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51510         this_ptr_conv.is_owned = false;
51511         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
51512         return ret_conv;
51513 }
51514
51515 void  CS_LDK_AnnouncementSignatures_set_short_channel_id(int64_t this_ptr, int64_t val) {
51516         LDKAnnouncementSignatures this_ptr_conv;
51517         this_ptr_conv.inner = untag_ptr(this_ptr);
51518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51520         this_ptr_conv.is_owned = false;
51521         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
51522 }
51523
51524 int8_tArray  CS_LDK_AnnouncementSignatures_get_node_signature(int64_t this_ptr) {
51525         LDKAnnouncementSignatures this_ptr_conv;
51526         this_ptr_conv.inner = untag_ptr(this_ptr);
51527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51529         this_ptr_conv.is_owned = false;
51530         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51531         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
51532         return ret_arr;
51533 }
51534
51535 void  CS_LDK_AnnouncementSignatures_set_node_signature(int64_t this_ptr, int8_tArray val) {
51536         LDKAnnouncementSignatures this_ptr_conv;
51537         this_ptr_conv.inner = untag_ptr(this_ptr);
51538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51540         this_ptr_conv.is_owned = false;
51541         LDKECDSASignature val_ref;
51542         CHECK(val->arr_len == 64);
51543         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51544         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
51545 }
51546
51547 int8_tArray  CS_LDK_AnnouncementSignatures_get_bitcoin_signature(int64_t this_ptr) {
51548         LDKAnnouncementSignatures this_ptr_conv;
51549         this_ptr_conv.inner = untag_ptr(this_ptr);
51550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51552         this_ptr_conv.is_owned = false;
51553         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51554         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
51555         return ret_arr;
51556 }
51557
51558 void  CS_LDK_AnnouncementSignatures_set_bitcoin_signature(int64_t this_ptr, int8_tArray val) {
51559         LDKAnnouncementSignatures this_ptr_conv;
51560         this_ptr_conv.inner = untag_ptr(this_ptr);
51561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51563         this_ptr_conv.is_owned = false;
51564         LDKECDSASignature val_ref;
51565         CHECK(val->arr_len == 64);
51566         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51567         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
51568 }
51569
51570 int64_t  CS_LDK_AnnouncementSignatures_new(int64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
51571         LDKChannelId channel_id_arg_conv;
51572         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51573         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51574         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51575         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51576         LDKECDSASignature node_signature_arg_ref;
51577         CHECK(node_signature_arg->arr_len == 64);
51578         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
51579         LDKECDSASignature bitcoin_signature_arg_ref;
51580         CHECK(bitcoin_signature_arg->arr_len == 64);
51581         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
51582         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
51583         int64_t ret_ref = 0;
51584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51586         return ret_ref;
51587 }
51588
51589 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
51590         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
51591         int64_t ret_ref = 0;
51592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51594         return ret_ref;
51595 }
51596 int64_t  CS_LDK_AnnouncementSignatures_clone_ptr(int64_t arg) {
51597         LDKAnnouncementSignatures arg_conv;
51598         arg_conv.inner = untag_ptr(arg);
51599         arg_conv.is_owned = ptr_is_owned(arg);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51601         arg_conv.is_owned = false;
51602         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
51603         return ret_conv;
51604 }
51605
51606 int64_t  CS_LDK_AnnouncementSignatures_clone(int64_t orig) {
51607         LDKAnnouncementSignatures orig_conv;
51608         orig_conv.inner = untag_ptr(orig);
51609         orig_conv.is_owned = ptr_is_owned(orig);
51610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51611         orig_conv.is_owned = false;
51612         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
51613         int64_t ret_ref = 0;
51614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51616         return ret_ref;
51617 }
51618
51619 int64_t  CS_LDK_AnnouncementSignatures_hash(int64_t o) {
51620         LDKAnnouncementSignatures o_conv;
51621         o_conv.inner = untag_ptr(o);
51622         o_conv.is_owned = ptr_is_owned(o);
51623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51624         o_conv.is_owned = false;
51625         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
51626         return ret_conv;
51627 }
51628
51629 jboolean  CS_LDK_AnnouncementSignatures_eq(int64_t a, int64_t b) {
51630         LDKAnnouncementSignatures a_conv;
51631         a_conv.inner = untag_ptr(a);
51632         a_conv.is_owned = ptr_is_owned(a);
51633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51634         a_conv.is_owned = false;
51635         LDKAnnouncementSignatures b_conv;
51636         b_conv.inner = untag_ptr(b);
51637         b_conv.is_owned = ptr_is_owned(b);
51638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51639         b_conv.is_owned = false;
51640         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
51641         return ret_conv;
51642 }
51643
51644 void  CS_LDK_SocketAddress_free(int64_t this_ptr) {
51645         if (!ptr_is_owned(this_ptr)) return;
51646         void* this_ptr_ptr = untag_ptr(this_ptr);
51647         CHECK_ACCESS(this_ptr_ptr);
51648         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
51649         FREE(untag_ptr(this_ptr));
51650         SocketAddress_free(this_ptr_conv);
51651 }
51652
51653 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
51654         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51655         *ret_copy = SocketAddress_clone(arg);
51656         int64_t ret_ref = tag_ptr(ret_copy, true);
51657         return ret_ref;
51658 }
51659 int64_t  CS_LDK_SocketAddress_clone_ptr(int64_t arg) {
51660         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
51661         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
51662         return ret_conv;
51663 }
51664
51665 int64_t  CS_LDK_SocketAddress_clone(int64_t orig) {
51666         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
51667         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51668         *ret_copy = SocketAddress_clone(orig_conv);
51669         int64_t ret_ref = tag_ptr(ret_copy, true);
51670         return ret_ref;
51671 }
51672
51673 int64_t  CS_LDK_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
51674         LDKFourBytes addr_ref;
51675         CHECK(addr->arr_len == 4);
51676         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
51677         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51678         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
51679         int64_t ret_ref = tag_ptr(ret_copy, true);
51680         return ret_ref;
51681 }
51682
51683 int64_t  CS_LDK_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
51684         LDKSixteenBytes addr_ref;
51685         CHECK(addr->arr_len == 16);
51686         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
51687         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51688         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
51689         int64_t ret_ref = tag_ptr(ret_copy, true);
51690         return ret_ref;
51691 }
51692
51693 int64_t  CS_LDK_SocketAddress_onion_v2(int8_tArray a) {
51694         LDKTwelveBytes a_ref;
51695         CHECK(a->arr_len == 12);
51696         memcpy(a_ref.data, a->elems, 12); FREE(a);
51697         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51698         *ret_copy = SocketAddress_onion_v2(a_ref);
51699         int64_t ret_ref = tag_ptr(ret_copy, true);
51700         return ret_ref;
51701 }
51702
51703 int64_t  CS_LDK_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
51704         LDKThirtyTwoBytes ed25519_pubkey_ref;
51705         CHECK(ed25519_pubkey->arr_len == 32);
51706         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
51707         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51708         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
51709         int64_t ret_ref = tag_ptr(ret_copy, true);
51710         return ret_ref;
51711 }
51712
51713 int64_t  CS_LDK_SocketAddress_hostname(int64_t hostname, int16_t port) {
51714         LDKHostname hostname_conv;
51715         hostname_conv.inner = untag_ptr(hostname);
51716         hostname_conv.is_owned = ptr_is_owned(hostname);
51717         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
51718         hostname_conv = Hostname_clone(&hostname_conv);
51719         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
51720         *ret_copy = SocketAddress_hostname(hostname_conv, port);
51721         int64_t ret_ref = tag_ptr(ret_copy, true);
51722         return ret_ref;
51723 }
51724
51725 int64_t  CS_LDK_SocketAddress_hash(int64_t o) {
51726         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51727         int64_t ret_conv = SocketAddress_hash(o_conv);
51728         return ret_conv;
51729 }
51730
51731 jboolean  CS_LDK_SocketAddress_eq(int64_t a, int64_t b) {
51732         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
51733         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
51734         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
51735         return ret_conv;
51736 }
51737
51738 int8_tArray  CS_LDK_SocketAddress_write(int64_t obj) {
51739         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
51740         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
51741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51743         CVec_u8Z_free(ret_var);
51744         return ret_arr;
51745 }
51746
51747 int64_t  CS_LDK_SocketAddress_read(int8_tArray ser) {
51748         LDKu8slice ser_ref;
51749         ser_ref.datalen = ser->arr_len;
51750         ser_ref.data = ser->elems;
51751         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
51752         *ret_conv = SocketAddress_read(ser_ref);
51753         FREE(ser);
51754         return tag_ptr(ret_conv, true);
51755 }
51756
51757 int32_t  CS_LDK_SocketAddressParseError_clone(int64_t orig) {
51758         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
51759         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_clone(orig_conv));
51760         return ret_conv;
51761 }
51762
51763 int32_t  CS_LDK_SocketAddressParseError_socket_addr_parse() {
51764         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_socket_addr_parse());
51765         return ret_conv;
51766 }
51767
51768 int32_t  CS_LDK_SocketAddressParseError_invalid_input() {
51769         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_input());
51770         return ret_conv;
51771 }
51772
51773 int32_t  CS_LDK_SocketAddressParseError_invalid_port() {
51774         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_port());
51775         return ret_conv;
51776 }
51777
51778 int32_t  CS_LDK_SocketAddressParseError_invalid_onion_v3() {
51779         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_onion_v3());
51780         return ret_conv;
51781 }
51782
51783 int64_t  CS_LDK_SocketAddressParseError_hash(int64_t o) {
51784         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
51785         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
51786         return ret_conv;
51787 }
51788
51789 jboolean  CS_LDK_SocketAddressParseError_eq(int64_t a, int64_t b) {
51790         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
51791         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
51792         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
51793         return ret_conv;
51794 }
51795
51796 int64_t  CS_LDK_parse_onion_address(jstring host, int16_t port) {
51797         LDKStr host_conv = str_ref_to_owned_c(host);
51798         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
51799         *ret_conv = parse_onion_address(host_conv, port);
51800         return tag_ptr(ret_conv, true);
51801 }
51802
51803 jstring  CS_LDK_SocketAddress_to_str(int64_t o) {
51804         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
51805         LDKStr ret_str = SocketAddress_to_str(o_conv);
51806         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
51807         Str_free(ret_str);
51808         return ret_conv;
51809 }
51810
51811 int64_t  CS_LDK_SocketAddress_from_str(jstring s) {
51812         LDKStr s_conv = str_ref_to_owned_c(s);
51813         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
51814         *ret_conv = SocketAddress_from_str(s_conv);
51815         return tag_ptr(ret_conv, true);
51816 }
51817
51818 void  CS_LDK_UnsignedGossipMessage_free(int64_t this_ptr) {
51819         if (!ptr_is_owned(this_ptr)) return;
51820         void* this_ptr_ptr = untag_ptr(this_ptr);
51821         CHECK_ACCESS(this_ptr_ptr);
51822         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
51823         FREE(untag_ptr(this_ptr));
51824         UnsignedGossipMessage_free(this_ptr_conv);
51825 }
51826
51827 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
51828         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51829         *ret_copy = UnsignedGossipMessage_clone(arg);
51830         int64_t ret_ref = tag_ptr(ret_copy, true);
51831         return ret_ref;
51832 }
51833 int64_t  CS_LDK_UnsignedGossipMessage_clone_ptr(int64_t arg) {
51834         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
51835         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
51836         return ret_conv;
51837 }
51838
51839 int64_t  CS_LDK_UnsignedGossipMessage_clone(int64_t orig) {
51840         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
51841         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51842         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
51843         int64_t ret_ref = tag_ptr(ret_copy, true);
51844         return ret_ref;
51845 }
51846
51847 int64_t  CS_LDK_UnsignedGossipMessage_channel_announcement(int64_t a) {
51848         LDKUnsignedChannelAnnouncement a_conv;
51849         a_conv.inner = untag_ptr(a);
51850         a_conv.is_owned = ptr_is_owned(a);
51851         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51852         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
51853         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51854         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
51855         int64_t ret_ref = tag_ptr(ret_copy, true);
51856         return ret_ref;
51857 }
51858
51859 int64_t  CS_LDK_UnsignedGossipMessage_channel_update(int64_t a) {
51860         LDKUnsignedChannelUpdate a_conv;
51861         a_conv.inner = untag_ptr(a);
51862         a_conv.is_owned = ptr_is_owned(a);
51863         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51864         a_conv = UnsignedChannelUpdate_clone(&a_conv);
51865         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51866         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
51867         int64_t ret_ref = tag_ptr(ret_copy, true);
51868         return ret_ref;
51869 }
51870
51871 int64_t  CS_LDK_UnsignedGossipMessage_node_announcement(int64_t a) {
51872         LDKUnsignedNodeAnnouncement a_conv;
51873         a_conv.inner = untag_ptr(a);
51874         a_conv.is_owned = ptr_is_owned(a);
51875         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51876         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
51877         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
51878         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
51879         int64_t ret_ref = tag_ptr(ret_copy, true);
51880         return ret_ref;
51881 }
51882
51883 int8_tArray  CS_LDK_UnsignedGossipMessage_write(int64_t obj) {
51884         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
51885         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
51886         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51887         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51888         CVec_u8Z_free(ret_var);
51889         return ret_arr;
51890 }
51891
51892 void  CS_LDK_UnsignedNodeAnnouncement_free(int64_t this_obj) {
51893         LDKUnsignedNodeAnnouncement this_obj_conv;
51894         this_obj_conv.inner = untag_ptr(this_obj);
51895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51897         UnsignedNodeAnnouncement_free(this_obj_conv);
51898 }
51899
51900 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_features(int64_t this_ptr) {
51901         LDKUnsignedNodeAnnouncement this_ptr_conv;
51902         this_ptr_conv.inner = untag_ptr(this_ptr);
51903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51905         this_ptr_conv.is_owned = false;
51906         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
51907         int64_t ret_ref = 0;
51908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51910         return ret_ref;
51911 }
51912
51913 void  CS_LDK_UnsignedNodeAnnouncement_set_features(int64_t this_ptr, int64_t val) {
51914         LDKUnsignedNodeAnnouncement this_ptr_conv;
51915         this_ptr_conv.inner = untag_ptr(this_ptr);
51916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51918         this_ptr_conv.is_owned = false;
51919         LDKNodeFeatures val_conv;
51920         val_conv.inner = untag_ptr(val);
51921         val_conv.is_owned = ptr_is_owned(val);
51922         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51923         val_conv = NodeFeatures_clone(&val_conv);
51924         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
51925 }
51926
51927 int32_t  CS_LDK_UnsignedNodeAnnouncement_get_timestamp(int64_t this_ptr) {
51928         LDKUnsignedNodeAnnouncement this_ptr_conv;
51929         this_ptr_conv.inner = untag_ptr(this_ptr);
51930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51932         this_ptr_conv.is_owned = false;
51933         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
51934         return ret_conv;
51935 }
51936
51937 void  CS_LDK_UnsignedNodeAnnouncement_set_timestamp(int64_t this_ptr, int32_t val) {
51938         LDKUnsignedNodeAnnouncement this_ptr_conv;
51939         this_ptr_conv.inner = untag_ptr(this_ptr);
51940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51942         this_ptr_conv.is_owned = false;
51943         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
51944 }
51945
51946 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_node_id(int64_t this_ptr) {
51947         LDKUnsignedNodeAnnouncement this_ptr_conv;
51948         this_ptr_conv.inner = untag_ptr(this_ptr);
51949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51951         this_ptr_conv.is_owned = false;
51952         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
51953         int64_t ret_ref = 0;
51954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51956         return ret_ref;
51957 }
51958
51959 void  CS_LDK_UnsignedNodeAnnouncement_set_node_id(int64_t this_ptr, int64_t val) {
51960         LDKUnsignedNodeAnnouncement this_ptr_conv;
51961         this_ptr_conv.inner = untag_ptr(this_ptr);
51962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51964         this_ptr_conv.is_owned = false;
51965         LDKNodeId val_conv;
51966         val_conv.inner = untag_ptr(val);
51967         val_conv.is_owned = ptr_is_owned(val);
51968         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51969         val_conv = NodeId_clone(&val_conv);
51970         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
51971 }
51972
51973 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_rgb(int64_t this_ptr) {
51974         LDKUnsignedNodeAnnouncement this_ptr_conv;
51975         this_ptr_conv.inner = untag_ptr(this_ptr);
51976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51978         this_ptr_conv.is_owned = false;
51979         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
51980         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
51981         return ret_arr;
51982 }
51983
51984 void  CS_LDK_UnsignedNodeAnnouncement_set_rgb(int64_t this_ptr, int8_tArray val) {
51985         LDKUnsignedNodeAnnouncement this_ptr_conv;
51986         this_ptr_conv.inner = untag_ptr(this_ptr);
51987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51989         this_ptr_conv.is_owned = false;
51990         LDKThreeBytes val_ref;
51991         CHECK(val->arr_len == 3);
51992         memcpy(val_ref.data, val->elems, 3); FREE(val);
51993         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
51994 }
51995
51996 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_alias(int64_t this_ptr) {
51997         LDKUnsignedNodeAnnouncement this_ptr_conv;
51998         this_ptr_conv.inner = untag_ptr(this_ptr);
51999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52001         this_ptr_conv.is_owned = false;
52002         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
52003         int64_t ret_ref = 0;
52004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52006         return ret_ref;
52007 }
52008
52009 void  CS_LDK_UnsignedNodeAnnouncement_set_alias(int64_t this_ptr, int64_t val) {
52010         LDKUnsignedNodeAnnouncement this_ptr_conv;
52011         this_ptr_conv.inner = untag_ptr(this_ptr);
52012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52014         this_ptr_conv.is_owned = false;
52015         LDKNodeAlias val_conv;
52016         val_conv.inner = untag_ptr(val);
52017         val_conv.is_owned = ptr_is_owned(val);
52018         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52019         val_conv = NodeAlias_clone(&val_conv);
52020         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
52021 }
52022
52023 int64_tArray  CS_LDK_UnsignedNodeAnnouncement_get_addresses(int64_t this_ptr) {
52024         LDKUnsignedNodeAnnouncement this_ptr_conv;
52025         this_ptr_conv.inner = untag_ptr(this_ptr);
52026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52028         this_ptr_conv.is_owned = false;
52029         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
52030         int64_tArray ret_arr = NULL;
52031         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
52032         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
52033         for (size_t p = 0; p < ret_var.datalen; p++) {
52034                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52035                 *ret_conv_15_copy = ret_var.data[p];
52036                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
52037                 ret_arr_ptr[p] = ret_conv_15_ref;
52038         }
52039         
52040         FREE(ret_var.data);
52041         return ret_arr;
52042 }
52043
52044 void  CS_LDK_UnsignedNodeAnnouncement_set_addresses(int64_t this_ptr, int64_tArray val) {
52045         LDKUnsignedNodeAnnouncement this_ptr_conv;
52046         this_ptr_conv.inner = untag_ptr(this_ptr);
52047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52049         this_ptr_conv.is_owned = false;
52050         LDKCVec_SocketAddressZ val_constr;
52051         val_constr.datalen = val->arr_len;
52052         if (val_constr.datalen > 0)
52053                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52054         else
52055                 val_constr.data = NULL;
52056         int64_t* val_vals = val->elems;
52057         for (size_t p = 0; p < val_constr.datalen; p++) {
52058                 int64_t val_conv_15 = val_vals[p];
52059                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
52060                 CHECK_ACCESS(val_conv_15_ptr);
52061                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
52062                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
52063                 val_constr.data[p] = val_conv_15_conv;
52064         }
52065         FREE(val);
52066         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
52067 }
52068
52069 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_excess_address_data(int64_t this_ptr) {
52070         LDKUnsignedNodeAnnouncement this_ptr_conv;
52071         this_ptr_conv.inner = untag_ptr(this_ptr);
52072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52074         this_ptr_conv.is_owned = false;
52075         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
52076         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52077         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52078         CVec_u8Z_free(ret_var);
52079         return ret_arr;
52080 }
52081
52082 void  CS_LDK_UnsignedNodeAnnouncement_set_excess_address_data(int64_t this_ptr, int8_tArray val) {
52083         LDKUnsignedNodeAnnouncement this_ptr_conv;
52084         this_ptr_conv.inner = untag_ptr(this_ptr);
52085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52087         this_ptr_conv.is_owned = false;
52088         LDKCVec_u8Z val_ref;
52089         val_ref.datalen = val->arr_len;
52090         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52091         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52092         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
52093 }
52094
52095 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_excess_data(int64_t this_ptr) {
52096         LDKUnsignedNodeAnnouncement this_ptr_conv;
52097         this_ptr_conv.inner = untag_ptr(this_ptr);
52098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52100         this_ptr_conv.is_owned = false;
52101         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
52102         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52103         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52104         CVec_u8Z_free(ret_var);
52105         return ret_arr;
52106 }
52107
52108 void  CS_LDK_UnsignedNodeAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
52109         LDKUnsignedNodeAnnouncement this_ptr_conv;
52110         this_ptr_conv.inner = untag_ptr(this_ptr);
52111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52113         this_ptr_conv.is_owned = false;
52114         LDKCVec_u8Z val_ref;
52115         val_ref.datalen = val->arr_len;
52116         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52117         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52118         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
52119 }
52120
52121 int64_t  CS_LDK_UnsignedNodeAnnouncement_new(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) {
52122         LDKNodeFeatures features_arg_conv;
52123         features_arg_conv.inner = untag_ptr(features_arg);
52124         features_arg_conv.is_owned = ptr_is_owned(features_arg);
52125         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
52126         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
52127         LDKNodeId node_id_arg_conv;
52128         node_id_arg_conv.inner = untag_ptr(node_id_arg);
52129         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
52130         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
52131         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
52132         LDKThreeBytes rgb_arg_ref;
52133         CHECK(rgb_arg->arr_len == 3);
52134         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
52135         LDKNodeAlias alias_arg_conv;
52136         alias_arg_conv.inner = untag_ptr(alias_arg);
52137         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
52138         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
52139         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
52140         LDKCVec_SocketAddressZ addresses_arg_constr;
52141         addresses_arg_constr.datalen = addresses_arg->arr_len;
52142         if (addresses_arg_constr.datalen > 0)
52143                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52144         else
52145                 addresses_arg_constr.data = NULL;
52146         int64_t* addresses_arg_vals = addresses_arg->elems;
52147         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
52148                 int64_t addresses_arg_conv_15 = addresses_arg_vals[p];
52149                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
52150                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
52151                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
52152                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
52153         }
52154         FREE(addresses_arg);
52155         LDKCVec_u8Z excess_address_data_arg_ref;
52156         excess_address_data_arg_ref.datalen = excess_address_data_arg->arr_len;
52157         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52158         memcpy(excess_address_data_arg_ref.data, excess_address_data_arg->elems, excess_address_data_arg_ref.datalen); FREE(excess_address_data_arg);
52159         LDKCVec_u8Z excess_data_arg_ref;
52160         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52161         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52162         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52163         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);
52164         int64_t ret_ref = 0;
52165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52167         return ret_ref;
52168 }
52169
52170 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
52171         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
52172         int64_t ret_ref = 0;
52173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52175         return ret_ref;
52176 }
52177 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone_ptr(int64_t arg) {
52178         LDKUnsignedNodeAnnouncement arg_conv;
52179         arg_conv.inner = untag_ptr(arg);
52180         arg_conv.is_owned = ptr_is_owned(arg);
52181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52182         arg_conv.is_owned = false;
52183         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
52184         return ret_conv;
52185 }
52186
52187 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone(int64_t orig) {
52188         LDKUnsignedNodeAnnouncement orig_conv;
52189         orig_conv.inner = untag_ptr(orig);
52190         orig_conv.is_owned = ptr_is_owned(orig);
52191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52192         orig_conv.is_owned = false;
52193         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
52194         int64_t ret_ref = 0;
52195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52197         return ret_ref;
52198 }
52199
52200 int64_t  CS_LDK_UnsignedNodeAnnouncement_hash(int64_t o) {
52201         LDKUnsignedNodeAnnouncement o_conv;
52202         o_conv.inner = untag_ptr(o);
52203         o_conv.is_owned = ptr_is_owned(o);
52204         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52205         o_conv.is_owned = false;
52206         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
52207         return ret_conv;
52208 }
52209
52210 jboolean  CS_LDK_UnsignedNodeAnnouncement_eq(int64_t a, int64_t b) {
52211         LDKUnsignedNodeAnnouncement a_conv;
52212         a_conv.inner = untag_ptr(a);
52213         a_conv.is_owned = ptr_is_owned(a);
52214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52215         a_conv.is_owned = false;
52216         LDKUnsignedNodeAnnouncement b_conv;
52217         b_conv.inner = untag_ptr(b);
52218         b_conv.is_owned = ptr_is_owned(b);
52219         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52220         b_conv.is_owned = false;
52221         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
52222         return ret_conv;
52223 }
52224
52225 void  CS_LDK_NodeAnnouncement_free(int64_t this_obj) {
52226         LDKNodeAnnouncement this_obj_conv;
52227         this_obj_conv.inner = untag_ptr(this_obj);
52228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52230         NodeAnnouncement_free(this_obj_conv);
52231 }
52232
52233 int8_tArray  CS_LDK_NodeAnnouncement_get_signature(int64_t this_ptr) {
52234         LDKNodeAnnouncement this_ptr_conv;
52235         this_ptr_conv.inner = untag_ptr(this_ptr);
52236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52238         this_ptr_conv.is_owned = false;
52239         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52240         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
52241         return ret_arr;
52242 }
52243
52244 void  CS_LDK_NodeAnnouncement_set_signature(int64_t this_ptr, int8_tArray val) {
52245         LDKNodeAnnouncement this_ptr_conv;
52246         this_ptr_conv.inner = untag_ptr(this_ptr);
52247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52249         this_ptr_conv.is_owned = false;
52250         LDKECDSASignature val_ref;
52251         CHECK(val->arr_len == 64);
52252         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52253         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
52254 }
52255
52256 int64_t  CS_LDK_NodeAnnouncement_get_contents(int64_t this_ptr) {
52257         LDKNodeAnnouncement this_ptr_conv;
52258         this_ptr_conv.inner = untag_ptr(this_ptr);
52259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52261         this_ptr_conv.is_owned = false;
52262         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
52263         int64_t ret_ref = 0;
52264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52266         return ret_ref;
52267 }
52268
52269 void  CS_LDK_NodeAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
52270         LDKNodeAnnouncement this_ptr_conv;
52271         this_ptr_conv.inner = untag_ptr(this_ptr);
52272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52274         this_ptr_conv.is_owned = false;
52275         LDKUnsignedNodeAnnouncement val_conv;
52276         val_conv.inner = untag_ptr(val);
52277         val_conv.is_owned = ptr_is_owned(val);
52278         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52279         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
52280         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
52281 }
52282
52283 int64_t  CS_LDK_NodeAnnouncement_new(int8_tArray signature_arg, int64_t contents_arg) {
52284         LDKECDSASignature signature_arg_ref;
52285         CHECK(signature_arg->arr_len == 64);
52286         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
52287         LDKUnsignedNodeAnnouncement contents_arg_conv;
52288         contents_arg_conv.inner = untag_ptr(contents_arg);
52289         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52290         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52291         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
52292         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
52293         int64_t ret_ref = 0;
52294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52296         return ret_ref;
52297 }
52298
52299 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
52300         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
52301         int64_t ret_ref = 0;
52302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52304         return ret_ref;
52305 }
52306 int64_t  CS_LDK_NodeAnnouncement_clone_ptr(int64_t arg) {
52307         LDKNodeAnnouncement arg_conv;
52308         arg_conv.inner = untag_ptr(arg);
52309         arg_conv.is_owned = ptr_is_owned(arg);
52310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52311         arg_conv.is_owned = false;
52312         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
52313         return ret_conv;
52314 }
52315
52316 int64_t  CS_LDK_NodeAnnouncement_clone(int64_t orig) {
52317         LDKNodeAnnouncement orig_conv;
52318         orig_conv.inner = untag_ptr(orig);
52319         orig_conv.is_owned = ptr_is_owned(orig);
52320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52321         orig_conv.is_owned = false;
52322         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
52323         int64_t ret_ref = 0;
52324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52326         return ret_ref;
52327 }
52328
52329 int64_t  CS_LDK_NodeAnnouncement_hash(int64_t o) {
52330         LDKNodeAnnouncement o_conv;
52331         o_conv.inner = untag_ptr(o);
52332         o_conv.is_owned = ptr_is_owned(o);
52333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52334         o_conv.is_owned = false;
52335         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
52336         return ret_conv;
52337 }
52338
52339 jboolean  CS_LDK_NodeAnnouncement_eq(int64_t a, int64_t b) {
52340         LDKNodeAnnouncement a_conv;
52341         a_conv.inner = untag_ptr(a);
52342         a_conv.is_owned = ptr_is_owned(a);
52343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52344         a_conv.is_owned = false;
52345         LDKNodeAnnouncement b_conv;
52346         b_conv.inner = untag_ptr(b);
52347         b_conv.is_owned = ptr_is_owned(b);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52349         b_conv.is_owned = false;
52350         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
52351         return ret_conv;
52352 }
52353
52354 void  CS_LDK_UnsignedChannelAnnouncement_free(int64_t this_obj) {
52355         LDKUnsignedChannelAnnouncement this_obj_conv;
52356         this_obj_conv.inner = untag_ptr(this_obj);
52357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52359         UnsignedChannelAnnouncement_free(this_obj_conv);
52360 }
52361
52362 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_features(int64_t this_ptr) {
52363         LDKUnsignedChannelAnnouncement this_ptr_conv;
52364         this_ptr_conv.inner = untag_ptr(this_ptr);
52365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52367         this_ptr_conv.is_owned = false;
52368         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
52369         int64_t ret_ref = 0;
52370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52372         return ret_ref;
52373 }
52374
52375 void  CS_LDK_UnsignedChannelAnnouncement_set_features(int64_t this_ptr, int64_t val) {
52376         LDKUnsignedChannelAnnouncement 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         LDKChannelFeatures val_conv;
52382         val_conv.inner = untag_ptr(val);
52383         val_conv.is_owned = ptr_is_owned(val);
52384         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52385         val_conv = ChannelFeatures_clone(&val_conv);
52386         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
52387 }
52388
52389 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_chain_hash(int64_t this_ptr) {
52390         LDKUnsignedChannelAnnouncement this_ptr_conv;
52391         this_ptr_conv.inner = untag_ptr(this_ptr);
52392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52394         this_ptr_conv.is_owned = false;
52395         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52396         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
52397         return ret_arr;
52398 }
52399
52400 void  CS_LDK_UnsignedChannelAnnouncement_set_chain_hash(int64_t this_ptr, int8_tArray val) {
52401         LDKUnsignedChannelAnnouncement this_ptr_conv;
52402         this_ptr_conv.inner = untag_ptr(this_ptr);
52403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52405         this_ptr_conv.is_owned = false;
52406         LDKThirtyTwoBytes val_ref;
52407         CHECK(val->arr_len == 32);
52408         memcpy(val_ref.data, val->elems, 32); FREE(val);
52409         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
52410 }
52411
52412 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_short_channel_id(int64_t this_ptr) {
52413         LDKUnsignedChannelAnnouncement this_ptr_conv;
52414         this_ptr_conv.inner = untag_ptr(this_ptr);
52415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52417         this_ptr_conv.is_owned = false;
52418         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
52419         return ret_conv;
52420 }
52421
52422 void  CS_LDK_UnsignedChannelAnnouncement_set_short_channel_id(int64_t this_ptr, int64_t val) {
52423         LDKUnsignedChannelAnnouncement this_ptr_conv;
52424         this_ptr_conv.inner = untag_ptr(this_ptr);
52425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52427         this_ptr_conv.is_owned = false;
52428         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
52429 }
52430
52431 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_1(int64_t this_ptr) {
52432         LDKUnsignedChannelAnnouncement this_ptr_conv;
52433         this_ptr_conv.inner = untag_ptr(this_ptr);
52434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52436         this_ptr_conv.is_owned = false;
52437         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
52438         int64_t ret_ref = 0;
52439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52441         return ret_ref;
52442 }
52443
52444 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_1(int64_t this_ptr, int64_t val) {
52445         LDKUnsignedChannelAnnouncement this_ptr_conv;
52446         this_ptr_conv.inner = untag_ptr(this_ptr);
52447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52449         this_ptr_conv.is_owned = false;
52450         LDKNodeId val_conv;
52451         val_conv.inner = untag_ptr(val);
52452         val_conv.is_owned = ptr_is_owned(val);
52453         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52454         val_conv = NodeId_clone(&val_conv);
52455         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
52456 }
52457
52458 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_2(int64_t this_ptr) {
52459         LDKUnsignedChannelAnnouncement this_ptr_conv;
52460         this_ptr_conv.inner = untag_ptr(this_ptr);
52461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52463         this_ptr_conv.is_owned = false;
52464         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
52465         int64_t ret_ref = 0;
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52468         return ret_ref;
52469 }
52470
52471 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_2(int64_t this_ptr, int64_t val) {
52472         LDKUnsignedChannelAnnouncement this_ptr_conv;
52473         this_ptr_conv.inner = untag_ptr(this_ptr);
52474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52476         this_ptr_conv.is_owned = false;
52477         LDKNodeId val_conv;
52478         val_conv.inner = untag_ptr(val);
52479         val_conv.is_owned = ptr_is_owned(val);
52480         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52481         val_conv = NodeId_clone(&val_conv);
52482         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
52483 }
52484
52485 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_1(int64_t this_ptr) {
52486         LDKUnsignedChannelAnnouncement this_ptr_conv;
52487         this_ptr_conv.inner = untag_ptr(this_ptr);
52488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52490         this_ptr_conv.is_owned = false;
52491         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
52492         int64_t ret_ref = 0;
52493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52495         return ret_ref;
52496 }
52497
52498 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_1(int64_t this_ptr, int64_t val) {
52499         LDKUnsignedChannelAnnouncement this_ptr_conv;
52500         this_ptr_conv.inner = untag_ptr(this_ptr);
52501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52503         this_ptr_conv.is_owned = false;
52504         LDKNodeId val_conv;
52505         val_conv.inner = untag_ptr(val);
52506         val_conv.is_owned = ptr_is_owned(val);
52507         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52508         val_conv = NodeId_clone(&val_conv);
52509         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
52510 }
52511
52512 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_2(int64_t this_ptr) {
52513         LDKUnsignedChannelAnnouncement this_ptr_conv;
52514         this_ptr_conv.inner = untag_ptr(this_ptr);
52515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52517         this_ptr_conv.is_owned = false;
52518         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
52519         int64_t ret_ref = 0;
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52522         return ret_ref;
52523 }
52524
52525 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_2(int64_t this_ptr, int64_t val) {
52526         LDKUnsignedChannelAnnouncement this_ptr_conv;
52527         this_ptr_conv.inner = untag_ptr(this_ptr);
52528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52530         this_ptr_conv.is_owned = false;
52531         LDKNodeId val_conv;
52532         val_conv.inner = untag_ptr(val);
52533         val_conv.is_owned = ptr_is_owned(val);
52534         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52535         val_conv = NodeId_clone(&val_conv);
52536         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
52537 }
52538
52539 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_excess_data(int64_t this_ptr) {
52540         LDKUnsignedChannelAnnouncement this_ptr_conv;
52541         this_ptr_conv.inner = untag_ptr(this_ptr);
52542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52544         this_ptr_conv.is_owned = false;
52545         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
52546         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52547         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52548         CVec_u8Z_free(ret_var);
52549         return ret_arr;
52550 }
52551
52552 void  CS_LDK_UnsignedChannelAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
52553         LDKUnsignedChannelAnnouncement this_ptr_conv;
52554         this_ptr_conv.inner = untag_ptr(this_ptr);
52555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52557         this_ptr_conv.is_owned = false;
52558         LDKCVec_u8Z val_ref;
52559         val_ref.datalen = val->arr_len;
52560         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
52561         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
52562         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
52563 }
52564
52565 int64_t  CS_LDK_UnsignedChannelAnnouncement_new(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) {
52566         LDKChannelFeatures features_arg_conv;
52567         features_arg_conv.inner = untag_ptr(features_arg);
52568         features_arg_conv.is_owned = ptr_is_owned(features_arg);
52569         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
52570         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
52571         LDKThirtyTwoBytes chain_hash_arg_ref;
52572         CHECK(chain_hash_arg->arr_len == 32);
52573         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
52574         LDKNodeId node_id_1_arg_conv;
52575         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
52576         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
52577         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
52578         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
52579         LDKNodeId node_id_2_arg_conv;
52580         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
52581         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
52582         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
52583         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
52584         LDKNodeId bitcoin_key_1_arg_conv;
52585         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
52586         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
52587         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
52588         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
52589         LDKNodeId bitcoin_key_2_arg_conv;
52590         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
52591         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
52592         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
52593         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
52594         LDKCVec_u8Z excess_data_arg_ref;
52595         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
52596         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
52597         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
52598         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);
52599         int64_t ret_ref = 0;
52600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52602         return ret_ref;
52603 }
52604
52605 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
52606         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
52607         int64_t ret_ref = 0;
52608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52610         return ret_ref;
52611 }
52612 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone_ptr(int64_t arg) {
52613         LDKUnsignedChannelAnnouncement arg_conv;
52614         arg_conv.inner = untag_ptr(arg);
52615         arg_conv.is_owned = ptr_is_owned(arg);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52617         arg_conv.is_owned = false;
52618         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
52619         return ret_conv;
52620 }
52621
52622 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone(int64_t orig) {
52623         LDKUnsignedChannelAnnouncement orig_conv;
52624         orig_conv.inner = untag_ptr(orig);
52625         orig_conv.is_owned = ptr_is_owned(orig);
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52627         orig_conv.is_owned = false;
52628         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
52629         int64_t ret_ref = 0;
52630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52632         return ret_ref;
52633 }
52634
52635 int64_t  CS_LDK_UnsignedChannelAnnouncement_hash(int64_t o) {
52636         LDKUnsignedChannelAnnouncement o_conv;
52637         o_conv.inner = untag_ptr(o);
52638         o_conv.is_owned = ptr_is_owned(o);
52639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52640         o_conv.is_owned = false;
52641         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
52642         return ret_conv;
52643 }
52644
52645 jboolean  CS_LDK_UnsignedChannelAnnouncement_eq(int64_t a, int64_t b) {
52646         LDKUnsignedChannelAnnouncement a_conv;
52647         a_conv.inner = untag_ptr(a);
52648         a_conv.is_owned = ptr_is_owned(a);
52649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52650         a_conv.is_owned = false;
52651         LDKUnsignedChannelAnnouncement b_conv;
52652         b_conv.inner = untag_ptr(b);
52653         b_conv.is_owned = ptr_is_owned(b);
52654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52655         b_conv.is_owned = false;
52656         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
52657         return ret_conv;
52658 }
52659
52660 void  CS_LDK_ChannelAnnouncement_free(int64_t this_obj) {
52661         LDKChannelAnnouncement this_obj_conv;
52662         this_obj_conv.inner = untag_ptr(this_obj);
52663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52665         ChannelAnnouncement_free(this_obj_conv);
52666 }
52667
52668 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_1(int64_t this_ptr) {
52669         LDKChannelAnnouncement this_ptr_conv;
52670         this_ptr_conv.inner = untag_ptr(this_ptr);
52671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52673         this_ptr_conv.is_owned = false;
52674         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52675         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
52676         return ret_arr;
52677 }
52678
52679 void  CS_LDK_ChannelAnnouncement_set_node_signature_1(int64_t this_ptr, int8_tArray val) {
52680         LDKChannelAnnouncement this_ptr_conv;
52681         this_ptr_conv.inner = untag_ptr(this_ptr);
52682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52684         this_ptr_conv.is_owned = false;
52685         LDKECDSASignature val_ref;
52686         CHECK(val->arr_len == 64);
52687         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52688         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
52689 }
52690
52691 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_2(int64_t this_ptr) {
52692         LDKChannelAnnouncement this_ptr_conv;
52693         this_ptr_conv.inner = untag_ptr(this_ptr);
52694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52696         this_ptr_conv.is_owned = false;
52697         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52698         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
52699         return ret_arr;
52700 }
52701
52702 void  CS_LDK_ChannelAnnouncement_set_node_signature_2(int64_t this_ptr, int8_tArray val) {
52703         LDKChannelAnnouncement this_ptr_conv;
52704         this_ptr_conv.inner = untag_ptr(this_ptr);
52705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52707         this_ptr_conv.is_owned = false;
52708         LDKECDSASignature val_ref;
52709         CHECK(val->arr_len == 64);
52710         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52711         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
52712 }
52713
52714 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_1(int64_t this_ptr) {
52715         LDKChannelAnnouncement this_ptr_conv;
52716         this_ptr_conv.inner = untag_ptr(this_ptr);
52717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52719         this_ptr_conv.is_owned = false;
52720         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52721         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
52722         return ret_arr;
52723 }
52724
52725 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_1(int64_t this_ptr, int8_tArray val) {
52726         LDKChannelAnnouncement this_ptr_conv;
52727         this_ptr_conv.inner = untag_ptr(this_ptr);
52728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52730         this_ptr_conv.is_owned = false;
52731         LDKECDSASignature val_ref;
52732         CHECK(val->arr_len == 64);
52733         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52734         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
52735 }
52736
52737 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_2(int64_t this_ptr) {
52738         LDKChannelAnnouncement this_ptr_conv;
52739         this_ptr_conv.inner = untag_ptr(this_ptr);
52740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52742         this_ptr_conv.is_owned = false;
52743         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52744         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
52745         return ret_arr;
52746 }
52747
52748 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_2(int64_t this_ptr, int8_tArray val) {
52749         LDKChannelAnnouncement this_ptr_conv;
52750         this_ptr_conv.inner = untag_ptr(this_ptr);
52751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52753         this_ptr_conv.is_owned = false;
52754         LDKECDSASignature val_ref;
52755         CHECK(val->arr_len == 64);
52756         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52757         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
52758 }
52759
52760 int64_t  CS_LDK_ChannelAnnouncement_get_contents(int64_t this_ptr) {
52761         LDKChannelAnnouncement this_ptr_conv;
52762         this_ptr_conv.inner = untag_ptr(this_ptr);
52763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52765         this_ptr_conv.is_owned = false;
52766         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
52767         int64_t ret_ref = 0;
52768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52770         return ret_ref;
52771 }
52772
52773 void  CS_LDK_ChannelAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
52774         LDKChannelAnnouncement this_ptr_conv;
52775         this_ptr_conv.inner = untag_ptr(this_ptr);
52776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52778         this_ptr_conv.is_owned = false;
52779         LDKUnsignedChannelAnnouncement val_conv;
52780         val_conv.inner = untag_ptr(val);
52781         val_conv.is_owned = ptr_is_owned(val);
52782         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52783         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
52784         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
52785 }
52786
52787 int64_t  CS_LDK_ChannelAnnouncement_new(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) {
52788         LDKECDSASignature node_signature_1_arg_ref;
52789         CHECK(node_signature_1_arg->arr_len == 64);
52790         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
52791         LDKECDSASignature node_signature_2_arg_ref;
52792         CHECK(node_signature_2_arg->arr_len == 64);
52793         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
52794         LDKECDSASignature bitcoin_signature_1_arg_ref;
52795         CHECK(bitcoin_signature_1_arg->arr_len == 64);
52796         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
52797         LDKECDSASignature bitcoin_signature_2_arg_ref;
52798         CHECK(bitcoin_signature_2_arg->arr_len == 64);
52799         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
52800         LDKUnsignedChannelAnnouncement contents_arg_conv;
52801         contents_arg_conv.inner = untag_ptr(contents_arg);
52802         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
52803         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
52804         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
52805         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);
52806         int64_t ret_ref = 0;
52807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52809         return ret_ref;
52810 }
52811
52812 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
52813         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
52814         int64_t ret_ref = 0;
52815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52817         return ret_ref;
52818 }
52819 int64_t  CS_LDK_ChannelAnnouncement_clone_ptr(int64_t arg) {
52820         LDKChannelAnnouncement arg_conv;
52821         arg_conv.inner = untag_ptr(arg);
52822         arg_conv.is_owned = ptr_is_owned(arg);
52823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52824         arg_conv.is_owned = false;
52825         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
52826         return ret_conv;
52827 }
52828
52829 int64_t  CS_LDK_ChannelAnnouncement_clone(int64_t orig) {
52830         LDKChannelAnnouncement orig_conv;
52831         orig_conv.inner = untag_ptr(orig);
52832         orig_conv.is_owned = ptr_is_owned(orig);
52833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52834         orig_conv.is_owned = false;
52835         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
52836         int64_t ret_ref = 0;
52837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52839         return ret_ref;
52840 }
52841
52842 int64_t  CS_LDK_ChannelAnnouncement_hash(int64_t o) {
52843         LDKChannelAnnouncement o_conv;
52844         o_conv.inner = untag_ptr(o);
52845         o_conv.is_owned = ptr_is_owned(o);
52846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52847         o_conv.is_owned = false;
52848         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
52849         return ret_conv;
52850 }
52851
52852 jboolean  CS_LDK_ChannelAnnouncement_eq(int64_t a, int64_t b) {
52853         LDKChannelAnnouncement a_conv;
52854         a_conv.inner = untag_ptr(a);
52855         a_conv.is_owned = ptr_is_owned(a);
52856         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52857         a_conv.is_owned = false;
52858         LDKChannelAnnouncement b_conv;
52859         b_conv.inner = untag_ptr(b);
52860         b_conv.is_owned = ptr_is_owned(b);
52861         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52862         b_conv.is_owned = false;
52863         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
52864         return ret_conv;
52865 }
52866
52867 void  CS_LDK_UnsignedChannelUpdate_free(int64_t this_obj) {
52868         LDKUnsignedChannelUpdate this_obj_conv;
52869         this_obj_conv.inner = untag_ptr(this_obj);
52870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52872         UnsignedChannelUpdate_free(this_obj_conv);
52873 }
52874
52875 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_chain_hash(int64_t this_ptr) {
52876         LDKUnsignedChannelUpdate this_ptr_conv;
52877         this_ptr_conv.inner = untag_ptr(this_ptr);
52878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52880         this_ptr_conv.is_owned = false;
52881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52882         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
52883         return ret_arr;
52884 }
52885
52886 void  CS_LDK_UnsignedChannelUpdate_set_chain_hash(int64_t this_ptr, int8_tArray val) {
52887         LDKUnsignedChannelUpdate this_ptr_conv;
52888         this_ptr_conv.inner = untag_ptr(this_ptr);
52889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52891         this_ptr_conv.is_owned = false;
52892         LDKThirtyTwoBytes val_ref;
52893         CHECK(val->arr_len == 32);
52894         memcpy(val_ref.data, val->elems, 32); FREE(val);
52895         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
52896 }
52897
52898 int64_t  CS_LDK_UnsignedChannelUpdate_get_short_channel_id(int64_t this_ptr) {
52899         LDKUnsignedChannelUpdate this_ptr_conv;
52900         this_ptr_conv.inner = untag_ptr(this_ptr);
52901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52903         this_ptr_conv.is_owned = false;
52904         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
52905         return ret_conv;
52906 }
52907
52908 void  CS_LDK_UnsignedChannelUpdate_set_short_channel_id(int64_t this_ptr, int64_t val) {
52909         LDKUnsignedChannelUpdate this_ptr_conv;
52910         this_ptr_conv.inner = untag_ptr(this_ptr);
52911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52913         this_ptr_conv.is_owned = false;
52914         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
52915 }
52916
52917 int32_t  CS_LDK_UnsignedChannelUpdate_get_timestamp(int64_t this_ptr) {
52918         LDKUnsignedChannelUpdate this_ptr_conv;
52919         this_ptr_conv.inner = untag_ptr(this_ptr);
52920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52922         this_ptr_conv.is_owned = false;
52923         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
52924         return ret_conv;
52925 }
52926
52927 void  CS_LDK_UnsignedChannelUpdate_set_timestamp(int64_t this_ptr, int32_t val) {
52928         LDKUnsignedChannelUpdate this_ptr_conv;
52929         this_ptr_conv.inner = untag_ptr(this_ptr);
52930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52932         this_ptr_conv.is_owned = false;
52933         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
52934 }
52935
52936 int8_t  CS_LDK_UnsignedChannelUpdate_get_flags(int64_t this_ptr) {
52937         LDKUnsignedChannelUpdate this_ptr_conv;
52938         this_ptr_conv.inner = untag_ptr(this_ptr);
52939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52941         this_ptr_conv.is_owned = false;
52942         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
52943         return ret_conv;
52944 }
52945
52946 void  CS_LDK_UnsignedChannelUpdate_set_flags(int64_t this_ptr, int8_t val) {
52947         LDKUnsignedChannelUpdate this_ptr_conv;
52948         this_ptr_conv.inner = untag_ptr(this_ptr);
52949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52951         this_ptr_conv.is_owned = false;
52952         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
52953 }
52954
52955 int16_t  CS_LDK_UnsignedChannelUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
52956         LDKUnsignedChannelUpdate this_ptr_conv;
52957         this_ptr_conv.inner = untag_ptr(this_ptr);
52958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52960         this_ptr_conv.is_owned = false;
52961         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
52962         return ret_conv;
52963 }
52964
52965 void  CS_LDK_UnsignedChannelUpdate_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
52966         LDKUnsignedChannelUpdate this_ptr_conv;
52967         this_ptr_conv.inner = untag_ptr(this_ptr);
52968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52970         this_ptr_conv.is_owned = false;
52971         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
52972 }
52973
52974 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_minimum_msat(int64_t this_ptr) {
52975         LDKUnsignedChannelUpdate this_ptr_conv;
52976         this_ptr_conv.inner = untag_ptr(this_ptr);
52977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52979         this_ptr_conv.is_owned = false;
52980         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
52981         return ret_conv;
52982 }
52983
52984 void  CS_LDK_UnsignedChannelUpdate_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
52985         LDKUnsignedChannelUpdate this_ptr_conv;
52986         this_ptr_conv.inner = untag_ptr(this_ptr);
52987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52989         this_ptr_conv.is_owned = false;
52990         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
52991 }
52992
52993 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_maximum_msat(int64_t this_ptr) {
52994         LDKUnsignedChannelUpdate this_ptr_conv;
52995         this_ptr_conv.inner = untag_ptr(this_ptr);
52996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52998         this_ptr_conv.is_owned = false;
52999         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
53000         return ret_conv;
53001 }
53002
53003 void  CS_LDK_UnsignedChannelUpdate_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
53004         LDKUnsignedChannelUpdate this_ptr_conv;
53005         this_ptr_conv.inner = untag_ptr(this_ptr);
53006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53008         this_ptr_conv.is_owned = false;
53009         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
53010 }
53011
53012 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_base_msat(int64_t this_ptr) {
53013         LDKUnsignedChannelUpdate this_ptr_conv;
53014         this_ptr_conv.inner = untag_ptr(this_ptr);
53015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53017         this_ptr_conv.is_owned = false;
53018         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
53019         return ret_conv;
53020 }
53021
53022 void  CS_LDK_UnsignedChannelUpdate_set_fee_base_msat(int64_t this_ptr, int32_t val) {
53023         LDKUnsignedChannelUpdate this_ptr_conv;
53024         this_ptr_conv.inner = untag_ptr(this_ptr);
53025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53027         this_ptr_conv.is_owned = false;
53028         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
53029 }
53030
53031 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_proportional_millionths(int64_t this_ptr) {
53032         LDKUnsignedChannelUpdate this_ptr_conv;
53033         this_ptr_conv.inner = untag_ptr(this_ptr);
53034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53036         this_ptr_conv.is_owned = false;
53037         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
53038         return ret_conv;
53039 }
53040
53041 void  CS_LDK_UnsignedChannelUpdate_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
53042         LDKUnsignedChannelUpdate this_ptr_conv;
53043         this_ptr_conv.inner = untag_ptr(this_ptr);
53044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53046         this_ptr_conv.is_owned = false;
53047         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
53048 }
53049
53050 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_excess_data(int64_t this_ptr) {
53051         LDKUnsignedChannelUpdate this_ptr_conv;
53052         this_ptr_conv.inner = untag_ptr(this_ptr);
53053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53055         this_ptr_conv.is_owned = false;
53056         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
53057         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53058         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53059         CVec_u8Z_free(ret_var);
53060         return ret_arr;
53061 }
53062
53063 void  CS_LDK_UnsignedChannelUpdate_set_excess_data(int64_t this_ptr, int8_tArray val) {
53064         LDKUnsignedChannelUpdate this_ptr_conv;
53065         this_ptr_conv.inner = untag_ptr(this_ptr);
53066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53068         this_ptr_conv.is_owned = false;
53069         LDKCVec_u8Z val_ref;
53070         val_ref.datalen = val->arr_len;
53071         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53072         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53073         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
53074 }
53075
53076 int64_t  CS_LDK_UnsignedChannelUpdate_new(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) {
53077         LDKThirtyTwoBytes chain_hash_arg_ref;
53078         CHECK(chain_hash_arg->arr_len == 32);
53079         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53080         LDKCVec_u8Z excess_data_arg_ref;
53081         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
53082         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53083         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
53084         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);
53085         int64_t ret_ref = 0;
53086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53088         return ret_ref;
53089 }
53090
53091 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
53092         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
53093         int64_t ret_ref = 0;
53094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53096         return ret_ref;
53097 }
53098 int64_t  CS_LDK_UnsignedChannelUpdate_clone_ptr(int64_t arg) {
53099         LDKUnsignedChannelUpdate arg_conv;
53100         arg_conv.inner = untag_ptr(arg);
53101         arg_conv.is_owned = ptr_is_owned(arg);
53102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53103         arg_conv.is_owned = false;
53104         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
53105         return ret_conv;
53106 }
53107
53108 int64_t  CS_LDK_UnsignedChannelUpdate_clone(int64_t orig) {
53109         LDKUnsignedChannelUpdate orig_conv;
53110         orig_conv.inner = untag_ptr(orig);
53111         orig_conv.is_owned = ptr_is_owned(orig);
53112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53113         orig_conv.is_owned = false;
53114         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
53115         int64_t ret_ref = 0;
53116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53118         return ret_ref;
53119 }
53120
53121 int64_t  CS_LDK_UnsignedChannelUpdate_hash(int64_t o) {
53122         LDKUnsignedChannelUpdate o_conv;
53123         o_conv.inner = untag_ptr(o);
53124         o_conv.is_owned = ptr_is_owned(o);
53125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53126         o_conv.is_owned = false;
53127         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
53128         return ret_conv;
53129 }
53130
53131 jboolean  CS_LDK_UnsignedChannelUpdate_eq(int64_t a, int64_t b) {
53132         LDKUnsignedChannelUpdate a_conv;
53133         a_conv.inner = untag_ptr(a);
53134         a_conv.is_owned = ptr_is_owned(a);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53136         a_conv.is_owned = false;
53137         LDKUnsignedChannelUpdate b_conv;
53138         b_conv.inner = untag_ptr(b);
53139         b_conv.is_owned = ptr_is_owned(b);
53140         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53141         b_conv.is_owned = false;
53142         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
53143         return ret_conv;
53144 }
53145
53146 void  CS_LDK_ChannelUpdate_free(int64_t this_obj) {
53147         LDKChannelUpdate this_obj_conv;
53148         this_obj_conv.inner = untag_ptr(this_obj);
53149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53151         ChannelUpdate_free(this_obj_conv);
53152 }
53153
53154 int8_tArray  CS_LDK_ChannelUpdate_get_signature(int64_t this_ptr) {
53155         LDKChannelUpdate this_ptr_conv;
53156         this_ptr_conv.inner = untag_ptr(this_ptr);
53157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53159         this_ptr_conv.is_owned = false;
53160         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53161         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
53162         return ret_arr;
53163 }
53164
53165 void  CS_LDK_ChannelUpdate_set_signature(int64_t this_ptr, int8_tArray val) {
53166         LDKChannelUpdate this_ptr_conv;
53167         this_ptr_conv.inner = untag_ptr(this_ptr);
53168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53170         this_ptr_conv.is_owned = false;
53171         LDKECDSASignature val_ref;
53172         CHECK(val->arr_len == 64);
53173         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53174         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
53175 }
53176
53177 int64_t  CS_LDK_ChannelUpdate_get_contents(int64_t this_ptr) {
53178         LDKChannelUpdate this_ptr_conv;
53179         this_ptr_conv.inner = untag_ptr(this_ptr);
53180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53182         this_ptr_conv.is_owned = false;
53183         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
53184         int64_t ret_ref = 0;
53185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53187         return ret_ref;
53188 }
53189
53190 void  CS_LDK_ChannelUpdate_set_contents(int64_t this_ptr, int64_t val) {
53191         LDKChannelUpdate this_ptr_conv;
53192         this_ptr_conv.inner = untag_ptr(this_ptr);
53193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53195         this_ptr_conv.is_owned = false;
53196         LDKUnsignedChannelUpdate val_conv;
53197         val_conv.inner = untag_ptr(val);
53198         val_conv.is_owned = ptr_is_owned(val);
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53200         val_conv = UnsignedChannelUpdate_clone(&val_conv);
53201         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
53202 }
53203
53204 int64_t  CS_LDK_ChannelUpdate_new(int8_tArray signature_arg, int64_t contents_arg) {
53205         LDKECDSASignature signature_arg_ref;
53206         CHECK(signature_arg->arr_len == 64);
53207         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
53208         LDKUnsignedChannelUpdate contents_arg_conv;
53209         contents_arg_conv.inner = untag_ptr(contents_arg);
53210         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53211         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53212         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
53213         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
53214         int64_t ret_ref = 0;
53215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53217         return ret_ref;
53218 }
53219
53220 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
53221         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
53222         int64_t ret_ref = 0;
53223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53225         return ret_ref;
53226 }
53227 int64_t  CS_LDK_ChannelUpdate_clone_ptr(int64_t arg) {
53228         LDKChannelUpdate arg_conv;
53229         arg_conv.inner = untag_ptr(arg);
53230         arg_conv.is_owned = ptr_is_owned(arg);
53231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53232         arg_conv.is_owned = false;
53233         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
53234         return ret_conv;
53235 }
53236
53237 int64_t  CS_LDK_ChannelUpdate_clone(int64_t orig) {
53238         LDKChannelUpdate orig_conv;
53239         orig_conv.inner = untag_ptr(orig);
53240         orig_conv.is_owned = ptr_is_owned(orig);
53241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53242         orig_conv.is_owned = false;
53243         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
53244         int64_t ret_ref = 0;
53245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53247         return ret_ref;
53248 }
53249
53250 int64_t  CS_LDK_ChannelUpdate_hash(int64_t o) {
53251         LDKChannelUpdate o_conv;
53252         o_conv.inner = untag_ptr(o);
53253         o_conv.is_owned = ptr_is_owned(o);
53254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53255         o_conv.is_owned = false;
53256         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
53257         return ret_conv;
53258 }
53259
53260 jboolean  CS_LDK_ChannelUpdate_eq(int64_t a, int64_t b) {
53261         LDKChannelUpdate a_conv;
53262         a_conv.inner = untag_ptr(a);
53263         a_conv.is_owned = ptr_is_owned(a);
53264         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53265         a_conv.is_owned = false;
53266         LDKChannelUpdate b_conv;
53267         b_conv.inner = untag_ptr(b);
53268         b_conv.is_owned = ptr_is_owned(b);
53269         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53270         b_conv.is_owned = false;
53271         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
53272         return ret_conv;
53273 }
53274
53275 void  CS_LDK_QueryChannelRange_free(int64_t this_obj) {
53276         LDKQueryChannelRange this_obj_conv;
53277         this_obj_conv.inner = untag_ptr(this_obj);
53278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53280         QueryChannelRange_free(this_obj_conv);
53281 }
53282
53283 int8_tArray  CS_LDK_QueryChannelRange_get_chain_hash(int64_t this_ptr) {
53284         LDKQueryChannelRange this_ptr_conv;
53285         this_ptr_conv.inner = untag_ptr(this_ptr);
53286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53288         this_ptr_conv.is_owned = false;
53289         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53290         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
53291         return ret_arr;
53292 }
53293
53294 void  CS_LDK_QueryChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53295         LDKQueryChannelRange this_ptr_conv;
53296         this_ptr_conv.inner = untag_ptr(this_ptr);
53297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53299         this_ptr_conv.is_owned = false;
53300         LDKThirtyTwoBytes val_ref;
53301         CHECK(val->arr_len == 32);
53302         memcpy(val_ref.data, val->elems, 32); FREE(val);
53303         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
53304 }
53305
53306 int32_t  CS_LDK_QueryChannelRange_get_first_blocknum(int64_t this_ptr) {
53307         LDKQueryChannelRange this_ptr_conv;
53308         this_ptr_conv.inner = untag_ptr(this_ptr);
53309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53311         this_ptr_conv.is_owned = false;
53312         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
53313         return ret_conv;
53314 }
53315
53316 void  CS_LDK_QueryChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
53317         LDKQueryChannelRange this_ptr_conv;
53318         this_ptr_conv.inner = untag_ptr(this_ptr);
53319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53321         this_ptr_conv.is_owned = false;
53322         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
53323 }
53324
53325 int32_t  CS_LDK_QueryChannelRange_get_number_of_blocks(int64_t this_ptr) {
53326         LDKQueryChannelRange this_ptr_conv;
53327         this_ptr_conv.inner = untag_ptr(this_ptr);
53328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53330         this_ptr_conv.is_owned = false;
53331         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
53332         return ret_conv;
53333 }
53334
53335 void  CS_LDK_QueryChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
53336         LDKQueryChannelRange this_ptr_conv;
53337         this_ptr_conv.inner = untag_ptr(this_ptr);
53338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53340         this_ptr_conv.is_owned = false;
53341         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
53342 }
53343
53344 int64_t  CS_LDK_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
53345         LDKThirtyTwoBytes chain_hash_arg_ref;
53346         CHECK(chain_hash_arg->arr_len == 32);
53347         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53348         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
53349         int64_t ret_ref = 0;
53350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53352         return ret_ref;
53353 }
53354
53355 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
53356         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
53357         int64_t ret_ref = 0;
53358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53360         return ret_ref;
53361 }
53362 int64_t  CS_LDK_QueryChannelRange_clone_ptr(int64_t arg) {
53363         LDKQueryChannelRange arg_conv;
53364         arg_conv.inner = untag_ptr(arg);
53365         arg_conv.is_owned = ptr_is_owned(arg);
53366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53367         arg_conv.is_owned = false;
53368         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
53369         return ret_conv;
53370 }
53371
53372 int64_t  CS_LDK_QueryChannelRange_clone(int64_t orig) {
53373         LDKQueryChannelRange orig_conv;
53374         orig_conv.inner = untag_ptr(orig);
53375         orig_conv.is_owned = ptr_is_owned(orig);
53376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53377         orig_conv.is_owned = false;
53378         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
53379         int64_t ret_ref = 0;
53380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53382         return ret_ref;
53383 }
53384
53385 int64_t  CS_LDK_QueryChannelRange_hash(int64_t o) {
53386         LDKQueryChannelRange o_conv;
53387         o_conv.inner = untag_ptr(o);
53388         o_conv.is_owned = ptr_is_owned(o);
53389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53390         o_conv.is_owned = false;
53391         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
53392         return ret_conv;
53393 }
53394
53395 jboolean  CS_LDK_QueryChannelRange_eq(int64_t a, int64_t b) {
53396         LDKQueryChannelRange a_conv;
53397         a_conv.inner = untag_ptr(a);
53398         a_conv.is_owned = ptr_is_owned(a);
53399         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53400         a_conv.is_owned = false;
53401         LDKQueryChannelRange b_conv;
53402         b_conv.inner = untag_ptr(b);
53403         b_conv.is_owned = ptr_is_owned(b);
53404         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53405         b_conv.is_owned = false;
53406         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
53407         return ret_conv;
53408 }
53409
53410 void  CS_LDK_ReplyChannelRange_free(int64_t this_obj) {
53411         LDKReplyChannelRange this_obj_conv;
53412         this_obj_conv.inner = untag_ptr(this_obj);
53413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53415         ReplyChannelRange_free(this_obj_conv);
53416 }
53417
53418 int8_tArray  CS_LDK_ReplyChannelRange_get_chain_hash(int64_t this_ptr) {
53419         LDKReplyChannelRange 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53425         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
53426         return ret_arr;
53427 }
53428
53429 void  CS_LDK_ReplyChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53430         LDKReplyChannelRange this_ptr_conv;
53431         this_ptr_conv.inner = untag_ptr(this_ptr);
53432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53434         this_ptr_conv.is_owned = false;
53435         LDKThirtyTwoBytes val_ref;
53436         CHECK(val->arr_len == 32);
53437         memcpy(val_ref.data, val->elems, 32); FREE(val);
53438         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
53439 }
53440
53441 int32_t  CS_LDK_ReplyChannelRange_get_first_blocknum(int64_t this_ptr) {
53442         LDKReplyChannelRange this_ptr_conv;
53443         this_ptr_conv.inner = untag_ptr(this_ptr);
53444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53446         this_ptr_conv.is_owned = false;
53447         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
53448         return ret_conv;
53449 }
53450
53451 void  CS_LDK_ReplyChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
53452         LDKReplyChannelRange this_ptr_conv;
53453         this_ptr_conv.inner = untag_ptr(this_ptr);
53454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53456         this_ptr_conv.is_owned = false;
53457         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
53458 }
53459
53460 int32_t  CS_LDK_ReplyChannelRange_get_number_of_blocks(int64_t this_ptr) {
53461         LDKReplyChannelRange this_ptr_conv;
53462         this_ptr_conv.inner = untag_ptr(this_ptr);
53463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53465         this_ptr_conv.is_owned = false;
53466         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
53467         return ret_conv;
53468 }
53469
53470 void  CS_LDK_ReplyChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
53471         LDKReplyChannelRange this_ptr_conv;
53472         this_ptr_conv.inner = untag_ptr(this_ptr);
53473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53475         this_ptr_conv.is_owned = false;
53476         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
53477 }
53478
53479 jboolean  CS_LDK_ReplyChannelRange_get_sync_complete(int64_t this_ptr) {
53480         LDKReplyChannelRange this_ptr_conv;
53481         this_ptr_conv.inner = untag_ptr(this_ptr);
53482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53484         this_ptr_conv.is_owned = false;
53485         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
53486         return ret_conv;
53487 }
53488
53489 void  CS_LDK_ReplyChannelRange_set_sync_complete(int64_t this_ptr, jboolean val) {
53490         LDKReplyChannelRange this_ptr_conv;
53491         this_ptr_conv.inner = untag_ptr(this_ptr);
53492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53494         this_ptr_conv.is_owned = false;
53495         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
53496 }
53497
53498 int64_tArray  CS_LDK_ReplyChannelRange_get_short_channel_ids(int64_t this_ptr) {
53499         LDKReplyChannelRange this_ptr_conv;
53500         this_ptr_conv.inner = untag_ptr(this_ptr);
53501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53503         this_ptr_conv.is_owned = false;
53504         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
53505         int64_tArray ret_arr = NULL;
53506         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53507         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53508         for (size_t g = 0; g < ret_var.datalen; g++) {
53509                 int64_t ret_conv_6_conv = ret_var.data[g];
53510                 ret_arr_ptr[g] = ret_conv_6_conv;
53511         }
53512         
53513         FREE(ret_var.data);
53514         return ret_arr;
53515 }
53516
53517 void  CS_LDK_ReplyChannelRange_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
53518         LDKReplyChannelRange this_ptr_conv;
53519         this_ptr_conv.inner = untag_ptr(this_ptr);
53520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53522         this_ptr_conv.is_owned = false;
53523         LDKCVec_u64Z val_constr;
53524         val_constr.datalen = val->arr_len;
53525         if (val_constr.datalen > 0)
53526                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53527         else
53528                 val_constr.data = NULL;
53529         int64_t* val_vals = val->elems;
53530         for (size_t g = 0; g < val_constr.datalen; g++) {
53531                 int64_t val_conv_6 = val_vals[g];
53532                 val_constr.data[g] = val_conv_6;
53533         }
53534         FREE(val);
53535         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
53536 }
53537
53538 int64_t  CS_LDK_ReplyChannelRange_new(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) {
53539         LDKThirtyTwoBytes chain_hash_arg_ref;
53540         CHECK(chain_hash_arg->arr_len == 32);
53541         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53542         LDKCVec_u64Z short_channel_ids_arg_constr;
53543         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53544         if (short_channel_ids_arg_constr.datalen > 0)
53545                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53546         else
53547                 short_channel_ids_arg_constr.data = NULL;
53548         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53549         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
53550                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
53551                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
53552         }
53553         FREE(short_channel_ids_arg);
53554         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
53555         int64_t ret_ref = 0;
53556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53558         return ret_ref;
53559 }
53560
53561 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
53562         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
53563         int64_t ret_ref = 0;
53564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53566         return ret_ref;
53567 }
53568 int64_t  CS_LDK_ReplyChannelRange_clone_ptr(int64_t arg) {
53569         LDKReplyChannelRange arg_conv;
53570         arg_conv.inner = untag_ptr(arg);
53571         arg_conv.is_owned = ptr_is_owned(arg);
53572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53573         arg_conv.is_owned = false;
53574         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
53575         return ret_conv;
53576 }
53577
53578 int64_t  CS_LDK_ReplyChannelRange_clone(int64_t orig) {
53579         LDKReplyChannelRange orig_conv;
53580         orig_conv.inner = untag_ptr(orig);
53581         orig_conv.is_owned = ptr_is_owned(orig);
53582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53583         orig_conv.is_owned = false;
53584         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
53585         int64_t ret_ref = 0;
53586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53588         return ret_ref;
53589 }
53590
53591 int64_t  CS_LDK_ReplyChannelRange_hash(int64_t o) {
53592         LDKReplyChannelRange o_conv;
53593         o_conv.inner = untag_ptr(o);
53594         o_conv.is_owned = ptr_is_owned(o);
53595         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53596         o_conv.is_owned = false;
53597         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
53598         return ret_conv;
53599 }
53600
53601 jboolean  CS_LDK_ReplyChannelRange_eq(int64_t a, int64_t b) {
53602         LDKReplyChannelRange a_conv;
53603         a_conv.inner = untag_ptr(a);
53604         a_conv.is_owned = ptr_is_owned(a);
53605         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53606         a_conv.is_owned = false;
53607         LDKReplyChannelRange b_conv;
53608         b_conv.inner = untag_ptr(b);
53609         b_conv.is_owned = ptr_is_owned(b);
53610         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53611         b_conv.is_owned = false;
53612         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
53613         return ret_conv;
53614 }
53615
53616 void  CS_LDK_QueryShortChannelIds_free(int64_t this_obj) {
53617         LDKQueryShortChannelIds this_obj_conv;
53618         this_obj_conv.inner = untag_ptr(this_obj);
53619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53621         QueryShortChannelIds_free(this_obj_conv);
53622 }
53623
53624 int8_tArray  CS_LDK_QueryShortChannelIds_get_chain_hash(int64_t this_ptr) {
53625         LDKQueryShortChannelIds 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 = init_int8_tArray(32, __LINE__);
53631         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
53632         return ret_arr;
53633 }
53634
53635 void  CS_LDK_QueryShortChannelIds_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53636         LDKQueryShortChannelIds 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         LDKThirtyTwoBytes val_ref;
53642         CHECK(val->arr_len == 32);
53643         memcpy(val_ref.data, val->elems, 32); FREE(val);
53644         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
53645 }
53646
53647 int64_tArray  CS_LDK_QueryShortChannelIds_get_short_channel_ids(int64_t this_ptr) {
53648         LDKQueryShortChannelIds 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         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
53654         int64_tArray ret_arr = NULL;
53655         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53656         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53657         for (size_t g = 0; g < ret_var.datalen; g++) {
53658                 int64_t ret_conv_6_conv = ret_var.data[g];
53659                 ret_arr_ptr[g] = ret_conv_6_conv;
53660         }
53661         
53662         FREE(ret_var.data);
53663         return ret_arr;
53664 }
53665
53666 void  CS_LDK_QueryShortChannelIds_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
53667         LDKQueryShortChannelIds this_ptr_conv;
53668         this_ptr_conv.inner = untag_ptr(this_ptr);
53669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53671         this_ptr_conv.is_owned = false;
53672         LDKCVec_u64Z val_constr;
53673         val_constr.datalen = val->arr_len;
53674         if (val_constr.datalen > 0)
53675                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53676         else
53677                 val_constr.data = NULL;
53678         int64_t* val_vals = val->elems;
53679         for (size_t g = 0; g < val_constr.datalen; g++) {
53680                 int64_t val_conv_6 = val_vals[g];
53681                 val_constr.data[g] = val_conv_6;
53682         }
53683         FREE(val);
53684         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
53685 }
53686
53687 int64_t  CS_LDK_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
53688         LDKThirtyTwoBytes chain_hash_arg_ref;
53689         CHECK(chain_hash_arg->arr_len == 32);
53690         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53691         LDKCVec_u64Z short_channel_ids_arg_constr;
53692         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
53693         if (short_channel_ids_arg_constr.datalen > 0)
53694                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53695         else
53696                 short_channel_ids_arg_constr.data = NULL;
53697         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
53698         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
53699                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
53700                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
53701         }
53702         FREE(short_channel_ids_arg);
53703         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
53704         int64_t ret_ref = 0;
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53707         return ret_ref;
53708 }
53709
53710 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
53711         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
53712         int64_t ret_ref = 0;
53713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53715         return ret_ref;
53716 }
53717 int64_t  CS_LDK_QueryShortChannelIds_clone_ptr(int64_t arg) {
53718         LDKQueryShortChannelIds arg_conv;
53719         arg_conv.inner = untag_ptr(arg);
53720         arg_conv.is_owned = ptr_is_owned(arg);
53721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53722         arg_conv.is_owned = false;
53723         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
53724         return ret_conv;
53725 }
53726
53727 int64_t  CS_LDK_QueryShortChannelIds_clone(int64_t orig) {
53728         LDKQueryShortChannelIds orig_conv;
53729         orig_conv.inner = untag_ptr(orig);
53730         orig_conv.is_owned = ptr_is_owned(orig);
53731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53732         orig_conv.is_owned = false;
53733         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
53734         int64_t ret_ref = 0;
53735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53737         return ret_ref;
53738 }
53739
53740 int64_t  CS_LDK_QueryShortChannelIds_hash(int64_t o) {
53741         LDKQueryShortChannelIds o_conv;
53742         o_conv.inner = untag_ptr(o);
53743         o_conv.is_owned = ptr_is_owned(o);
53744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53745         o_conv.is_owned = false;
53746         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
53747         return ret_conv;
53748 }
53749
53750 jboolean  CS_LDK_QueryShortChannelIds_eq(int64_t a, int64_t b) {
53751         LDKQueryShortChannelIds a_conv;
53752         a_conv.inner = untag_ptr(a);
53753         a_conv.is_owned = ptr_is_owned(a);
53754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53755         a_conv.is_owned = false;
53756         LDKQueryShortChannelIds b_conv;
53757         b_conv.inner = untag_ptr(b);
53758         b_conv.is_owned = ptr_is_owned(b);
53759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53760         b_conv.is_owned = false;
53761         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
53762         return ret_conv;
53763 }
53764
53765 void  CS_LDK_ReplyShortChannelIdsEnd_free(int64_t this_obj) {
53766         LDKReplyShortChannelIdsEnd this_obj_conv;
53767         this_obj_conv.inner = untag_ptr(this_obj);
53768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53770         ReplyShortChannelIdsEnd_free(this_obj_conv);
53771 }
53772
53773 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_get_chain_hash(int64_t this_ptr) {
53774         LDKReplyShortChannelIdsEnd this_ptr_conv;
53775         this_ptr_conv.inner = untag_ptr(this_ptr);
53776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53778         this_ptr_conv.is_owned = false;
53779         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53780         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
53781         return ret_arr;
53782 }
53783
53784 void  CS_LDK_ReplyShortChannelIdsEnd_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53785         LDKReplyShortChannelIdsEnd this_ptr_conv;
53786         this_ptr_conv.inner = untag_ptr(this_ptr);
53787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53789         this_ptr_conv.is_owned = false;
53790         LDKThirtyTwoBytes val_ref;
53791         CHECK(val->arr_len == 32);
53792         memcpy(val_ref.data, val->elems, 32); FREE(val);
53793         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
53794 }
53795
53796 jboolean  CS_LDK_ReplyShortChannelIdsEnd_get_full_information(int64_t this_ptr) {
53797         LDKReplyShortChannelIdsEnd this_ptr_conv;
53798         this_ptr_conv.inner = untag_ptr(this_ptr);
53799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53801         this_ptr_conv.is_owned = false;
53802         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
53803         return ret_conv;
53804 }
53805
53806 void  CS_LDK_ReplyShortChannelIdsEnd_set_full_information(int64_t this_ptr, jboolean val) {
53807         LDKReplyShortChannelIdsEnd this_ptr_conv;
53808         this_ptr_conv.inner = untag_ptr(this_ptr);
53809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53811         this_ptr_conv.is_owned = false;
53812         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
53813 }
53814
53815 int64_t  CS_LDK_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
53816         LDKThirtyTwoBytes chain_hash_arg_ref;
53817         CHECK(chain_hash_arg->arr_len == 32);
53818         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53819         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
53820         int64_t ret_ref = 0;
53821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53823         return ret_ref;
53824 }
53825
53826 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
53827         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
53828         int64_t ret_ref = 0;
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53831         return ret_ref;
53832 }
53833 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone_ptr(int64_t arg) {
53834         LDKReplyShortChannelIdsEnd arg_conv;
53835         arg_conv.inner = untag_ptr(arg);
53836         arg_conv.is_owned = ptr_is_owned(arg);
53837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53838         arg_conv.is_owned = false;
53839         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
53840         return ret_conv;
53841 }
53842
53843 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone(int64_t orig) {
53844         LDKReplyShortChannelIdsEnd orig_conv;
53845         orig_conv.inner = untag_ptr(orig);
53846         orig_conv.is_owned = ptr_is_owned(orig);
53847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53848         orig_conv.is_owned = false;
53849         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
53850         int64_t ret_ref = 0;
53851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53853         return ret_ref;
53854 }
53855
53856 int64_t  CS_LDK_ReplyShortChannelIdsEnd_hash(int64_t o) {
53857         LDKReplyShortChannelIdsEnd o_conv;
53858         o_conv.inner = untag_ptr(o);
53859         o_conv.is_owned = ptr_is_owned(o);
53860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53861         o_conv.is_owned = false;
53862         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
53863         return ret_conv;
53864 }
53865
53866 jboolean  CS_LDK_ReplyShortChannelIdsEnd_eq(int64_t a, int64_t b) {
53867         LDKReplyShortChannelIdsEnd a_conv;
53868         a_conv.inner = untag_ptr(a);
53869         a_conv.is_owned = ptr_is_owned(a);
53870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53871         a_conv.is_owned = false;
53872         LDKReplyShortChannelIdsEnd b_conv;
53873         b_conv.inner = untag_ptr(b);
53874         b_conv.is_owned = ptr_is_owned(b);
53875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53876         b_conv.is_owned = false;
53877         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
53878         return ret_conv;
53879 }
53880
53881 void  CS_LDK_GossipTimestampFilter_free(int64_t this_obj) {
53882         LDKGossipTimestampFilter this_obj_conv;
53883         this_obj_conv.inner = untag_ptr(this_obj);
53884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53886         GossipTimestampFilter_free(this_obj_conv);
53887 }
53888
53889 int8_tArray  CS_LDK_GossipTimestampFilter_get_chain_hash(int64_t this_ptr) {
53890         LDKGossipTimestampFilter this_ptr_conv;
53891         this_ptr_conv.inner = untag_ptr(this_ptr);
53892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53894         this_ptr_conv.is_owned = false;
53895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53896         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
53897         return ret_arr;
53898 }
53899
53900 void  CS_LDK_GossipTimestampFilter_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53901         LDKGossipTimestampFilter this_ptr_conv;
53902         this_ptr_conv.inner = untag_ptr(this_ptr);
53903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53905         this_ptr_conv.is_owned = false;
53906         LDKThirtyTwoBytes val_ref;
53907         CHECK(val->arr_len == 32);
53908         memcpy(val_ref.data, val->elems, 32); FREE(val);
53909         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
53910 }
53911
53912 int32_t  CS_LDK_GossipTimestampFilter_get_first_timestamp(int64_t this_ptr) {
53913         LDKGossipTimestampFilter this_ptr_conv;
53914         this_ptr_conv.inner = untag_ptr(this_ptr);
53915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53917         this_ptr_conv.is_owned = false;
53918         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
53919         return ret_conv;
53920 }
53921
53922 void  CS_LDK_GossipTimestampFilter_set_first_timestamp(int64_t this_ptr, int32_t val) {
53923         LDKGossipTimestampFilter this_ptr_conv;
53924         this_ptr_conv.inner = untag_ptr(this_ptr);
53925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53927         this_ptr_conv.is_owned = false;
53928         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
53929 }
53930
53931 int32_t  CS_LDK_GossipTimestampFilter_get_timestamp_range(int64_t this_ptr) {
53932         LDKGossipTimestampFilter this_ptr_conv;
53933         this_ptr_conv.inner = untag_ptr(this_ptr);
53934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53936         this_ptr_conv.is_owned = false;
53937         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
53938         return ret_conv;
53939 }
53940
53941 void  CS_LDK_GossipTimestampFilter_set_timestamp_range(int64_t this_ptr, int32_t val) {
53942         LDKGossipTimestampFilter this_ptr_conv;
53943         this_ptr_conv.inner = untag_ptr(this_ptr);
53944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53946         this_ptr_conv.is_owned = false;
53947         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
53948 }
53949
53950 int64_t  CS_LDK_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
53951         LDKThirtyTwoBytes chain_hash_arg_ref;
53952         CHECK(chain_hash_arg->arr_len == 32);
53953         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53954         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
53955         int64_t ret_ref = 0;
53956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53958         return ret_ref;
53959 }
53960
53961 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
53962         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
53963         int64_t ret_ref = 0;
53964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53966         return ret_ref;
53967 }
53968 int64_t  CS_LDK_GossipTimestampFilter_clone_ptr(int64_t arg) {
53969         LDKGossipTimestampFilter arg_conv;
53970         arg_conv.inner = untag_ptr(arg);
53971         arg_conv.is_owned = ptr_is_owned(arg);
53972         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53973         arg_conv.is_owned = false;
53974         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
53975         return ret_conv;
53976 }
53977
53978 int64_t  CS_LDK_GossipTimestampFilter_clone(int64_t orig) {
53979         LDKGossipTimestampFilter orig_conv;
53980         orig_conv.inner = untag_ptr(orig);
53981         orig_conv.is_owned = ptr_is_owned(orig);
53982         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53983         orig_conv.is_owned = false;
53984         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
53985         int64_t ret_ref = 0;
53986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53988         return ret_ref;
53989 }
53990
53991 int64_t  CS_LDK_GossipTimestampFilter_hash(int64_t o) {
53992         LDKGossipTimestampFilter o_conv;
53993         o_conv.inner = untag_ptr(o);
53994         o_conv.is_owned = ptr_is_owned(o);
53995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53996         o_conv.is_owned = false;
53997         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
53998         return ret_conv;
53999 }
54000
54001 jboolean  CS_LDK_GossipTimestampFilter_eq(int64_t a, int64_t b) {
54002         LDKGossipTimestampFilter a_conv;
54003         a_conv.inner = untag_ptr(a);
54004         a_conv.is_owned = ptr_is_owned(a);
54005         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54006         a_conv.is_owned = false;
54007         LDKGossipTimestampFilter b_conv;
54008         b_conv.inner = untag_ptr(b);
54009         b_conv.is_owned = ptr_is_owned(b);
54010         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54011         b_conv.is_owned = false;
54012         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
54013         return ret_conv;
54014 }
54015
54016 void  CS_LDK_ErrorAction_free(int64_t this_ptr) {
54017         if (!ptr_is_owned(this_ptr)) return;
54018         void* this_ptr_ptr = untag_ptr(this_ptr);
54019         CHECK_ACCESS(this_ptr_ptr);
54020         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
54021         FREE(untag_ptr(this_ptr));
54022         ErrorAction_free(this_ptr_conv);
54023 }
54024
54025 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
54026         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54027         *ret_copy = ErrorAction_clone(arg);
54028         int64_t ret_ref = tag_ptr(ret_copy, true);
54029         return ret_ref;
54030 }
54031 int64_t  CS_LDK_ErrorAction_clone_ptr(int64_t arg) {
54032         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
54033         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
54034         return ret_conv;
54035 }
54036
54037 int64_t  CS_LDK_ErrorAction_clone(int64_t orig) {
54038         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
54039         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54040         *ret_copy = ErrorAction_clone(orig_conv);
54041         int64_t ret_ref = tag_ptr(ret_copy, true);
54042         return ret_ref;
54043 }
54044
54045 int64_t  CS_LDK_ErrorAction_disconnect_peer(int64_t msg) {
54046         LDKErrorMessage msg_conv;
54047         msg_conv.inner = untag_ptr(msg);
54048         msg_conv.is_owned = ptr_is_owned(msg);
54049         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54050         msg_conv = ErrorMessage_clone(&msg_conv);
54051         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54052         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
54053         int64_t ret_ref = tag_ptr(ret_copy, true);
54054         return ret_ref;
54055 }
54056
54057 int64_t  CS_LDK_ErrorAction_disconnect_peer_with_warning(int64_t msg) {
54058         LDKWarningMessage msg_conv;
54059         msg_conv.inner = untag_ptr(msg);
54060         msg_conv.is_owned = ptr_is_owned(msg);
54061         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54062         msg_conv = WarningMessage_clone(&msg_conv);
54063         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54064         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
54065         int64_t ret_ref = tag_ptr(ret_copy, true);
54066         return ret_ref;
54067 }
54068
54069 int64_t  CS_LDK_ErrorAction_ignore_error() {
54070         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54071         *ret_copy = ErrorAction_ignore_error();
54072         int64_t ret_ref = tag_ptr(ret_copy, true);
54073         return ret_ref;
54074 }
54075
54076 int64_t  CS_LDK_ErrorAction_ignore_and_log(int32_t a) {
54077         LDKLevel a_conv = LDKLevel_from_cs(a);
54078         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54079         *ret_copy = ErrorAction_ignore_and_log(a_conv);
54080         int64_t ret_ref = tag_ptr(ret_copy, true);
54081         return ret_ref;
54082 }
54083
54084 int64_t  CS_LDK_ErrorAction_ignore_duplicate_gossip() {
54085         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54086         *ret_copy = ErrorAction_ignore_duplicate_gossip();
54087         int64_t ret_ref = tag_ptr(ret_copy, true);
54088         return ret_ref;
54089 }
54090
54091 int64_t  CS_LDK_ErrorAction_send_error_message(int64_t msg) {
54092         LDKErrorMessage msg_conv;
54093         msg_conv.inner = untag_ptr(msg);
54094         msg_conv.is_owned = ptr_is_owned(msg);
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54096         msg_conv = ErrorMessage_clone(&msg_conv);
54097         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54098         *ret_copy = ErrorAction_send_error_message(msg_conv);
54099         int64_t ret_ref = tag_ptr(ret_copy, true);
54100         return ret_ref;
54101 }
54102
54103 int64_t  CS_LDK_ErrorAction_send_warning_message(int64_t msg, int32_t log_level) {
54104         LDKWarningMessage msg_conv;
54105         msg_conv.inner = untag_ptr(msg);
54106         msg_conv.is_owned = ptr_is_owned(msg);
54107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
54108         msg_conv = WarningMessage_clone(&msg_conv);
54109         LDKLevel log_level_conv = LDKLevel_from_cs(log_level);
54110         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54111         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
54112         int64_t ret_ref = tag_ptr(ret_copy, true);
54113         return ret_ref;
54114 }
54115
54116 int64_t  CS_LDK_ErrorAction_hash(int64_t o) {
54117         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
54118         int64_t ret_conv = ErrorAction_hash(o_conv);
54119         return ret_conv;
54120 }
54121
54122 void  CS_LDK_LightningError_free(int64_t this_obj) {
54123         LDKLightningError this_obj_conv;
54124         this_obj_conv.inner = untag_ptr(this_obj);
54125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54127         LightningError_free(this_obj_conv);
54128 }
54129
54130 jstring  CS_LDK_LightningError_get_err(int64_t this_ptr) {
54131         LDKLightningError this_ptr_conv;
54132         this_ptr_conv.inner = untag_ptr(this_ptr);
54133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54135         this_ptr_conv.is_owned = false;
54136         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
54137         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
54138         Str_free(ret_str);
54139         return ret_conv;
54140 }
54141
54142 void  CS_LDK_LightningError_set_err(int64_t this_ptr, jstring val) {
54143         LDKLightningError this_ptr_conv;
54144         this_ptr_conv.inner = untag_ptr(this_ptr);
54145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54147         this_ptr_conv.is_owned = false;
54148         LDKStr val_conv = str_ref_to_owned_c(val);
54149         LightningError_set_err(&this_ptr_conv, val_conv);
54150 }
54151
54152 int64_t  CS_LDK_LightningError_get_action(int64_t this_ptr) {
54153         LDKLightningError this_ptr_conv;
54154         this_ptr_conv.inner = untag_ptr(this_ptr);
54155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54157         this_ptr_conv.is_owned = false;
54158         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
54159         *ret_copy = LightningError_get_action(&this_ptr_conv);
54160         int64_t ret_ref = tag_ptr(ret_copy, true);
54161         return ret_ref;
54162 }
54163
54164 void  CS_LDK_LightningError_set_action(int64_t this_ptr, int64_t val) {
54165         LDKLightningError this_ptr_conv;
54166         this_ptr_conv.inner = untag_ptr(this_ptr);
54167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54169         this_ptr_conv.is_owned = false;
54170         void* val_ptr = untag_ptr(val);
54171         CHECK_ACCESS(val_ptr);
54172         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
54173         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
54174         LightningError_set_action(&this_ptr_conv, val_conv);
54175 }
54176
54177 int64_t  CS_LDK_LightningError_new(jstring err_arg, int64_t action_arg) {
54178         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
54179         void* action_arg_ptr = untag_ptr(action_arg);
54180         CHECK_ACCESS(action_arg_ptr);
54181         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
54182         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
54183         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
54184         int64_t ret_ref = 0;
54185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54187         return ret_ref;
54188 }
54189
54190 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
54191         LDKLightningError ret_var = LightningError_clone(arg);
54192         int64_t ret_ref = 0;
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54195         return ret_ref;
54196 }
54197 int64_t  CS_LDK_LightningError_clone_ptr(int64_t arg) {
54198         LDKLightningError arg_conv;
54199         arg_conv.inner = untag_ptr(arg);
54200         arg_conv.is_owned = ptr_is_owned(arg);
54201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54202         arg_conv.is_owned = false;
54203         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
54204         return ret_conv;
54205 }
54206
54207 int64_t  CS_LDK_LightningError_clone(int64_t orig) {
54208         LDKLightningError orig_conv;
54209         orig_conv.inner = untag_ptr(orig);
54210         orig_conv.is_owned = ptr_is_owned(orig);
54211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54212         orig_conv.is_owned = false;
54213         LDKLightningError ret_var = LightningError_clone(&orig_conv);
54214         int64_t ret_ref = 0;
54215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54217         return ret_ref;
54218 }
54219
54220 void  CS_LDK_CommitmentUpdate_free(int64_t this_obj) {
54221         LDKCommitmentUpdate this_obj_conv;
54222         this_obj_conv.inner = untag_ptr(this_obj);
54223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54225         CommitmentUpdate_free(this_obj_conv);
54226 }
54227
54228 int64_tArray  CS_LDK_CommitmentUpdate_get_update_add_htlcs(int64_t this_ptr) {
54229         LDKCommitmentUpdate this_ptr_conv;
54230         this_ptr_conv.inner = untag_ptr(this_ptr);
54231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54233         this_ptr_conv.is_owned = false;
54234         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
54235         int64_tArray ret_arr = NULL;
54236         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54237         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54238         for (size_t p = 0; p < ret_var.datalen; p++) {
54239                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
54240                 int64_t ret_conv_15_ref = 0;
54241                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
54242                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
54243                 ret_arr_ptr[p] = ret_conv_15_ref;
54244         }
54245         
54246         FREE(ret_var.data);
54247         return ret_arr;
54248 }
54249
54250 void  CS_LDK_CommitmentUpdate_set_update_add_htlcs(int64_t this_ptr, int64_tArray val) {
54251         LDKCommitmentUpdate this_ptr_conv;
54252         this_ptr_conv.inner = untag_ptr(this_ptr);
54253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54255         this_ptr_conv.is_owned = false;
54256         LDKCVec_UpdateAddHTLCZ val_constr;
54257         val_constr.datalen = val->arr_len;
54258         if (val_constr.datalen > 0)
54259                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
54260         else
54261                 val_constr.data = NULL;
54262         int64_t* val_vals = val->elems;
54263         for (size_t p = 0; p < val_constr.datalen; p++) {
54264                 int64_t val_conv_15 = val_vals[p];
54265                 LDKUpdateAddHTLC val_conv_15_conv;
54266                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
54267                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
54268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
54269                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
54270                 val_constr.data[p] = val_conv_15_conv;
54271         }
54272         FREE(val);
54273         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
54274 }
54275
54276 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fulfill_htlcs(int64_t this_ptr) {
54277         LDKCommitmentUpdate this_ptr_conv;
54278         this_ptr_conv.inner = untag_ptr(this_ptr);
54279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54281         this_ptr_conv.is_owned = false;
54282         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
54283         int64_tArray ret_arr = NULL;
54284         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54285         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54286         for (size_t t = 0; t < ret_var.datalen; t++) {
54287                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
54288                 int64_t ret_conv_19_ref = 0;
54289                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
54290                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
54291                 ret_arr_ptr[t] = ret_conv_19_ref;
54292         }
54293         
54294         FREE(ret_var.data);
54295         return ret_arr;
54296 }
54297
54298 void  CS_LDK_CommitmentUpdate_set_update_fulfill_htlcs(int64_t this_ptr, int64_tArray val) {
54299         LDKCommitmentUpdate this_ptr_conv;
54300         this_ptr_conv.inner = untag_ptr(this_ptr);
54301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54303         this_ptr_conv.is_owned = false;
54304         LDKCVec_UpdateFulfillHTLCZ val_constr;
54305         val_constr.datalen = val->arr_len;
54306         if (val_constr.datalen > 0)
54307                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
54308         else
54309                 val_constr.data = NULL;
54310         int64_t* val_vals = val->elems;
54311         for (size_t t = 0; t < val_constr.datalen; t++) {
54312                 int64_t val_conv_19 = val_vals[t];
54313                 LDKUpdateFulfillHTLC val_conv_19_conv;
54314                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
54315                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
54316                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
54317                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
54318                 val_constr.data[t] = val_conv_19_conv;
54319         }
54320         FREE(val);
54321         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
54322 }
54323
54324 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_htlcs(int64_t this_ptr) {
54325         LDKCommitmentUpdate this_ptr_conv;
54326         this_ptr_conv.inner = untag_ptr(this_ptr);
54327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54329         this_ptr_conv.is_owned = false;
54330         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
54331         int64_tArray ret_arr = NULL;
54332         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54333         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54334         for (size_t q = 0; q < ret_var.datalen; q++) {
54335                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
54336                 int64_t ret_conv_16_ref = 0;
54337                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
54338                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
54339                 ret_arr_ptr[q] = ret_conv_16_ref;
54340         }
54341         
54342         FREE(ret_var.data);
54343         return ret_arr;
54344 }
54345
54346 void  CS_LDK_CommitmentUpdate_set_update_fail_htlcs(int64_t this_ptr, int64_tArray val) {
54347         LDKCommitmentUpdate this_ptr_conv;
54348         this_ptr_conv.inner = untag_ptr(this_ptr);
54349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54351         this_ptr_conv.is_owned = false;
54352         LDKCVec_UpdateFailHTLCZ val_constr;
54353         val_constr.datalen = val->arr_len;
54354         if (val_constr.datalen > 0)
54355                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
54356         else
54357                 val_constr.data = NULL;
54358         int64_t* val_vals = val->elems;
54359         for (size_t q = 0; q < val_constr.datalen; q++) {
54360                 int64_t val_conv_16 = val_vals[q];
54361                 LDKUpdateFailHTLC val_conv_16_conv;
54362                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
54363                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
54364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
54365                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
54366                 val_constr.data[q] = val_conv_16_conv;
54367         }
54368         FREE(val);
54369         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
54370 }
54371
54372 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_malformed_htlcs(int64_t this_ptr) {
54373         LDKCommitmentUpdate this_ptr_conv;
54374         this_ptr_conv.inner = untag_ptr(this_ptr);
54375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54377         this_ptr_conv.is_owned = false;
54378         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
54379         int64_tArray ret_arr = NULL;
54380         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54381         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54382         for (size_t z = 0; z < ret_var.datalen; z++) {
54383                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
54384                 int64_t ret_conv_25_ref = 0;
54385                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
54386                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
54387                 ret_arr_ptr[z] = ret_conv_25_ref;
54388         }
54389         
54390         FREE(ret_var.data);
54391         return ret_arr;
54392 }
54393
54394 void  CS_LDK_CommitmentUpdate_set_update_fail_malformed_htlcs(int64_t this_ptr, int64_tArray val) {
54395         LDKCommitmentUpdate this_ptr_conv;
54396         this_ptr_conv.inner = untag_ptr(this_ptr);
54397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54399         this_ptr_conv.is_owned = false;
54400         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
54401         val_constr.datalen = val->arr_len;
54402         if (val_constr.datalen > 0)
54403                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54404         else
54405                 val_constr.data = NULL;
54406         int64_t* val_vals = val->elems;
54407         for (size_t z = 0; z < val_constr.datalen; z++) {
54408                 int64_t val_conv_25 = val_vals[z];
54409                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
54410                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
54411                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
54412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
54413                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
54414                 val_constr.data[z] = val_conv_25_conv;
54415         }
54416         FREE(val);
54417         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
54418 }
54419
54420 int64_t  CS_LDK_CommitmentUpdate_get_update_fee(int64_t this_ptr) {
54421         LDKCommitmentUpdate this_ptr_conv;
54422         this_ptr_conv.inner = untag_ptr(this_ptr);
54423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54425         this_ptr_conv.is_owned = false;
54426         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
54427         int64_t ret_ref = 0;
54428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54430         return ret_ref;
54431 }
54432
54433 void  CS_LDK_CommitmentUpdate_set_update_fee(int64_t this_ptr, int64_t val) {
54434         LDKCommitmentUpdate this_ptr_conv;
54435         this_ptr_conv.inner = untag_ptr(this_ptr);
54436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54438         this_ptr_conv.is_owned = false;
54439         LDKUpdateFee val_conv;
54440         val_conv.inner = untag_ptr(val);
54441         val_conv.is_owned = ptr_is_owned(val);
54442         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54443         val_conv = UpdateFee_clone(&val_conv);
54444         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
54445 }
54446
54447 int64_t  CS_LDK_CommitmentUpdate_get_commitment_signed(int64_t this_ptr) {
54448         LDKCommitmentUpdate this_ptr_conv;
54449         this_ptr_conv.inner = untag_ptr(this_ptr);
54450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54452         this_ptr_conv.is_owned = false;
54453         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
54454         int64_t ret_ref = 0;
54455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54457         return ret_ref;
54458 }
54459
54460 void  CS_LDK_CommitmentUpdate_set_commitment_signed(int64_t this_ptr, int64_t val) {
54461         LDKCommitmentUpdate this_ptr_conv;
54462         this_ptr_conv.inner = untag_ptr(this_ptr);
54463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54465         this_ptr_conv.is_owned = false;
54466         LDKCommitmentSigned val_conv;
54467         val_conv.inner = untag_ptr(val);
54468         val_conv.is_owned = ptr_is_owned(val);
54469         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54470         val_conv = CommitmentSigned_clone(&val_conv);
54471         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
54472 }
54473
54474 int64_t  CS_LDK_CommitmentUpdate_new(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) {
54475         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
54476         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
54477         if (update_add_htlcs_arg_constr.datalen > 0)
54478                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
54479         else
54480                 update_add_htlcs_arg_constr.data = NULL;
54481         int64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
54482         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
54483                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
54484                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
54485                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
54486                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
54487                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
54488                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
54489                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
54490         }
54491         FREE(update_add_htlcs_arg);
54492         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
54493         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
54494         if (update_fulfill_htlcs_arg_constr.datalen > 0)
54495                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
54496         else
54497                 update_fulfill_htlcs_arg_constr.data = NULL;
54498         int64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
54499         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
54500                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
54501                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
54502                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
54503                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
54504                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
54505                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
54506                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
54507         }
54508         FREE(update_fulfill_htlcs_arg);
54509         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
54510         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
54511         if (update_fail_htlcs_arg_constr.datalen > 0)
54512                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
54513         else
54514                 update_fail_htlcs_arg_constr.data = NULL;
54515         int64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
54516         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
54517                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
54518                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
54519                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
54520                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
54521                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
54522                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
54523                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
54524         }
54525         FREE(update_fail_htlcs_arg);
54526         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
54527         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
54528         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
54529                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
54530         else
54531                 update_fail_malformed_htlcs_arg_constr.data = NULL;
54532         int64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
54533         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
54534                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
54535                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
54536                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
54537                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
54538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
54539                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
54540                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
54541         }
54542         FREE(update_fail_malformed_htlcs_arg);
54543         LDKUpdateFee update_fee_arg_conv;
54544         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
54545         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
54546         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
54547         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
54548         LDKCommitmentSigned commitment_signed_arg_conv;
54549         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
54550         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
54551         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
54552         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
54553         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);
54554         int64_t ret_ref = 0;
54555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54557         return ret_ref;
54558 }
54559
54560 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
54561         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
54562         int64_t ret_ref = 0;
54563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54565         return ret_ref;
54566 }
54567 int64_t  CS_LDK_CommitmentUpdate_clone_ptr(int64_t arg) {
54568         LDKCommitmentUpdate arg_conv;
54569         arg_conv.inner = untag_ptr(arg);
54570         arg_conv.is_owned = ptr_is_owned(arg);
54571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54572         arg_conv.is_owned = false;
54573         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
54574         return ret_conv;
54575 }
54576
54577 int64_t  CS_LDK_CommitmentUpdate_clone(int64_t orig) {
54578         LDKCommitmentUpdate orig_conv;
54579         orig_conv.inner = untag_ptr(orig);
54580         orig_conv.is_owned = ptr_is_owned(orig);
54581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54582         orig_conv.is_owned = false;
54583         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_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 int64_t  CS_LDK_CommitmentUpdate_hash(int64_t o) {
54591         LDKCommitmentUpdate o_conv;
54592         o_conv.inner = untag_ptr(o);
54593         o_conv.is_owned = ptr_is_owned(o);
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54595         o_conv.is_owned = false;
54596         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
54597         return ret_conv;
54598 }
54599
54600 jboolean  CS_LDK_CommitmentUpdate_eq(int64_t a, int64_t b) {
54601         LDKCommitmentUpdate a_conv;
54602         a_conv.inner = untag_ptr(a);
54603         a_conv.is_owned = ptr_is_owned(a);
54604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54605         a_conv.is_owned = false;
54606         LDKCommitmentUpdate b_conv;
54607         b_conv.inner = untag_ptr(b);
54608         b_conv.is_owned = ptr_is_owned(b);
54609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54610         b_conv.is_owned = false;
54611         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
54612         return ret_conv;
54613 }
54614
54615 void  CS_LDK_ChannelMessageHandler_free(int64_t this_ptr) {
54616         if (!ptr_is_owned(this_ptr)) return;
54617         void* this_ptr_ptr = untag_ptr(this_ptr);
54618         CHECK_ACCESS(this_ptr_ptr);
54619         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
54620         FREE(untag_ptr(this_ptr));
54621         ChannelMessageHandler_free(this_ptr_conv);
54622 }
54623
54624 void  CS_LDK_RoutingMessageHandler_free(int64_t this_ptr) {
54625         if (!ptr_is_owned(this_ptr)) return;
54626         void* this_ptr_ptr = untag_ptr(this_ptr);
54627         CHECK_ACCESS(this_ptr_ptr);
54628         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
54629         FREE(untag_ptr(this_ptr));
54630         RoutingMessageHandler_free(this_ptr_conv);
54631 }
54632
54633 void  CS_LDK_OnionMessageHandler_free(int64_t this_ptr) {
54634         if (!ptr_is_owned(this_ptr)) return;
54635         void* this_ptr_ptr = untag_ptr(this_ptr);
54636         CHECK_ACCESS(this_ptr_ptr);
54637         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
54638         FREE(untag_ptr(this_ptr));
54639         OnionMessageHandler_free(this_ptr_conv);
54640 }
54641
54642 void  CS_LDK_FinalOnionHopData_free(int64_t this_obj) {
54643         LDKFinalOnionHopData this_obj_conv;
54644         this_obj_conv.inner = untag_ptr(this_obj);
54645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54647         FinalOnionHopData_free(this_obj_conv);
54648 }
54649
54650 int8_tArray  CS_LDK_FinalOnionHopData_get_payment_secret(int64_t this_ptr) {
54651         LDKFinalOnionHopData this_ptr_conv;
54652         this_ptr_conv.inner = untag_ptr(this_ptr);
54653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54655         this_ptr_conv.is_owned = false;
54656         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54657         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
54658         return ret_arr;
54659 }
54660
54661 void  CS_LDK_FinalOnionHopData_set_payment_secret(int64_t this_ptr, int8_tArray val) {
54662         LDKFinalOnionHopData this_ptr_conv;
54663         this_ptr_conv.inner = untag_ptr(this_ptr);
54664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54666         this_ptr_conv.is_owned = false;
54667         LDKThirtyTwoBytes val_ref;
54668         CHECK(val->arr_len == 32);
54669         memcpy(val_ref.data, val->elems, 32); FREE(val);
54670         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
54671 }
54672
54673 int64_t  CS_LDK_FinalOnionHopData_get_total_msat(int64_t this_ptr) {
54674         LDKFinalOnionHopData this_ptr_conv;
54675         this_ptr_conv.inner = untag_ptr(this_ptr);
54676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54678         this_ptr_conv.is_owned = false;
54679         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
54680         return ret_conv;
54681 }
54682
54683 void  CS_LDK_FinalOnionHopData_set_total_msat(int64_t this_ptr, int64_t val) {
54684         LDKFinalOnionHopData this_ptr_conv;
54685         this_ptr_conv.inner = untag_ptr(this_ptr);
54686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54688         this_ptr_conv.is_owned = false;
54689         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
54690 }
54691
54692 int64_t  CS_LDK_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
54693         LDKThirtyTwoBytes payment_secret_arg_ref;
54694         CHECK(payment_secret_arg->arr_len == 32);
54695         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
54696         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
54697         int64_t ret_ref = 0;
54698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54700         return ret_ref;
54701 }
54702
54703 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
54704         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
54705         int64_t ret_ref = 0;
54706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54708         return ret_ref;
54709 }
54710 int64_t  CS_LDK_FinalOnionHopData_clone_ptr(int64_t arg) {
54711         LDKFinalOnionHopData arg_conv;
54712         arg_conv.inner = untag_ptr(arg);
54713         arg_conv.is_owned = ptr_is_owned(arg);
54714         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54715         arg_conv.is_owned = false;
54716         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
54717         return ret_conv;
54718 }
54719
54720 int64_t  CS_LDK_FinalOnionHopData_clone(int64_t orig) {
54721         LDKFinalOnionHopData orig_conv;
54722         orig_conv.inner = untag_ptr(orig);
54723         orig_conv.is_owned = ptr_is_owned(orig);
54724         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54725         orig_conv.is_owned = false;
54726         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
54727         int64_t ret_ref = 0;
54728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54730         return ret_ref;
54731 }
54732
54733 void  CS_LDK_OnionPacket_free(int64_t this_obj) {
54734         LDKOnionPacket this_obj_conv;
54735         this_obj_conv.inner = untag_ptr(this_obj);
54736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54738         OnionPacket_free(this_obj_conv);
54739 }
54740
54741 int8_t  CS_LDK_OnionPacket_get_version(int64_t this_ptr) {
54742         LDKOnionPacket this_ptr_conv;
54743         this_ptr_conv.inner = untag_ptr(this_ptr);
54744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54746         this_ptr_conv.is_owned = false;
54747         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
54748         return ret_conv;
54749 }
54750
54751 void  CS_LDK_OnionPacket_set_version(int64_t this_ptr, int8_t val) {
54752         LDKOnionPacket this_ptr_conv;
54753         this_ptr_conv.inner = untag_ptr(this_ptr);
54754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54756         this_ptr_conv.is_owned = false;
54757         OnionPacket_set_version(&this_ptr_conv, val);
54758 }
54759
54760 int64_t  CS_LDK_OnionPacket_get_public_key(int64_t this_ptr) {
54761         LDKOnionPacket this_ptr_conv;
54762         this_ptr_conv.inner = untag_ptr(this_ptr);
54763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54765         this_ptr_conv.is_owned = false;
54766         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
54767         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
54768         return tag_ptr(ret_conv, true);
54769 }
54770
54771 void  CS_LDK_OnionPacket_set_public_key(int64_t this_ptr, int64_t val) {
54772         LDKOnionPacket this_ptr_conv;
54773         this_ptr_conv.inner = untag_ptr(this_ptr);
54774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54776         this_ptr_conv.is_owned = false;
54777         void* val_ptr = untag_ptr(val);
54778         CHECK_ACCESS(val_ptr);
54779         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
54780         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
54781         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
54782 }
54783
54784 int8_tArray  CS_LDK_OnionPacket_get_hmac(int64_t this_ptr) {
54785         LDKOnionPacket this_ptr_conv;
54786         this_ptr_conv.inner = untag_ptr(this_ptr);
54787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54789         this_ptr_conv.is_owned = false;
54790         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54791         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
54792         return ret_arr;
54793 }
54794
54795 void  CS_LDK_OnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
54796         LDKOnionPacket this_ptr_conv;
54797         this_ptr_conv.inner = untag_ptr(this_ptr);
54798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54800         this_ptr_conv.is_owned = false;
54801         LDKThirtyTwoBytes val_ref;
54802         CHECK(val->arr_len == 32);
54803         memcpy(val_ref.data, val->elems, 32); FREE(val);
54804         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
54805 }
54806
54807 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
54808         LDKOnionPacket ret_var = OnionPacket_clone(arg);
54809         int64_t ret_ref = 0;
54810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54812         return ret_ref;
54813 }
54814 int64_t  CS_LDK_OnionPacket_clone_ptr(int64_t arg) {
54815         LDKOnionPacket arg_conv;
54816         arg_conv.inner = untag_ptr(arg);
54817         arg_conv.is_owned = ptr_is_owned(arg);
54818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54819         arg_conv.is_owned = false;
54820         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
54821         return ret_conv;
54822 }
54823
54824 int64_t  CS_LDK_OnionPacket_clone(int64_t orig) {
54825         LDKOnionPacket orig_conv;
54826         orig_conv.inner = untag_ptr(orig);
54827         orig_conv.is_owned = ptr_is_owned(orig);
54828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54829         orig_conv.is_owned = false;
54830         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
54831         int64_t ret_ref = 0;
54832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54834         return ret_ref;
54835 }
54836
54837 int64_t  CS_LDK_OnionPacket_hash(int64_t o) {
54838         LDKOnionPacket o_conv;
54839         o_conv.inner = untag_ptr(o);
54840         o_conv.is_owned = ptr_is_owned(o);
54841         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54842         o_conv.is_owned = false;
54843         int64_t ret_conv = OnionPacket_hash(&o_conv);
54844         return ret_conv;
54845 }
54846
54847 jboolean  CS_LDK_OnionPacket_eq(int64_t a, int64_t b) {
54848         LDKOnionPacket a_conv;
54849         a_conv.inner = untag_ptr(a);
54850         a_conv.is_owned = ptr_is_owned(a);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54852         a_conv.is_owned = false;
54853         LDKOnionPacket b_conv;
54854         b_conv.inner = untag_ptr(b);
54855         b_conv.is_owned = ptr_is_owned(b);
54856         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54857         b_conv.is_owned = false;
54858         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
54859         return ret_conv;
54860 }
54861
54862 void  CS_LDK_TrampolineOnionPacket_free(int64_t this_obj) {
54863         LDKTrampolineOnionPacket this_obj_conv;
54864         this_obj_conv.inner = untag_ptr(this_obj);
54865         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54867         TrampolineOnionPacket_free(this_obj_conv);
54868 }
54869
54870 int8_t  CS_LDK_TrampolineOnionPacket_get_version(int64_t this_ptr) {
54871         LDKTrampolineOnionPacket this_ptr_conv;
54872         this_ptr_conv.inner = untag_ptr(this_ptr);
54873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54875         this_ptr_conv.is_owned = false;
54876         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
54877         return ret_conv;
54878 }
54879
54880 void  CS_LDK_TrampolineOnionPacket_set_version(int64_t this_ptr, int8_t val) {
54881         LDKTrampolineOnionPacket this_ptr_conv;
54882         this_ptr_conv.inner = untag_ptr(this_ptr);
54883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54885         this_ptr_conv.is_owned = false;
54886         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
54887 }
54888
54889 int8_tArray  CS_LDK_TrampolineOnionPacket_get_public_key(int64_t this_ptr) {
54890         LDKTrampolineOnionPacket this_ptr_conv;
54891         this_ptr_conv.inner = untag_ptr(this_ptr);
54892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54894         this_ptr_conv.is_owned = false;
54895         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54896         memcpy(ret_arr->elems, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form, 33);
54897         return ret_arr;
54898 }
54899
54900 void  CS_LDK_TrampolineOnionPacket_set_public_key(int64_t this_ptr, int8_tArray val) {
54901         LDKTrampolineOnionPacket this_ptr_conv;
54902         this_ptr_conv.inner = untag_ptr(this_ptr);
54903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54905         this_ptr_conv.is_owned = false;
54906         LDKPublicKey val_ref;
54907         CHECK(val->arr_len == 33);
54908         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54909         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
54910 }
54911
54912 int8_tArray  CS_LDK_TrampolineOnionPacket_get_hop_data(int64_t this_ptr) {
54913         LDKTrampolineOnionPacket this_ptr_conv;
54914         this_ptr_conv.inner = untag_ptr(this_ptr);
54915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54917         this_ptr_conv.is_owned = false;
54918         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
54919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54921         CVec_u8Z_free(ret_var);
54922         return ret_arr;
54923 }
54924
54925 void  CS_LDK_TrampolineOnionPacket_set_hop_data(int64_t this_ptr, int8_tArray val) {
54926         LDKTrampolineOnionPacket this_ptr_conv;
54927         this_ptr_conv.inner = untag_ptr(this_ptr);
54928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54930         this_ptr_conv.is_owned = false;
54931         LDKCVec_u8Z val_ref;
54932         val_ref.datalen = val->arr_len;
54933         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54934         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54935         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
54936 }
54937
54938 int8_tArray  CS_LDK_TrampolineOnionPacket_get_hmac(int64_t this_ptr) {
54939         LDKTrampolineOnionPacket this_ptr_conv;
54940         this_ptr_conv.inner = untag_ptr(this_ptr);
54941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54943         this_ptr_conv.is_owned = false;
54944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54945         memcpy(ret_arr->elems, *TrampolineOnionPacket_get_hmac(&this_ptr_conv), 32);
54946         return ret_arr;
54947 }
54948
54949 void  CS_LDK_TrampolineOnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
54950         LDKTrampolineOnionPacket this_ptr_conv;
54951         this_ptr_conv.inner = untag_ptr(this_ptr);
54952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54954         this_ptr_conv.is_owned = false;
54955         LDKThirtyTwoBytes val_ref;
54956         CHECK(val->arr_len == 32);
54957         memcpy(val_ref.data, val->elems, 32); FREE(val);
54958         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
54959 }
54960
54961 int64_t  CS_LDK_TrampolineOnionPacket_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
54962         LDKPublicKey public_key_arg_ref;
54963         CHECK(public_key_arg->arr_len == 33);
54964         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
54965         LDKCVec_u8Z hop_data_arg_ref;
54966         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
54967         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54968         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
54969         LDKThirtyTwoBytes hmac_arg_ref;
54970         CHECK(hmac_arg->arr_len == 32);
54971         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
54972         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
54973         int64_t ret_ref = 0;
54974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54976         return ret_ref;
54977 }
54978
54979 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
54980         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
54981         int64_t ret_ref = 0;
54982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54984         return ret_ref;
54985 }
54986 int64_t  CS_LDK_TrampolineOnionPacket_clone_ptr(int64_t arg) {
54987         LDKTrampolineOnionPacket arg_conv;
54988         arg_conv.inner = untag_ptr(arg);
54989         arg_conv.is_owned = ptr_is_owned(arg);
54990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54991         arg_conv.is_owned = false;
54992         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
54993         return ret_conv;
54994 }
54995
54996 int64_t  CS_LDK_TrampolineOnionPacket_clone(int64_t orig) {
54997         LDKTrampolineOnionPacket orig_conv;
54998         orig_conv.inner = untag_ptr(orig);
54999         orig_conv.is_owned = ptr_is_owned(orig);
55000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55001         orig_conv.is_owned = false;
55002         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
55003         int64_t ret_ref = 0;
55004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55006         return ret_ref;
55007 }
55008
55009 int64_t  CS_LDK_TrampolineOnionPacket_hash(int64_t o) {
55010         LDKTrampolineOnionPacket o_conv;
55011         o_conv.inner = untag_ptr(o);
55012         o_conv.is_owned = ptr_is_owned(o);
55013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55014         o_conv.is_owned = false;
55015         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
55016         return ret_conv;
55017 }
55018
55019 jboolean  CS_LDK_TrampolineOnionPacket_eq(int64_t a, int64_t b) {
55020         LDKTrampolineOnionPacket a_conv;
55021         a_conv.inner = untag_ptr(a);
55022         a_conv.is_owned = ptr_is_owned(a);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55024         a_conv.is_owned = false;
55025         LDKTrampolineOnionPacket b_conv;
55026         b_conv.inner = untag_ptr(b);
55027         b_conv.is_owned = ptr_is_owned(b);
55028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55029         b_conv.is_owned = false;
55030         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
55031         return ret_conv;
55032 }
55033
55034 int8_tArray  CS_LDK_TrampolineOnionPacket_write(int64_t obj) {
55035         LDKTrampolineOnionPacket obj_conv;
55036         obj_conv.inner = untag_ptr(obj);
55037         obj_conv.is_owned = ptr_is_owned(obj);
55038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55039         obj_conv.is_owned = false;
55040         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
55041         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55042         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55043         CVec_u8Z_free(ret_var);
55044         return ret_arr;
55045 }
55046
55047 int8_tArray  CS_LDK_AcceptChannel_write(int64_t obj) {
55048         LDKAcceptChannel obj_conv;
55049         obj_conv.inner = untag_ptr(obj);
55050         obj_conv.is_owned = ptr_is_owned(obj);
55051         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55052         obj_conv.is_owned = false;
55053         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
55054         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55055         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55056         CVec_u8Z_free(ret_var);
55057         return ret_arr;
55058 }
55059
55060 int64_t  CS_LDK_AcceptChannel_read(int8_tArray ser) {
55061         LDKu8slice ser_ref;
55062         ser_ref.datalen = ser->arr_len;
55063         ser_ref.data = ser->elems;
55064         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
55065         *ret_conv = AcceptChannel_read(ser_ref);
55066         FREE(ser);
55067         return tag_ptr(ret_conv, true);
55068 }
55069
55070 int8_tArray  CS_LDK_AcceptChannelV2_write(int64_t obj) {
55071         LDKAcceptChannelV2 obj_conv;
55072         obj_conv.inner = untag_ptr(obj);
55073         obj_conv.is_owned = ptr_is_owned(obj);
55074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55075         obj_conv.is_owned = false;
55076         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
55077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55079         CVec_u8Z_free(ret_var);
55080         return ret_arr;
55081 }
55082
55083 int64_t  CS_LDK_AcceptChannelV2_read(int8_tArray ser) {
55084         LDKu8slice ser_ref;
55085         ser_ref.datalen = ser->arr_len;
55086         ser_ref.data = ser->elems;
55087         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
55088         *ret_conv = AcceptChannelV2_read(ser_ref);
55089         FREE(ser);
55090         return tag_ptr(ret_conv, true);
55091 }
55092
55093 int8_tArray  CS_LDK_Stfu_write(int64_t obj) {
55094         LDKStfu obj_conv;
55095         obj_conv.inner = untag_ptr(obj);
55096         obj_conv.is_owned = ptr_is_owned(obj);
55097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55098         obj_conv.is_owned = false;
55099         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
55100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55102         CVec_u8Z_free(ret_var);
55103         return ret_arr;
55104 }
55105
55106 int64_t  CS_LDK_Stfu_read(int8_tArray ser) {
55107         LDKu8slice ser_ref;
55108         ser_ref.datalen = ser->arr_len;
55109         ser_ref.data = ser->elems;
55110         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
55111         *ret_conv = Stfu_read(ser_ref);
55112         FREE(ser);
55113         return tag_ptr(ret_conv, true);
55114 }
55115
55116 int8_tArray  CS_LDK_Splice_write(int64_t obj) {
55117         LDKSplice obj_conv;
55118         obj_conv.inner = untag_ptr(obj);
55119         obj_conv.is_owned = ptr_is_owned(obj);
55120         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55121         obj_conv.is_owned = false;
55122         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
55123         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55124         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55125         CVec_u8Z_free(ret_var);
55126         return ret_arr;
55127 }
55128
55129 int64_t  CS_LDK_Splice_read(int8_tArray ser) {
55130         LDKu8slice ser_ref;
55131         ser_ref.datalen = ser->arr_len;
55132         ser_ref.data = ser->elems;
55133         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
55134         *ret_conv = Splice_read(ser_ref);
55135         FREE(ser);
55136         return tag_ptr(ret_conv, true);
55137 }
55138
55139 int8_tArray  CS_LDK_SpliceAck_write(int64_t obj) {
55140         LDKSpliceAck obj_conv;
55141         obj_conv.inner = untag_ptr(obj);
55142         obj_conv.is_owned = ptr_is_owned(obj);
55143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55144         obj_conv.is_owned = false;
55145         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
55146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55148         CVec_u8Z_free(ret_var);
55149         return ret_arr;
55150 }
55151
55152 int64_t  CS_LDK_SpliceAck_read(int8_tArray ser) {
55153         LDKu8slice ser_ref;
55154         ser_ref.datalen = ser->arr_len;
55155         ser_ref.data = ser->elems;
55156         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
55157         *ret_conv = SpliceAck_read(ser_ref);
55158         FREE(ser);
55159         return tag_ptr(ret_conv, true);
55160 }
55161
55162 int8_tArray  CS_LDK_SpliceLocked_write(int64_t obj) {
55163         LDKSpliceLocked obj_conv;
55164         obj_conv.inner = untag_ptr(obj);
55165         obj_conv.is_owned = ptr_is_owned(obj);
55166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55167         obj_conv.is_owned = false;
55168         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
55169         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55170         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55171         CVec_u8Z_free(ret_var);
55172         return ret_arr;
55173 }
55174
55175 int64_t  CS_LDK_SpliceLocked_read(int8_tArray ser) {
55176         LDKu8slice ser_ref;
55177         ser_ref.datalen = ser->arr_len;
55178         ser_ref.data = ser->elems;
55179         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
55180         *ret_conv = SpliceLocked_read(ser_ref);
55181         FREE(ser);
55182         return tag_ptr(ret_conv, true);
55183 }
55184
55185 int8_tArray  CS_LDK_TxAddInput_write(int64_t obj) {
55186         LDKTxAddInput obj_conv;
55187         obj_conv.inner = untag_ptr(obj);
55188         obj_conv.is_owned = ptr_is_owned(obj);
55189         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55190         obj_conv.is_owned = false;
55191         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
55192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55194         CVec_u8Z_free(ret_var);
55195         return ret_arr;
55196 }
55197
55198 int64_t  CS_LDK_TxAddInput_read(int8_tArray ser) {
55199         LDKu8slice ser_ref;
55200         ser_ref.datalen = ser->arr_len;
55201         ser_ref.data = ser->elems;
55202         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
55203         *ret_conv = TxAddInput_read(ser_ref);
55204         FREE(ser);
55205         return tag_ptr(ret_conv, true);
55206 }
55207
55208 int8_tArray  CS_LDK_TxAddOutput_write(int64_t obj) {
55209         LDKTxAddOutput obj_conv;
55210         obj_conv.inner = untag_ptr(obj);
55211         obj_conv.is_owned = ptr_is_owned(obj);
55212         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55213         obj_conv.is_owned = false;
55214         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
55215         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55216         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55217         CVec_u8Z_free(ret_var);
55218         return ret_arr;
55219 }
55220
55221 int64_t  CS_LDK_TxAddOutput_read(int8_tArray ser) {
55222         LDKu8slice ser_ref;
55223         ser_ref.datalen = ser->arr_len;
55224         ser_ref.data = ser->elems;
55225         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
55226         *ret_conv = TxAddOutput_read(ser_ref);
55227         FREE(ser);
55228         return tag_ptr(ret_conv, true);
55229 }
55230
55231 int8_tArray  CS_LDK_TxRemoveInput_write(int64_t obj) {
55232         LDKTxRemoveInput obj_conv;
55233         obj_conv.inner = untag_ptr(obj);
55234         obj_conv.is_owned = ptr_is_owned(obj);
55235         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55236         obj_conv.is_owned = false;
55237         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
55238         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55239         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55240         CVec_u8Z_free(ret_var);
55241         return ret_arr;
55242 }
55243
55244 int64_t  CS_LDK_TxRemoveInput_read(int8_tArray ser) {
55245         LDKu8slice ser_ref;
55246         ser_ref.datalen = ser->arr_len;
55247         ser_ref.data = ser->elems;
55248         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
55249         *ret_conv = TxRemoveInput_read(ser_ref);
55250         FREE(ser);
55251         return tag_ptr(ret_conv, true);
55252 }
55253
55254 int8_tArray  CS_LDK_TxRemoveOutput_write(int64_t obj) {
55255         LDKTxRemoveOutput obj_conv;
55256         obj_conv.inner = untag_ptr(obj);
55257         obj_conv.is_owned = ptr_is_owned(obj);
55258         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55259         obj_conv.is_owned = false;
55260         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
55261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55263         CVec_u8Z_free(ret_var);
55264         return ret_arr;
55265 }
55266
55267 int64_t  CS_LDK_TxRemoveOutput_read(int8_tArray ser) {
55268         LDKu8slice ser_ref;
55269         ser_ref.datalen = ser->arr_len;
55270         ser_ref.data = ser->elems;
55271         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
55272         *ret_conv = TxRemoveOutput_read(ser_ref);
55273         FREE(ser);
55274         return tag_ptr(ret_conv, true);
55275 }
55276
55277 int8_tArray  CS_LDK_TxComplete_write(int64_t obj) {
55278         LDKTxComplete obj_conv;
55279         obj_conv.inner = untag_ptr(obj);
55280         obj_conv.is_owned = ptr_is_owned(obj);
55281         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55282         obj_conv.is_owned = false;
55283         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
55284         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55285         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55286         CVec_u8Z_free(ret_var);
55287         return ret_arr;
55288 }
55289
55290 int64_t  CS_LDK_TxComplete_read(int8_tArray ser) {
55291         LDKu8slice ser_ref;
55292         ser_ref.datalen = ser->arr_len;
55293         ser_ref.data = ser->elems;
55294         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
55295         *ret_conv = TxComplete_read(ser_ref);
55296         FREE(ser);
55297         return tag_ptr(ret_conv, true);
55298 }
55299
55300 int8_tArray  CS_LDK_TxSignatures_write(int64_t obj) {
55301         LDKTxSignatures obj_conv;
55302         obj_conv.inner = untag_ptr(obj);
55303         obj_conv.is_owned = ptr_is_owned(obj);
55304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55305         obj_conv.is_owned = false;
55306         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
55307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55309         CVec_u8Z_free(ret_var);
55310         return ret_arr;
55311 }
55312
55313 int64_t  CS_LDK_TxSignatures_read(int8_tArray ser) {
55314         LDKu8slice ser_ref;
55315         ser_ref.datalen = ser->arr_len;
55316         ser_ref.data = ser->elems;
55317         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
55318         *ret_conv = TxSignatures_read(ser_ref);
55319         FREE(ser);
55320         return tag_ptr(ret_conv, true);
55321 }
55322
55323 int8_tArray  CS_LDK_TxInitRbf_write(int64_t obj) {
55324         LDKTxInitRbf obj_conv;
55325         obj_conv.inner = untag_ptr(obj);
55326         obj_conv.is_owned = ptr_is_owned(obj);
55327         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55328         obj_conv.is_owned = false;
55329         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
55330         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55331         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55332         CVec_u8Z_free(ret_var);
55333         return ret_arr;
55334 }
55335
55336 int64_t  CS_LDK_TxInitRbf_read(int8_tArray ser) {
55337         LDKu8slice ser_ref;
55338         ser_ref.datalen = ser->arr_len;
55339         ser_ref.data = ser->elems;
55340         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
55341         *ret_conv = TxInitRbf_read(ser_ref);
55342         FREE(ser);
55343         return tag_ptr(ret_conv, true);
55344 }
55345
55346 int8_tArray  CS_LDK_TxAckRbf_write(int64_t obj) {
55347         LDKTxAckRbf obj_conv;
55348         obj_conv.inner = untag_ptr(obj);
55349         obj_conv.is_owned = ptr_is_owned(obj);
55350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55351         obj_conv.is_owned = false;
55352         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
55353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55355         CVec_u8Z_free(ret_var);
55356         return ret_arr;
55357 }
55358
55359 int64_t  CS_LDK_TxAckRbf_read(int8_tArray ser) {
55360         LDKu8slice ser_ref;
55361         ser_ref.datalen = ser->arr_len;
55362         ser_ref.data = ser->elems;
55363         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
55364         *ret_conv = TxAckRbf_read(ser_ref);
55365         FREE(ser);
55366         return tag_ptr(ret_conv, true);
55367 }
55368
55369 int8_tArray  CS_LDK_TxAbort_write(int64_t obj) {
55370         LDKTxAbort obj_conv;
55371         obj_conv.inner = untag_ptr(obj);
55372         obj_conv.is_owned = ptr_is_owned(obj);
55373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55374         obj_conv.is_owned = false;
55375         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
55376         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55377         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55378         CVec_u8Z_free(ret_var);
55379         return ret_arr;
55380 }
55381
55382 int64_t  CS_LDK_TxAbort_read(int8_tArray ser) {
55383         LDKu8slice ser_ref;
55384         ser_ref.datalen = ser->arr_len;
55385         ser_ref.data = ser->elems;
55386         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
55387         *ret_conv = TxAbort_read(ser_ref);
55388         FREE(ser);
55389         return tag_ptr(ret_conv, true);
55390 }
55391
55392 int8_tArray  CS_LDK_AnnouncementSignatures_write(int64_t obj) {
55393         LDKAnnouncementSignatures obj_conv;
55394         obj_conv.inner = untag_ptr(obj);
55395         obj_conv.is_owned = ptr_is_owned(obj);
55396         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55397         obj_conv.is_owned = false;
55398         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
55399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55401         CVec_u8Z_free(ret_var);
55402         return ret_arr;
55403 }
55404
55405 int64_t  CS_LDK_AnnouncementSignatures_read(int8_tArray ser) {
55406         LDKu8slice ser_ref;
55407         ser_ref.datalen = ser->arr_len;
55408         ser_ref.data = ser->elems;
55409         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
55410         *ret_conv = AnnouncementSignatures_read(ser_ref);
55411         FREE(ser);
55412         return tag_ptr(ret_conv, true);
55413 }
55414
55415 int8_tArray  CS_LDK_ChannelReestablish_write(int64_t obj) {
55416         LDKChannelReestablish obj_conv;
55417         obj_conv.inner = untag_ptr(obj);
55418         obj_conv.is_owned = ptr_is_owned(obj);
55419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55420         obj_conv.is_owned = false;
55421         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
55422         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55423         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55424         CVec_u8Z_free(ret_var);
55425         return ret_arr;
55426 }
55427
55428 int64_t  CS_LDK_ChannelReestablish_read(int8_tArray ser) {
55429         LDKu8slice ser_ref;
55430         ser_ref.datalen = ser->arr_len;
55431         ser_ref.data = ser->elems;
55432         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
55433         *ret_conv = ChannelReestablish_read(ser_ref);
55434         FREE(ser);
55435         return tag_ptr(ret_conv, true);
55436 }
55437
55438 int8_tArray  CS_LDK_ClosingSigned_write(int64_t obj) {
55439         LDKClosingSigned obj_conv;
55440         obj_conv.inner = untag_ptr(obj);
55441         obj_conv.is_owned = ptr_is_owned(obj);
55442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55443         obj_conv.is_owned = false;
55444         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
55445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55447         CVec_u8Z_free(ret_var);
55448         return ret_arr;
55449 }
55450
55451 int64_t  CS_LDK_ClosingSigned_read(int8_tArray ser) {
55452         LDKu8slice ser_ref;
55453         ser_ref.datalen = ser->arr_len;
55454         ser_ref.data = ser->elems;
55455         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
55456         *ret_conv = ClosingSigned_read(ser_ref);
55457         FREE(ser);
55458         return tag_ptr(ret_conv, true);
55459 }
55460
55461 int8_tArray  CS_LDK_ClosingSignedFeeRange_write(int64_t obj) {
55462         LDKClosingSignedFeeRange obj_conv;
55463         obj_conv.inner = untag_ptr(obj);
55464         obj_conv.is_owned = ptr_is_owned(obj);
55465         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55466         obj_conv.is_owned = false;
55467         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
55468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55470         CVec_u8Z_free(ret_var);
55471         return ret_arr;
55472 }
55473
55474 int64_t  CS_LDK_ClosingSignedFeeRange_read(int8_tArray ser) {
55475         LDKu8slice ser_ref;
55476         ser_ref.datalen = ser->arr_len;
55477         ser_ref.data = ser->elems;
55478         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
55479         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
55480         FREE(ser);
55481         return tag_ptr(ret_conv, true);
55482 }
55483
55484 int8_tArray  CS_LDK_CommitmentSigned_write(int64_t obj) {
55485         LDKCommitmentSigned obj_conv;
55486         obj_conv.inner = untag_ptr(obj);
55487         obj_conv.is_owned = ptr_is_owned(obj);
55488         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55489         obj_conv.is_owned = false;
55490         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
55491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55493         CVec_u8Z_free(ret_var);
55494         return ret_arr;
55495 }
55496
55497 int64_t  CS_LDK_CommitmentSigned_read(int8_tArray ser) {
55498         LDKu8slice ser_ref;
55499         ser_ref.datalen = ser->arr_len;
55500         ser_ref.data = ser->elems;
55501         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
55502         *ret_conv = CommitmentSigned_read(ser_ref);
55503         FREE(ser);
55504         return tag_ptr(ret_conv, true);
55505 }
55506
55507 int8_tArray  CS_LDK_FundingCreated_write(int64_t obj) {
55508         LDKFundingCreated obj_conv;
55509         obj_conv.inner = untag_ptr(obj);
55510         obj_conv.is_owned = ptr_is_owned(obj);
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55512         obj_conv.is_owned = false;
55513         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
55514         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55515         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55516         CVec_u8Z_free(ret_var);
55517         return ret_arr;
55518 }
55519
55520 int64_t  CS_LDK_FundingCreated_read(int8_tArray ser) {
55521         LDKu8slice ser_ref;
55522         ser_ref.datalen = ser->arr_len;
55523         ser_ref.data = ser->elems;
55524         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
55525         *ret_conv = FundingCreated_read(ser_ref);
55526         FREE(ser);
55527         return tag_ptr(ret_conv, true);
55528 }
55529
55530 int8_tArray  CS_LDK_FundingSigned_write(int64_t obj) {
55531         LDKFundingSigned obj_conv;
55532         obj_conv.inner = untag_ptr(obj);
55533         obj_conv.is_owned = ptr_is_owned(obj);
55534         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55535         obj_conv.is_owned = false;
55536         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
55537         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55538         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55539         CVec_u8Z_free(ret_var);
55540         return ret_arr;
55541 }
55542
55543 int64_t  CS_LDK_FundingSigned_read(int8_tArray ser) {
55544         LDKu8slice ser_ref;
55545         ser_ref.datalen = ser->arr_len;
55546         ser_ref.data = ser->elems;
55547         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
55548         *ret_conv = FundingSigned_read(ser_ref);
55549         FREE(ser);
55550         return tag_ptr(ret_conv, true);
55551 }
55552
55553 int8_tArray  CS_LDK_ChannelReady_write(int64_t obj) {
55554         LDKChannelReady obj_conv;
55555         obj_conv.inner = untag_ptr(obj);
55556         obj_conv.is_owned = ptr_is_owned(obj);
55557         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55558         obj_conv.is_owned = false;
55559         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
55560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55562         CVec_u8Z_free(ret_var);
55563         return ret_arr;
55564 }
55565
55566 int64_t  CS_LDK_ChannelReady_read(int8_tArray ser) {
55567         LDKu8slice ser_ref;
55568         ser_ref.datalen = ser->arr_len;
55569         ser_ref.data = ser->elems;
55570         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
55571         *ret_conv = ChannelReady_read(ser_ref);
55572         FREE(ser);
55573         return tag_ptr(ret_conv, true);
55574 }
55575
55576 int8_tArray  CS_LDK_Init_write(int64_t obj) {
55577         LDKInit obj_conv;
55578         obj_conv.inner = untag_ptr(obj);
55579         obj_conv.is_owned = ptr_is_owned(obj);
55580         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55581         obj_conv.is_owned = false;
55582         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
55583         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55584         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55585         CVec_u8Z_free(ret_var);
55586         return ret_arr;
55587 }
55588
55589 int64_t  CS_LDK_Init_read(int8_tArray ser) {
55590         LDKu8slice ser_ref;
55591         ser_ref.datalen = ser->arr_len;
55592         ser_ref.data = ser->elems;
55593         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
55594         *ret_conv = Init_read(ser_ref);
55595         FREE(ser);
55596         return tag_ptr(ret_conv, true);
55597 }
55598
55599 int8_tArray  CS_LDK_OpenChannel_write(int64_t obj) {
55600         LDKOpenChannel obj_conv;
55601         obj_conv.inner = untag_ptr(obj);
55602         obj_conv.is_owned = ptr_is_owned(obj);
55603         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55604         obj_conv.is_owned = false;
55605         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
55606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55608         CVec_u8Z_free(ret_var);
55609         return ret_arr;
55610 }
55611
55612 int64_t  CS_LDK_OpenChannel_read(int8_tArray ser) {
55613         LDKu8slice ser_ref;
55614         ser_ref.datalen = ser->arr_len;
55615         ser_ref.data = ser->elems;
55616         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
55617         *ret_conv = OpenChannel_read(ser_ref);
55618         FREE(ser);
55619         return tag_ptr(ret_conv, true);
55620 }
55621
55622 int8_tArray  CS_LDK_OpenChannelV2_write(int64_t obj) {
55623         LDKOpenChannelV2 obj_conv;
55624         obj_conv.inner = untag_ptr(obj);
55625         obj_conv.is_owned = ptr_is_owned(obj);
55626         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55627         obj_conv.is_owned = false;
55628         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
55629         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55630         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55631         CVec_u8Z_free(ret_var);
55632         return ret_arr;
55633 }
55634
55635 int64_t  CS_LDK_OpenChannelV2_read(int8_tArray ser) {
55636         LDKu8slice ser_ref;
55637         ser_ref.datalen = ser->arr_len;
55638         ser_ref.data = ser->elems;
55639         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
55640         *ret_conv = OpenChannelV2_read(ser_ref);
55641         FREE(ser);
55642         return tag_ptr(ret_conv, true);
55643 }
55644
55645 int8_tArray  CS_LDK_RevokeAndACK_write(int64_t obj) {
55646         LDKRevokeAndACK obj_conv;
55647         obj_conv.inner = untag_ptr(obj);
55648         obj_conv.is_owned = ptr_is_owned(obj);
55649         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55650         obj_conv.is_owned = false;
55651         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
55652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55654         CVec_u8Z_free(ret_var);
55655         return ret_arr;
55656 }
55657
55658 int64_t  CS_LDK_RevokeAndACK_read(int8_tArray ser) {
55659         LDKu8slice ser_ref;
55660         ser_ref.datalen = ser->arr_len;
55661         ser_ref.data = ser->elems;
55662         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
55663         *ret_conv = RevokeAndACK_read(ser_ref);
55664         FREE(ser);
55665         return tag_ptr(ret_conv, true);
55666 }
55667
55668 int8_tArray  CS_LDK_Shutdown_write(int64_t obj) {
55669         LDKShutdown obj_conv;
55670         obj_conv.inner = untag_ptr(obj);
55671         obj_conv.is_owned = ptr_is_owned(obj);
55672         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55673         obj_conv.is_owned = false;
55674         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
55675         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55676         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55677         CVec_u8Z_free(ret_var);
55678         return ret_arr;
55679 }
55680
55681 int64_t  CS_LDK_Shutdown_read(int8_tArray ser) {
55682         LDKu8slice ser_ref;
55683         ser_ref.datalen = ser->arr_len;
55684         ser_ref.data = ser->elems;
55685         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
55686         *ret_conv = Shutdown_read(ser_ref);
55687         FREE(ser);
55688         return tag_ptr(ret_conv, true);
55689 }
55690
55691 int8_tArray  CS_LDK_UpdateFailHTLC_write(int64_t obj) {
55692         LDKUpdateFailHTLC obj_conv;
55693         obj_conv.inner = untag_ptr(obj);
55694         obj_conv.is_owned = ptr_is_owned(obj);
55695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55696         obj_conv.is_owned = false;
55697         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
55698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55700         CVec_u8Z_free(ret_var);
55701         return ret_arr;
55702 }
55703
55704 int64_t  CS_LDK_UpdateFailHTLC_read(int8_tArray ser) {
55705         LDKu8slice ser_ref;
55706         ser_ref.datalen = ser->arr_len;
55707         ser_ref.data = ser->elems;
55708         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
55709         *ret_conv = UpdateFailHTLC_read(ser_ref);
55710         FREE(ser);
55711         return tag_ptr(ret_conv, true);
55712 }
55713
55714 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_write(int64_t obj) {
55715         LDKUpdateFailMalformedHTLC obj_conv;
55716         obj_conv.inner = untag_ptr(obj);
55717         obj_conv.is_owned = ptr_is_owned(obj);
55718         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55719         obj_conv.is_owned = false;
55720         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
55721         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55722         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55723         CVec_u8Z_free(ret_var);
55724         return ret_arr;
55725 }
55726
55727 int64_t  CS_LDK_UpdateFailMalformedHTLC_read(int8_tArray ser) {
55728         LDKu8slice ser_ref;
55729         ser_ref.datalen = ser->arr_len;
55730         ser_ref.data = ser->elems;
55731         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
55732         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
55733         FREE(ser);
55734         return tag_ptr(ret_conv, true);
55735 }
55736
55737 int8_tArray  CS_LDK_UpdateFee_write(int64_t obj) {
55738         LDKUpdateFee obj_conv;
55739         obj_conv.inner = untag_ptr(obj);
55740         obj_conv.is_owned = ptr_is_owned(obj);
55741         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55742         obj_conv.is_owned = false;
55743         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
55744         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55745         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55746         CVec_u8Z_free(ret_var);
55747         return ret_arr;
55748 }
55749
55750 int64_t  CS_LDK_UpdateFee_read(int8_tArray ser) {
55751         LDKu8slice ser_ref;
55752         ser_ref.datalen = ser->arr_len;
55753         ser_ref.data = ser->elems;
55754         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
55755         *ret_conv = UpdateFee_read(ser_ref);
55756         FREE(ser);
55757         return tag_ptr(ret_conv, true);
55758 }
55759
55760 int8_tArray  CS_LDK_UpdateFulfillHTLC_write(int64_t obj) {
55761         LDKUpdateFulfillHTLC obj_conv;
55762         obj_conv.inner = untag_ptr(obj);
55763         obj_conv.is_owned = ptr_is_owned(obj);
55764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55765         obj_conv.is_owned = false;
55766         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
55767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55769         CVec_u8Z_free(ret_var);
55770         return ret_arr;
55771 }
55772
55773 int64_t  CS_LDK_UpdateFulfillHTLC_read(int8_tArray ser) {
55774         LDKu8slice ser_ref;
55775         ser_ref.datalen = ser->arr_len;
55776         ser_ref.data = ser->elems;
55777         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
55778         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
55779         FREE(ser);
55780         return tag_ptr(ret_conv, true);
55781 }
55782
55783 int8_tArray  CS_LDK_OnionPacket_write(int64_t obj) {
55784         LDKOnionPacket obj_conv;
55785         obj_conv.inner = untag_ptr(obj);
55786         obj_conv.is_owned = ptr_is_owned(obj);
55787         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55788         obj_conv.is_owned = false;
55789         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
55790         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55791         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55792         CVec_u8Z_free(ret_var);
55793         return ret_arr;
55794 }
55795
55796 int64_t  CS_LDK_OnionPacket_read(int8_tArray ser) {
55797         LDKu8slice ser_ref;
55798         ser_ref.datalen = ser->arr_len;
55799         ser_ref.data = ser->elems;
55800         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
55801         *ret_conv = OnionPacket_read(ser_ref);
55802         FREE(ser);
55803         return tag_ptr(ret_conv, true);
55804 }
55805
55806 int8_tArray  CS_LDK_UpdateAddHTLC_write(int64_t obj) {
55807         LDKUpdateAddHTLC obj_conv;
55808         obj_conv.inner = untag_ptr(obj);
55809         obj_conv.is_owned = ptr_is_owned(obj);
55810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55811         obj_conv.is_owned = false;
55812         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
55813         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55814         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55815         CVec_u8Z_free(ret_var);
55816         return ret_arr;
55817 }
55818
55819 int64_t  CS_LDK_UpdateAddHTLC_read(int8_tArray ser) {
55820         LDKu8slice ser_ref;
55821         ser_ref.datalen = ser->arr_len;
55822         ser_ref.data = ser->elems;
55823         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
55824         *ret_conv = UpdateAddHTLC_read(ser_ref);
55825         FREE(ser);
55826         return tag_ptr(ret_conv, true);
55827 }
55828
55829 int64_t  CS_LDK_OnionMessage_read(int8_tArray ser) {
55830         LDKu8slice ser_ref;
55831         ser_ref.datalen = ser->arr_len;
55832         ser_ref.data = ser->elems;
55833         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
55834         *ret_conv = OnionMessage_read(ser_ref);
55835         FREE(ser);
55836         return tag_ptr(ret_conv, true);
55837 }
55838
55839 int8_tArray  CS_LDK_OnionMessage_write(int64_t obj) {
55840         LDKOnionMessage obj_conv;
55841         obj_conv.inner = untag_ptr(obj);
55842         obj_conv.is_owned = ptr_is_owned(obj);
55843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55844         obj_conv.is_owned = false;
55845         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
55846         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55847         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55848         CVec_u8Z_free(ret_var);
55849         return ret_arr;
55850 }
55851
55852 int8_tArray  CS_LDK_FinalOnionHopData_write(int64_t obj) {
55853         LDKFinalOnionHopData obj_conv;
55854         obj_conv.inner = untag_ptr(obj);
55855         obj_conv.is_owned = ptr_is_owned(obj);
55856         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55857         obj_conv.is_owned = false;
55858         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
55859         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55860         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55861         CVec_u8Z_free(ret_var);
55862         return ret_arr;
55863 }
55864
55865 int64_t  CS_LDK_FinalOnionHopData_read(int8_tArray ser) {
55866         LDKu8slice ser_ref;
55867         ser_ref.datalen = ser->arr_len;
55868         ser_ref.data = ser->elems;
55869         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
55870         *ret_conv = FinalOnionHopData_read(ser_ref);
55871         FREE(ser);
55872         return tag_ptr(ret_conv, true);
55873 }
55874
55875 int8_tArray  CS_LDK_Ping_write(int64_t obj) {
55876         LDKPing obj_conv;
55877         obj_conv.inner = untag_ptr(obj);
55878         obj_conv.is_owned = ptr_is_owned(obj);
55879         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55880         obj_conv.is_owned = false;
55881         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
55882         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55883         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55884         CVec_u8Z_free(ret_var);
55885         return ret_arr;
55886 }
55887
55888 int64_t  CS_LDK_Ping_read(int8_tArray ser) {
55889         LDKu8slice ser_ref;
55890         ser_ref.datalen = ser->arr_len;
55891         ser_ref.data = ser->elems;
55892         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
55893         *ret_conv = Ping_read(ser_ref);
55894         FREE(ser);
55895         return tag_ptr(ret_conv, true);
55896 }
55897
55898 int8_tArray  CS_LDK_Pong_write(int64_t obj) {
55899         LDKPong obj_conv;
55900         obj_conv.inner = untag_ptr(obj);
55901         obj_conv.is_owned = ptr_is_owned(obj);
55902         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55903         obj_conv.is_owned = false;
55904         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
55905         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55906         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55907         CVec_u8Z_free(ret_var);
55908         return ret_arr;
55909 }
55910
55911 int64_t  CS_LDK_Pong_read(int8_tArray ser) {
55912         LDKu8slice ser_ref;
55913         ser_ref.datalen = ser->arr_len;
55914         ser_ref.data = ser->elems;
55915         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
55916         *ret_conv = Pong_read(ser_ref);
55917         FREE(ser);
55918         return tag_ptr(ret_conv, true);
55919 }
55920
55921 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_write(int64_t obj) {
55922         LDKUnsignedChannelAnnouncement obj_conv;
55923         obj_conv.inner = untag_ptr(obj);
55924         obj_conv.is_owned = ptr_is_owned(obj);
55925         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55926         obj_conv.is_owned = false;
55927         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
55928         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55929         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55930         CVec_u8Z_free(ret_var);
55931         return ret_arr;
55932 }
55933
55934 int64_t  CS_LDK_UnsignedChannelAnnouncement_read(int8_tArray ser) {
55935         LDKu8slice ser_ref;
55936         ser_ref.datalen = ser->arr_len;
55937         ser_ref.data = ser->elems;
55938         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
55939         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
55940         FREE(ser);
55941         return tag_ptr(ret_conv, true);
55942 }
55943
55944 int8_tArray  CS_LDK_ChannelAnnouncement_write(int64_t obj) {
55945         LDKChannelAnnouncement obj_conv;
55946         obj_conv.inner = untag_ptr(obj);
55947         obj_conv.is_owned = ptr_is_owned(obj);
55948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55949         obj_conv.is_owned = false;
55950         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
55951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55953         CVec_u8Z_free(ret_var);
55954         return ret_arr;
55955 }
55956
55957 int64_t  CS_LDK_ChannelAnnouncement_read(int8_tArray ser) {
55958         LDKu8slice ser_ref;
55959         ser_ref.datalen = ser->arr_len;
55960         ser_ref.data = ser->elems;
55961         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
55962         *ret_conv = ChannelAnnouncement_read(ser_ref);
55963         FREE(ser);
55964         return tag_ptr(ret_conv, true);
55965 }
55966
55967 int8_tArray  CS_LDK_UnsignedChannelUpdate_write(int64_t obj) {
55968         LDKUnsignedChannelUpdate obj_conv;
55969         obj_conv.inner = untag_ptr(obj);
55970         obj_conv.is_owned = ptr_is_owned(obj);
55971         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55972         obj_conv.is_owned = false;
55973         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
55974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55976         CVec_u8Z_free(ret_var);
55977         return ret_arr;
55978 }
55979
55980 int64_t  CS_LDK_UnsignedChannelUpdate_read(int8_tArray ser) {
55981         LDKu8slice ser_ref;
55982         ser_ref.datalen = ser->arr_len;
55983         ser_ref.data = ser->elems;
55984         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
55985         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
55986         FREE(ser);
55987         return tag_ptr(ret_conv, true);
55988 }
55989
55990 int8_tArray  CS_LDK_ChannelUpdate_write(int64_t obj) {
55991         LDKChannelUpdate obj_conv;
55992         obj_conv.inner = untag_ptr(obj);
55993         obj_conv.is_owned = ptr_is_owned(obj);
55994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55995         obj_conv.is_owned = false;
55996         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
55997         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55998         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55999         CVec_u8Z_free(ret_var);
56000         return ret_arr;
56001 }
56002
56003 int64_t  CS_LDK_ChannelUpdate_read(int8_tArray ser) {
56004         LDKu8slice ser_ref;
56005         ser_ref.datalen = ser->arr_len;
56006         ser_ref.data = ser->elems;
56007         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
56008         *ret_conv = ChannelUpdate_read(ser_ref);
56009         FREE(ser);
56010         return tag_ptr(ret_conv, true);
56011 }
56012
56013 int8_tArray  CS_LDK_ErrorMessage_write(int64_t obj) {
56014         LDKErrorMessage obj_conv;
56015         obj_conv.inner = untag_ptr(obj);
56016         obj_conv.is_owned = ptr_is_owned(obj);
56017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56018         obj_conv.is_owned = false;
56019         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
56020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56022         CVec_u8Z_free(ret_var);
56023         return ret_arr;
56024 }
56025
56026 int64_t  CS_LDK_ErrorMessage_read(int8_tArray ser) {
56027         LDKu8slice ser_ref;
56028         ser_ref.datalen = ser->arr_len;
56029         ser_ref.data = ser->elems;
56030         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
56031         *ret_conv = ErrorMessage_read(ser_ref);
56032         FREE(ser);
56033         return tag_ptr(ret_conv, true);
56034 }
56035
56036 int8_tArray  CS_LDK_WarningMessage_write(int64_t obj) {
56037         LDKWarningMessage obj_conv;
56038         obj_conv.inner = untag_ptr(obj);
56039         obj_conv.is_owned = ptr_is_owned(obj);
56040         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56041         obj_conv.is_owned = false;
56042         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
56043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56045         CVec_u8Z_free(ret_var);
56046         return ret_arr;
56047 }
56048
56049 int64_t  CS_LDK_WarningMessage_read(int8_tArray ser) {
56050         LDKu8slice ser_ref;
56051         ser_ref.datalen = ser->arr_len;
56052         ser_ref.data = ser->elems;
56053         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
56054         *ret_conv = WarningMessage_read(ser_ref);
56055         FREE(ser);
56056         return tag_ptr(ret_conv, true);
56057 }
56058
56059 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_write(int64_t obj) {
56060         LDKUnsignedNodeAnnouncement obj_conv;
56061         obj_conv.inner = untag_ptr(obj);
56062         obj_conv.is_owned = ptr_is_owned(obj);
56063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56064         obj_conv.is_owned = false;
56065         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
56066         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56067         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56068         CVec_u8Z_free(ret_var);
56069         return ret_arr;
56070 }
56071
56072 int64_t  CS_LDK_UnsignedNodeAnnouncement_read(int8_tArray ser) {
56073         LDKu8slice ser_ref;
56074         ser_ref.datalen = ser->arr_len;
56075         ser_ref.data = ser->elems;
56076         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
56077         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
56078         FREE(ser);
56079         return tag_ptr(ret_conv, true);
56080 }
56081
56082 int8_tArray  CS_LDK_NodeAnnouncement_write(int64_t obj) {
56083         LDKNodeAnnouncement obj_conv;
56084         obj_conv.inner = untag_ptr(obj);
56085         obj_conv.is_owned = ptr_is_owned(obj);
56086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56087         obj_conv.is_owned = false;
56088         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
56089         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56090         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56091         CVec_u8Z_free(ret_var);
56092         return ret_arr;
56093 }
56094
56095 int64_t  CS_LDK_NodeAnnouncement_read(int8_tArray ser) {
56096         LDKu8slice ser_ref;
56097         ser_ref.datalen = ser->arr_len;
56098         ser_ref.data = ser->elems;
56099         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
56100         *ret_conv = NodeAnnouncement_read(ser_ref);
56101         FREE(ser);
56102         return tag_ptr(ret_conv, true);
56103 }
56104
56105 int64_t  CS_LDK_QueryShortChannelIds_read(int8_tArray ser) {
56106         LDKu8slice ser_ref;
56107         ser_ref.datalen = ser->arr_len;
56108         ser_ref.data = ser->elems;
56109         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
56110         *ret_conv = QueryShortChannelIds_read(ser_ref);
56111         FREE(ser);
56112         return tag_ptr(ret_conv, true);
56113 }
56114
56115 int8_tArray  CS_LDK_QueryShortChannelIds_write(int64_t obj) {
56116         LDKQueryShortChannelIds obj_conv;
56117         obj_conv.inner = untag_ptr(obj);
56118         obj_conv.is_owned = ptr_is_owned(obj);
56119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56120         obj_conv.is_owned = false;
56121         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
56122         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56123         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56124         CVec_u8Z_free(ret_var);
56125         return ret_arr;
56126 }
56127
56128 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_write(int64_t obj) {
56129         LDKReplyShortChannelIdsEnd obj_conv;
56130         obj_conv.inner = untag_ptr(obj);
56131         obj_conv.is_owned = ptr_is_owned(obj);
56132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56133         obj_conv.is_owned = false;
56134         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
56135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56137         CVec_u8Z_free(ret_var);
56138         return ret_arr;
56139 }
56140
56141 int64_t  CS_LDK_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
56142         LDKu8slice ser_ref;
56143         ser_ref.datalen = ser->arr_len;
56144         ser_ref.data = ser->elems;
56145         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
56146         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
56147         FREE(ser);
56148         return tag_ptr(ret_conv, true);
56149 }
56150
56151 int32_t  CS_LDK_QueryChannelRange_end_blocknum(int64_t this_arg) {
56152         LDKQueryChannelRange this_arg_conv;
56153         this_arg_conv.inner = untag_ptr(this_arg);
56154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56156         this_arg_conv.is_owned = false;
56157         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
56158         return ret_conv;
56159 }
56160
56161 int8_tArray  CS_LDK_QueryChannelRange_write(int64_t obj) {
56162         LDKQueryChannelRange obj_conv;
56163         obj_conv.inner = untag_ptr(obj);
56164         obj_conv.is_owned = ptr_is_owned(obj);
56165         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56166         obj_conv.is_owned = false;
56167         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
56168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56170         CVec_u8Z_free(ret_var);
56171         return ret_arr;
56172 }
56173
56174 int64_t  CS_LDK_QueryChannelRange_read(int8_tArray ser) {
56175         LDKu8slice ser_ref;
56176         ser_ref.datalen = ser->arr_len;
56177         ser_ref.data = ser->elems;
56178         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
56179         *ret_conv = QueryChannelRange_read(ser_ref);
56180         FREE(ser);
56181         return tag_ptr(ret_conv, true);
56182 }
56183
56184 int64_t  CS_LDK_ReplyChannelRange_read(int8_tArray ser) {
56185         LDKu8slice ser_ref;
56186         ser_ref.datalen = ser->arr_len;
56187         ser_ref.data = ser->elems;
56188         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
56189         *ret_conv = ReplyChannelRange_read(ser_ref);
56190         FREE(ser);
56191         return tag_ptr(ret_conv, true);
56192 }
56193
56194 int8_tArray  CS_LDK_ReplyChannelRange_write(int64_t obj) {
56195         LDKReplyChannelRange obj_conv;
56196         obj_conv.inner = untag_ptr(obj);
56197         obj_conv.is_owned = ptr_is_owned(obj);
56198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56199         obj_conv.is_owned = false;
56200         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
56201         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56202         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56203         CVec_u8Z_free(ret_var);
56204         return ret_arr;
56205 }
56206
56207 int8_tArray  CS_LDK_GossipTimestampFilter_write(int64_t obj) {
56208         LDKGossipTimestampFilter obj_conv;
56209         obj_conv.inner = untag_ptr(obj);
56210         obj_conv.is_owned = ptr_is_owned(obj);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56212         obj_conv.is_owned = false;
56213         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
56214         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56215         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56216         CVec_u8Z_free(ret_var);
56217         return ret_arr;
56218 }
56219
56220 int64_t  CS_LDK_GossipTimestampFilter_read(int8_tArray ser) {
56221         LDKu8slice ser_ref;
56222         ser_ref.datalen = ser->arr_len;
56223         ser_ref.data = ser->elems;
56224         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
56225         *ret_conv = GossipTimestampFilter_read(ser_ref);
56226         FREE(ser);
56227         return tag_ptr(ret_conv, true);
56228 }
56229
56230 void  CS_LDK_CustomMessageHandler_free(int64_t this_ptr) {
56231         if (!ptr_is_owned(this_ptr)) return;
56232         void* this_ptr_ptr = untag_ptr(this_ptr);
56233         CHECK_ACCESS(this_ptr_ptr);
56234         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
56235         FREE(untag_ptr(this_ptr));
56236         CustomMessageHandler_free(this_ptr_conv);
56237 }
56238
56239 void  CS_LDK_IgnoringMessageHandler_free(int64_t this_obj) {
56240         LDKIgnoringMessageHandler 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         IgnoringMessageHandler_free(this_obj_conv);
56245 }
56246
56247 int64_t  CS_LDK_IgnoringMessageHandler_new() {
56248         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
56249         int64_t ret_ref = 0;
56250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56252         return ret_ref;
56253 }
56254
56255 int64_t  CS_LDK_IgnoringMessageHandler_as_EventsProvider(int64_t this_arg) {
56256         LDKIgnoringMessageHandler this_arg_conv;
56257         this_arg_conv.inner = untag_ptr(this_arg);
56258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56260         this_arg_conv.is_owned = false;
56261         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
56262         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
56263         return tag_ptr(ret_ret, true);
56264 }
56265
56266 int64_t  CS_LDK_IgnoringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
56267         LDKIgnoringMessageHandler this_arg_conv;
56268         this_arg_conv.inner = untag_ptr(this_arg);
56269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56271         this_arg_conv.is_owned = false;
56272         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
56273         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
56274         return tag_ptr(ret_ret, true);
56275 }
56276
56277 int64_t  CS_LDK_IgnoringMessageHandler_as_RoutingMessageHandler(int64_t this_arg) {
56278         LDKIgnoringMessageHandler this_arg_conv;
56279         this_arg_conv.inner = untag_ptr(this_arg);
56280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56282         this_arg_conv.is_owned = false;
56283         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
56284         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
56285         return tag_ptr(ret_ret, true);
56286 }
56287
56288 int64_t  CS_LDK_IgnoringMessageHandler_as_OnionMessageHandler(int64_t this_arg) {
56289         LDKIgnoringMessageHandler this_arg_conv;
56290         this_arg_conv.inner = untag_ptr(this_arg);
56291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56293         this_arg_conv.is_owned = false;
56294         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
56295         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
56296         return tag_ptr(ret_ret, true);
56297 }
56298
56299 int64_t  CS_LDK_IgnoringMessageHandler_as_OffersMessageHandler(int64_t this_arg) {
56300         LDKIgnoringMessageHandler this_arg_conv;
56301         this_arg_conv.inner = untag_ptr(this_arg);
56302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56304         this_arg_conv.is_owned = false;
56305         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
56306         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
56307         return tag_ptr(ret_ret, true);
56308 }
56309
56310 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomOnionMessageHandler(int64_t this_arg) {
56311         LDKIgnoringMessageHandler this_arg_conv;
56312         this_arg_conv.inner = untag_ptr(this_arg);
56313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56315         this_arg_conv.is_owned = false;
56316         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
56317         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
56318         return tag_ptr(ret_ret, true);
56319 }
56320
56321 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageReader(int64_t this_arg) {
56322         LDKIgnoringMessageHandler this_arg_conv;
56323         this_arg_conv.inner = untag_ptr(this_arg);
56324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56326         this_arg_conv.is_owned = false;
56327         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
56328         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
56329         return tag_ptr(ret_ret, true);
56330 }
56331
56332 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageHandler(int64_t this_arg) {
56333         LDKIgnoringMessageHandler this_arg_conv;
56334         this_arg_conv.inner = untag_ptr(this_arg);
56335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56337         this_arg_conv.is_owned = false;
56338         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
56339         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
56340         return tag_ptr(ret_ret, true);
56341 }
56342
56343 void  CS_LDK_ErroringMessageHandler_free(int64_t this_obj) {
56344         LDKErroringMessageHandler this_obj_conv;
56345         this_obj_conv.inner = untag_ptr(this_obj);
56346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56348         ErroringMessageHandler_free(this_obj_conv);
56349 }
56350
56351 int64_t  CS_LDK_ErroringMessageHandler_new() {
56352         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
56353         int64_t ret_ref = 0;
56354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56356         return ret_ref;
56357 }
56358
56359 int64_t  CS_LDK_ErroringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
56360         LDKErroringMessageHandler this_arg_conv;
56361         this_arg_conv.inner = untag_ptr(this_arg);
56362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56364         this_arg_conv.is_owned = false;
56365         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
56366         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
56367         return tag_ptr(ret_ret, true);
56368 }
56369
56370 int64_t  CS_LDK_ErroringMessageHandler_as_ChannelMessageHandler(int64_t this_arg) {
56371         LDKErroringMessageHandler this_arg_conv;
56372         this_arg_conv.inner = untag_ptr(this_arg);
56373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56375         this_arg_conv.is_owned = false;
56376         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
56377         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
56378         return tag_ptr(ret_ret, true);
56379 }
56380
56381 void  CS_LDK_MessageHandler_free(int64_t this_obj) {
56382         LDKMessageHandler this_obj_conv;
56383         this_obj_conv.inner = untag_ptr(this_obj);
56384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56386         MessageHandler_free(this_obj_conv);
56387 }
56388
56389 int64_t  CS_LDK_MessageHandler_get_chan_handler(int64_t this_ptr) {
56390         LDKMessageHandler this_ptr_conv;
56391         this_ptr_conv.inner = untag_ptr(this_ptr);
56392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56394         this_ptr_conv.is_owned = false;
56395         // WARNING: This object doesn't live past this scope, needs clone!
56396         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
56397         return ret_ret;
56398 }
56399
56400 void  CS_LDK_MessageHandler_set_chan_handler(int64_t this_ptr, int64_t val) {
56401         LDKMessageHandler this_ptr_conv;
56402         this_ptr_conv.inner = untag_ptr(this_ptr);
56403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56405         this_ptr_conv.is_owned = false;
56406         void* val_ptr = untag_ptr(val);
56407         CHECK_ACCESS(val_ptr);
56408         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
56409         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
56410                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56411                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
56412         }
56413         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
56414 }
56415
56416 int64_t  CS_LDK_MessageHandler_get_route_handler(int64_t this_ptr) {
56417         LDKMessageHandler this_ptr_conv;
56418         this_ptr_conv.inner = untag_ptr(this_ptr);
56419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56421         this_ptr_conv.is_owned = false;
56422         // WARNING: This object doesn't live past this scope, needs clone!
56423         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
56424         return ret_ret;
56425 }
56426
56427 void  CS_LDK_MessageHandler_set_route_handler(int64_t this_ptr, int64_t val) {
56428         LDKMessageHandler this_ptr_conv;
56429         this_ptr_conv.inner = untag_ptr(this_ptr);
56430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56432         this_ptr_conv.is_owned = false;
56433         void* val_ptr = untag_ptr(val);
56434         CHECK_ACCESS(val_ptr);
56435         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
56436         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56438                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
56439         }
56440         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
56441 }
56442
56443 int64_t  CS_LDK_MessageHandler_get_onion_message_handler(int64_t this_ptr) {
56444         LDKMessageHandler this_ptr_conv;
56445         this_ptr_conv.inner = untag_ptr(this_ptr);
56446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56448         this_ptr_conv.is_owned = false;
56449         // WARNING: This object doesn't live past this scope, needs clone!
56450         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
56451         return ret_ret;
56452 }
56453
56454 void  CS_LDK_MessageHandler_set_onion_message_handler(int64_t this_ptr, int64_t val) {
56455         LDKMessageHandler this_ptr_conv;
56456         this_ptr_conv.inner = untag_ptr(this_ptr);
56457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56459         this_ptr_conv.is_owned = false;
56460         void* val_ptr = untag_ptr(val);
56461         CHECK_ACCESS(val_ptr);
56462         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
56463         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
56464                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56465                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
56466         }
56467         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
56468 }
56469
56470 int64_t  CS_LDK_MessageHandler_get_custom_message_handler(int64_t this_ptr) {
56471         LDKMessageHandler this_ptr_conv;
56472         this_ptr_conv.inner = untag_ptr(this_ptr);
56473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56475         this_ptr_conv.is_owned = false;
56476         // WARNING: This object doesn't live past this scope, needs clone!
56477         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
56478         return ret_ret;
56479 }
56480
56481 void  CS_LDK_MessageHandler_set_custom_message_handler(int64_t this_ptr, int64_t val) {
56482         LDKMessageHandler this_ptr_conv;
56483         this_ptr_conv.inner = untag_ptr(this_ptr);
56484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56486         this_ptr_conv.is_owned = false;
56487         void* val_ptr = untag_ptr(val);
56488         CHECK_ACCESS(val_ptr);
56489         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
56490         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
56491                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56492                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
56493         }
56494         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
56495 }
56496
56497 int64_t  CS_LDK_MessageHandler_new(int64_t chan_handler_arg, int64_t route_handler_arg, int64_t onion_message_handler_arg, int64_t custom_message_handler_arg) {
56498         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
56499         CHECK_ACCESS(chan_handler_arg_ptr);
56500         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
56501         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
56502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56503                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
56504         }
56505         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
56506         CHECK_ACCESS(route_handler_arg_ptr);
56507         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
56508         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
56509                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56510                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
56511         }
56512         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
56513         CHECK_ACCESS(onion_message_handler_arg_ptr);
56514         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
56515         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
56516                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56517                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
56518         }
56519         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
56520         CHECK_ACCESS(custom_message_handler_arg_ptr);
56521         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
56522         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
56523                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56524                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
56525         }
56526         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
56527         int64_t ret_ref = 0;
56528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56530         return ret_ref;
56531 }
56532
56533 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
56534         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56535         *ret_ret = SocketDescriptor_clone(arg);
56536         return tag_ptr(ret_ret, true);
56537 }
56538 int64_t  CS_LDK_SocketDescriptor_clone_ptr(int64_t arg) {
56539         void* arg_ptr = untag_ptr(arg);
56540         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
56541         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
56542         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
56543         return ret_conv;
56544 }
56545
56546 int64_t  CS_LDK_SocketDescriptor_clone(int64_t orig) {
56547         void* orig_ptr = untag_ptr(orig);
56548         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
56549         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
56550         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
56551         *ret_ret = SocketDescriptor_clone(orig_conv);
56552         return tag_ptr(ret_ret, true);
56553 }
56554
56555 void  CS_LDK_SocketDescriptor_free(int64_t this_ptr) {
56556         if (!ptr_is_owned(this_ptr)) return;
56557         void* this_ptr_ptr = untag_ptr(this_ptr);
56558         CHECK_ACCESS(this_ptr_ptr);
56559         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
56560         FREE(untag_ptr(this_ptr));
56561         SocketDescriptor_free(this_ptr_conv);
56562 }
56563
56564 void  CS_LDK_PeerDetails_free(int64_t this_obj) {
56565         LDKPeerDetails this_obj_conv;
56566         this_obj_conv.inner = untag_ptr(this_obj);
56567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56569         PeerDetails_free(this_obj_conv);
56570 }
56571
56572 int8_tArray  CS_LDK_PeerDetails_get_counterparty_node_id(int64_t this_ptr) {
56573         LDKPeerDetails this_ptr_conv;
56574         this_ptr_conv.inner = untag_ptr(this_ptr);
56575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56577         this_ptr_conv.is_owned = false;
56578         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56579         memcpy(ret_arr->elems, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form, 33);
56580         return ret_arr;
56581 }
56582
56583 void  CS_LDK_PeerDetails_set_counterparty_node_id(int64_t this_ptr, int8_tArray val) {
56584         LDKPeerDetails this_ptr_conv;
56585         this_ptr_conv.inner = untag_ptr(this_ptr);
56586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56588         this_ptr_conv.is_owned = false;
56589         LDKPublicKey val_ref;
56590         CHECK(val->arr_len == 33);
56591         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56592         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
56593 }
56594
56595 int64_t  CS_LDK_PeerDetails_get_socket_address(int64_t this_ptr) {
56596         LDKPeerDetails this_ptr_conv;
56597         this_ptr_conv.inner = untag_ptr(this_ptr);
56598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56600         this_ptr_conv.is_owned = false;
56601         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
56602         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
56603         int64_t ret_ref = tag_ptr(ret_copy, true);
56604         return ret_ref;
56605 }
56606
56607 void  CS_LDK_PeerDetails_set_socket_address(int64_t this_ptr, int64_t val) {
56608         LDKPeerDetails this_ptr_conv;
56609         this_ptr_conv.inner = untag_ptr(this_ptr);
56610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56612         this_ptr_conv.is_owned = false;
56613         void* val_ptr = untag_ptr(val);
56614         CHECK_ACCESS(val_ptr);
56615         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
56616         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
56617         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
56618 }
56619
56620 int64_t  CS_LDK_PeerDetails_get_init_features(int64_t this_ptr) {
56621         LDKPeerDetails this_ptr_conv;
56622         this_ptr_conv.inner = untag_ptr(this_ptr);
56623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56625         this_ptr_conv.is_owned = false;
56626         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
56627         int64_t ret_ref = 0;
56628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56630         return ret_ref;
56631 }
56632
56633 void  CS_LDK_PeerDetails_set_init_features(int64_t this_ptr, int64_t val) {
56634         LDKPeerDetails this_ptr_conv;
56635         this_ptr_conv.inner = untag_ptr(this_ptr);
56636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56638         this_ptr_conv.is_owned = false;
56639         LDKInitFeatures val_conv;
56640         val_conv.inner = untag_ptr(val);
56641         val_conv.is_owned = ptr_is_owned(val);
56642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56643         val_conv = InitFeatures_clone(&val_conv);
56644         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
56645 }
56646
56647 jboolean  CS_LDK_PeerDetails_get_is_inbound_connection(int64_t this_ptr) {
56648         LDKPeerDetails this_ptr_conv;
56649         this_ptr_conv.inner = untag_ptr(this_ptr);
56650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56652         this_ptr_conv.is_owned = false;
56653         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
56654         return ret_conv;
56655 }
56656
56657 void  CS_LDK_PeerDetails_set_is_inbound_connection(int64_t this_ptr, jboolean val) {
56658         LDKPeerDetails this_ptr_conv;
56659         this_ptr_conv.inner = untag_ptr(this_ptr);
56660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56662         this_ptr_conv.is_owned = false;
56663         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
56664 }
56665
56666 int64_t  CS_LDK_PeerDetails_new(int8_tArray counterparty_node_id_arg, int64_t socket_address_arg, int64_t init_features_arg, jboolean is_inbound_connection_arg) {
56667         LDKPublicKey counterparty_node_id_arg_ref;
56668         CHECK(counterparty_node_id_arg->arr_len == 33);
56669         memcpy(counterparty_node_id_arg_ref.compressed_form, counterparty_node_id_arg->elems, 33); FREE(counterparty_node_id_arg);
56670         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
56671         CHECK_ACCESS(socket_address_arg_ptr);
56672         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
56673         LDKInitFeatures init_features_arg_conv;
56674         init_features_arg_conv.inner = untag_ptr(init_features_arg);
56675         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
56676         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
56677         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
56678         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
56679         int64_t ret_ref = 0;
56680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56682         return ret_ref;
56683 }
56684
56685 void  CS_LDK_PeerHandleError_free(int64_t this_obj) {
56686         LDKPeerHandleError this_obj_conv;
56687         this_obj_conv.inner = untag_ptr(this_obj);
56688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56690         PeerHandleError_free(this_obj_conv);
56691 }
56692
56693 int64_t  CS_LDK_PeerHandleError_new() {
56694         LDKPeerHandleError ret_var = PeerHandleError_new();
56695         int64_t ret_ref = 0;
56696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56698         return ret_ref;
56699 }
56700
56701 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
56702         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
56703         int64_t ret_ref = 0;
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56706         return ret_ref;
56707 }
56708 int64_t  CS_LDK_PeerHandleError_clone_ptr(int64_t arg) {
56709         LDKPeerHandleError arg_conv;
56710         arg_conv.inner = untag_ptr(arg);
56711         arg_conv.is_owned = ptr_is_owned(arg);
56712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56713         arg_conv.is_owned = false;
56714         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
56715         return ret_conv;
56716 }
56717
56718 int64_t  CS_LDK_PeerHandleError_clone(int64_t orig) {
56719         LDKPeerHandleError orig_conv;
56720         orig_conv.inner = untag_ptr(orig);
56721         orig_conv.is_owned = ptr_is_owned(orig);
56722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56723         orig_conv.is_owned = false;
56724         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
56725         int64_t ret_ref = 0;
56726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56728         return ret_ref;
56729 }
56730
56731 void  CS_LDK_PeerManager_free(int64_t this_obj) {
56732         LDKPeerManager this_obj_conv;
56733         this_obj_conv.inner = untag_ptr(this_obj);
56734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56736         PeerManager_free(this_obj_conv);
56737 }
56738
56739 int64_t  CS_LDK_PeerManager_new(int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t node_signer) {
56740         LDKMessageHandler message_handler_conv;
56741         message_handler_conv.inner = untag_ptr(message_handler);
56742         message_handler_conv.is_owned = ptr_is_owned(message_handler);
56743         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
56744         // WARNING: we need a move here but no clone is available for LDKMessageHandler
56745         
56746         uint8_t ephemeral_random_data_arr[32];
56747         CHECK(ephemeral_random_data->arr_len == 32);
56748         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
56749         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
56750         void* logger_ptr = untag_ptr(logger);
56751         CHECK_ACCESS(logger_ptr);
56752         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56753         if (logger_conv.free == LDKLogger_JCalls_free) {
56754                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56755                 LDKLogger_JCalls_cloned(&logger_conv);
56756         }
56757         void* node_signer_ptr = untag_ptr(node_signer);
56758         CHECK_ACCESS(node_signer_ptr);
56759         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
56760         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
56761                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56762                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
56763         }
56764         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
56765         int64_t ret_ref = 0;
56766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56768         return ret_ref;
56769 }
56770
56771 int64_tArray  CS_LDK_PeerManager_list_peers(int64_t this_arg) {
56772         LDKPeerManager this_arg_conv;
56773         this_arg_conv.inner = untag_ptr(this_arg);
56774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56776         this_arg_conv.is_owned = false;
56777         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
56778         int64_tArray ret_arr = NULL;
56779         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
56780         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
56781         for (size_t n = 0; n < ret_var.datalen; n++) {
56782                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
56783                 int64_t ret_conv_13_ref = 0;
56784                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56785                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56786                 ret_arr_ptr[n] = ret_conv_13_ref;
56787         }
56788         
56789         FREE(ret_var.data);
56790         return ret_arr;
56791 }
56792
56793 int64_t  CS_LDK_PeerManager_peer_by_node_id(int64_t this_arg, int8_tArray their_node_id) {
56794         LDKPeerManager this_arg_conv;
56795         this_arg_conv.inner = untag_ptr(this_arg);
56796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56798         this_arg_conv.is_owned = false;
56799         LDKPublicKey their_node_id_ref;
56800         CHECK(their_node_id->arr_len == 33);
56801         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56802         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
56803         int64_t ret_ref = 0;
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56806         return ret_ref;
56807 }
56808
56809 int64_t  CS_LDK_PeerManager_new_outbound_connection(int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) {
56810         LDKPeerManager this_arg_conv;
56811         this_arg_conv.inner = untag_ptr(this_arg);
56812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56814         this_arg_conv.is_owned = false;
56815         LDKPublicKey their_node_id_ref;
56816         CHECK(their_node_id->arr_len == 33);
56817         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
56818         void* descriptor_ptr = untag_ptr(descriptor);
56819         CHECK_ACCESS(descriptor_ptr);
56820         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56821         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56823                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56824         }
56825         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56826         CHECK_ACCESS(remote_network_address_ptr);
56827         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56828         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
56829         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
56830         return tag_ptr(ret_conv, true);
56831 }
56832
56833 int64_t  CS_LDK_PeerManager_new_inbound_connection(int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
56834         LDKPeerManager this_arg_conv;
56835         this_arg_conv.inner = untag_ptr(this_arg);
56836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56838         this_arg_conv.is_owned = false;
56839         void* descriptor_ptr = untag_ptr(descriptor);
56840         CHECK_ACCESS(descriptor_ptr);
56841         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
56842         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
56843                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56844                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
56845         }
56846         void* remote_network_address_ptr = untag_ptr(remote_network_address);
56847         CHECK_ACCESS(remote_network_address_ptr);
56848         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
56849         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56850         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
56851         return tag_ptr(ret_conv, true);
56852 }
56853
56854 int64_t  CS_LDK_PeerManager_write_buffer_space_avail(int64_t this_arg, int64_t descriptor) {
56855         LDKPeerManager this_arg_conv;
56856         this_arg_conv.inner = untag_ptr(this_arg);
56857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56859         this_arg_conv.is_owned = false;
56860         void* descriptor_ptr = untag_ptr(descriptor);
56861         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56862         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56863         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
56864         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
56865         return tag_ptr(ret_conv, true);
56866 }
56867
56868 int64_t  CS_LDK_PeerManager_read_event(int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
56869         LDKPeerManager this_arg_conv;
56870         this_arg_conv.inner = untag_ptr(this_arg);
56871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56873         this_arg_conv.is_owned = false;
56874         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
56875         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
56876         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
56877         LDKu8slice data_ref;
56878         data_ref.datalen = data->arr_len;
56879         data_ref.data = data->elems;
56880         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
56881         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
56882         FREE(data);
56883         return tag_ptr(ret_conv, true);
56884 }
56885
56886 void  CS_LDK_PeerManager_process_events(int64_t this_arg) {
56887         LDKPeerManager this_arg_conv;
56888         this_arg_conv.inner = untag_ptr(this_arg);
56889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56891         this_arg_conv.is_owned = false;
56892         PeerManager_process_events(&this_arg_conv);
56893 }
56894
56895 void  CS_LDK_PeerManager_socket_disconnected(int64_t this_arg, int64_t descriptor) {
56896         LDKPeerManager this_arg_conv;
56897         this_arg_conv.inner = untag_ptr(this_arg);
56898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56900         this_arg_conv.is_owned = false;
56901         void* descriptor_ptr = untag_ptr(descriptor);
56902         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
56903         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
56904         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
56905 }
56906
56907 void  CS_LDK_PeerManager_disconnect_by_node_id(int64_t this_arg, int8_tArray node_id) {
56908         LDKPeerManager this_arg_conv;
56909         this_arg_conv.inner = untag_ptr(this_arg);
56910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56912         this_arg_conv.is_owned = false;
56913         LDKPublicKey node_id_ref;
56914         CHECK(node_id->arr_len == 33);
56915         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
56916         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
56917 }
56918
56919 void  CS_LDK_PeerManager_disconnect_all_peers(int64_t this_arg) {
56920         LDKPeerManager this_arg_conv;
56921         this_arg_conv.inner = untag_ptr(this_arg);
56922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56924         this_arg_conv.is_owned = false;
56925         PeerManager_disconnect_all_peers(&this_arg_conv);
56926 }
56927
56928 void  CS_LDK_PeerManager_timer_tick_occurred(int64_t this_arg) {
56929         LDKPeerManager this_arg_conv;
56930         this_arg_conv.inner = untag_ptr(this_arg);
56931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56933         this_arg_conv.is_owned = false;
56934         PeerManager_timer_tick_occurred(&this_arg_conv);
56935 }
56936
56937 void  CS_LDK_PeerManager_broadcast_node_announcement(int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
56938         LDKPeerManager this_arg_conv;
56939         this_arg_conv.inner = untag_ptr(this_arg);
56940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56942         this_arg_conv.is_owned = false;
56943         LDKThreeBytes rgb_ref;
56944         CHECK(rgb->arr_len == 3);
56945         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
56946         LDKThirtyTwoBytes alias_ref;
56947         CHECK(alias->arr_len == 32);
56948         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
56949         LDKCVec_SocketAddressZ addresses_constr;
56950         addresses_constr.datalen = addresses->arr_len;
56951         if (addresses_constr.datalen > 0)
56952                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
56953         else
56954                 addresses_constr.data = NULL;
56955         int64_t* addresses_vals = addresses->elems;
56956         for (size_t p = 0; p < addresses_constr.datalen; p++) {
56957                 int64_t addresses_conv_15 = addresses_vals[p];
56958                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
56959                 CHECK_ACCESS(addresses_conv_15_ptr);
56960                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
56961                 addresses_constr.data[p] = addresses_conv_15_conv;
56962         }
56963         FREE(addresses);
56964         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
56965 }
56966
56967 int64_t  CS_LDK_htlc_success_tx_weight(int64_t channel_type_features) {
56968         LDKChannelTypeFeatures channel_type_features_conv;
56969         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56970         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56971         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56972         channel_type_features_conv.is_owned = false;
56973         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
56974         return ret_conv;
56975 }
56976
56977 int64_t  CS_LDK_htlc_timeout_tx_weight(int64_t channel_type_features) {
56978         LDKChannelTypeFeatures channel_type_features_conv;
56979         channel_type_features_conv.inner = untag_ptr(channel_type_features);
56980         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
56981         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
56982         channel_type_features_conv.is_owned = false;
56983         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
56984         return ret_conv;
56985 }
56986
56987 int32_t  CS_LDK_HTLCClaim_clone(int64_t orig) {
56988         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
56989         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_clone(orig_conv));
56990         return ret_conv;
56991 }
56992
56993 int32_t  CS_LDK_HTLCClaim_offered_timeout() {
56994         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_timeout());
56995         return ret_conv;
56996 }
56997
56998 int32_t  CS_LDK_HTLCClaim_offered_preimage() {
56999         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_preimage());
57000         return ret_conv;
57001 }
57002
57003 int32_t  CS_LDK_HTLCClaim_accepted_timeout() {
57004         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_timeout());
57005         return ret_conv;
57006 }
57007
57008 int32_t  CS_LDK_HTLCClaim_accepted_preimage() {
57009         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_preimage());
57010         return ret_conv;
57011 }
57012
57013 int32_t  CS_LDK_HTLCClaim_revocation() {
57014         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_revocation());
57015         return ret_conv;
57016 }
57017
57018 jboolean  CS_LDK_HTLCClaim_eq(int64_t a, int64_t b) {
57019         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
57020         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
57021         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
57022         return ret_conv;
57023 }
57024
57025 int64_t  CS_LDK_HTLCClaim_from_witness(int8_tArray witness) {
57026         LDKWitness witness_ref;
57027         witness_ref.datalen = witness->arr_len;
57028         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
57029         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
57030         witness_ref.data_is_owned = true;
57031         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
57032         *ret_copy = HTLCClaim_from_witness(witness_ref);
57033         int64_t ret_ref = tag_ptr(ret_copy, true);
57034         return ret_ref;
57035 }
57036
57037 int8_tArray  CS_LDK_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
57038         uint8_t commitment_seed_arr[32];
57039         CHECK(commitment_seed->arr_len == 32);
57040         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
57041         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
57042         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57043         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
57044         return ret_arr;
57045 }
57046
57047 int8_tArray  CS_LDK_build_closing_transaction(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) {
57048         LDKCVec_u8Z to_holder_script_ref;
57049         to_holder_script_ref.datalen = to_holder_script->arr_len;
57050         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
57051         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
57052         LDKCVec_u8Z to_counterparty_script_ref;
57053         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
57054         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
57055         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
57056         LDKOutPoint funding_outpoint_conv;
57057         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
57058         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
57059         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
57060         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
57061         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);
57062         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57063         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57064         Transaction_free(ret_var);
57065         return ret_arr;
57066 }
57067
57068 void  CS_LDK_CounterpartyCommitmentSecrets_free(int64_t this_obj) {
57069         LDKCounterpartyCommitmentSecrets this_obj_conv;
57070         this_obj_conv.inner = untag_ptr(this_obj);
57071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57073         CounterpartyCommitmentSecrets_free(this_obj_conv);
57074 }
57075
57076 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
57077         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
57078         int64_t ret_ref = 0;
57079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57081         return ret_ref;
57082 }
57083 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone_ptr(int64_t arg) {
57084         LDKCounterpartyCommitmentSecrets arg_conv;
57085         arg_conv.inner = untag_ptr(arg);
57086         arg_conv.is_owned = ptr_is_owned(arg);
57087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57088         arg_conv.is_owned = false;
57089         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
57090         return ret_conv;
57091 }
57092
57093 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone(int64_t orig) {
57094         LDKCounterpartyCommitmentSecrets orig_conv;
57095         orig_conv.inner = untag_ptr(orig);
57096         orig_conv.is_owned = ptr_is_owned(orig);
57097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57098         orig_conv.is_owned = false;
57099         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
57100         int64_t ret_ref = 0;
57101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57103         return ret_ref;
57104 }
57105
57106 int64_t  CS_LDK_CounterpartyCommitmentSecrets_new() {
57107         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
57108         int64_t ret_ref = 0;
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57111         return ret_ref;
57112 }
57113
57114 int64_t  CS_LDK_CounterpartyCommitmentSecrets_get_min_seen_secret(int64_t this_arg) {
57115         LDKCounterpartyCommitmentSecrets this_arg_conv;
57116         this_arg_conv.inner = untag_ptr(this_arg);
57117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57119         this_arg_conv.is_owned = false;
57120         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
57121         return ret_conv;
57122 }
57123
57124 int64_t  CS_LDK_CounterpartyCommitmentSecrets_provide_secret(int64_t this_arg, int64_t idx, int8_tArray secret) {
57125         LDKCounterpartyCommitmentSecrets this_arg_conv;
57126         this_arg_conv.inner = untag_ptr(this_arg);
57127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57129         this_arg_conv.is_owned = false;
57130         LDKThirtyTwoBytes secret_ref;
57131         CHECK(secret->arr_len == 32);
57132         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
57133         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
57134         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
57135         return tag_ptr(ret_conv, true);
57136 }
57137
57138 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_get_secret(int64_t this_arg, int64_t idx) {
57139         LDKCounterpartyCommitmentSecrets this_arg_conv;
57140         this_arg_conv.inner = untag_ptr(this_arg);
57141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57143         this_arg_conv.is_owned = false;
57144         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57145         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
57146         return ret_arr;
57147 }
57148
57149 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_write(int64_t obj) {
57150         LDKCounterpartyCommitmentSecrets obj_conv;
57151         obj_conv.inner = untag_ptr(obj);
57152         obj_conv.is_owned = ptr_is_owned(obj);
57153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57154         obj_conv.is_owned = false;
57155         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
57156         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57157         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57158         CVec_u8Z_free(ret_var);
57159         return ret_arr;
57160 }
57161
57162 int64_t  CS_LDK_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
57163         LDKu8slice ser_ref;
57164         ser_ref.datalen = ser->arr_len;
57165         ser_ref.data = ser->elems;
57166         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
57167         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
57168         FREE(ser);
57169         return tag_ptr(ret_conv, true);
57170 }
57171
57172 int8_tArray  CS_LDK_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
57173         LDKPublicKey per_commitment_point_ref;
57174         CHECK(per_commitment_point->arr_len == 33);
57175         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57176         uint8_t base_secret_arr[32];
57177         CHECK(base_secret->arr_len == 32);
57178         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
57179         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
57180         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57181         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
57182         return ret_arr;
57183 }
57184
57185 int8_tArray  CS_LDK_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
57186         uint8_t per_commitment_secret_arr[32];
57187         CHECK(per_commitment_secret->arr_len == 32);
57188         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
57189         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
57190         uint8_t countersignatory_revocation_base_secret_arr[32];
57191         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
57192         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
57193         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
57194         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57195         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
57196         return ret_arr;
57197 }
57198
57199 void  CS_LDK_TxCreationKeys_free(int64_t this_obj) {
57200         LDKTxCreationKeys 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         TxCreationKeys_free(this_obj_conv);
57205 }
57206
57207 int8_tArray  CS_LDK_TxCreationKeys_get_per_commitment_point(int64_t this_ptr) {
57208         LDKTxCreationKeys 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 = init_int8_tArray(33, __LINE__);
57214         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
57215         return ret_arr;
57216 }
57217
57218 void  CS_LDK_TxCreationKeys_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
57219         LDKTxCreationKeys 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(val->arr_len == 33);
57226         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57227         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
57228 }
57229
57230 int64_t  CS_LDK_TxCreationKeys_get_revocation_key(int64_t this_ptr) {
57231         LDKTxCreationKeys 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         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&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 void  CS_LDK_TxCreationKeys_set_revocation_key(int64_t this_ptr, int64_t val) {
57244         LDKTxCreationKeys 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         LDKRevocationKey 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 = RevocationKey_clone(&val_conv);
57254         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
57255 }
57256
57257 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_htlc_key(int64_t this_ptr) {
57258         LDKTxCreationKeys this_ptr_conv;
57259         this_ptr_conv.inner = untag_ptr(this_ptr);
57260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57262         this_ptr_conv.is_owned = false;
57263         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
57264         int64_t ret_ref = 0;
57265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57267         return ret_ref;
57268 }
57269
57270 void  CS_LDK_TxCreationKeys_set_broadcaster_htlc_key(int64_t this_ptr, int64_t val) {
57271         LDKTxCreationKeys this_ptr_conv;
57272         this_ptr_conv.inner = untag_ptr(this_ptr);
57273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57275         this_ptr_conv.is_owned = false;
57276         LDKHtlcKey val_conv;
57277         val_conv.inner = untag_ptr(val);
57278         val_conv.is_owned = ptr_is_owned(val);
57279         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57280         val_conv = HtlcKey_clone(&val_conv);
57281         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
57282 }
57283
57284 int64_t  CS_LDK_TxCreationKeys_get_countersignatory_htlc_key(int64_t this_ptr) {
57285         LDKTxCreationKeys this_ptr_conv;
57286         this_ptr_conv.inner = untag_ptr(this_ptr);
57287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57289         this_ptr_conv.is_owned = false;
57290         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
57291         int64_t ret_ref = 0;
57292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57294         return ret_ref;
57295 }
57296
57297 void  CS_LDK_TxCreationKeys_set_countersignatory_htlc_key(int64_t this_ptr, int64_t val) {
57298         LDKTxCreationKeys this_ptr_conv;
57299         this_ptr_conv.inner = untag_ptr(this_ptr);
57300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57302         this_ptr_conv.is_owned = false;
57303         LDKHtlcKey val_conv;
57304         val_conv.inner = untag_ptr(val);
57305         val_conv.is_owned = ptr_is_owned(val);
57306         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57307         val_conv = HtlcKey_clone(&val_conv);
57308         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
57309 }
57310
57311 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_delayed_payment_key(int64_t this_ptr) {
57312         LDKTxCreationKeys this_ptr_conv;
57313         this_ptr_conv.inner = untag_ptr(this_ptr);
57314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57316         this_ptr_conv.is_owned = false;
57317         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
57318         int64_t ret_ref = 0;
57319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57321         return ret_ref;
57322 }
57323
57324 void  CS_LDK_TxCreationKeys_set_broadcaster_delayed_payment_key(int64_t this_ptr, int64_t val) {
57325         LDKTxCreationKeys this_ptr_conv;
57326         this_ptr_conv.inner = untag_ptr(this_ptr);
57327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57329         this_ptr_conv.is_owned = false;
57330         LDKDelayedPaymentKey val_conv;
57331         val_conv.inner = untag_ptr(val);
57332         val_conv.is_owned = ptr_is_owned(val);
57333         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57334         val_conv = DelayedPaymentKey_clone(&val_conv);
57335         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
57336 }
57337
57338 int64_t  CS_LDK_TxCreationKeys_new(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) {
57339         LDKPublicKey per_commitment_point_arg_ref;
57340         CHECK(per_commitment_point_arg->arr_len == 33);
57341         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
57342         LDKRevocationKey revocation_key_arg_conv;
57343         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
57344         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
57345         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
57346         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
57347         LDKHtlcKey broadcaster_htlc_key_arg_conv;
57348         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
57349         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
57350         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
57351         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
57352         LDKHtlcKey countersignatory_htlc_key_arg_conv;
57353         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
57354         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
57355         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
57356         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
57357         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
57358         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
57359         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
57360         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
57361         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
57362         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);
57363         int64_t ret_ref = 0;
57364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57366         return ret_ref;
57367 }
57368
57369 jboolean  CS_LDK_TxCreationKeys_eq(int64_t a, int64_t b) {
57370         LDKTxCreationKeys a_conv;
57371         a_conv.inner = untag_ptr(a);
57372         a_conv.is_owned = ptr_is_owned(a);
57373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57374         a_conv.is_owned = false;
57375         LDKTxCreationKeys b_conv;
57376         b_conv.inner = untag_ptr(b);
57377         b_conv.is_owned = ptr_is_owned(b);
57378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57379         b_conv.is_owned = false;
57380         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
57381         return ret_conv;
57382 }
57383
57384 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
57385         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
57386         int64_t ret_ref = 0;
57387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57389         return ret_ref;
57390 }
57391 int64_t  CS_LDK_TxCreationKeys_clone_ptr(int64_t arg) {
57392         LDKTxCreationKeys arg_conv;
57393         arg_conv.inner = untag_ptr(arg);
57394         arg_conv.is_owned = ptr_is_owned(arg);
57395         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57396         arg_conv.is_owned = false;
57397         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
57398         return ret_conv;
57399 }
57400
57401 int64_t  CS_LDK_TxCreationKeys_clone(int64_t orig) {
57402         LDKTxCreationKeys orig_conv;
57403         orig_conv.inner = untag_ptr(orig);
57404         orig_conv.is_owned = ptr_is_owned(orig);
57405         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57406         orig_conv.is_owned = false;
57407         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
57408         int64_t ret_ref = 0;
57409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57411         return ret_ref;
57412 }
57413
57414 int8_tArray  CS_LDK_TxCreationKeys_write(int64_t obj) {
57415         LDKTxCreationKeys obj_conv;
57416         obj_conv.inner = untag_ptr(obj);
57417         obj_conv.is_owned = ptr_is_owned(obj);
57418         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57419         obj_conv.is_owned = false;
57420         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
57421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57423         CVec_u8Z_free(ret_var);
57424         return ret_arr;
57425 }
57426
57427 int64_t  CS_LDK_TxCreationKeys_read(int8_tArray ser) {
57428         LDKu8slice ser_ref;
57429         ser_ref.datalen = ser->arr_len;
57430         ser_ref.data = ser->elems;
57431         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
57432         *ret_conv = TxCreationKeys_read(ser_ref);
57433         FREE(ser);
57434         return tag_ptr(ret_conv, true);
57435 }
57436
57437 void  CS_LDK_ChannelPublicKeys_free(int64_t this_obj) {
57438         LDKChannelPublicKeys this_obj_conv;
57439         this_obj_conv.inner = untag_ptr(this_obj);
57440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57442         ChannelPublicKeys_free(this_obj_conv);
57443 }
57444
57445 int8_tArray  CS_LDK_ChannelPublicKeys_get_funding_pubkey(int64_t this_ptr) {
57446         LDKChannelPublicKeys this_ptr_conv;
57447         this_ptr_conv.inner = untag_ptr(this_ptr);
57448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57450         this_ptr_conv.is_owned = false;
57451         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57452         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
57453         return ret_arr;
57454 }
57455
57456 void  CS_LDK_ChannelPublicKeys_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
57457         LDKChannelPublicKeys this_ptr_conv;
57458         this_ptr_conv.inner = untag_ptr(this_ptr);
57459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57461         this_ptr_conv.is_owned = false;
57462         LDKPublicKey val_ref;
57463         CHECK(val->arr_len == 33);
57464         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57465         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
57466 }
57467
57468 int64_t  CS_LDK_ChannelPublicKeys_get_revocation_basepoint(int64_t this_ptr) {
57469         LDKChannelPublicKeys this_ptr_conv;
57470         this_ptr_conv.inner = untag_ptr(this_ptr);
57471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57473         this_ptr_conv.is_owned = false;
57474         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
57475         int64_t ret_ref = 0;
57476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57478         return ret_ref;
57479 }
57480
57481 void  CS_LDK_ChannelPublicKeys_set_revocation_basepoint(int64_t this_ptr, int64_t val) {
57482         LDKChannelPublicKeys this_ptr_conv;
57483         this_ptr_conv.inner = untag_ptr(this_ptr);
57484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57486         this_ptr_conv.is_owned = false;
57487         LDKRevocationBasepoint val_conv;
57488         val_conv.inner = untag_ptr(val);
57489         val_conv.is_owned = ptr_is_owned(val);
57490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57491         val_conv = RevocationBasepoint_clone(&val_conv);
57492         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
57493 }
57494
57495 int8_tArray  CS_LDK_ChannelPublicKeys_get_payment_point(int64_t this_ptr) {
57496         LDKChannelPublicKeys this_ptr_conv;
57497         this_ptr_conv.inner = untag_ptr(this_ptr);
57498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57500         this_ptr_conv.is_owned = false;
57501         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57502         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
57503         return ret_arr;
57504 }
57505
57506 void  CS_LDK_ChannelPublicKeys_set_payment_point(int64_t this_ptr, int8_tArray val) {
57507         LDKChannelPublicKeys this_ptr_conv;
57508         this_ptr_conv.inner = untag_ptr(this_ptr);
57509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57511         this_ptr_conv.is_owned = false;
57512         LDKPublicKey val_ref;
57513         CHECK(val->arr_len == 33);
57514         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57515         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
57516 }
57517
57518 int64_t  CS_LDK_ChannelPublicKeys_get_delayed_payment_basepoint(int64_t this_ptr) {
57519         LDKChannelPublicKeys this_ptr_conv;
57520         this_ptr_conv.inner = untag_ptr(this_ptr);
57521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57523         this_ptr_conv.is_owned = false;
57524         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
57525         int64_t ret_ref = 0;
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57528         return ret_ref;
57529 }
57530
57531 void  CS_LDK_ChannelPublicKeys_set_delayed_payment_basepoint(int64_t this_ptr, int64_t val) {
57532         LDKChannelPublicKeys this_ptr_conv;
57533         this_ptr_conv.inner = untag_ptr(this_ptr);
57534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57536         this_ptr_conv.is_owned = false;
57537         LDKDelayedPaymentBasepoint val_conv;
57538         val_conv.inner = untag_ptr(val);
57539         val_conv.is_owned = ptr_is_owned(val);
57540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57541         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
57542         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
57543 }
57544
57545 int64_t  CS_LDK_ChannelPublicKeys_get_htlc_basepoint(int64_t this_ptr) {
57546         LDKChannelPublicKeys this_ptr_conv;
57547         this_ptr_conv.inner = untag_ptr(this_ptr);
57548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57550         this_ptr_conv.is_owned = false;
57551         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
57552         int64_t ret_ref = 0;
57553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57555         return ret_ref;
57556 }
57557
57558 void  CS_LDK_ChannelPublicKeys_set_htlc_basepoint(int64_t this_ptr, int64_t val) {
57559         LDKChannelPublicKeys this_ptr_conv;
57560         this_ptr_conv.inner = untag_ptr(this_ptr);
57561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57563         this_ptr_conv.is_owned = false;
57564         LDKHtlcBasepoint val_conv;
57565         val_conv.inner = untag_ptr(val);
57566         val_conv.is_owned = ptr_is_owned(val);
57567         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57568         val_conv = HtlcBasepoint_clone(&val_conv);
57569         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
57570 }
57571
57572 int64_t  CS_LDK_ChannelPublicKeys_new(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) {
57573         LDKPublicKey funding_pubkey_arg_ref;
57574         CHECK(funding_pubkey_arg->arr_len == 33);
57575         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
57576         LDKRevocationBasepoint revocation_basepoint_arg_conv;
57577         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
57578         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
57579         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
57580         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
57581         LDKPublicKey payment_point_arg_ref;
57582         CHECK(payment_point_arg->arr_len == 33);
57583         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
57584         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
57585         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
57586         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
57587         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
57588         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
57589         LDKHtlcBasepoint htlc_basepoint_arg_conv;
57590         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
57591         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
57592         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
57593         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
57594         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);
57595         int64_t ret_ref = 0;
57596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57598         return ret_ref;
57599 }
57600
57601 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
57602         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
57603         int64_t ret_ref = 0;
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57606         return ret_ref;
57607 }
57608 int64_t  CS_LDK_ChannelPublicKeys_clone_ptr(int64_t arg) {
57609         LDKChannelPublicKeys arg_conv;
57610         arg_conv.inner = untag_ptr(arg);
57611         arg_conv.is_owned = ptr_is_owned(arg);
57612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57613         arg_conv.is_owned = false;
57614         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
57615         return ret_conv;
57616 }
57617
57618 int64_t  CS_LDK_ChannelPublicKeys_clone(int64_t orig) {
57619         LDKChannelPublicKeys orig_conv;
57620         orig_conv.inner = untag_ptr(orig);
57621         orig_conv.is_owned = ptr_is_owned(orig);
57622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57623         orig_conv.is_owned = false;
57624         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
57625         int64_t ret_ref = 0;
57626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57628         return ret_ref;
57629 }
57630
57631 int64_t  CS_LDK_ChannelPublicKeys_hash(int64_t o) {
57632         LDKChannelPublicKeys o_conv;
57633         o_conv.inner = untag_ptr(o);
57634         o_conv.is_owned = ptr_is_owned(o);
57635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57636         o_conv.is_owned = false;
57637         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
57638         return ret_conv;
57639 }
57640
57641 jboolean  CS_LDK_ChannelPublicKeys_eq(int64_t a, int64_t b) {
57642         LDKChannelPublicKeys a_conv;
57643         a_conv.inner = untag_ptr(a);
57644         a_conv.is_owned = ptr_is_owned(a);
57645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57646         a_conv.is_owned = false;
57647         LDKChannelPublicKeys b_conv;
57648         b_conv.inner = untag_ptr(b);
57649         b_conv.is_owned = ptr_is_owned(b);
57650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57651         b_conv.is_owned = false;
57652         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
57653         return ret_conv;
57654 }
57655
57656 int8_tArray  CS_LDK_ChannelPublicKeys_write(int64_t obj) {
57657         LDKChannelPublicKeys obj_conv;
57658         obj_conv.inner = untag_ptr(obj);
57659         obj_conv.is_owned = ptr_is_owned(obj);
57660         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57661         obj_conv.is_owned = false;
57662         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
57663         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57664         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57665         CVec_u8Z_free(ret_var);
57666         return ret_arr;
57667 }
57668
57669 int64_t  CS_LDK_ChannelPublicKeys_read(int8_tArray ser) {
57670         LDKu8slice ser_ref;
57671         ser_ref.datalen = ser->arr_len;
57672         ser_ref.data = ser->elems;
57673         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
57674         *ret_conv = ChannelPublicKeys_read(ser_ref);
57675         FREE(ser);
57676         return tag_ptr(ret_conv, true);
57677 }
57678
57679 int64_t  CS_LDK_TxCreationKeys_derive_new(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) {
57680         LDKPublicKey per_commitment_point_ref;
57681         CHECK(per_commitment_point->arr_len == 33);
57682         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57683         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
57684         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
57685         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
57686         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
57687         broadcaster_delayed_payment_base_conv.is_owned = false;
57688         LDKHtlcBasepoint broadcaster_htlc_base_conv;
57689         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
57690         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
57691         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
57692         broadcaster_htlc_base_conv.is_owned = false;
57693         LDKRevocationBasepoint countersignatory_revocation_base_conv;
57694         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
57695         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
57696         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
57697         countersignatory_revocation_base_conv.is_owned = false;
57698         LDKHtlcBasepoint countersignatory_htlc_base_conv;
57699         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
57700         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
57701         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
57702         countersignatory_htlc_base_conv.is_owned = false;
57703         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);
57704         int64_t ret_ref = 0;
57705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57707         return ret_ref;
57708 }
57709
57710 int64_t  CS_LDK_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
57711         LDKPublicKey per_commitment_point_ref;
57712         CHECK(per_commitment_point->arr_len == 33);
57713         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
57714         LDKChannelPublicKeys broadcaster_keys_conv;
57715         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
57716         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
57718         broadcaster_keys_conv.is_owned = false;
57719         LDKChannelPublicKeys countersignatory_keys_conv;
57720         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
57721         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
57722         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
57723         countersignatory_keys_conv.is_owned = false;
57724         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
57725         int64_t ret_ref = 0;
57726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57728         return ret_ref;
57729 }
57730
57731 int8_tArray  CS_LDK_get_revokeable_redeemscript(int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
57732         LDKRevocationKey revocation_key_conv;
57733         revocation_key_conv.inner = untag_ptr(revocation_key);
57734         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
57735         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
57736         revocation_key_conv.is_owned = false;
57737         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
57738         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
57739         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
57740         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
57741         broadcaster_delayed_payment_key_conv.is_owned = false;
57742         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
57743         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57744         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57745         CVec_u8Z_free(ret_var);
57746         return ret_arr;
57747 }
57748
57749 int8_tArray  CS_LDK_get_counterparty_payment_script(int64_t channel_type_features, int8_tArray payment_key) {
57750         LDKChannelTypeFeatures channel_type_features_conv;
57751         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57752         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57753         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57754         channel_type_features_conv.is_owned = false;
57755         LDKPublicKey payment_key_ref;
57756         CHECK(payment_key->arr_len == 33);
57757         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
57758         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
57759         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57760         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57761         CVec_u8Z_free(ret_var);
57762         return ret_arr;
57763 }
57764
57765 void  CS_LDK_HTLCOutputInCommitment_free(int64_t this_obj) {
57766         LDKHTLCOutputInCommitment this_obj_conv;
57767         this_obj_conv.inner = untag_ptr(this_obj);
57768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57770         HTLCOutputInCommitment_free(this_obj_conv);
57771 }
57772
57773 jboolean  CS_LDK_HTLCOutputInCommitment_get_offered(int64_t this_ptr) {
57774         LDKHTLCOutputInCommitment this_ptr_conv;
57775         this_ptr_conv.inner = untag_ptr(this_ptr);
57776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57778         this_ptr_conv.is_owned = false;
57779         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
57780         return ret_conv;
57781 }
57782
57783 void  CS_LDK_HTLCOutputInCommitment_set_offered(int64_t this_ptr, jboolean val) {
57784         LDKHTLCOutputInCommitment this_ptr_conv;
57785         this_ptr_conv.inner = untag_ptr(this_ptr);
57786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57788         this_ptr_conv.is_owned = false;
57789         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
57790 }
57791
57792 int64_t  CS_LDK_HTLCOutputInCommitment_get_amount_msat(int64_t this_ptr) {
57793         LDKHTLCOutputInCommitment this_ptr_conv;
57794         this_ptr_conv.inner = untag_ptr(this_ptr);
57795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57797         this_ptr_conv.is_owned = false;
57798         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
57799         return ret_conv;
57800 }
57801
57802 void  CS_LDK_HTLCOutputInCommitment_set_amount_msat(int64_t this_ptr, int64_t val) {
57803         LDKHTLCOutputInCommitment this_ptr_conv;
57804         this_ptr_conv.inner = untag_ptr(this_ptr);
57805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57807         this_ptr_conv.is_owned = false;
57808         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
57809 }
57810
57811 int32_t  CS_LDK_HTLCOutputInCommitment_get_cltv_expiry(int64_t this_ptr) {
57812         LDKHTLCOutputInCommitment this_ptr_conv;
57813         this_ptr_conv.inner = untag_ptr(this_ptr);
57814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57816         this_ptr_conv.is_owned = false;
57817         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
57818         return ret_conv;
57819 }
57820
57821 void  CS_LDK_HTLCOutputInCommitment_set_cltv_expiry(int64_t this_ptr, int32_t val) {
57822         LDKHTLCOutputInCommitment this_ptr_conv;
57823         this_ptr_conv.inner = untag_ptr(this_ptr);
57824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57826         this_ptr_conv.is_owned = false;
57827         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
57828 }
57829
57830 int8_tArray  CS_LDK_HTLCOutputInCommitment_get_payment_hash(int64_t this_ptr) {
57831         LDKHTLCOutputInCommitment this_ptr_conv;
57832         this_ptr_conv.inner = untag_ptr(this_ptr);
57833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57835         this_ptr_conv.is_owned = false;
57836         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57837         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
57838         return ret_arr;
57839 }
57840
57841 void  CS_LDK_HTLCOutputInCommitment_set_payment_hash(int64_t this_ptr, int8_tArray val) {
57842         LDKHTLCOutputInCommitment this_ptr_conv;
57843         this_ptr_conv.inner = untag_ptr(this_ptr);
57844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57846         this_ptr_conv.is_owned = false;
57847         LDKThirtyTwoBytes val_ref;
57848         CHECK(val->arr_len == 32);
57849         memcpy(val_ref.data, val->elems, 32); FREE(val);
57850         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
57851 }
57852
57853 int64_t  CS_LDK_HTLCOutputInCommitment_get_transaction_output_index(int64_t this_ptr) {
57854         LDKHTLCOutputInCommitment this_ptr_conv;
57855         this_ptr_conv.inner = untag_ptr(this_ptr);
57856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57858         this_ptr_conv.is_owned = false;
57859         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
57860         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
57861         int64_t ret_ref = tag_ptr(ret_copy, true);
57862         return ret_ref;
57863 }
57864
57865 void  CS_LDK_HTLCOutputInCommitment_set_transaction_output_index(int64_t this_ptr, int64_t val) {
57866         LDKHTLCOutputInCommitment this_ptr_conv;
57867         this_ptr_conv.inner = untag_ptr(this_ptr);
57868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57870         this_ptr_conv.is_owned = false;
57871         void* val_ptr = untag_ptr(val);
57872         CHECK_ACCESS(val_ptr);
57873         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
57874         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
57875         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
57876 }
57877
57878 int64_t  CS_LDK_HTLCOutputInCommitment_new(jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
57879         LDKThirtyTwoBytes payment_hash_arg_ref;
57880         CHECK(payment_hash_arg->arr_len == 32);
57881         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
57882         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
57883         CHECK_ACCESS(transaction_output_index_arg_ptr);
57884         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
57885         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
57886         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
57887         int64_t ret_ref = 0;
57888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57890         return ret_ref;
57891 }
57892
57893 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
57894         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
57895         int64_t ret_ref = 0;
57896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57898         return ret_ref;
57899 }
57900 int64_t  CS_LDK_HTLCOutputInCommitment_clone_ptr(int64_t arg) {
57901         LDKHTLCOutputInCommitment arg_conv;
57902         arg_conv.inner = untag_ptr(arg);
57903         arg_conv.is_owned = ptr_is_owned(arg);
57904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57905         arg_conv.is_owned = false;
57906         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
57907         return ret_conv;
57908 }
57909
57910 int64_t  CS_LDK_HTLCOutputInCommitment_clone(int64_t orig) {
57911         LDKHTLCOutputInCommitment orig_conv;
57912         orig_conv.inner = untag_ptr(orig);
57913         orig_conv.is_owned = ptr_is_owned(orig);
57914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57915         orig_conv.is_owned = false;
57916         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
57917         int64_t ret_ref = 0;
57918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57920         return ret_ref;
57921 }
57922
57923 jboolean  CS_LDK_HTLCOutputInCommitment_eq(int64_t a, int64_t b) {
57924         LDKHTLCOutputInCommitment a_conv;
57925         a_conv.inner = untag_ptr(a);
57926         a_conv.is_owned = ptr_is_owned(a);
57927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57928         a_conv.is_owned = false;
57929         LDKHTLCOutputInCommitment b_conv;
57930         b_conv.inner = untag_ptr(b);
57931         b_conv.is_owned = ptr_is_owned(b);
57932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57933         b_conv.is_owned = false;
57934         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
57935         return ret_conv;
57936 }
57937
57938 int8_tArray  CS_LDK_HTLCOutputInCommitment_write(int64_t obj) {
57939         LDKHTLCOutputInCommitment obj_conv;
57940         obj_conv.inner = untag_ptr(obj);
57941         obj_conv.is_owned = ptr_is_owned(obj);
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57943         obj_conv.is_owned = false;
57944         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
57945         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57946         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57947         CVec_u8Z_free(ret_var);
57948         return ret_arr;
57949 }
57950
57951 int64_t  CS_LDK_HTLCOutputInCommitment_read(int8_tArray ser) {
57952         LDKu8slice ser_ref;
57953         ser_ref.datalen = ser->arr_len;
57954         ser_ref.data = ser->elems;
57955         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
57956         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
57957         FREE(ser);
57958         return tag_ptr(ret_conv, true);
57959 }
57960
57961 int8_tArray  CS_LDK_get_htlc_redeemscript(int64_t htlc, int64_t channel_type_features, int64_t keys) {
57962         LDKHTLCOutputInCommitment htlc_conv;
57963         htlc_conv.inner = untag_ptr(htlc);
57964         htlc_conv.is_owned = ptr_is_owned(htlc);
57965         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
57966         htlc_conv.is_owned = false;
57967         LDKChannelTypeFeatures channel_type_features_conv;
57968         channel_type_features_conv.inner = untag_ptr(channel_type_features);
57969         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
57970         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
57971         channel_type_features_conv.is_owned = false;
57972         LDKTxCreationKeys keys_conv;
57973         keys_conv.inner = untag_ptr(keys);
57974         keys_conv.is_owned = ptr_is_owned(keys);
57975         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
57976         keys_conv.is_owned = false;
57977         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
57978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57980         CVec_u8Z_free(ret_var);
57981         return ret_arr;
57982 }
57983
57984 int8_tArray  CS_LDK_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
57985         LDKPublicKey broadcaster_ref;
57986         CHECK(broadcaster->arr_len == 33);
57987         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
57988         LDKPublicKey countersignatory_ref;
57989         CHECK(countersignatory->arr_len == 33);
57990         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
57991         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
57992         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57993         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57994         CVec_u8Z_free(ret_var);
57995         return ret_arr;
57996 }
57997
57998 int8_tArray  CS_LDK_build_htlc_transaction(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) {
57999         uint8_t commitment_txid_arr[32];
58000         CHECK(commitment_txid->arr_len == 32);
58001         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
58002         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
58003         LDKHTLCOutputInCommitment htlc_conv;
58004         htlc_conv.inner = untag_ptr(htlc);
58005         htlc_conv.is_owned = ptr_is_owned(htlc);
58006         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
58007         htlc_conv.is_owned = false;
58008         LDKChannelTypeFeatures channel_type_features_conv;
58009         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58010         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58012         channel_type_features_conv.is_owned = false;
58013         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
58014         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
58015         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
58016         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
58017         broadcaster_delayed_payment_key_conv.is_owned = false;
58018         LDKRevocationKey revocation_key_conv;
58019         revocation_key_conv.inner = untag_ptr(revocation_key);
58020         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
58021         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
58022         revocation_key_conv.is_owned = false;
58023         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);
58024         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58025         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58026         Transaction_free(ret_var);
58027         return ret_arr;
58028 }
58029
58030 int8_tArray  CS_LDK_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, int64_t preimage, int8_tArray redeem_script, int64_t channel_type_features) {
58031         LDKECDSASignature local_sig_ref;
58032         CHECK(local_sig->arr_len == 64);
58033         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
58034         LDKECDSASignature remote_sig_ref;
58035         CHECK(remote_sig->arr_len == 64);
58036         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
58037         void* preimage_ptr = untag_ptr(preimage);
58038         CHECK_ACCESS(preimage_ptr);
58039         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
58040         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
58041         LDKu8slice redeem_script_ref;
58042         redeem_script_ref.datalen = redeem_script->arr_len;
58043         redeem_script_ref.data = redeem_script->elems;
58044         LDKChannelTypeFeatures channel_type_features_conv;
58045         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58046         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58047         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58048         channel_type_features_conv.is_owned = false;
58049         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
58050         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58051         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58052         Witness_free(ret_var);
58053         FREE(redeem_script);
58054         return ret_arr;
58055 }
58056
58057 int8_tArray  CS_LDK_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
58058         LDKPublicKey payment_point_ref;
58059         CHECK(payment_point->arr_len == 33);
58060         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
58061         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
58062         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58063         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58064         CVec_u8Z_free(ret_var);
58065         return ret_arr;
58066 }
58067
58068 int8_tArray  CS_LDK_get_anchor_redeemscript(int8_tArray funding_pubkey) {
58069         LDKPublicKey funding_pubkey_ref;
58070         CHECK(funding_pubkey->arr_len == 33);
58071         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
58072         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
58073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58075         CVec_u8Z_free(ret_var);
58076         return ret_arr;
58077 }
58078
58079 int8_tArray  CS_LDK_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
58080         LDKPublicKey funding_key_ref;
58081         CHECK(funding_key->arr_len == 33);
58082         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
58083         LDKECDSASignature funding_sig_ref;
58084         CHECK(funding_sig->arr_len == 64);
58085         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
58086         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
58087         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58088         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58089         Witness_free(ret_var);
58090         return ret_arr;
58091 }
58092
58093 void  CS_LDK_ChannelTransactionParameters_free(int64_t this_obj) {
58094         LDKChannelTransactionParameters this_obj_conv;
58095         this_obj_conv.inner = untag_ptr(this_obj);
58096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58098         ChannelTransactionParameters_free(this_obj_conv);
58099 }
58100
58101 int64_t  CS_LDK_ChannelTransactionParameters_get_holder_pubkeys(int64_t this_ptr) {
58102         LDKChannelTransactionParameters this_ptr_conv;
58103         this_ptr_conv.inner = untag_ptr(this_ptr);
58104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58106         this_ptr_conv.is_owned = false;
58107         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
58108         int64_t ret_ref = 0;
58109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58111         return ret_ref;
58112 }
58113
58114 void  CS_LDK_ChannelTransactionParameters_set_holder_pubkeys(int64_t this_ptr, int64_t val) {
58115         LDKChannelTransactionParameters this_ptr_conv;
58116         this_ptr_conv.inner = untag_ptr(this_ptr);
58117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58119         this_ptr_conv.is_owned = false;
58120         LDKChannelPublicKeys val_conv;
58121         val_conv.inner = untag_ptr(val);
58122         val_conv.is_owned = ptr_is_owned(val);
58123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58124         val_conv = ChannelPublicKeys_clone(&val_conv);
58125         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
58126 }
58127
58128 int16_t  CS_LDK_ChannelTransactionParameters_get_holder_selected_contest_delay(int64_t this_ptr) {
58129         LDKChannelTransactionParameters this_ptr_conv;
58130         this_ptr_conv.inner = untag_ptr(this_ptr);
58131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58133         this_ptr_conv.is_owned = false;
58134         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
58135         return ret_conv;
58136 }
58137
58138 void  CS_LDK_ChannelTransactionParameters_set_holder_selected_contest_delay(int64_t this_ptr, int16_t val) {
58139         LDKChannelTransactionParameters this_ptr_conv;
58140         this_ptr_conv.inner = untag_ptr(this_ptr);
58141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58143         this_ptr_conv.is_owned = false;
58144         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
58145 }
58146
58147 jboolean  CS_LDK_ChannelTransactionParameters_get_is_outbound_from_holder(int64_t this_ptr) {
58148         LDKChannelTransactionParameters this_ptr_conv;
58149         this_ptr_conv.inner = untag_ptr(this_ptr);
58150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58152         this_ptr_conv.is_owned = false;
58153         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
58154         return ret_conv;
58155 }
58156
58157 void  CS_LDK_ChannelTransactionParameters_set_is_outbound_from_holder(int64_t this_ptr, jboolean val) {
58158         LDKChannelTransactionParameters this_ptr_conv;
58159         this_ptr_conv.inner = untag_ptr(this_ptr);
58160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58162         this_ptr_conv.is_owned = false;
58163         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
58164 }
58165
58166 int64_t  CS_LDK_ChannelTransactionParameters_get_counterparty_parameters(int64_t this_ptr) {
58167         LDKChannelTransactionParameters this_ptr_conv;
58168         this_ptr_conv.inner = untag_ptr(this_ptr);
58169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58171         this_ptr_conv.is_owned = false;
58172         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
58173         int64_t ret_ref = 0;
58174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58176         return ret_ref;
58177 }
58178
58179 void  CS_LDK_ChannelTransactionParameters_set_counterparty_parameters(int64_t this_ptr, int64_t val) {
58180         LDKChannelTransactionParameters this_ptr_conv;
58181         this_ptr_conv.inner = untag_ptr(this_ptr);
58182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58184         this_ptr_conv.is_owned = false;
58185         LDKCounterpartyChannelTransactionParameters val_conv;
58186         val_conv.inner = untag_ptr(val);
58187         val_conv.is_owned = ptr_is_owned(val);
58188         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58189         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
58190         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
58191 }
58192
58193 int64_t  CS_LDK_ChannelTransactionParameters_get_funding_outpoint(int64_t this_ptr) {
58194         LDKChannelTransactionParameters this_ptr_conv;
58195         this_ptr_conv.inner = untag_ptr(this_ptr);
58196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58198         this_ptr_conv.is_owned = false;
58199         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
58200         int64_t ret_ref = 0;
58201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58203         return ret_ref;
58204 }
58205
58206 void  CS_LDK_ChannelTransactionParameters_set_funding_outpoint(int64_t this_ptr, int64_t val) {
58207         LDKChannelTransactionParameters this_ptr_conv;
58208         this_ptr_conv.inner = untag_ptr(this_ptr);
58209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58211         this_ptr_conv.is_owned = false;
58212         LDKOutPoint val_conv;
58213         val_conv.inner = untag_ptr(val);
58214         val_conv.is_owned = ptr_is_owned(val);
58215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58216         val_conv = OutPoint_clone(&val_conv);
58217         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
58218 }
58219
58220 int64_t  CS_LDK_ChannelTransactionParameters_get_channel_type_features(int64_t this_ptr) {
58221         LDKChannelTransactionParameters this_ptr_conv;
58222         this_ptr_conv.inner = untag_ptr(this_ptr);
58223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58225         this_ptr_conv.is_owned = false;
58226         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
58227         int64_t ret_ref = 0;
58228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58230         return ret_ref;
58231 }
58232
58233 void  CS_LDK_ChannelTransactionParameters_set_channel_type_features(int64_t this_ptr, int64_t val) {
58234         LDKChannelTransactionParameters this_ptr_conv;
58235         this_ptr_conv.inner = untag_ptr(this_ptr);
58236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58238         this_ptr_conv.is_owned = false;
58239         LDKChannelTypeFeatures val_conv;
58240         val_conv.inner = untag_ptr(val);
58241         val_conv.is_owned = ptr_is_owned(val);
58242         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58243         val_conv = ChannelTypeFeatures_clone(&val_conv);
58244         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
58245 }
58246
58247 int64_t  CS_LDK_ChannelTransactionParameters_new(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) {
58248         LDKChannelPublicKeys holder_pubkeys_arg_conv;
58249         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
58250         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
58251         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
58252         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
58253         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
58254         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
58255         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
58256         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
58257         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
58258         LDKOutPoint funding_outpoint_arg_conv;
58259         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
58260         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
58261         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
58262         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
58263         LDKChannelTypeFeatures channel_type_features_arg_conv;
58264         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
58265         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
58266         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
58267         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
58268         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);
58269         int64_t ret_ref = 0;
58270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58272         return ret_ref;
58273 }
58274
58275 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
58276         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
58277         int64_t ret_ref = 0;
58278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58280         return ret_ref;
58281 }
58282 int64_t  CS_LDK_ChannelTransactionParameters_clone_ptr(int64_t arg) {
58283         LDKChannelTransactionParameters arg_conv;
58284         arg_conv.inner = untag_ptr(arg);
58285         arg_conv.is_owned = ptr_is_owned(arg);
58286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58287         arg_conv.is_owned = false;
58288         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
58289         return ret_conv;
58290 }
58291
58292 int64_t  CS_LDK_ChannelTransactionParameters_clone(int64_t orig) {
58293         LDKChannelTransactionParameters orig_conv;
58294         orig_conv.inner = untag_ptr(orig);
58295         orig_conv.is_owned = ptr_is_owned(orig);
58296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58297         orig_conv.is_owned = false;
58298         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
58299         int64_t ret_ref = 0;
58300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58302         return ret_ref;
58303 }
58304
58305 int64_t  CS_LDK_ChannelTransactionParameters_hash(int64_t o) {
58306         LDKChannelTransactionParameters o_conv;
58307         o_conv.inner = untag_ptr(o);
58308         o_conv.is_owned = ptr_is_owned(o);
58309         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58310         o_conv.is_owned = false;
58311         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
58312         return ret_conv;
58313 }
58314
58315 jboolean  CS_LDK_ChannelTransactionParameters_eq(int64_t a, int64_t b) {
58316         LDKChannelTransactionParameters a_conv;
58317         a_conv.inner = untag_ptr(a);
58318         a_conv.is_owned = ptr_is_owned(a);
58319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58320         a_conv.is_owned = false;
58321         LDKChannelTransactionParameters b_conv;
58322         b_conv.inner = untag_ptr(b);
58323         b_conv.is_owned = ptr_is_owned(b);
58324         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58325         b_conv.is_owned = false;
58326         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
58327         return ret_conv;
58328 }
58329
58330 void  CS_LDK_CounterpartyChannelTransactionParameters_free(int64_t this_obj) {
58331         LDKCounterpartyChannelTransactionParameters this_obj_conv;
58332         this_obj_conv.inner = untag_ptr(this_obj);
58333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58335         CounterpartyChannelTransactionParameters_free(this_obj_conv);
58336 }
58337
58338 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_get_pubkeys(int64_t this_ptr) {
58339         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
58340         this_ptr_conv.inner = untag_ptr(this_ptr);
58341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58343         this_ptr_conv.is_owned = false;
58344         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
58345         int64_t ret_ref = 0;
58346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58348         return ret_ref;
58349 }
58350
58351 void  CS_LDK_CounterpartyChannelTransactionParameters_set_pubkeys(int64_t this_ptr, int64_t val) {
58352         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
58353         this_ptr_conv.inner = untag_ptr(this_ptr);
58354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58356         this_ptr_conv.is_owned = false;
58357         LDKChannelPublicKeys val_conv;
58358         val_conv.inner = untag_ptr(val);
58359         val_conv.is_owned = ptr_is_owned(val);
58360         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58361         val_conv = ChannelPublicKeys_clone(&val_conv);
58362         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
58363 }
58364
58365 int16_t  CS_LDK_CounterpartyChannelTransactionParameters_get_selected_contest_delay(int64_t this_ptr) {
58366         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
58367         this_ptr_conv.inner = untag_ptr(this_ptr);
58368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58370         this_ptr_conv.is_owned = false;
58371         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
58372         return ret_conv;
58373 }
58374
58375 void  CS_LDK_CounterpartyChannelTransactionParameters_set_selected_contest_delay(int64_t this_ptr, int16_t val) {
58376         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
58377         this_ptr_conv.inner = untag_ptr(this_ptr);
58378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58380         this_ptr_conv.is_owned = false;
58381         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
58382 }
58383
58384 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_new(int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
58385         LDKChannelPublicKeys pubkeys_arg_conv;
58386         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
58387         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
58388         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
58389         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
58390         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
58391         int64_t ret_ref = 0;
58392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58394         return ret_ref;
58395 }
58396
58397 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
58398         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
58399         int64_t ret_ref = 0;
58400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58402         return ret_ref;
58403 }
58404 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone_ptr(int64_t arg) {
58405         LDKCounterpartyChannelTransactionParameters arg_conv;
58406         arg_conv.inner = untag_ptr(arg);
58407         arg_conv.is_owned = ptr_is_owned(arg);
58408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58409         arg_conv.is_owned = false;
58410         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
58411         return ret_conv;
58412 }
58413
58414 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone(int64_t orig) {
58415         LDKCounterpartyChannelTransactionParameters orig_conv;
58416         orig_conv.inner = untag_ptr(orig);
58417         orig_conv.is_owned = ptr_is_owned(orig);
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58419         orig_conv.is_owned = false;
58420         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
58421         int64_t ret_ref = 0;
58422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58424         return ret_ref;
58425 }
58426
58427 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_hash(int64_t o) {
58428         LDKCounterpartyChannelTransactionParameters o_conv;
58429         o_conv.inner = untag_ptr(o);
58430         o_conv.is_owned = ptr_is_owned(o);
58431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58432         o_conv.is_owned = false;
58433         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
58434         return ret_conv;
58435 }
58436
58437 jboolean  CS_LDK_CounterpartyChannelTransactionParameters_eq(int64_t a, int64_t b) {
58438         LDKCounterpartyChannelTransactionParameters a_conv;
58439         a_conv.inner = untag_ptr(a);
58440         a_conv.is_owned = ptr_is_owned(a);
58441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58442         a_conv.is_owned = false;
58443         LDKCounterpartyChannelTransactionParameters b_conv;
58444         b_conv.inner = untag_ptr(b);
58445         b_conv.is_owned = ptr_is_owned(b);
58446         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58447         b_conv.is_owned = false;
58448         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
58449         return ret_conv;
58450 }
58451
58452 jboolean  CS_LDK_ChannelTransactionParameters_is_populated(int64_t this_arg) {
58453         LDKChannelTransactionParameters this_arg_conv;
58454         this_arg_conv.inner = untag_ptr(this_arg);
58455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58457         this_arg_conv.is_owned = false;
58458         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
58459         return ret_conv;
58460 }
58461
58462 int64_t  CS_LDK_ChannelTransactionParameters_as_holder_broadcastable(int64_t this_arg) {
58463         LDKChannelTransactionParameters this_arg_conv;
58464         this_arg_conv.inner = untag_ptr(this_arg);
58465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58467         this_arg_conv.is_owned = false;
58468         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
58469         int64_t ret_ref = 0;
58470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58472         return ret_ref;
58473 }
58474
58475 int64_t  CS_LDK_ChannelTransactionParameters_as_counterparty_broadcastable(int64_t this_arg) {
58476         LDKChannelTransactionParameters this_arg_conv;
58477         this_arg_conv.inner = untag_ptr(this_arg);
58478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58480         this_arg_conv.is_owned = false;
58481         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
58482         int64_t ret_ref = 0;
58483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58485         return ret_ref;
58486 }
58487
58488 int8_tArray  CS_LDK_CounterpartyChannelTransactionParameters_write(int64_t obj) {
58489         LDKCounterpartyChannelTransactionParameters obj_conv;
58490         obj_conv.inner = untag_ptr(obj);
58491         obj_conv.is_owned = ptr_is_owned(obj);
58492         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58493         obj_conv.is_owned = false;
58494         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
58495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58497         CVec_u8Z_free(ret_var);
58498         return ret_arr;
58499 }
58500
58501 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
58502         LDKu8slice ser_ref;
58503         ser_ref.datalen = ser->arr_len;
58504         ser_ref.data = ser->elems;
58505         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
58506         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
58507         FREE(ser);
58508         return tag_ptr(ret_conv, true);
58509 }
58510
58511 int8_tArray  CS_LDK_ChannelTransactionParameters_write(int64_t obj) {
58512         LDKChannelTransactionParameters obj_conv;
58513         obj_conv.inner = untag_ptr(obj);
58514         obj_conv.is_owned = ptr_is_owned(obj);
58515         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58516         obj_conv.is_owned = false;
58517         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
58518         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58519         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58520         CVec_u8Z_free(ret_var);
58521         return ret_arr;
58522 }
58523
58524 int64_t  CS_LDK_ChannelTransactionParameters_read(int8_tArray ser) {
58525         LDKu8slice ser_ref;
58526         ser_ref.datalen = ser->arr_len;
58527         ser_ref.data = ser->elems;
58528         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
58529         *ret_conv = ChannelTransactionParameters_read(ser_ref);
58530         FREE(ser);
58531         return tag_ptr(ret_conv, true);
58532 }
58533
58534 void  CS_LDK_DirectedChannelTransactionParameters_free(int64_t this_obj) {
58535         LDKDirectedChannelTransactionParameters this_obj_conv;
58536         this_obj_conv.inner = untag_ptr(this_obj);
58537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58539         DirectedChannelTransactionParameters_free(this_obj_conv);
58540 }
58541
58542 int64_t  CS_LDK_DirectedChannelTransactionParameters_broadcaster_pubkeys(int64_t this_arg) {
58543         LDKDirectedChannelTransactionParameters this_arg_conv;
58544         this_arg_conv.inner = untag_ptr(this_arg);
58545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58547         this_arg_conv.is_owned = false;
58548         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
58549         int64_t ret_ref = 0;
58550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58552         return ret_ref;
58553 }
58554
58555 int64_t  CS_LDK_DirectedChannelTransactionParameters_countersignatory_pubkeys(int64_t this_arg) {
58556         LDKDirectedChannelTransactionParameters this_arg_conv;
58557         this_arg_conv.inner = untag_ptr(this_arg);
58558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58560         this_arg_conv.is_owned = false;
58561         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
58562         int64_t ret_ref = 0;
58563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58565         return ret_ref;
58566 }
58567
58568 int16_t  CS_LDK_DirectedChannelTransactionParameters_contest_delay(int64_t this_arg) {
58569         LDKDirectedChannelTransactionParameters this_arg_conv;
58570         this_arg_conv.inner = untag_ptr(this_arg);
58571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58573         this_arg_conv.is_owned = false;
58574         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
58575         return ret_conv;
58576 }
58577
58578 jboolean  CS_LDK_DirectedChannelTransactionParameters_is_outbound(int64_t this_arg) {
58579         LDKDirectedChannelTransactionParameters this_arg_conv;
58580         this_arg_conv.inner = untag_ptr(this_arg);
58581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58583         this_arg_conv.is_owned = false;
58584         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
58585         return ret_conv;
58586 }
58587
58588 int64_t  CS_LDK_DirectedChannelTransactionParameters_funding_outpoint(int64_t this_arg) {
58589         LDKDirectedChannelTransactionParameters this_arg_conv;
58590         this_arg_conv.inner = untag_ptr(this_arg);
58591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58593         this_arg_conv.is_owned = false;
58594         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
58595         int64_t ret_ref = 0;
58596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58598         return ret_ref;
58599 }
58600
58601 int64_t  CS_LDK_DirectedChannelTransactionParameters_channel_type_features(int64_t this_arg) {
58602         LDKDirectedChannelTransactionParameters this_arg_conv;
58603         this_arg_conv.inner = untag_ptr(this_arg);
58604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58606         this_arg_conv.is_owned = false;
58607         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
58608         int64_t ret_ref = 0;
58609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58611         return ret_ref;
58612 }
58613
58614 void  CS_LDK_HolderCommitmentTransaction_free(int64_t this_obj) {
58615         LDKHolderCommitmentTransaction this_obj_conv;
58616         this_obj_conv.inner = untag_ptr(this_obj);
58617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58619         HolderCommitmentTransaction_free(this_obj_conv);
58620 }
58621
58622 int8_tArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_sig(int64_t this_ptr) {
58623         LDKHolderCommitmentTransaction this_ptr_conv;
58624         this_ptr_conv.inner = untag_ptr(this_ptr);
58625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58627         this_ptr_conv.is_owned = false;
58628         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58629         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
58630         return ret_arr;
58631 }
58632
58633 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
58634         LDKHolderCommitmentTransaction this_ptr_conv;
58635         this_ptr_conv.inner = untag_ptr(this_ptr);
58636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58638         this_ptr_conv.is_owned = false;
58639         LDKECDSASignature val_ref;
58640         CHECK(val->arr_len == 64);
58641         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
58642         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
58643 }
58644
58645 ptrArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_htlc_sigs(int64_t this_ptr) {
58646         LDKHolderCommitmentTransaction this_ptr_conv;
58647         this_ptr_conv.inner = untag_ptr(this_ptr);
58648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58650         this_ptr_conv.is_owned = false;
58651         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
58652         ptrArray ret_arr = NULL;
58653         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58654         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58655         for (size_t i = 0; i < ret_var.datalen; i++) {
58656                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
58657                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
58658                 ret_arr_ptr[i] = ret_conv_8_arr;
58659         }
58660         
58661         FREE(ret_var.data);
58662         return ret_arr;
58663 }
58664
58665 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_htlc_sigs(int64_t this_ptr, ptrArray val) {
58666         LDKHolderCommitmentTransaction this_ptr_conv;
58667         this_ptr_conv.inner = untag_ptr(this_ptr);
58668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58670         this_ptr_conv.is_owned = false;
58671         LDKCVec_ECDSASignatureZ val_constr;
58672         val_constr.datalen = val->arr_len;
58673         if (val_constr.datalen > 0)
58674                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58675         else
58676                 val_constr.data = NULL;
58677         int8_tArray* val_vals = (void*) val->elems;
58678         for (size_t i = 0; i < val_constr.datalen; i++) {
58679                 int8_tArray val_conv_8 = val_vals[i];
58680                 LDKECDSASignature val_conv_8_ref;
58681                 CHECK(val_conv_8->arr_len == 64);
58682                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
58683                 val_constr.data[i] = val_conv_8_ref;
58684         }
58685         FREE(val);
58686         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
58687 }
58688
58689 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
58690         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
58691         int64_t ret_ref = 0;
58692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58694         return ret_ref;
58695 }
58696 int64_t  CS_LDK_HolderCommitmentTransaction_clone_ptr(int64_t arg) {
58697         LDKHolderCommitmentTransaction arg_conv;
58698         arg_conv.inner = untag_ptr(arg);
58699         arg_conv.is_owned = ptr_is_owned(arg);
58700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58701         arg_conv.is_owned = false;
58702         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
58703         return ret_conv;
58704 }
58705
58706 int64_t  CS_LDK_HolderCommitmentTransaction_clone(int64_t orig) {
58707         LDKHolderCommitmentTransaction orig_conv;
58708         orig_conv.inner = untag_ptr(orig);
58709         orig_conv.is_owned = ptr_is_owned(orig);
58710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58711         orig_conv.is_owned = false;
58712         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
58713         int64_t ret_ref = 0;
58714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58716         return ret_ref;
58717 }
58718
58719 int8_tArray  CS_LDK_HolderCommitmentTransaction_write(int64_t obj) {
58720         LDKHolderCommitmentTransaction obj_conv;
58721         obj_conv.inner = untag_ptr(obj);
58722         obj_conv.is_owned = ptr_is_owned(obj);
58723         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58724         obj_conv.is_owned = false;
58725         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
58726         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58727         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58728         CVec_u8Z_free(ret_var);
58729         return ret_arr;
58730 }
58731
58732 int64_t  CS_LDK_HolderCommitmentTransaction_read(int8_tArray ser) {
58733         LDKu8slice ser_ref;
58734         ser_ref.datalen = ser->arr_len;
58735         ser_ref.data = ser->elems;
58736         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
58737         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
58738         FREE(ser);
58739         return tag_ptr(ret_conv, true);
58740 }
58741
58742 int64_t  CS_LDK_HolderCommitmentTransaction_new(int64_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
58743         LDKCommitmentTransaction commitment_tx_conv;
58744         commitment_tx_conv.inner = untag_ptr(commitment_tx);
58745         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
58746         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
58747         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
58748         LDKECDSASignature counterparty_sig_ref;
58749         CHECK(counterparty_sig->arr_len == 64);
58750         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
58751         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
58752         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
58753         if (counterparty_htlc_sigs_constr.datalen > 0)
58754                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
58755         else
58756                 counterparty_htlc_sigs_constr.data = NULL;
58757         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
58758         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
58759                 int8_tArray counterparty_htlc_sigs_conv_8 = counterparty_htlc_sigs_vals[i];
58760                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
58761                 CHECK(counterparty_htlc_sigs_conv_8->arr_len == 64);
58762                 memcpy(counterparty_htlc_sigs_conv_8_ref.compact_form, counterparty_htlc_sigs_conv_8->elems, 64); FREE(counterparty_htlc_sigs_conv_8);
58763                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
58764         }
58765         FREE(counterparty_htlc_sigs);
58766         LDKPublicKey holder_funding_key_ref;
58767         CHECK(holder_funding_key->arr_len == 33);
58768         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
58769         LDKPublicKey counterparty_funding_key_ref;
58770         CHECK(counterparty_funding_key->arr_len == 33);
58771         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
58772         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
58773         int64_t ret_ref = 0;
58774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58776         return ret_ref;
58777 }
58778
58779 void  CS_LDK_BuiltCommitmentTransaction_free(int64_t this_obj) {
58780         LDKBuiltCommitmentTransaction this_obj_conv;
58781         this_obj_conv.inner = untag_ptr(this_obj);
58782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58784         BuiltCommitmentTransaction_free(this_obj_conv);
58785 }
58786
58787 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_transaction(int64_t this_ptr) {
58788         LDKBuiltCommitmentTransaction this_ptr_conv;
58789         this_ptr_conv.inner = untag_ptr(this_ptr);
58790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58792         this_ptr_conv.is_owned = false;
58793         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
58794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58796         Transaction_free(ret_var);
58797         return ret_arr;
58798 }
58799
58800 void  CS_LDK_BuiltCommitmentTransaction_set_transaction(int64_t this_ptr, int8_tArray val) {
58801         LDKBuiltCommitmentTransaction this_ptr_conv;
58802         this_ptr_conv.inner = untag_ptr(this_ptr);
58803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58805         this_ptr_conv.is_owned = false;
58806         LDKTransaction val_ref;
58807         val_ref.datalen = val->arr_len;
58808         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
58809         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58810         val_ref.data_is_owned = true;
58811         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
58812 }
58813
58814 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_txid(int64_t this_ptr) {
58815         LDKBuiltCommitmentTransaction this_ptr_conv;
58816         this_ptr_conv.inner = untag_ptr(this_ptr);
58817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58819         this_ptr_conv.is_owned = false;
58820         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58821         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
58822         return ret_arr;
58823 }
58824
58825 void  CS_LDK_BuiltCommitmentTransaction_set_txid(int64_t this_ptr, int8_tArray val) {
58826         LDKBuiltCommitmentTransaction this_ptr_conv;
58827         this_ptr_conv.inner = untag_ptr(this_ptr);
58828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58830         this_ptr_conv.is_owned = false;
58831         LDKThirtyTwoBytes val_ref;
58832         CHECK(val->arr_len == 32);
58833         memcpy(val_ref.data, val->elems, 32); FREE(val);
58834         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
58835 }
58836
58837 int64_t  CS_LDK_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
58838         LDKTransaction transaction_arg_ref;
58839         transaction_arg_ref.datalen = transaction_arg->arr_len;
58840         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
58841         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
58842         transaction_arg_ref.data_is_owned = true;
58843         LDKThirtyTwoBytes txid_arg_ref;
58844         CHECK(txid_arg->arr_len == 32);
58845         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
58846         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
58847         int64_t ret_ref = 0;
58848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58850         return ret_ref;
58851 }
58852
58853 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
58854         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
58855         int64_t ret_ref = 0;
58856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58858         return ret_ref;
58859 }
58860 int64_t  CS_LDK_BuiltCommitmentTransaction_clone_ptr(int64_t arg) {
58861         LDKBuiltCommitmentTransaction arg_conv;
58862         arg_conv.inner = untag_ptr(arg);
58863         arg_conv.is_owned = ptr_is_owned(arg);
58864         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58865         arg_conv.is_owned = false;
58866         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
58867         return ret_conv;
58868 }
58869
58870 int64_t  CS_LDK_BuiltCommitmentTransaction_clone(int64_t orig) {
58871         LDKBuiltCommitmentTransaction orig_conv;
58872         orig_conv.inner = untag_ptr(orig);
58873         orig_conv.is_owned = ptr_is_owned(orig);
58874         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58875         orig_conv.is_owned = false;
58876         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
58877         int64_t ret_ref = 0;
58878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58880         return ret_ref;
58881 }
58882
58883 int8_tArray  CS_LDK_BuiltCommitmentTransaction_write(int64_t obj) {
58884         LDKBuiltCommitmentTransaction obj_conv;
58885         obj_conv.inner = untag_ptr(obj);
58886         obj_conv.is_owned = ptr_is_owned(obj);
58887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58888         obj_conv.is_owned = false;
58889         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
58890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58892         CVec_u8Z_free(ret_var);
58893         return ret_arr;
58894 }
58895
58896 int64_t  CS_LDK_BuiltCommitmentTransaction_read(int8_tArray ser) {
58897         LDKu8slice ser_ref;
58898         ser_ref.datalen = ser->arr_len;
58899         ser_ref.data = ser->elems;
58900         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
58901         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
58902         FREE(ser);
58903         return tag_ptr(ret_conv, true);
58904 }
58905
58906 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
58907         LDKBuiltCommitmentTransaction this_arg_conv;
58908         this_arg_conv.inner = untag_ptr(this_arg);
58909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58911         this_arg_conv.is_owned = false;
58912         LDKu8slice funding_redeemscript_ref;
58913         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58914         funding_redeemscript_ref.data = funding_redeemscript->elems;
58915         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58916         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
58917         FREE(funding_redeemscript);
58918         return ret_arr;
58919 }
58920
58921 int8_tArray  CS_LDK_BuiltCommitmentTransaction_sign_counterparty_commitment(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
58922         LDKBuiltCommitmentTransaction this_arg_conv;
58923         this_arg_conv.inner = untag_ptr(this_arg);
58924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58926         this_arg_conv.is_owned = false;
58927         uint8_t funding_key_arr[32];
58928         CHECK(funding_key->arr_len == 32);
58929         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58930         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58931         LDKu8slice funding_redeemscript_ref;
58932         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58933         funding_redeemscript_ref.data = funding_redeemscript->elems;
58934         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58935         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
58936         FREE(funding_redeemscript);
58937         return ret_arr;
58938 }
58939
58940 int8_tArray  CS_LDK_BuiltCommitmentTransaction_sign_holder_commitment(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, int64_t entropy_source) {
58941         LDKBuiltCommitmentTransaction this_arg_conv;
58942         this_arg_conv.inner = untag_ptr(this_arg);
58943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58945         this_arg_conv.is_owned = false;
58946         uint8_t funding_key_arr[32];
58947         CHECK(funding_key->arr_len == 32);
58948         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
58949         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
58950         LDKu8slice funding_redeemscript_ref;
58951         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
58952         funding_redeemscript_ref.data = funding_redeemscript->elems;
58953         void* entropy_source_ptr = untag_ptr(entropy_source);
58954         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58955         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58956         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
58957         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form, 64);
58958         FREE(funding_redeemscript);
58959         return ret_arr;
58960 }
58961
58962 void  CS_LDK_ClosingTransaction_free(int64_t this_obj) {
58963         LDKClosingTransaction this_obj_conv;
58964         this_obj_conv.inner = untag_ptr(this_obj);
58965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58967         ClosingTransaction_free(this_obj_conv);
58968 }
58969
58970 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
58971         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
58972         int64_t ret_ref = 0;
58973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58975         return ret_ref;
58976 }
58977 int64_t  CS_LDK_ClosingTransaction_clone_ptr(int64_t arg) {
58978         LDKClosingTransaction arg_conv;
58979         arg_conv.inner = untag_ptr(arg);
58980         arg_conv.is_owned = ptr_is_owned(arg);
58981         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58982         arg_conv.is_owned = false;
58983         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
58984         return ret_conv;
58985 }
58986
58987 int64_t  CS_LDK_ClosingTransaction_clone(int64_t orig) {
58988         LDKClosingTransaction orig_conv;
58989         orig_conv.inner = untag_ptr(orig);
58990         orig_conv.is_owned = ptr_is_owned(orig);
58991         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58992         orig_conv.is_owned = false;
58993         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
58994         int64_t ret_ref = 0;
58995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58997         return ret_ref;
58998 }
58999
59000 int64_t  CS_LDK_ClosingTransaction_hash(int64_t o) {
59001         LDKClosingTransaction o_conv;
59002         o_conv.inner = untag_ptr(o);
59003         o_conv.is_owned = ptr_is_owned(o);
59004         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59005         o_conv.is_owned = false;
59006         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
59007         return ret_conv;
59008 }
59009
59010 jboolean  CS_LDK_ClosingTransaction_eq(int64_t a, int64_t b) {
59011         LDKClosingTransaction a_conv;
59012         a_conv.inner = untag_ptr(a);
59013         a_conv.is_owned = ptr_is_owned(a);
59014         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59015         a_conv.is_owned = false;
59016         LDKClosingTransaction b_conv;
59017         b_conv.inner = untag_ptr(b);
59018         b_conv.is_owned = ptr_is_owned(b);
59019         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59020         b_conv.is_owned = false;
59021         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
59022         return ret_conv;
59023 }
59024
59025 int64_t  CS_LDK_ClosingTransaction_new(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) {
59026         LDKCVec_u8Z to_holder_script_ref;
59027         to_holder_script_ref.datalen = to_holder_script->arr_len;
59028         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
59029         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
59030         LDKCVec_u8Z to_counterparty_script_ref;
59031         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
59032         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
59033         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
59034         LDKOutPoint funding_outpoint_conv;
59035         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
59036         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
59038         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
59039         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
59040         int64_t ret_ref = 0;
59041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59043         return ret_ref;
59044 }
59045
59046 int64_t  CS_LDK_ClosingTransaction_trust(int64_t this_arg) {
59047         LDKClosingTransaction this_arg_conv;
59048         this_arg_conv.inner = untag_ptr(this_arg);
59049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59051         this_arg_conv.is_owned = false;
59052         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
59053         int64_t ret_ref = 0;
59054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59056         return ret_ref;
59057 }
59058
59059 int64_t  CS_LDK_ClosingTransaction_verify(int64_t this_arg, int64_t funding_outpoint) {
59060         LDKClosingTransaction this_arg_conv;
59061         this_arg_conv.inner = untag_ptr(this_arg);
59062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59064         this_arg_conv.is_owned = false;
59065         LDKOutPoint funding_outpoint_conv;
59066         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
59067         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
59068         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
59069         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
59070         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
59071         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
59072         return tag_ptr(ret_conv, true);
59073 }
59074
59075 int64_t  CS_LDK_ClosingTransaction_to_holder_value_sat(int64_t this_arg) {
59076         LDKClosingTransaction this_arg_conv;
59077         this_arg_conv.inner = untag_ptr(this_arg);
59078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59080         this_arg_conv.is_owned = false;
59081         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
59082         return ret_conv;
59083 }
59084
59085 int64_t  CS_LDK_ClosingTransaction_to_counterparty_value_sat(int64_t this_arg) {
59086         LDKClosingTransaction this_arg_conv;
59087         this_arg_conv.inner = untag_ptr(this_arg);
59088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59090         this_arg_conv.is_owned = false;
59091         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
59092         return ret_conv;
59093 }
59094
59095 int8_tArray  CS_LDK_ClosingTransaction_to_holder_script(int64_t this_arg) {
59096         LDKClosingTransaction this_arg_conv;
59097         this_arg_conv.inner = untag_ptr(this_arg);
59098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59100         this_arg_conv.is_owned = false;
59101         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
59102         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59103         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59104         return ret_arr;
59105 }
59106
59107 int8_tArray  CS_LDK_ClosingTransaction_to_counterparty_script(int64_t this_arg) {
59108         LDKClosingTransaction this_arg_conv;
59109         this_arg_conv.inner = untag_ptr(this_arg);
59110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59112         this_arg_conv.is_owned = false;
59113         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
59114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59116         return ret_arr;
59117 }
59118
59119 void  CS_LDK_TrustedClosingTransaction_free(int64_t this_obj) {
59120         LDKTrustedClosingTransaction this_obj_conv;
59121         this_obj_conv.inner = untag_ptr(this_obj);
59122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59124         TrustedClosingTransaction_free(this_obj_conv);
59125 }
59126
59127 int8_tArray  CS_LDK_TrustedClosingTransaction_built_transaction(int64_t this_arg) {
59128         LDKTrustedClosingTransaction this_arg_conv;
59129         this_arg_conv.inner = untag_ptr(this_arg);
59130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59132         this_arg_conv.is_owned = false;
59133         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
59134         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59135         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59136         Transaction_free(ret_var);
59137         return ret_arr;
59138 }
59139
59140 int8_tArray  CS_LDK_TrustedClosingTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
59141         LDKTrustedClosingTransaction this_arg_conv;
59142         this_arg_conv.inner = untag_ptr(this_arg);
59143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59145         this_arg_conv.is_owned = false;
59146         LDKu8slice funding_redeemscript_ref;
59147         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
59148         funding_redeemscript_ref.data = funding_redeemscript->elems;
59149         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59150         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
59151         FREE(funding_redeemscript);
59152         return ret_arr;
59153 }
59154
59155 int8_tArray  CS_LDK_TrustedClosingTransaction_sign(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
59156         LDKTrustedClosingTransaction this_arg_conv;
59157         this_arg_conv.inner = untag_ptr(this_arg);
59158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59160         this_arg_conv.is_owned = false;
59161         uint8_t funding_key_arr[32];
59162         CHECK(funding_key->arr_len == 32);
59163         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
59164         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
59165         LDKu8slice funding_redeemscript_ref;
59166         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
59167         funding_redeemscript_ref.data = funding_redeemscript->elems;
59168         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59169         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
59170         FREE(funding_redeemscript);
59171         return ret_arr;
59172 }
59173
59174 void  CS_LDK_CommitmentTransaction_free(int64_t this_obj) {
59175         LDKCommitmentTransaction this_obj_conv;
59176         this_obj_conv.inner = untag_ptr(this_obj);
59177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59179         CommitmentTransaction_free(this_obj_conv);
59180 }
59181
59182 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
59183         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
59184         int64_t ret_ref = 0;
59185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59187         return ret_ref;
59188 }
59189 int64_t  CS_LDK_CommitmentTransaction_clone_ptr(int64_t arg) {
59190         LDKCommitmentTransaction arg_conv;
59191         arg_conv.inner = untag_ptr(arg);
59192         arg_conv.is_owned = ptr_is_owned(arg);
59193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59194         arg_conv.is_owned = false;
59195         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
59196         return ret_conv;
59197 }
59198
59199 int64_t  CS_LDK_CommitmentTransaction_clone(int64_t orig) {
59200         LDKCommitmentTransaction orig_conv;
59201         orig_conv.inner = untag_ptr(orig);
59202         orig_conv.is_owned = ptr_is_owned(orig);
59203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59204         orig_conv.is_owned = false;
59205         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
59206         int64_t ret_ref = 0;
59207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59209         return ret_ref;
59210 }
59211
59212 int8_tArray  CS_LDK_CommitmentTransaction_write(int64_t obj) {
59213         LDKCommitmentTransaction obj_conv;
59214         obj_conv.inner = untag_ptr(obj);
59215         obj_conv.is_owned = ptr_is_owned(obj);
59216         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59217         obj_conv.is_owned = false;
59218         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
59219         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59220         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59221         CVec_u8Z_free(ret_var);
59222         return ret_arr;
59223 }
59224
59225 int64_t  CS_LDK_CommitmentTransaction_read(int8_tArray ser) {
59226         LDKu8slice ser_ref;
59227         ser_ref.datalen = ser->arr_len;
59228         ser_ref.data = ser->elems;
59229         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
59230         *ret_conv = CommitmentTransaction_read(ser_ref);
59231         FREE(ser);
59232         return tag_ptr(ret_conv, true);
59233 }
59234
59235 int64_t  CS_LDK_CommitmentTransaction_commitment_number(int64_t this_arg) {
59236         LDKCommitmentTransaction this_arg_conv;
59237         this_arg_conv.inner = untag_ptr(this_arg);
59238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59240         this_arg_conv.is_owned = false;
59241         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
59242         return ret_conv;
59243 }
59244
59245 int8_tArray  CS_LDK_CommitmentTransaction_per_commitment_point(int64_t this_arg) {
59246         LDKCommitmentTransaction this_arg_conv;
59247         this_arg_conv.inner = untag_ptr(this_arg);
59248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59250         this_arg_conv.is_owned = false;
59251         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59252         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
59253         return ret_arr;
59254 }
59255
59256 int64_t  CS_LDK_CommitmentTransaction_to_broadcaster_value_sat(int64_t this_arg) {
59257         LDKCommitmentTransaction this_arg_conv;
59258         this_arg_conv.inner = untag_ptr(this_arg);
59259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59261         this_arg_conv.is_owned = false;
59262         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
59263         return ret_conv;
59264 }
59265
59266 int64_t  CS_LDK_CommitmentTransaction_to_countersignatory_value_sat(int64_t this_arg) {
59267         LDKCommitmentTransaction this_arg_conv;
59268         this_arg_conv.inner = untag_ptr(this_arg);
59269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59271         this_arg_conv.is_owned = false;
59272         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
59273         return ret_conv;
59274 }
59275
59276 int32_t  CS_LDK_CommitmentTransaction_feerate_per_kw(int64_t this_arg) {
59277         LDKCommitmentTransaction this_arg_conv;
59278         this_arg_conv.inner = untag_ptr(this_arg);
59279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59281         this_arg_conv.is_owned = false;
59282         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
59283         return ret_conv;
59284 }
59285
59286 int64_t  CS_LDK_CommitmentTransaction_trust(int64_t this_arg) {
59287         LDKCommitmentTransaction this_arg_conv;
59288         this_arg_conv.inner = untag_ptr(this_arg);
59289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59291         this_arg_conv.is_owned = false;
59292         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
59293         int64_t ret_ref = 0;
59294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59296         return ret_ref;
59297 }
59298
59299 int64_t  CS_LDK_CommitmentTransaction_verify(int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
59300         LDKCommitmentTransaction this_arg_conv;
59301         this_arg_conv.inner = untag_ptr(this_arg);
59302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59304         this_arg_conv.is_owned = false;
59305         LDKDirectedChannelTransactionParameters channel_parameters_conv;
59306         channel_parameters_conv.inner = untag_ptr(channel_parameters);
59307         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
59308         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
59309         channel_parameters_conv.is_owned = false;
59310         LDKChannelPublicKeys broadcaster_keys_conv;
59311         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
59312         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
59313         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
59314         broadcaster_keys_conv.is_owned = false;
59315         LDKChannelPublicKeys countersignatory_keys_conv;
59316         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
59317         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
59319         countersignatory_keys_conv.is_owned = false;
59320         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
59321         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
59322         return tag_ptr(ret_conv, true);
59323 }
59324
59325 void  CS_LDK_TrustedCommitmentTransaction_free(int64_t this_obj) {
59326         LDKTrustedCommitmentTransaction this_obj_conv;
59327         this_obj_conv.inner = untag_ptr(this_obj);
59328         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59330         TrustedCommitmentTransaction_free(this_obj_conv);
59331 }
59332
59333 int8_tArray  CS_LDK_TrustedCommitmentTransaction_txid(int64_t this_arg) {
59334         LDKTrustedCommitmentTransaction this_arg_conv;
59335         this_arg_conv.inner = untag_ptr(this_arg);
59336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59338         this_arg_conv.is_owned = false;
59339         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59340         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
59341         return ret_arr;
59342 }
59343
59344 int64_t  CS_LDK_TrustedCommitmentTransaction_built_transaction(int64_t this_arg) {
59345         LDKTrustedCommitmentTransaction this_arg_conv;
59346         this_arg_conv.inner = untag_ptr(this_arg);
59347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59349         this_arg_conv.is_owned = false;
59350         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
59351         int64_t ret_ref = 0;
59352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59354         return ret_ref;
59355 }
59356
59357 int64_t  CS_LDK_TrustedCommitmentTransaction_keys(int64_t this_arg) {
59358         LDKTrustedCommitmentTransaction this_arg_conv;
59359         this_arg_conv.inner = untag_ptr(this_arg);
59360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59362         this_arg_conv.is_owned = false;
59363         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
59364         int64_t ret_ref = 0;
59365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59367         return ret_ref;
59368 }
59369
59370 int64_t  CS_LDK_TrustedCommitmentTransaction_channel_type_features(int64_t this_arg) {
59371         LDKTrustedCommitmentTransaction this_arg_conv;
59372         this_arg_conv.inner = untag_ptr(this_arg);
59373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59375         this_arg_conv.is_owned = false;
59376         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
59377         int64_t ret_ref = 0;
59378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59380         return ret_ref;
59381 }
59382
59383 int64_t  CS_LDK_TrustedCommitmentTransaction_get_htlc_sigs(int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters, int64_t entropy_source) {
59384         LDKTrustedCommitmentTransaction this_arg_conv;
59385         this_arg_conv.inner = untag_ptr(this_arg);
59386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59388         this_arg_conv.is_owned = false;
59389         uint8_t htlc_base_key_arr[32];
59390         CHECK(htlc_base_key->arr_len == 32);
59391         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
59392         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
59393         LDKDirectedChannelTransactionParameters channel_parameters_conv;
59394         channel_parameters_conv.inner = untag_ptr(channel_parameters);
59395         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
59396         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
59397         channel_parameters_conv.is_owned = false;
59398         void* entropy_source_ptr = untag_ptr(entropy_source);
59399         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
59400         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
59401         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
59402         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
59403         return tag_ptr(ret_conv, true);
59404 }
59405
59406 int64_t  CS_LDK_TrustedCommitmentTransaction_revokeable_output_index(int64_t this_arg) {
59407         LDKTrustedCommitmentTransaction this_arg_conv;
59408         this_arg_conv.inner = untag_ptr(this_arg);
59409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59411         this_arg_conv.is_owned = false;
59412         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
59413         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
59414         int64_t ret_ref = tag_ptr(ret_copy, true);
59415         return ret_ref;
59416 }
59417
59418 int64_t  CS_LDK_TrustedCommitmentTransaction_build_to_local_justice_tx(int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
59419         LDKTrustedCommitmentTransaction this_arg_conv;
59420         this_arg_conv.inner = untag_ptr(this_arg);
59421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59423         this_arg_conv.is_owned = false;
59424         LDKCVec_u8Z destination_script_ref;
59425         destination_script_ref.datalen = destination_script->arr_len;
59426         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
59427         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
59428         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
59429         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
59430         return tag_ptr(ret_conv, true);
59431 }
59432
59433 int64_t  CS_LDK_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
59434         LDKPublicKey broadcaster_payment_basepoint_ref;
59435         CHECK(broadcaster_payment_basepoint->arr_len == 33);
59436         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
59437         LDKPublicKey countersignatory_payment_basepoint_ref;
59438         CHECK(countersignatory_payment_basepoint->arr_len == 33);
59439         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
59440         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
59441         return ret_conv;
59442 }
59443
59444 jboolean  CS_LDK_InitFeatures_eq(int64_t a, int64_t b) {
59445         LDKInitFeatures a_conv;
59446         a_conv.inner = untag_ptr(a);
59447         a_conv.is_owned = ptr_is_owned(a);
59448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59449         a_conv.is_owned = false;
59450         LDKInitFeatures b_conv;
59451         b_conv.inner = untag_ptr(b);
59452         b_conv.is_owned = ptr_is_owned(b);
59453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59454         b_conv.is_owned = false;
59455         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
59456         return ret_conv;
59457 }
59458
59459 jboolean  CS_LDK_NodeFeatures_eq(int64_t a, int64_t b) {
59460         LDKNodeFeatures a_conv;
59461         a_conv.inner = untag_ptr(a);
59462         a_conv.is_owned = ptr_is_owned(a);
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59464         a_conv.is_owned = false;
59465         LDKNodeFeatures b_conv;
59466         b_conv.inner = untag_ptr(b);
59467         b_conv.is_owned = ptr_is_owned(b);
59468         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59469         b_conv.is_owned = false;
59470         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
59471         return ret_conv;
59472 }
59473
59474 jboolean  CS_LDK_ChannelFeatures_eq(int64_t a, int64_t b) {
59475         LDKChannelFeatures a_conv;
59476         a_conv.inner = untag_ptr(a);
59477         a_conv.is_owned = ptr_is_owned(a);
59478         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59479         a_conv.is_owned = false;
59480         LDKChannelFeatures b_conv;
59481         b_conv.inner = untag_ptr(b);
59482         b_conv.is_owned = ptr_is_owned(b);
59483         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59484         b_conv.is_owned = false;
59485         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
59486         return ret_conv;
59487 }
59488
59489 jboolean  CS_LDK_Bolt11InvoiceFeatures_eq(int64_t a, int64_t b) {
59490         LDKBolt11InvoiceFeatures a_conv;
59491         a_conv.inner = untag_ptr(a);
59492         a_conv.is_owned = ptr_is_owned(a);
59493         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59494         a_conv.is_owned = false;
59495         LDKBolt11InvoiceFeatures b_conv;
59496         b_conv.inner = untag_ptr(b);
59497         b_conv.is_owned = ptr_is_owned(b);
59498         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59499         b_conv.is_owned = false;
59500         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
59501         return ret_conv;
59502 }
59503
59504 jboolean  CS_LDK_OfferFeatures_eq(int64_t a, int64_t b) {
59505         LDKOfferFeatures a_conv;
59506         a_conv.inner = untag_ptr(a);
59507         a_conv.is_owned = ptr_is_owned(a);
59508         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59509         a_conv.is_owned = false;
59510         LDKOfferFeatures b_conv;
59511         b_conv.inner = untag_ptr(b);
59512         b_conv.is_owned = ptr_is_owned(b);
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59514         b_conv.is_owned = false;
59515         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
59516         return ret_conv;
59517 }
59518
59519 jboolean  CS_LDK_InvoiceRequestFeatures_eq(int64_t a, int64_t b) {
59520         LDKInvoiceRequestFeatures a_conv;
59521         a_conv.inner = untag_ptr(a);
59522         a_conv.is_owned = ptr_is_owned(a);
59523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59524         a_conv.is_owned = false;
59525         LDKInvoiceRequestFeatures b_conv;
59526         b_conv.inner = untag_ptr(b);
59527         b_conv.is_owned = ptr_is_owned(b);
59528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59529         b_conv.is_owned = false;
59530         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
59531         return ret_conv;
59532 }
59533
59534 jboolean  CS_LDK_Bolt12InvoiceFeatures_eq(int64_t a, int64_t b) {
59535         LDKBolt12InvoiceFeatures a_conv;
59536         a_conv.inner = untag_ptr(a);
59537         a_conv.is_owned = ptr_is_owned(a);
59538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59539         a_conv.is_owned = false;
59540         LDKBolt12InvoiceFeatures b_conv;
59541         b_conv.inner = untag_ptr(b);
59542         b_conv.is_owned = ptr_is_owned(b);
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59544         b_conv.is_owned = false;
59545         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
59546         return ret_conv;
59547 }
59548
59549 jboolean  CS_LDK_BlindedHopFeatures_eq(int64_t a, int64_t b) {
59550         LDKBlindedHopFeatures a_conv;
59551         a_conv.inner = untag_ptr(a);
59552         a_conv.is_owned = ptr_is_owned(a);
59553         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59554         a_conv.is_owned = false;
59555         LDKBlindedHopFeatures b_conv;
59556         b_conv.inner = untag_ptr(b);
59557         b_conv.is_owned = ptr_is_owned(b);
59558         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59559         b_conv.is_owned = false;
59560         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
59561         return ret_conv;
59562 }
59563
59564 jboolean  CS_LDK_ChannelTypeFeatures_eq(int64_t a, int64_t b) {
59565         LDKChannelTypeFeatures a_conv;
59566         a_conv.inner = untag_ptr(a);
59567         a_conv.is_owned = ptr_is_owned(a);
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59569         a_conv.is_owned = false;
59570         LDKChannelTypeFeatures b_conv;
59571         b_conv.inner = untag_ptr(b);
59572         b_conv.is_owned = ptr_is_owned(b);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59574         b_conv.is_owned = false;
59575         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
59576         return ret_conv;
59577 }
59578
59579 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
59580         LDKInitFeatures ret_var = InitFeatures_clone(arg);
59581         int64_t ret_ref = 0;
59582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59584         return ret_ref;
59585 }
59586 int64_t  CS_LDK_InitFeatures_clone_ptr(int64_t arg) {
59587         LDKInitFeatures arg_conv;
59588         arg_conv.inner = untag_ptr(arg);
59589         arg_conv.is_owned = ptr_is_owned(arg);
59590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59591         arg_conv.is_owned = false;
59592         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
59593         return ret_conv;
59594 }
59595
59596 int64_t  CS_LDK_InitFeatures_clone(int64_t orig) {
59597         LDKInitFeatures orig_conv;
59598         orig_conv.inner = untag_ptr(orig);
59599         orig_conv.is_owned = ptr_is_owned(orig);
59600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59601         orig_conv.is_owned = false;
59602         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
59603         int64_t ret_ref = 0;
59604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59606         return ret_ref;
59607 }
59608
59609 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
59610         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
59611         int64_t ret_ref = 0;
59612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59614         return ret_ref;
59615 }
59616 int64_t  CS_LDK_NodeFeatures_clone_ptr(int64_t arg) {
59617         LDKNodeFeatures arg_conv;
59618         arg_conv.inner = untag_ptr(arg);
59619         arg_conv.is_owned = ptr_is_owned(arg);
59620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59621         arg_conv.is_owned = false;
59622         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
59623         return ret_conv;
59624 }
59625
59626 int64_t  CS_LDK_NodeFeatures_clone(int64_t orig) {
59627         LDKNodeFeatures orig_conv;
59628         orig_conv.inner = untag_ptr(orig);
59629         orig_conv.is_owned = ptr_is_owned(orig);
59630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59631         orig_conv.is_owned = false;
59632         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
59633         int64_t ret_ref = 0;
59634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59636         return ret_ref;
59637 }
59638
59639 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
59640         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
59641         int64_t ret_ref = 0;
59642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59644         return ret_ref;
59645 }
59646 int64_t  CS_LDK_ChannelFeatures_clone_ptr(int64_t arg) {
59647         LDKChannelFeatures arg_conv;
59648         arg_conv.inner = untag_ptr(arg);
59649         arg_conv.is_owned = ptr_is_owned(arg);
59650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59651         arg_conv.is_owned = false;
59652         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
59653         return ret_conv;
59654 }
59655
59656 int64_t  CS_LDK_ChannelFeatures_clone(int64_t orig) {
59657         LDKChannelFeatures orig_conv;
59658         orig_conv.inner = untag_ptr(orig);
59659         orig_conv.is_owned = ptr_is_owned(orig);
59660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59661         orig_conv.is_owned = false;
59662         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
59663         int64_t ret_ref = 0;
59664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59666         return ret_ref;
59667 }
59668
59669 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
59670         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
59671         int64_t ret_ref = 0;
59672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59674         return ret_ref;
59675 }
59676 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone_ptr(int64_t arg) {
59677         LDKBolt11InvoiceFeatures arg_conv;
59678         arg_conv.inner = untag_ptr(arg);
59679         arg_conv.is_owned = ptr_is_owned(arg);
59680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59681         arg_conv.is_owned = false;
59682         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
59683         return ret_conv;
59684 }
59685
59686 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone(int64_t orig) {
59687         LDKBolt11InvoiceFeatures orig_conv;
59688         orig_conv.inner = untag_ptr(orig);
59689         orig_conv.is_owned = ptr_is_owned(orig);
59690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59691         orig_conv.is_owned = false;
59692         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
59693         int64_t ret_ref = 0;
59694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59696         return ret_ref;
59697 }
59698
59699 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
59700         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
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 int64_t  CS_LDK_OfferFeatures_clone_ptr(int64_t arg) {
59707         LDKOfferFeatures arg_conv;
59708         arg_conv.inner = untag_ptr(arg);
59709         arg_conv.is_owned = ptr_is_owned(arg);
59710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59711         arg_conv.is_owned = false;
59712         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
59713         return ret_conv;
59714 }
59715
59716 int64_t  CS_LDK_OfferFeatures_clone(int64_t orig) {
59717         LDKOfferFeatures orig_conv;
59718         orig_conv.inner = untag_ptr(orig);
59719         orig_conv.is_owned = ptr_is_owned(orig);
59720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59721         orig_conv.is_owned = false;
59722         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
59723         int64_t ret_ref = 0;
59724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59726         return ret_ref;
59727 }
59728
59729 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
59730         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
59731         int64_t ret_ref = 0;
59732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59734         return ret_ref;
59735 }
59736 int64_t  CS_LDK_InvoiceRequestFeatures_clone_ptr(int64_t arg) {
59737         LDKInvoiceRequestFeatures arg_conv;
59738         arg_conv.inner = untag_ptr(arg);
59739         arg_conv.is_owned = ptr_is_owned(arg);
59740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59741         arg_conv.is_owned = false;
59742         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
59743         return ret_conv;
59744 }
59745
59746 int64_t  CS_LDK_InvoiceRequestFeatures_clone(int64_t orig) {
59747         LDKInvoiceRequestFeatures orig_conv;
59748         orig_conv.inner = untag_ptr(orig);
59749         orig_conv.is_owned = ptr_is_owned(orig);
59750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59751         orig_conv.is_owned = false;
59752         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
59753         int64_t ret_ref = 0;
59754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59756         return ret_ref;
59757 }
59758
59759 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
59760         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
59761         int64_t ret_ref = 0;
59762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59764         return ret_ref;
59765 }
59766 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone_ptr(int64_t arg) {
59767         LDKBolt12InvoiceFeatures arg_conv;
59768         arg_conv.inner = untag_ptr(arg);
59769         arg_conv.is_owned = ptr_is_owned(arg);
59770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59771         arg_conv.is_owned = false;
59772         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
59773         return ret_conv;
59774 }
59775
59776 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone(int64_t orig) {
59777         LDKBolt12InvoiceFeatures orig_conv;
59778         orig_conv.inner = untag_ptr(orig);
59779         orig_conv.is_owned = ptr_is_owned(orig);
59780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59781         orig_conv.is_owned = false;
59782         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
59783         int64_t ret_ref = 0;
59784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59786         return ret_ref;
59787 }
59788
59789 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
59790         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
59791         int64_t ret_ref = 0;
59792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59794         return ret_ref;
59795 }
59796 int64_t  CS_LDK_BlindedHopFeatures_clone_ptr(int64_t arg) {
59797         LDKBlindedHopFeatures arg_conv;
59798         arg_conv.inner = untag_ptr(arg);
59799         arg_conv.is_owned = ptr_is_owned(arg);
59800         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59801         arg_conv.is_owned = false;
59802         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
59803         return ret_conv;
59804 }
59805
59806 int64_t  CS_LDK_BlindedHopFeatures_clone(int64_t orig) {
59807         LDKBlindedHopFeatures orig_conv;
59808         orig_conv.inner = untag_ptr(orig);
59809         orig_conv.is_owned = ptr_is_owned(orig);
59810         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59811         orig_conv.is_owned = false;
59812         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
59813         int64_t ret_ref = 0;
59814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59816         return ret_ref;
59817 }
59818
59819 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
59820         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
59821         int64_t ret_ref = 0;
59822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59824         return ret_ref;
59825 }
59826 int64_t  CS_LDK_ChannelTypeFeatures_clone_ptr(int64_t arg) {
59827         LDKChannelTypeFeatures arg_conv;
59828         arg_conv.inner = untag_ptr(arg);
59829         arg_conv.is_owned = ptr_is_owned(arg);
59830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59831         arg_conv.is_owned = false;
59832         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
59833         return ret_conv;
59834 }
59835
59836 int64_t  CS_LDK_ChannelTypeFeatures_clone(int64_t orig) {
59837         LDKChannelTypeFeatures orig_conv;
59838         orig_conv.inner = untag_ptr(orig);
59839         orig_conv.is_owned = ptr_is_owned(orig);
59840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59841         orig_conv.is_owned = false;
59842         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
59843         int64_t ret_ref = 0;
59844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59846         return ret_ref;
59847 }
59848
59849 int64_t  CS_LDK_InitFeatures_hash(int64_t o) {
59850         LDKInitFeatures o_conv;
59851         o_conv.inner = untag_ptr(o);
59852         o_conv.is_owned = ptr_is_owned(o);
59853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59854         o_conv.is_owned = false;
59855         int64_t ret_conv = InitFeatures_hash(&o_conv);
59856         return ret_conv;
59857 }
59858
59859 int64_t  CS_LDK_NodeFeatures_hash(int64_t o) {
59860         LDKNodeFeatures o_conv;
59861         o_conv.inner = untag_ptr(o);
59862         o_conv.is_owned = ptr_is_owned(o);
59863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59864         o_conv.is_owned = false;
59865         int64_t ret_conv = NodeFeatures_hash(&o_conv);
59866         return ret_conv;
59867 }
59868
59869 int64_t  CS_LDK_ChannelFeatures_hash(int64_t o) {
59870         LDKChannelFeatures o_conv;
59871         o_conv.inner = untag_ptr(o);
59872         o_conv.is_owned = ptr_is_owned(o);
59873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59874         o_conv.is_owned = false;
59875         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
59876         return ret_conv;
59877 }
59878
59879 int64_t  CS_LDK_Bolt11InvoiceFeatures_hash(int64_t o) {
59880         LDKBolt11InvoiceFeatures o_conv;
59881         o_conv.inner = untag_ptr(o);
59882         o_conv.is_owned = ptr_is_owned(o);
59883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59884         o_conv.is_owned = false;
59885         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
59886         return ret_conv;
59887 }
59888
59889 int64_t  CS_LDK_OfferFeatures_hash(int64_t o) {
59890         LDKOfferFeatures o_conv;
59891         o_conv.inner = untag_ptr(o);
59892         o_conv.is_owned = ptr_is_owned(o);
59893         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59894         o_conv.is_owned = false;
59895         int64_t ret_conv = OfferFeatures_hash(&o_conv);
59896         return ret_conv;
59897 }
59898
59899 int64_t  CS_LDK_InvoiceRequestFeatures_hash(int64_t o) {
59900         LDKInvoiceRequestFeatures o_conv;
59901         o_conv.inner = untag_ptr(o);
59902         o_conv.is_owned = ptr_is_owned(o);
59903         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59904         o_conv.is_owned = false;
59905         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
59906         return ret_conv;
59907 }
59908
59909 int64_t  CS_LDK_Bolt12InvoiceFeatures_hash(int64_t o) {
59910         LDKBolt12InvoiceFeatures o_conv;
59911         o_conv.inner = untag_ptr(o);
59912         o_conv.is_owned = ptr_is_owned(o);
59913         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59914         o_conv.is_owned = false;
59915         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
59916         return ret_conv;
59917 }
59918
59919 int64_t  CS_LDK_BlindedHopFeatures_hash(int64_t o) {
59920         LDKBlindedHopFeatures o_conv;
59921         o_conv.inner = untag_ptr(o);
59922         o_conv.is_owned = ptr_is_owned(o);
59923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59924         o_conv.is_owned = false;
59925         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
59926         return ret_conv;
59927 }
59928
59929 int64_t  CS_LDK_ChannelTypeFeatures_hash(int64_t o) {
59930         LDKChannelTypeFeatures o_conv;
59931         o_conv.inner = untag_ptr(o);
59932         o_conv.is_owned = ptr_is_owned(o);
59933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59934         o_conv.is_owned = false;
59935         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
59936         return ret_conv;
59937 }
59938
59939 void  CS_LDK_InitFeatures_free(int64_t this_obj) {
59940         LDKInitFeatures this_obj_conv;
59941         this_obj_conv.inner = untag_ptr(this_obj);
59942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59944         InitFeatures_free(this_obj_conv);
59945 }
59946
59947 void  CS_LDK_NodeFeatures_free(int64_t this_obj) {
59948         LDKNodeFeatures this_obj_conv;
59949         this_obj_conv.inner = untag_ptr(this_obj);
59950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59952         NodeFeatures_free(this_obj_conv);
59953 }
59954
59955 void  CS_LDK_ChannelFeatures_free(int64_t this_obj) {
59956         LDKChannelFeatures this_obj_conv;
59957         this_obj_conv.inner = untag_ptr(this_obj);
59958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59960         ChannelFeatures_free(this_obj_conv);
59961 }
59962
59963 void  CS_LDK_Bolt11InvoiceFeatures_free(int64_t this_obj) {
59964         LDKBolt11InvoiceFeatures this_obj_conv;
59965         this_obj_conv.inner = untag_ptr(this_obj);
59966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59968         Bolt11InvoiceFeatures_free(this_obj_conv);
59969 }
59970
59971 void  CS_LDK_OfferFeatures_free(int64_t this_obj) {
59972         LDKOfferFeatures this_obj_conv;
59973         this_obj_conv.inner = untag_ptr(this_obj);
59974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59976         OfferFeatures_free(this_obj_conv);
59977 }
59978
59979 void  CS_LDK_InvoiceRequestFeatures_free(int64_t this_obj) {
59980         LDKInvoiceRequestFeatures this_obj_conv;
59981         this_obj_conv.inner = untag_ptr(this_obj);
59982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59984         InvoiceRequestFeatures_free(this_obj_conv);
59985 }
59986
59987 void  CS_LDK_Bolt12InvoiceFeatures_free(int64_t this_obj) {
59988         LDKBolt12InvoiceFeatures this_obj_conv;
59989         this_obj_conv.inner = untag_ptr(this_obj);
59990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59992         Bolt12InvoiceFeatures_free(this_obj_conv);
59993 }
59994
59995 void  CS_LDK_BlindedHopFeatures_free(int64_t this_obj) {
59996         LDKBlindedHopFeatures this_obj_conv;
59997         this_obj_conv.inner = untag_ptr(this_obj);
59998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60000         BlindedHopFeatures_free(this_obj_conv);
60001 }
60002
60003 void  CS_LDK_ChannelTypeFeatures_free(int64_t this_obj) {
60004         LDKChannelTypeFeatures this_obj_conv;
60005         this_obj_conv.inner = untag_ptr(this_obj);
60006         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60008         ChannelTypeFeatures_free(this_obj_conv);
60009 }
60010
60011 int64_t  CS_LDK_InitFeatures_empty() {
60012         LDKInitFeatures ret_var = InitFeatures_empty();
60013         int64_t ret_ref = 0;
60014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60016         return ret_ref;
60017 }
60018
60019 jboolean  CS_LDK_InitFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60020         LDKInitFeatures this_arg_conv;
60021         this_arg_conv.inner = untag_ptr(this_arg);
60022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60024         this_arg_conv.is_owned = false;
60025         LDKInitFeatures other_conv;
60026         other_conv.inner = untag_ptr(other);
60027         other_conv.is_owned = ptr_is_owned(other);
60028         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60029         other_conv.is_owned = false;
60030         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60031         return ret_conv;
60032 }
60033
60034 jboolean  CS_LDK_InitFeatures_requires_unknown_bits(int64_t this_arg) {
60035         LDKInitFeatures this_arg_conv;
60036         this_arg_conv.inner = untag_ptr(this_arg);
60037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60039         this_arg_conv.is_owned = false;
60040         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
60041         return ret_conv;
60042 }
60043
60044 int64_t  CS_LDK_InitFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60045         LDKInitFeatures this_arg_conv;
60046         this_arg_conv.inner = untag_ptr(this_arg);
60047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60049         this_arg_conv.is_owned = false;
60050         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60051         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
60052         return tag_ptr(ret_conv, true);
60053 }
60054
60055 int64_t  CS_LDK_InitFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60056         LDKInitFeatures this_arg_conv;
60057         this_arg_conv.inner = untag_ptr(this_arg);
60058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60060         this_arg_conv.is_owned = false;
60061         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60062         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60063         return tag_ptr(ret_conv, true);
60064 }
60065
60066 int64_t  CS_LDK_InitFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60067         LDKInitFeatures this_arg_conv;
60068         this_arg_conv.inner = untag_ptr(this_arg);
60069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60071         this_arg_conv.is_owned = false;
60072         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60073         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
60074         return tag_ptr(ret_conv, true);
60075 }
60076
60077 int64_t  CS_LDK_InitFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60078         LDKInitFeatures this_arg_conv;
60079         this_arg_conv.inner = untag_ptr(this_arg);
60080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60082         this_arg_conv.is_owned = false;
60083         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60084         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60085         return tag_ptr(ret_conv, true);
60086 }
60087
60088 int64_t  CS_LDK_NodeFeatures_empty() {
60089         LDKNodeFeatures ret_var = NodeFeatures_empty();
60090         int64_t ret_ref = 0;
60091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60093         return ret_ref;
60094 }
60095
60096 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60097         LDKNodeFeatures this_arg_conv;
60098         this_arg_conv.inner = untag_ptr(this_arg);
60099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60101         this_arg_conv.is_owned = false;
60102         LDKNodeFeatures other_conv;
60103         other_conv.inner = untag_ptr(other);
60104         other_conv.is_owned = ptr_is_owned(other);
60105         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60106         other_conv.is_owned = false;
60107         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60108         return ret_conv;
60109 }
60110
60111 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits(int64_t this_arg) {
60112         LDKNodeFeatures this_arg_conv;
60113         this_arg_conv.inner = untag_ptr(this_arg);
60114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60116         this_arg_conv.is_owned = false;
60117         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
60118         return ret_conv;
60119 }
60120
60121 int64_t  CS_LDK_NodeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60122         LDKNodeFeatures this_arg_conv;
60123         this_arg_conv.inner = untag_ptr(this_arg);
60124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60126         this_arg_conv.is_owned = false;
60127         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60128         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
60129         return tag_ptr(ret_conv, true);
60130 }
60131
60132 int64_t  CS_LDK_NodeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60133         LDKNodeFeatures this_arg_conv;
60134         this_arg_conv.inner = untag_ptr(this_arg);
60135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60137         this_arg_conv.is_owned = false;
60138         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60139         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60140         return tag_ptr(ret_conv, true);
60141 }
60142
60143 int64_t  CS_LDK_NodeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60144         LDKNodeFeatures this_arg_conv;
60145         this_arg_conv.inner = untag_ptr(this_arg);
60146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60148         this_arg_conv.is_owned = false;
60149         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60150         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
60151         return tag_ptr(ret_conv, true);
60152 }
60153
60154 int64_t  CS_LDK_NodeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60155         LDKNodeFeatures this_arg_conv;
60156         this_arg_conv.inner = untag_ptr(this_arg);
60157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60159         this_arg_conv.is_owned = false;
60160         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60161         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60162         return tag_ptr(ret_conv, true);
60163 }
60164
60165 int64_t  CS_LDK_ChannelFeatures_empty() {
60166         LDKChannelFeatures ret_var = ChannelFeatures_empty();
60167         int64_t ret_ref = 0;
60168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60170         return ret_ref;
60171 }
60172
60173 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60174         LDKChannelFeatures this_arg_conv;
60175         this_arg_conv.inner = untag_ptr(this_arg);
60176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60178         this_arg_conv.is_owned = false;
60179         LDKChannelFeatures other_conv;
60180         other_conv.inner = untag_ptr(other);
60181         other_conv.is_owned = ptr_is_owned(other);
60182         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60183         other_conv.is_owned = false;
60184         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60185         return ret_conv;
60186 }
60187
60188 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits(int64_t this_arg) {
60189         LDKChannelFeatures this_arg_conv;
60190         this_arg_conv.inner = untag_ptr(this_arg);
60191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60193         this_arg_conv.is_owned = false;
60194         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
60195         return ret_conv;
60196 }
60197
60198 int64_t  CS_LDK_ChannelFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60199         LDKChannelFeatures this_arg_conv;
60200         this_arg_conv.inner = untag_ptr(this_arg);
60201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60203         this_arg_conv.is_owned = false;
60204         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60205         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
60206         return tag_ptr(ret_conv, true);
60207 }
60208
60209 int64_t  CS_LDK_ChannelFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60210         LDKChannelFeatures this_arg_conv;
60211         this_arg_conv.inner = untag_ptr(this_arg);
60212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60214         this_arg_conv.is_owned = false;
60215         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60216         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60217         return tag_ptr(ret_conv, true);
60218 }
60219
60220 int64_t  CS_LDK_ChannelFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60221         LDKChannelFeatures this_arg_conv;
60222         this_arg_conv.inner = untag_ptr(this_arg);
60223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60225         this_arg_conv.is_owned = false;
60226         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60227         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
60228         return tag_ptr(ret_conv, true);
60229 }
60230
60231 int64_t  CS_LDK_ChannelFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60232         LDKChannelFeatures this_arg_conv;
60233         this_arg_conv.inner = untag_ptr(this_arg);
60234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60236         this_arg_conv.is_owned = false;
60237         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60238         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60239         return tag_ptr(ret_conv, true);
60240 }
60241
60242 int64_t  CS_LDK_Bolt11InvoiceFeatures_empty() {
60243         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
60244         int64_t ret_ref = 0;
60245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60247         return ret_ref;
60248 }
60249
60250 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60251         LDKBolt11InvoiceFeatures this_arg_conv;
60252         this_arg_conv.inner = untag_ptr(this_arg);
60253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60255         this_arg_conv.is_owned = false;
60256         LDKBolt11InvoiceFeatures other_conv;
60257         other_conv.inner = untag_ptr(other);
60258         other_conv.is_owned = ptr_is_owned(other);
60259         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60260         other_conv.is_owned = false;
60261         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60262         return ret_conv;
60263 }
60264
60265 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
60266         LDKBolt11InvoiceFeatures this_arg_conv;
60267         this_arg_conv.inner = untag_ptr(this_arg);
60268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60270         this_arg_conv.is_owned = false;
60271         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
60272         return ret_conv;
60273 }
60274
60275 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60276         LDKBolt11InvoiceFeatures this_arg_conv;
60277         this_arg_conv.inner = untag_ptr(this_arg);
60278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60280         this_arg_conv.is_owned = false;
60281         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60282         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
60283         return tag_ptr(ret_conv, true);
60284 }
60285
60286 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60287         LDKBolt11InvoiceFeatures this_arg_conv;
60288         this_arg_conv.inner = untag_ptr(this_arg);
60289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60291         this_arg_conv.is_owned = false;
60292         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60293         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60294         return tag_ptr(ret_conv, true);
60295 }
60296
60297 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60298         LDKBolt11InvoiceFeatures this_arg_conv;
60299         this_arg_conv.inner = untag_ptr(this_arg);
60300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60302         this_arg_conv.is_owned = false;
60303         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60304         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
60305         return tag_ptr(ret_conv, true);
60306 }
60307
60308 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60309         LDKBolt11InvoiceFeatures this_arg_conv;
60310         this_arg_conv.inner = untag_ptr(this_arg);
60311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60313         this_arg_conv.is_owned = false;
60314         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60315         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60316         return tag_ptr(ret_conv, true);
60317 }
60318
60319 int64_t  CS_LDK_OfferFeatures_empty() {
60320         LDKOfferFeatures ret_var = OfferFeatures_empty();
60321         int64_t ret_ref = 0;
60322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60324         return ret_ref;
60325 }
60326
60327 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60328         LDKOfferFeatures this_arg_conv;
60329         this_arg_conv.inner = untag_ptr(this_arg);
60330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60332         this_arg_conv.is_owned = false;
60333         LDKOfferFeatures other_conv;
60334         other_conv.inner = untag_ptr(other);
60335         other_conv.is_owned = ptr_is_owned(other);
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60337         other_conv.is_owned = false;
60338         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60339         return ret_conv;
60340 }
60341
60342 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits(int64_t this_arg) {
60343         LDKOfferFeatures this_arg_conv;
60344         this_arg_conv.inner = untag_ptr(this_arg);
60345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60347         this_arg_conv.is_owned = false;
60348         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
60349         return ret_conv;
60350 }
60351
60352 int64_t  CS_LDK_OfferFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60353         LDKOfferFeatures this_arg_conv;
60354         this_arg_conv.inner = untag_ptr(this_arg);
60355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60357         this_arg_conv.is_owned = false;
60358         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60359         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
60360         return tag_ptr(ret_conv, true);
60361 }
60362
60363 int64_t  CS_LDK_OfferFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60364         LDKOfferFeatures this_arg_conv;
60365         this_arg_conv.inner = untag_ptr(this_arg);
60366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60368         this_arg_conv.is_owned = false;
60369         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60370         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60371         return tag_ptr(ret_conv, true);
60372 }
60373
60374 int64_t  CS_LDK_OfferFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60375         LDKOfferFeatures this_arg_conv;
60376         this_arg_conv.inner = untag_ptr(this_arg);
60377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60379         this_arg_conv.is_owned = false;
60380         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60381         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
60382         return tag_ptr(ret_conv, true);
60383 }
60384
60385 int64_t  CS_LDK_OfferFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60386         LDKOfferFeatures this_arg_conv;
60387         this_arg_conv.inner = untag_ptr(this_arg);
60388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60390         this_arg_conv.is_owned = false;
60391         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60392         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60393         return tag_ptr(ret_conv, true);
60394 }
60395
60396 int64_t  CS_LDK_InvoiceRequestFeatures_empty() {
60397         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
60398         int64_t ret_ref = 0;
60399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60401         return ret_ref;
60402 }
60403
60404 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60405         LDKInvoiceRequestFeatures this_arg_conv;
60406         this_arg_conv.inner = untag_ptr(this_arg);
60407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60409         this_arg_conv.is_owned = false;
60410         LDKInvoiceRequestFeatures other_conv;
60411         other_conv.inner = untag_ptr(other);
60412         other_conv.is_owned = ptr_is_owned(other);
60413         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60414         other_conv.is_owned = false;
60415         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60416         return ret_conv;
60417 }
60418
60419 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits(int64_t this_arg) {
60420         LDKInvoiceRequestFeatures this_arg_conv;
60421         this_arg_conv.inner = untag_ptr(this_arg);
60422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60424         this_arg_conv.is_owned = false;
60425         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
60426         return ret_conv;
60427 }
60428
60429 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60430         LDKInvoiceRequestFeatures this_arg_conv;
60431         this_arg_conv.inner = untag_ptr(this_arg);
60432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60434         this_arg_conv.is_owned = false;
60435         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60436         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
60437         return tag_ptr(ret_conv, true);
60438 }
60439
60440 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60441         LDKInvoiceRequestFeatures this_arg_conv;
60442         this_arg_conv.inner = untag_ptr(this_arg);
60443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60445         this_arg_conv.is_owned = false;
60446         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60447         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60448         return tag_ptr(ret_conv, true);
60449 }
60450
60451 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60452         LDKInvoiceRequestFeatures this_arg_conv;
60453         this_arg_conv.inner = untag_ptr(this_arg);
60454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60456         this_arg_conv.is_owned = false;
60457         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60458         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
60459         return tag_ptr(ret_conv, true);
60460 }
60461
60462 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60463         LDKInvoiceRequestFeatures this_arg_conv;
60464         this_arg_conv.inner = untag_ptr(this_arg);
60465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60467         this_arg_conv.is_owned = false;
60468         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60469         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60470         return tag_ptr(ret_conv, true);
60471 }
60472
60473 int64_t  CS_LDK_Bolt12InvoiceFeatures_empty() {
60474         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
60475         int64_t ret_ref = 0;
60476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60478         return ret_ref;
60479 }
60480
60481 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60482         LDKBolt12InvoiceFeatures this_arg_conv;
60483         this_arg_conv.inner = untag_ptr(this_arg);
60484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60486         this_arg_conv.is_owned = false;
60487         LDKBolt12InvoiceFeatures other_conv;
60488         other_conv.inner = untag_ptr(other);
60489         other_conv.is_owned = ptr_is_owned(other);
60490         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60491         other_conv.is_owned = false;
60492         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60493         return ret_conv;
60494 }
60495
60496 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
60497         LDKBolt12InvoiceFeatures this_arg_conv;
60498         this_arg_conv.inner = untag_ptr(this_arg);
60499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60501         this_arg_conv.is_owned = false;
60502         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
60503         return ret_conv;
60504 }
60505
60506 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60507         LDKBolt12InvoiceFeatures this_arg_conv;
60508         this_arg_conv.inner = untag_ptr(this_arg);
60509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60511         this_arg_conv.is_owned = false;
60512         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60513         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
60514         return tag_ptr(ret_conv, true);
60515 }
60516
60517 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60518         LDKBolt12InvoiceFeatures this_arg_conv;
60519         this_arg_conv.inner = untag_ptr(this_arg);
60520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60522         this_arg_conv.is_owned = false;
60523         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60524         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60525         return tag_ptr(ret_conv, true);
60526 }
60527
60528 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60529         LDKBolt12InvoiceFeatures this_arg_conv;
60530         this_arg_conv.inner = untag_ptr(this_arg);
60531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60533         this_arg_conv.is_owned = false;
60534         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60535         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
60536         return tag_ptr(ret_conv, true);
60537 }
60538
60539 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60540         LDKBolt12InvoiceFeatures this_arg_conv;
60541         this_arg_conv.inner = untag_ptr(this_arg);
60542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60544         this_arg_conv.is_owned = false;
60545         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60546         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60547         return tag_ptr(ret_conv, true);
60548 }
60549
60550 int64_t  CS_LDK_BlindedHopFeatures_empty() {
60551         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
60552         int64_t ret_ref = 0;
60553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60555         return ret_ref;
60556 }
60557
60558 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60559         LDKBlindedHopFeatures this_arg_conv;
60560         this_arg_conv.inner = untag_ptr(this_arg);
60561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60563         this_arg_conv.is_owned = false;
60564         LDKBlindedHopFeatures other_conv;
60565         other_conv.inner = untag_ptr(other);
60566         other_conv.is_owned = ptr_is_owned(other);
60567         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60568         other_conv.is_owned = false;
60569         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60570         return ret_conv;
60571 }
60572
60573 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits(int64_t this_arg) {
60574         LDKBlindedHopFeatures this_arg_conv;
60575         this_arg_conv.inner = untag_ptr(this_arg);
60576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60578         this_arg_conv.is_owned = false;
60579         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
60580         return ret_conv;
60581 }
60582
60583 int64_t  CS_LDK_BlindedHopFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60584         LDKBlindedHopFeatures this_arg_conv;
60585         this_arg_conv.inner = untag_ptr(this_arg);
60586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60588         this_arg_conv.is_owned = false;
60589         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60590         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
60591         return tag_ptr(ret_conv, true);
60592 }
60593
60594 int64_t  CS_LDK_BlindedHopFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60595         LDKBlindedHopFeatures this_arg_conv;
60596         this_arg_conv.inner = untag_ptr(this_arg);
60597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60599         this_arg_conv.is_owned = false;
60600         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60601         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60602         return tag_ptr(ret_conv, true);
60603 }
60604
60605 int64_t  CS_LDK_BlindedHopFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60606         LDKBlindedHopFeatures this_arg_conv;
60607         this_arg_conv.inner = untag_ptr(this_arg);
60608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60610         this_arg_conv.is_owned = false;
60611         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60612         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
60613         return tag_ptr(ret_conv, true);
60614 }
60615
60616 int64_t  CS_LDK_BlindedHopFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60617         LDKBlindedHopFeatures this_arg_conv;
60618         this_arg_conv.inner = untag_ptr(this_arg);
60619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60621         this_arg_conv.is_owned = false;
60622         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60623         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60624         return tag_ptr(ret_conv, true);
60625 }
60626
60627 int64_t  CS_LDK_ChannelTypeFeatures_empty() {
60628         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
60629         int64_t ret_ref = 0;
60630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60632         return ret_ref;
60633 }
60634
60635 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
60636         LDKChannelTypeFeatures this_arg_conv;
60637         this_arg_conv.inner = untag_ptr(this_arg);
60638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60640         this_arg_conv.is_owned = false;
60641         LDKChannelTypeFeatures other_conv;
60642         other_conv.inner = untag_ptr(other);
60643         other_conv.is_owned = ptr_is_owned(other);
60644         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
60645         other_conv.is_owned = false;
60646         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
60647         return ret_conv;
60648 }
60649
60650 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits(int64_t this_arg) {
60651         LDKChannelTypeFeatures this_arg_conv;
60652         this_arg_conv.inner = untag_ptr(this_arg);
60653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60655         this_arg_conv.is_owned = false;
60656         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
60657         return ret_conv;
60658 }
60659
60660 int64_t  CS_LDK_ChannelTypeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
60661         LDKChannelTypeFeatures this_arg_conv;
60662         this_arg_conv.inner = untag_ptr(this_arg);
60663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60665         this_arg_conv.is_owned = false;
60666         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60667         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
60668         return tag_ptr(ret_conv, true);
60669 }
60670
60671 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
60672         LDKChannelTypeFeatures this_arg_conv;
60673         this_arg_conv.inner = untag_ptr(this_arg);
60674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60676         this_arg_conv.is_owned = false;
60677         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60678         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
60679         return tag_ptr(ret_conv, true);
60680 }
60681
60682 int64_t  CS_LDK_ChannelTypeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
60683         LDKChannelTypeFeatures this_arg_conv;
60684         this_arg_conv.inner = untag_ptr(this_arg);
60685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60687         this_arg_conv.is_owned = false;
60688         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60689         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
60690         return tag_ptr(ret_conv, true);
60691 }
60692
60693 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
60694         LDKChannelTypeFeatures this_arg_conv;
60695         this_arg_conv.inner = untag_ptr(this_arg);
60696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60698         this_arg_conv.is_owned = false;
60699         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
60700         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
60701         return tag_ptr(ret_conv, true);
60702 }
60703
60704 int8_tArray  CS_LDK_InitFeatures_write(int64_t obj) {
60705         LDKInitFeatures obj_conv;
60706         obj_conv.inner = untag_ptr(obj);
60707         obj_conv.is_owned = ptr_is_owned(obj);
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60709         obj_conv.is_owned = false;
60710         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
60711         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60712         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60713         CVec_u8Z_free(ret_var);
60714         return ret_arr;
60715 }
60716
60717 int64_t  CS_LDK_InitFeatures_read(int8_tArray ser) {
60718         LDKu8slice ser_ref;
60719         ser_ref.datalen = ser->arr_len;
60720         ser_ref.data = ser->elems;
60721         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
60722         *ret_conv = InitFeatures_read(ser_ref);
60723         FREE(ser);
60724         return tag_ptr(ret_conv, true);
60725 }
60726
60727 int8_tArray  CS_LDK_ChannelFeatures_write(int64_t obj) {
60728         LDKChannelFeatures obj_conv;
60729         obj_conv.inner = untag_ptr(obj);
60730         obj_conv.is_owned = ptr_is_owned(obj);
60731         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60732         obj_conv.is_owned = false;
60733         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
60734         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60735         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60736         CVec_u8Z_free(ret_var);
60737         return ret_arr;
60738 }
60739
60740 int64_t  CS_LDK_ChannelFeatures_read(int8_tArray ser) {
60741         LDKu8slice ser_ref;
60742         ser_ref.datalen = ser->arr_len;
60743         ser_ref.data = ser->elems;
60744         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
60745         *ret_conv = ChannelFeatures_read(ser_ref);
60746         FREE(ser);
60747         return tag_ptr(ret_conv, true);
60748 }
60749
60750 int8_tArray  CS_LDK_NodeFeatures_write(int64_t obj) {
60751         LDKNodeFeatures obj_conv;
60752         obj_conv.inner = untag_ptr(obj);
60753         obj_conv.is_owned = ptr_is_owned(obj);
60754         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60755         obj_conv.is_owned = false;
60756         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
60757         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60758         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60759         CVec_u8Z_free(ret_var);
60760         return ret_arr;
60761 }
60762
60763 int64_t  CS_LDK_NodeFeatures_read(int8_tArray ser) {
60764         LDKu8slice ser_ref;
60765         ser_ref.datalen = ser->arr_len;
60766         ser_ref.data = ser->elems;
60767         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
60768         *ret_conv = NodeFeatures_read(ser_ref);
60769         FREE(ser);
60770         return tag_ptr(ret_conv, true);
60771 }
60772
60773 int8_tArray  CS_LDK_Bolt11InvoiceFeatures_write(int64_t obj) {
60774         LDKBolt11InvoiceFeatures obj_conv;
60775         obj_conv.inner = untag_ptr(obj);
60776         obj_conv.is_owned = ptr_is_owned(obj);
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60778         obj_conv.is_owned = false;
60779         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
60780         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60781         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60782         CVec_u8Z_free(ret_var);
60783         return ret_arr;
60784 }
60785
60786 int64_t  CS_LDK_Bolt11InvoiceFeatures_read(int8_tArray ser) {
60787         LDKu8slice ser_ref;
60788         ser_ref.datalen = ser->arr_len;
60789         ser_ref.data = ser->elems;
60790         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
60791         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
60792         FREE(ser);
60793         return tag_ptr(ret_conv, true);
60794 }
60795
60796 int8_tArray  CS_LDK_Bolt12InvoiceFeatures_write(int64_t obj) {
60797         LDKBolt12InvoiceFeatures obj_conv;
60798         obj_conv.inner = untag_ptr(obj);
60799         obj_conv.is_owned = ptr_is_owned(obj);
60800         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60801         obj_conv.is_owned = false;
60802         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
60803         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60804         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60805         CVec_u8Z_free(ret_var);
60806         return ret_arr;
60807 }
60808
60809 int64_t  CS_LDK_Bolt12InvoiceFeatures_read(int8_tArray ser) {
60810         LDKu8slice ser_ref;
60811         ser_ref.datalen = ser->arr_len;
60812         ser_ref.data = ser->elems;
60813         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
60814         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
60815         FREE(ser);
60816         return tag_ptr(ret_conv, true);
60817 }
60818
60819 int8_tArray  CS_LDK_BlindedHopFeatures_write(int64_t obj) {
60820         LDKBlindedHopFeatures obj_conv;
60821         obj_conv.inner = untag_ptr(obj);
60822         obj_conv.is_owned = ptr_is_owned(obj);
60823         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60824         obj_conv.is_owned = false;
60825         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
60826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60828         CVec_u8Z_free(ret_var);
60829         return ret_arr;
60830 }
60831
60832 int64_t  CS_LDK_BlindedHopFeatures_read(int8_tArray ser) {
60833         LDKu8slice ser_ref;
60834         ser_ref.datalen = ser->arr_len;
60835         ser_ref.data = ser->elems;
60836         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
60837         *ret_conv = BlindedHopFeatures_read(ser_ref);
60838         FREE(ser);
60839         return tag_ptr(ret_conv, true);
60840 }
60841
60842 int8_tArray  CS_LDK_ChannelTypeFeatures_write(int64_t obj) {
60843         LDKChannelTypeFeatures obj_conv;
60844         obj_conv.inner = untag_ptr(obj);
60845         obj_conv.is_owned = ptr_is_owned(obj);
60846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60847         obj_conv.is_owned = false;
60848         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
60849         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60850         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60851         CVec_u8Z_free(ret_var);
60852         return ret_arr;
60853 }
60854
60855 int64_t  CS_LDK_ChannelTypeFeatures_read(int8_tArray ser) {
60856         LDKu8slice ser_ref;
60857         ser_ref.datalen = ser->arr_len;
60858         ser_ref.data = ser->elems;
60859         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
60860         *ret_conv = ChannelTypeFeatures_read(ser_ref);
60861         FREE(ser);
60862         return tag_ptr(ret_conv, true);
60863 }
60864
60865 void  CS_LDK_InitFeatures_set_data_loss_protect_optional(int64_t this_arg) {
60866         LDKInitFeatures this_arg_conv;
60867         this_arg_conv.inner = untag_ptr(this_arg);
60868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60870         this_arg_conv.is_owned = false;
60871         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
60872 }
60873
60874 void  CS_LDK_InitFeatures_set_data_loss_protect_required(int64_t this_arg) {
60875         LDKInitFeatures this_arg_conv;
60876         this_arg_conv.inner = untag_ptr(this_arg);
60877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60879         this_arg_conv.is_owned = false;
60880         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
60881 }
60882
60883 jboolean  CS_LDK_InitFeatures_supports_data_loss_protect(int64_t this_arg) {
60884         LDKInitFeatures this_arg_conv;
60885         this_arg_conv.inner = untag_ptr(this_arg);
60886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60888         this_arg_conv.is_owned = false;
60889         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
60890         return ret_conv;
60891 }
60892
60893 void  CS_LDK_NodeFeatures_set_data_loss_protect_optional(int64_t this_arg) {
60894         LDKNodeFeatures this_arg_conv;
60895         this_arg_conv.inner = untag_ptr(this_arg);
60896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60898         this_arg_conv.is_owned = false;
60899         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
60900 }
60901
60902 void  CS_LDK_NodeFeatures_set_data_loss_protect_required(int64_t this_arg) {
60903         LDKNodeFeatures this_arg_conv;
60904         this_arg_conv.inner = untag_ptr(this_arg);
60905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60907         this_arg_conv.is_owned = false;
60908         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
60909 }
60910
60911 jboolean  CS_LDK_NodeFeatures_supports_data_loss_protect(int64_t this_arg) {
60912         LDKNodeFeatures this_arg_conv;
60913         this_arg_conv.inner = untag_ptr(this_arg);
60914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60916         this_arg_conv.is_owned = false;
60917         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
60918         return ret_conv;
60919 }
60920
60921 jboolean  CS_LDK_InitFeatures_requires_data_loss_protect(int64_t this_arg) {
60922         LDKInitFeatures this_arg_conv;
60923         this_arg_conv.inner = untag_ptr(this_arg);
60924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60926         this_arg_conv.is_owned = false;
60927         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
60928         return ret_conv;
60929 }
60930
60931 jboolean  CS_LDK_NodeFeatures_requires_data_loss_protect(int64_t this_arg) {
60932         LDKNodeFeatures this_arg_conv;
60933         this_arg_conv.inner = untag_ptr(this_arg);
60934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60936         this_arg_conv.is_owned = false;
60937         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
60938         return ret_conv;
60939 }
60940
60941 void  CS_LDK_InitFeatures_set_initial_routing_sync_optional(int64_t this_arg) {
60942         LDKInitFeatures this_arg_conv;
60943         this_arg_conv.inner = untag_ptr(this_arg);
60944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60946         this_arg_conv.is_owned = false;
60947         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
60948 }
60949
60950 void  CS_LDK_InitFeatures_set_initial_routing_sync_required(int64_t this_arg) {
60951         LDKInitFeatures this_arg_conv;
60952         this_arg_conv.inner = untag_ptr(this_arg);
60953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60955         this_arg_conv.is_owned = false;
60956         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
60957 }
60958
60959 jboolean  CS_LDK_InitFeatures_initial_routing_sync(int64_t this_arg) {
60960         LDKInitFeatures this_arg_conv;
60961         this_arg_conv.inner = untag_ptr(this_arg);
60962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60964         this_arg_conv.is_owned = false;
60965         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
60966         return ret_conv;
60967 }
60968
60969 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
60970         LDKInitFeatures this_arg_conv;
60971         this_arg_conv.inner = untag_ptr(this_arg);
60972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60974         this_arg_conv.is_owned = false;
60975         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
60976 }
60977
60978 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
60979         LDKInitFeatures this_arg_conv;
60980         this_arg_conv.inner = untag_ptr(this_arg);
60981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60983         this_arg_conv.is_owned = false;
60984         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
60985 }
60986
60987 jboolean  CS_LDK_InitFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
60988         LDKInitFeatures this_arg_conv;
60989         this_arg_conv.inner = untag_ptr(this_arg);
60990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60992         this_arg_conv.is_owned = false;
60993         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
60994         return ret_conv;
60995 }
60996
60997 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
60998         LDKNodeFeatures this_arg_conv;
60999         this_arg_conv.inner = untag_ptr(this_arg);
61000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61002         this_arg_conv.is_owned = false;
61003         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
61004 }
61005
61006 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
61007         LDKNodeFeatures this_arg_conv;
61008         this_arg_conv.inner = untag_ptr(this_arg);
61009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61011         this_arg_conv.is_owned = false;
61012         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
61013 }
61014
61015 jboolean  CS_LDK_NodeFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
61016         LDKNodeFeatures this_arg_conv;
61017         this_arg_conv.inner = untag_ptr(this_arg);
61018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61020         this_arg_conv.is_owned = false;
61021         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
61022         return ret_conv;
61023 }
61024
61025 jboolean  CS_LDK_InitFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
61026         LDKInitFeatures this_arg_conv;
61027         this_arg_conv.inner = untag_ptr(this_arg);
61028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61030         this_arg_conv.is_owned = false;
61031         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
61032         return ret_conv;
61033 }
61034
61035 jboolean  CS_LDK_NodeFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
61036         LDKNodeFeatures this_arg_conv;
61037         this_arg_conv.inner = untag_ptr(this_arg);
61038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61040         this_arg_conv.is_owned = false;
61041         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
61042         return ret_conv;
61043 }
61044
61045 void  CS_LDK_InitFeatures_set_gossip_queries_optional(int64_t this_arg) {
61046         LDKInitFeatures this_arg_conv;
61047         this_arg_conv.inner = untag_ptr(this_arg);
61048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61050         this_arg_conv.is_owned = false;
61051         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
61052 }
61053
61054 void  CS_LDK_InitFeatures_set_gossip_queries_required(int64_t this_arg) {
61055         LDKInitFeatures this_arg_conv;
61056         this_arg_conv.inner = untag_ptr(this_arg);
61057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61059         this_arg_conv.is_owned = false;
61060         InitFeatures_set_gossip_queries_required(&this_arg_conv);
61061 }
61062
61063 jboolean  CS_LDK_InitFeatures_supports_gossip_queries(int64_t this_arg) {
61064         LDKInitFeatures this_arg_conv;
61065         this_arg_conv.inner = untag_ptr(this_arg);
61066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61068         this_arg_conv.is_owned = false;
61069         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
61070         return ret_conv;
61071 }
61072
61073 void  CS_LDK_NodeFeatures_set_gossip_queries_optional(int64_t this_arg) {
61074         LDKNodeFeatures this_arg_conv;
61075         this_arg_conv.inner = untag_ptr(this_arg);
61076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61078         this_arg_conv.is_owned = false;
61079         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
61080 }
61081
61082 void  CS_LDK_NodeFeatures_set_gossip_queries_required(int64_t this_arg) {
61083         LDKNodeFeatures this_arg_conv;
61084         this_arg_conv.inner = untag_ptr(this_arg);
61085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61087         this_arg_conv.is_owned = false;
61088         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
61089 }
61090
61091 jboolean  CS_LDK_NodeFeatures_supports_gossip_queries(int64_t this_arg) {
61092         LDKNodeFeatures this_arg_conv;
61093         this_arg_conv.inner = untag_ptr(this_arg);
61094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61096         this_arg_conv.is_owned = false;
61097         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
61098         return ret_conv;
61099 }
61100
61101 jboolean  CS_LDK_InitFeatures_requires_gossip_queries(int64_t this_arg) {
61102         LDKInitFeatures this_arg_conv;
61103         this_arg_conv.inner = untag_ptr(this_arg);
61104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61106         this_arg_conv.is_owned = false;
61107         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
61108         return ret_conv;
61109 }
61110
61111 jboolean  CS_LDK_NodeFeatures_requires_gossip_queries(int64_t this_arg) {
61112         LDKNodeFeatures this_arg_conv;
61113         this_arg_conv.inner = untag_ptr(this_arg);
61114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61116         this_arg_conv.is_owned = false;
61117         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
61118         return ret_conv;
61119 }
61120
61121 void  CS_LDK_InitFeatures_set_variable_length_onion_optional(int64_t this_arg) {
61122         LDKInitFeatures this_arg_conv;
61123         this_arg_conv.inner = untag_ptr(this_arg);
61124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61126         this_arg_conv.is_owned = false;
61127         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
61128 }
61129
61130 void  CS_LDK_InitFeatures_set_variable_length_onion_required(int64_t this_arg) {
61131         LDKInitFeatures this_arg_conv;
61132         this_arg_conv.inner = untag_ptr(this_arg);
61133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61135         this_arg_conv.is_owned = false;
61136         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
61137 }
61138
61139 jboolean  CS_LDK_InitFeatures_supports_variable_length_onion(int64_t this_arg) {
61140         LDKInitFeatures this_arg_conv;
61141         this_arg_conv.inner = untag_ptr(this_arg);
61142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61144         this_arg_conv.is_owned = false;
61145         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
61146         return ret_conv;
61147 }
61148
61149 void  CS_LDK_NodeFeatures_set_variable_length_onion_optional(int64_t this_arg) {
61150         LDKNodeFeatures this_arg_conv;
61151         this_arg_conv.inner = untag_ptr(this_arg);
61152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61154         this_arg_conv.is_owned = false;
61155         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
61156 }
61157
61158 void  CS_LDK_NodeFeatures_set_variable_length_onion_required(int64_t this_arg) {
61159         LDKNodeFeatures this_arg_conv;
61160         this_arg_conv.inner = untag_ptr(this_arg);
61161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61163         this_arg_conv.is_owned = false;
61164         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
61165 }
61166
61167 jboolean  CS_LDK_NodeFeatures_supports_variable_length_onion(int64_t this_arg) {
61168         LDKNodeFeatures this_arg_conv;
61169         this_arg_conv.inner = untag_ptr(this_arg);
61170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61172         this_arg_conv.is_owned = false;
61173         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
61174         return ret_conv;
61175 }
61176
61177 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_optional(int64_t this_arg) {
61178         LDKBolt11InvoiceFeatures this_arg_conv;
61179         this_arg_conv.inner = untag_ptr(this_arg);
61180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61182         this_arg_conv.is_owned = false;
61183         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
61184 }
61185
61186 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_required(int64_t this_arg) {
61187         LDKBolt11InvoiceFeatures this_arg_conv;
61188         this_arg_conv.inner = untag_ptr(this_arg);
61189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61191         this_arg_conv.is_owned = false;
61192         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
61193 }
61194
61195 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_variable_length_onion(int64_t this_arg) {
61196         LDKBolt11InvoiceFeatures this_arg_conv;
61197         this_arg_conv.inner = untag_ptr(this_arg);
61198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61200         this_arg_conv.is_owned = false;
61201         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
61202         return ret_conv;
61203 }
61204
61205 jboolean  CS_LDK_InitFeatures_requires_variable_length_onion(int64_t this_arg) {
61206         LDKInitFeatures this_arg_conv;
61207         this_arg_conv.inner = untag_ptr(this_arg);
61208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61210         this_arg_conv.is_owned = false;
61211         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
61212         return ret_conv;
61213 }
61214
61215 jboolean  CS_LDK_NodeFeatures_requires_variable_length_onion(int64_t this_arg) {
61216         LDKNodeFeatures this_arg_conv;
61217         this_arg_conv.inner = untag_ptr(this_arg);
61218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61220         this_arg_conv.is_owned = false;
61221         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
61222         return ret_conv;
61223 }
61224
61225 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_variable_length_onion(int64_t this_arg) {
61226         LDKBolt11InvoiceFeatures this_arg_conv;
61227         this_arg_conv.inner = untag_ptr(this_arg);
61228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61230         this_arg_conv.is_owned = false;
61231         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
61232         return ret_conv;
61233 }
61234
61235 void  CS_LDK_InitFeatures_set_static_remote_key_optional(int64_t this_arg) {
61236         LDKInitFeatures this_arg_conv;
61237         this_arg_conv.inner = untag_ptr(this_arg);
61238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61240         this_arg_conv.is_owned = false;
61241         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
61242 }
61243
61244 void  CS_LDK_InitFeatures_set_static_remote_key_required(int64_t this_arg) {
61245         LDKInitFeatures this_arg_conv;
61246         this_arg_conv.inner = untag_ptr(this_arg);
61247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61249         this_arg_conv.is_owned = false;
61250         InitFeatures_set_static_remote_key_required(&this_arg_conv);
61251 }
61252
61253 jboolean  CS_LDK_InitFeatures_supports_static_remote_key(int64_t this_arg) {
61254         LDKInitFeatures this_arg_conv;
61255         this_arg_conv.inner = untag_ptr(this_arg);
61256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61258         this_arg_conv.is_owned = false;
61259         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
61260         return ret_conv;
61261 }
61262
61263 void  CS_LDK_NodeFeatures_set_static_remote_key_optional(int64_t this_arg) {
61264         LDKNodeFeatures this_arg_conv;
61265         this_arg_conv.inner = untag_ptr(this_arg);
61266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61268         this_arg_conv.is_owned = false;
61269         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
61270 }
61271
61272 void  CS_LDK_NodeFeatures_set_static_remote_key_required(int64_t this_arg) {
61273         LDKNodeFeatures this_arg_conv;
61274         this_arg_conv.inner = untag_ptr(this_arg);
61275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61277         this_arg_conv.is_owned = false;
61278         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
61279 }
61280
61281 jboolean  CS_LDK_NodeFeatures_supports_static_remote_key(int64_t this_arg) {
61282         LDKNodeFeatures this_arg_conv;
61283         this_arg_conv.inner = untag_ptr(this_arg);
61284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61286         this_arg_conv.is_owned = false;
61287         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
61288         return ret_conv;
61289 }
61290
61291 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_optional(int64_t this_arg) {
61292         LDKChannelTypeFeatures this_arg_conv;
61293         this_arg_conv.inner = untag_ptr(this_arg);
61294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61296         this_arg_conv.is_owned = false;
61297         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
61298 }
61299
61300 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_required(int64_t this_arg) {
61301         LDKChannelTypeFeatures this_arg_conv;
61302         this_arg_conv.inner = untag_ptr(this_arg);
61303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61305         this_arg_conv.is_owned = false;
61306         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
61307 }
61308
61309 jboolean  CS_LDK_ChannelTypeFeatures_supports_static_remote_key(int64_t this_arg) {
61310         LDKChannelTypeFeatures this_arg_conv;
61311         this_arg_conv.inner = untag_ptr(this_arg);
61312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61314         this_arg_conv.is_owned = false;
61315         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
61316         return ret_conv;
61317 }
61318
61319 jboolean  CS_LDK_InitFeatures_requires_static_remote_key(int64_t this_arg) {
61320         LDKInitFeatures this_arg_conv;
61321         this_arg_conv.inner = untag_ptr(this_arg);
61322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61324         this_arg_conv.is_owned = false;
61325         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
61326         return ret_conv;
61327 }
61328
61329 jboolean  CS_LDK_NodeFeatures_requires_static_remote_key(int64_t this_arg) {
61330         LDKNodeFeatures this_arg_conv;
61331         this_arg_conv.inner = untag_ptr(this_arg);
61332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61334         this_arg_conv.is_owned = false;
61335         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
61336         return ret_conv;
61337 }
61338
61339 jboolean  CS_LDK_ChannelTypeFeatures_requires_static_remote_key(int64_t this_arg) {
61340         LDKChannelTypeFeatures this_arg_conv;
61341         this_arg_conv.inner = untag_ptr(this_arg);
61342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61344         this_arg_conv.is_owned = false;
61345         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
61346         return ret_conv;
61347 }
61348
61349 void  CS_LDK_InitFeatures_set_payment_secret_optional(int64_t this_arg) {
61350         LDKInitFeatures this_arg_conv;
61351         this_arg_conv.inner = untag_ptr(this_arg);
61352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61354         this_arg_conv.is_owned = false;
61355         InitFeatures_set_payment_secret_optional(&this_arg_conv);
61356 }
61357
61358 void  CS_LDK_InitFeatures_set_payment_secret_required(int64_t this_arg) {
61359         LDKInitFeatures this_arg_conv;
61360         this_arg_conv.inner = untag_ptr(this_arg);
61361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61363         this_arg_conv.is_owned = false;
61364         InitFeatures_set_payment_secret_required(&this_arg_conv);
61365 }
61366
61367 jboolean  CS_LDK_InitFeatures_supports_payment_secret(int64_t this_arg) {
61368         LDKInitFeatures this_arg_conv;
61369         this_arg_conv.inner = untag_ptr(this_arg);
61370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61372         this_arg_conv.is_owned = false;
61373         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
61374         return ret_conv;
61375 }
61376
61377 void  CS_LDK_NodeFeatures_set_payment_secret_optional(int64_t this_arg) {
61378         LDKNodeFeatures this_arg_conv;
61379         this_arg_conv.inner = untag_ptr(this_arg);
61380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61382         this_arg_conv.is_owned = false;
61383         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
61384 }
61385
61386 void  CS_LDK_NodeFeatures_set_payment_secret_required(int64_t this_arg) {
61387         LDKNodeFeatures this_arg_conv;
61388         this_arg_conv.inner = untag_ptr(this_arg);
61389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61391         this_arg_conv.is_owned = false;
61392         NodeFeatures_set_payment_secret_required(&this_arg_conv);
61393 }
61394
61395 jboolean  CS_LDK_NodeFeatures_supports_payment_secret(int64_t this_arg) {
61396         LDKNodeFeatures this_arg_conv;
61397         this_arg_conv.inner = untag_ptr(this_arg);
61398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61400         this_arg_conv.is_owned = false;
61401         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
61402         return ret_conv;
61403 }
61404
61405 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_optional(int64_t this_arg) {
61406         LDKBolt11InvoiceFeatures this_arg_conv;
61407         this_arg_conv.inner = untag_ptr(this_arg);
61408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61410         this_arg_conv.is_owned = false;
61411         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
61412 }
61413
61414 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_required(int64_t this_arg) {
61415         LDKBolt11InvoiceFeatures this_arg_conv;
61416         this_arg_conv.inner = untag_ptr(this_arg);
61417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61419         this_arg_conv.is_owned = false;
61420         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
61421 }
61422
61423 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_secret(int64_t this_arg) {
61424         LDKBolt11InvoiceFeatures this_arg_conv;
61425         this_arg_conv.inner = untag_ptr(this_arg);
61426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61428         this_arg_conv.is_owned = false;
61429         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
61430         return ret_conv;
61431 }
61432
61433 jboolean  CS_LDK_InitFeatures_requires_payment_secret(int64_t this_arg) {
61434         LDKInitFeatures this_arg_conv;
61435         this_arg_conv.inner = untag_ptr(this_arg);
61436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61438         this_arg_conv.is_owned = false;
61439         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
61440         return ret_conv;
61441 }
61442
61443 jboolean  CS_LDK_NodeFeatures_requires_payment_secret(int64_t this_arg) {
61444         LDKNodeFeatures this_arg_conv;
61445         this_arg_conv.inner = untag_ptr(this_arg);
61446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61448         this_arg_conv.is_owned = false;
61449         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
61450         return ret_conv;
61451 }
61452
61453 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_secret(int64_t this_arg) {
61454         LDKBolt11InvoiceFeatures this_arg_conv;
61455         this_arg_conv.inner = untag_ptr(this_arg);
61456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61458         this_arg_conv.is_owned = false;
61459         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
61460         return ret_conv;
61461 }
61462
61463 void  CS_LDK_InitFeatures_set_basic_mpp_optional(int64_t this_arg) {
61464         LDKInitFeatures this_arg_conv;
61465         this_arg_conv.inner = untag_ptr(this_arg);
61466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61468         this_arg_conv.is_owned = false;
61469         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
61470 }
61471
61472 void  CS_LDK_InitFeatures_set_basic_mpp_required(int64_t this_arg) {
61473         LDKInitFeatures this_arg_conv;
61474         this_arg_conv.inner = untag_ptr(this_arg);
61475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61477         this_arg_conv.is_owned = false;
61478         InitFeatures_set_basic_mpp_required(&this_arg_conv);
61479 }
61480
61481 jboolean  CS_LDK_InitFeatures_supports_basic_mpp(int64_t this_arg) {
61482         LDKInitFeatures this_arg_conv;
61483         this_arg_conv.inner = untag_ptr(this_arg);
61484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61486         this_arg_conv.is_owned = false;
61487         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
61488         return ret_conv;
61489 }
61490
61491 void  CS_LDK_NodeFeatures_set_basic_mpp_optional(int64_t this_arg) {
61492         LDKNodeFeatures this_arg_conv;
61493         this_arg_conv.inner = untag_ptr(this_arg);
61494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61496         this_arg_conv.is_owned = false;
61497         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
61498 }
61499
61500 void  CS_LDK_NodeFeatures_set_basic_mpp_required(int64_t this_arg) {
61501         LDKNodeFeatures this_arg_conv;
61502         this_arg_conv.inner = untag_ptr(this_arg);
61503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61505         this_arg_conv.is_owned = false;
61506         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
61507 }
61508
61509 jboolean  CS_LDK_NodeFeatures_supports_basic_mpp(int64_t this_arg) {
61510         LDKNodeFeatures this_arg_conv;
61511         this_arg_conv.inner = untag_ptr(this_arg);
61512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61514         this_arg_conv.is_owned = false;
61515         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
61516         return ret_conv;
61517 }
61518
61519 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
61520         LDKBolt11InvoiceFeatures this_arg_conv;
61521         this_arg_conv.inner = untag_ptr(this_arg);
61522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61524         this_arg_conv.is_owned = false;
61525         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61526 }
61527
61528 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
61529         LDKBolt11InvoiceFeatures this_arg_conv;
61530         this_arg_conv.inner = untag_ptr(this_arg);
61531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61533         this_arg_conv.is_owned = false;
61534         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61535 }
61536
61537 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
61538         LDKBolt11InvoiceFeatures this_arg_conv;
61539         this_arg_conv.inner = untag_ptr(this_arg);
61540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61542         this_arg_conv.is_owned = false;
61543         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61544         return ret_conv;
61545 }
61546
61547 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
61548         LDKBolt12InvoiceFeatures this_arg_conv;
61549         this_arg_conv.inner = untag_ptr(this_arg);
61550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61552         this_arg_conv.is_owned = false;
61553         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
61554 }
61555
61556 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
61557         LDKBolt12InvoiceFeatures this_arg_conv;
61558         this_arg_conv.inner = untag_ptr(this_arg);
61559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61561         this_arg_conv.is_owned = false;
61562         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
61563 }
61564
61565 jboolean  CS_LDK_Bolt12InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
61566         LDKBolt12InvoiceFeatures this_arg_conv;
61567         this_arg_conv.inner = untag_ptr(this_arg);
61568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61570         this_arg_conv.is_owned = false;
61571         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
61572         return ret_conv;
61573 }
61574
61575 jboolean  CS_LDK_InitFeatures_requires_basic_mpp(int64_t this_arg) {
61576         LDKInitFeatures this_arg_conv;
61577         this_arg_conv.inner = untag_ptr(this_arg);
61578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61580         this_arg_conv.is_owned = false;
61581         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
61582         return ret_conv;
61583 }
61584
61585 jboolean  CS_LDK_NodeFeatures_requires_basic_mpp(int64_t this_arg) {
61586         LDKNodeFeatures this_arg_conv;
61587         this_arg_conv.inner = untag_ptr(this_arg);
61588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61590         this_arg_conv.is_owned = false;
61591         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
61592         return ret_conv;
61593 }
61594
61595 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
61596         LDKBolt11InvoiceFeatures this_arg_conv;
61597         this_arg_conv.inner = untag_ptr(this_arg);
61598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61600         this_arg_conv.is_owned = false;
61601         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61602         return ret_conv;
61603 }
61604
61605 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
61606         LDKBolt12InvoiceFeatures this_arg_conv;
61607         this_arg_conv.inner = untag_ptr(this_arg);
61608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61610         this_arg_conv.is_owned = false;
61611         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
61612         return ret_conv;
61613 }
61614
61615 void  CS_LDK_InitFeatures_set_wumbo_optional(int64_t this_arg) {
61616         LDKInitFeatures this_arg_conv;
61617         this_arg_conv.inner = untag_ptr(this_arg);
61618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61620         this_arg_conv.is_owned = false;
61621         InitFeatures_set_wumbo_optional(&this_arg_conv);
61622 }
61623
61624 void  CS_LDK_InitFeatures_set_wumbo_required(int64_t this_arg) {
61625         LDKInitFeatures this_arg_conv;
61626         this_arg_conv.inner = untag_ptr(this_arg);
61627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61629         this_arg_conv.is_owned = false;
61630         InitFeatures_set_wumbo_required(&this_arg_conv);
61631 }
61632
61633 jboolean  CS_LDK_InitFeatures_supports_wumbo(int64_t this_arg) {
61634         LDKInitFeatures this_arg_conv;
61635         this_arg_conv.inner = untag_ptr(this_arg);
61636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61638         this_arg_conv.is_owned = false;
61639         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
61640         return ret_conv;
61641 }
61642
61643 void  CS_LDK_NodeFeatures_set_wumbo_optional(int64_t this_arg) {
61644         LDKNodeFeatures this_arg_conv;
61645         this_arg_conv.inner = untag_ptr(this_arg);
61646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61648         this_arg_conv.is_owned = false;
61649         NodeFeatures_set_wumbo_optional(&this_arg_conv);
61650 }
61651
61652 void  CS_LDK_NodeFeatures_set_wumbo_required(int64_t this_arg) {
61653         LDKNodeFeatures this_arg_conv;
61654         this_arg_conv.inner = untag_ptr(this_arg);
61655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61657         this_arg_conv.is_owned = false;
61658         NodeFeatures_set_wumbo_required(&this_arg_conv);
61659 }
61660
61661 jboolean  CS_LDK_NodeFeatures_supports_wumbo(int64_t this_arg) {
61662         LDKNodeFeatures this_arg_conv;
61663         this_arg_conv.inner = untag_ptr(this_arg);
61664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61666         this_arg_conv.is_owned = false;
61667         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
61668         return ret_conv;
61669 }
61670
61671 jboolean  CS_LDK_InitFeatures_requires_wumbo(int64_t this_arg) {
61672         LDKInitFeatures this_arg_conv;
61673         this_arg_conv.inner = untag_ptr(this_arg);
61674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61676         this_arg_conv.is_owned = false;
61677         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
61678         return ret_conv;
61679 }
61680
61681 jboolean  CS_LDK_NodeFeatures_requires_wumbo(int64_t this_arg) {
61682         LDKNodeFeatures this_arg_conv;
61683         this_arg_conv.inner = untag_ptr(this_arg);
61684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61686         this_arg_conv.is_owned = false;
61687         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
61688         return ret_conv;
61689 }
61690
61691 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
61692         LDKInitFeatures this_arg_conv;
61693         this_arg_conv.inner = untag_ptr(this_arg);
61694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61696         this_arg_conv.is_owned = false;
61697         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61698 }
61699
61700 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
61701         LDKInitFeatures this_arg_conv;
61702         this_arg_conv.inner = untag_ptr(this_arg);
61703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61705         this_arg_conv.is_owned = false;
61706         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61707 }
61708
61709 jboolean  CS_LDK_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61710         LDKInitFeatures this_arg_conv;
61711         this_arg_conv.inner = untag_ptr(this_arg);
61712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61714         this_arg_conv.is_owned = false;
61715         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61716         return ret_conv;
61717 }
61718
61719 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
61720         LDKNodeFeatures this_arg_conv;
61721         this_arg_conv.inner = untag_ptr(this_arg);
61722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61724         this_arg_conv.is_owned = false;
61725         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61726 }
61727
61728 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
61729         LDKNodeFeatures this_arg_conv;
61730         this_arg_conv.inner = untag_ptr(this_arg);
61731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61733         this_arg_conv.is_owned = false;
61734         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61735 }
61736
61737 jboolean  CS_LDK_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61738         LDKNodeFeatures this_arg_conv;
61739         this_arg_conv.inner = untag_ptr(this_arg);
61740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61742         this_arg_conv.is_owned = false;
61743         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61744         return ret_conv;
61745 }
61746
61747 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
61748         LDKChannelTypeFeatures this_arg_conv;
61749         this_arg_conv.inner = untag_ptr(this_arg);
61750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61752         this_arg_conv.is_owned = false;
61753         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
61754 }
61755
61756 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
61757         LDKChannelTypeFeatures this_arg_conv;
61758         this_arg_conv.inner = untag_ptr(this_arg);
61759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61761         this_arg_conv.is_owned = false;
61762         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
61763 }
61764
61765 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61766         LDKChannelTypeFeatures this_arg_conv;
61767         this_arg_conv.inner = untag_ptr(this_arg);
61768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61770         this_arg_conv.is_owned = false;
61771         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61772         return ret_conv;
61773 }
61774
61775 jboolean  CS_LDK_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61776         LDKInitFeatures this_arg_conv;
61777         this_arg_conv.inner = untag_ptr(this_arg);
61778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61780         this_arg_conv.is_owned = false;
61781         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61782         return ret_conv;
61783 }
61784
61785 jboolean  CS_LDK_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61786         LDKNodeFeatures this_arg_conv;
61787         this_arg_conv.inner = untag_ptr(this_arg);
61788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61790         this_arg_conv.is_owned = false;
61791         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61792         return ret_conv;
61793 }
61794
61795 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
61796         LDKChannelTypeFeatures this_arg_conv;
61797         this_arg_conv.inner = untag_ptr(this_arg);
61798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61800         this_arg_conv.is_owned = false;
61801         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
61802         return ret_conv;
61803 }
61804
61805 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
61806         LDKInitFeatures this_arg_conv;
61807         this_arg_conv.inner = untag_ptr(this_arg);
61808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61810         this_arg_conv.is_owned = false;
61811         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61812 }
61813
61814 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
61815         LDKInitFeatures this_arg_conv;
61816         this_arg_conv.inner = untag_ptr(this_arg);
61817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61819         this_arg_conv.is_owned = false;
61820         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61821 }
61822
61823 jboolean  CS_LDK_InitFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61824         LDKInitFeatures this_arg_conv;
61825         this_arg_conv.inner = untag_ptr(this_arg);
61826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61828         this_arg_conv.is_owned = false;
61829         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61830         return ret_conv;
61831 }
61832
61833 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
61834         LDKNodeFeatures this_arg_conv;
61835         this_arg_conv.inner = untag_ptr(this_arg);
61836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61838         this_arg_conv.is_owned = false;
61839         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61840 }
61841
61842 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
61843         LDKNodeFeatures this_arg_conv;
61844         this_arg_conv.inner = untag_ptr(this_arg);
61845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61847         this_arg_conv.is_owned = false;
61848         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61849 }
61850
61851 jboolean  CS_LDK_NodeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61852         LDKNodeFeatures this_arg_conv;
61853         this_arg_conv.inner = untag_ptr(this_arg);
61854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61856         this_arg_conv.is_owned = false;
61857         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61858         return ret_conv;
61859 }
61860
61861 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
61862         LDKChannelTypeFeatures this_arg_conv;
61863         this_arg_conv.inner = untag_ptr(this_arg);
61864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61866         this_arg_conv.is_owned = false;
61867         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
61868 }
61869
61870 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
61871         LDKChannelTypeFeatures this_arg_conv;
61872         this_arg_conv.inner = untag_ptr(this_arg);
61873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61875         this_arg_conv.is_owned = false;
61876         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
61877 }
61878
61879 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61880         LDKChannelTypeFeatures this_arg_conv;
61881         this_arg_conv.inner = untag_ptr(this_arg);
61882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61884         this_arg_conv.is_owned = false;
61885         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
61886         return ret_conv;
61887 }
61888
61889 jboolean  CS_LDK_InitFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61890         LDKInitFeatures this_arg_conv;
61891         this_arg_conv.inner = untag_ptr(this_arg);
61892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61894         this_arg_conv.is_owned = false;
61895         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61896         return ret_conv;
61897 }
61898
61899 jboolean  CS_LDK_NodeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61900         LDKNodeFeatures this_arg_conv;
61901         this_arg_conv.inner = untag_ptr(this_arg);
61902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61904         this_arg_conv.is_owned = false;
61905         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61906         return ret_conv;
61907 }
61908
61909 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
61910         LDKChannelTypeFeatures this_arg_conv;
61911         this_arg_conv.inner = untag_ptr(this_arg);
61912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61914         this_arg_conv.is_owned = false;
61915         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
61916         return ret_conv;
61917 }
61918
61919 void  CS_LDK_InitFeatures_set_route_blinding_optional(int64_t this_arg) {
61920         LDKInitFeatures this_arg_conv;
61921         this_arg_conv.inner = untag_ptr(this_arg);
61922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61924         this_arg_conv.is_owned = false;
61925         InitFeatures_set_route_blinding_optional(&this_arg_conv);
61926 }
61927
61928 void  CS_LDK_InitFeatures_set_route_blinding_required(int64_t this_arg) {
61929         LDKInitFeatures this_arg_conv;
61930         this_arg_conv.inner = untag_ptr(this_arg);
61931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61933         this_arg_conv.is_owned = false;
61934         InitFeatures_set_route_blinding_required(&this_arg_conv);
61935 }
61936
61937 jboolean  CS_LDK_InitFeatures_supports_route_blinding(int64_t this_arg) {
61938         LDKInitFeatures this_arg_conv;
61939         this_arg_conv.inner = untag_ptr(this_arg);
61940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61942         this_arg_conv.is_owned = false;
61943         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
61944         return ret_conv;
61945 }
61946
61947 void  CS_LDK_NodeFeatures_set_route_blinding_optional(int64_t this_arg) {
61948         LDKNodeFeatures this_arg_conv;
61949         this_arg_conv.inner = untag_ptr(this_arg);
61950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61952         this_arg_conv.is_owned = false;
61953         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
61954 }
61955
61956 void  CS_LDK_NodeFeatures_set_route_blinding_required(int64_t this_arg) {
61957         LDKNodeFeatures this_arg_conv;
61958         this_arg_conv.inner = untag_ptr(this_arg);
61959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61961         this_arg_conv.is_owned = false;
61962         NodeFeatures_set_route_blinding_required(&this_arg_conv);
61963 }
61964
61965 jboolean  CS_LDK_NodeFeatures_supports_route_blinding(int64_t this_arg) {
61966         LDKNodeFeatures this_arg_conv;
61967         this_arg_conv.inner = untag_ptr(this_arg);
61968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61970         this_arg_conv.is_owned = false;
61971         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
61972         return ret_conv;
61973 }
61974
61975 jboolean  CS_LDK_InitFeatures_requires_route_blinding(int64_t this_arg) {
61976         LDKInitFeatures this_arg_conv;
61977         this_arg_conv.inner = untag_ptr(this_arg);
61978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61980         this_arg_conv.is_owned = false;
61981         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
61982         return ret_conv;
61983 }
61984
61985 jboolean  CS_LDK_NodeFeatures_requires_route_blinding(int64_t this_arg) {
61986         LDKNodeFeatures this_arg_conv;
61987         this_arg_conv.inner = untag_ptr(this_arg);
61988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61990         this_arg_conv.is_owned = false;
61991         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
61992         return ret_conv;
61993 }
61994
61995 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
61996         LDKInitFeatures this_arg_conv;
61997         this_arg_conv.inner = untag_ptr(this_arg);
61998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62000         this_arg_conv.is_owned = false;
62001         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
62002 }
62003
62004 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
62005         LDKInitFeatures this_arg_conv;
62006         this_arg_conv.inner = untag_ptr(this_arg);
62007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62009         this_arg_conv.is_owned = false;
62010         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
62011 }
62012
62013 jboolean  CS_LDK_InitFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
62014         LDKInitFeatures this_arg_conv;
62015         this_arg_conv.inner = untag_ptr(this_arg);
62016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62018         this_arg_conv.is_owned = false;
62019         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
62020         return ret_conv;
62021 }
62022
62023 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
62024         LDKNodeFeatures this_arg_conv;
62025         this_arg_conv.inner = untag_ptr(this_arg);
62026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62028         this_arg_conv.is_owned = false;
62029         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
62030 }
62031
62032 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
62033         LDKNodeFeatures this_arg_conv;
62034         this_arg_conv.inner = untag_ptr(this_arg);
62035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62037         this_arg_conv.is_owned = false;
62038         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
62039 }
62040
62041 jboolean  CS_LDK_NodeFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
62042         LDKNodeFeatures this_arg_conv;
62043         this_arg_conv.inner = untag_ptr(this_arg);
62044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62046         this_arg_conv.is_owned = false;
62047         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
62048         return ret_conv;
62049 }
62050
62051 jboolean  CS_LDK_InitFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
62052         LDKInitFeatures this_arg_conv;
62053         this_arg_conv.inner = untag_ptr(this_arg);
62054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62056         this_arg_conv.is_owned = false;
62057         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
62058         return ret_conv;
62059 }
62060
62061 jboolean  CS_LDK_NodeFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
62062         LDKNodeFeatures this_arg_conv;
62063         this_arg_conv.inner = untag_ptr(this_arg);
62064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62066         this_arg_conv.is_owned = false;
62067         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
62068         return ret_conv;
62069 }
62070
62071 void  CS_LDK_InitFeatures_set_taproot_optional(int64_t this_arg) {
62072         LDKInitFeatures this_arg_conv;
62073         this_arg_conv.inner = untag_ptr(this_arg);
62074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62076         this_arg_conv.is_owned = false;
62077         InitFeatures_set_taproot_optional(&this_arg_conv);
62078 }
62079
62080 void  CS_LDK_InitFeatures_set_taproot_required(int64_t this_arg) {
62081         LDKInitFeatures this_arg_conv;
62082         this_arg_conv.inner = untag_ptr(this_arg);
62083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62085         this_arg_conv.is_owned = false;
62086         InitFeatures_set_taproot_required(&this_arg_conv);
62087 }
62088
62089 jboolean  CS_LDK_InitFeatures_supports_taproot(int64_t this_arg) {
62090         LDKInitFeatures this_arg_conv;
62091         this_arg_conv.inner = untag_ptr(this_arg);
62092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62094         this_arg_conv.is_owned = false;
62095         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
62096         return ret_conv;
62097 }
62098
62099 void  CS_LDK_NodeFeatures_set_taproot_optional(int64_t this_arg) {
62100         LDKNodeFeatures this_arg_conv;
62101         this_arg_conv.inner = untag_ptr(this_arg);
62102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62104         this_arg_conv.is_owned = false;
62105         NodeFeatures_set_taproot_optional(&this_arg_conv);
62106 }
62107
62108 void  CS_LDK_NodeFeatures_set_taproot_required(int64_t this_arg) {
62109         LDKNodeFeatures this_arg_conv;
62110         this_arg_conv.inner = untag_ptr(this_arg);
62111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62113         this_arg_conv.is_owned = false;
62114         NodeFeatures_set_taproot_required(&this_arg_conv);
62115 }
62116
62117 jboolean  CS_LDK_NodeFeatures_supports_taproot(int64_t this_arg) {
62118         LDKNodeFeatures this_arg_conv;
62119         this_arg_conv.inner = untag_ptr(this_arg);
62120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62122         this_arg_conv.is_owned = false;
62123         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
62124         return ret_conv;
62125 }
62126
62127 void  CS_LDK_ChannelTypeFeatures_set_taproot_optional(int64_t this_arg) {
62128         LDKChannelTypeFeatures this_arg_conv;
62129         this_arg_conv.inner = untag_ptr(this_arg);
62130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62132         this_arg_conv.is_owned = false;
62133         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
62134 }
62135
62136 void  CS_LDK_ChannelTypeFeatures_set_taproot_required(int64_t this_arg) {
62137         LDKChannelTypeFeatures this_arg_conv;
62138         this_arg_conv.inner = untag_ptr(this_arg);
62139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62141         this_arg_conv.is_owned = false;
62142         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
62143 }
62144
62145 jboolean  CS_LDK_ChannelTypeFeatures_supports_taproot(int64_t this_arg) {
62146         LDKChannelTypeFeatures this_arg_conv;
62147         this_arg_conv.inner = untag_ptr(this_arg);
62148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62150         this_arg_conv.is_owned = false;
62151         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
62152         return ret_conv;
62153 }
62154
62155 jboolean  CS_LDK_InitFeatures_requires_taproot(int64_t this_arg) {
62156         LDKInitFeatures this_arg_conv;
62157         this_arg_conv.inner = untag_ptr(this_arg);
62158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62160         this_arg_conv.is_owned = false;
62161         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
62162         return ret_conv;
62163 }
62164
62165 jboolean  CS_LDK_NodeFeatures_requires_taproot(int64_t this_arg) {
62166         LDKNodeFeatures this_arg_conv;
62167         this_arg_conv.inner = untag_ptr(this_arg);
62168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62170         this_arg_conv.is_owned = false;
62171         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
62172         return ret_conv;
62173 }
62174
62175 jboolean  CS_LDK_ChannelTypeFeatures_requires_taproot(int64_t this_arg) {
62176         LDKChannelTypeFeatures this_arg_conv;
62177         this_arg_conv.inner = untag_ptr(this_arg);
62178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62180         this_arg_conv.is_owned = false;
62181         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
62182         return ret_conv;
62183 }
62184
62185 void  CS_LDK_InitFeatures_set_onion_messages_optional(int64_t this_arg) {
62186         LDKInitFeatures this_arg_conv;
62187         this_arg_conv.inner = untag_ptr(this_arg);
62188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62190         this_arg_conv.is_owned = false;
62191         InitFeatures_set_onion_messages_optional(&this_arg_conv);
62192 }
62193
62194 void  CS_LDK_InitFeatures_set_onion_messages_required(int64_t this_arg) {
62195         LDKInitFeatures this_arg_conv;
62196         this_arg_conv.inner = untag_ptr(this_arg);
62197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62199         this_arg_conv.is_owned = false;
62200         InitFeatures_set_onion_messages_required(&this_arg_conv);
62201 }
62202
62203 jboolean  CS_LDK_InitFeatures_supports_onion_messages(int64_t this_arg) {
62204         LDKInitFeatures this_arg_conv;
62205         this_arg_conv.inner = untag_ptr(this_arg);
62206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62208         this_arg_conv.is_owned = false;
62209         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
62210         return ret_conv;
62211 }
62212
62213 void  CS_LDK_NodeFeatures_set_onion_messages_optional(int64_t this_arg) {
62214         LDKNodeFeatures this_arg_conv;
62215         this_arg_conv.inner = untag_ptr(this_arg);
62216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62218         this_arg_conv.is_owned = false;
62219         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
62220 }
62221
62222 void  CS_LDK_NodeFeatures_set_onion_messages_required(int64_t this_arg) {
62223         LDKNodeFeatures this_arg_conv;
62224         this_arg_conv.inner = untag_ptr(this_arg);
62225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62227         this_arg_conv.is_owned = false;
62228         NodeFeatures_set_onion_messages_required(&this_arg_conv);
62229 }
62230
62231 jboolean  CS_LDK_NodeFeatures_supports_onion_messages(int64_t this_arg) {
62232         LDKNodeFeatures this_arg_conv;
62233         this_arg_conv.inner = untag_ptr(this_arg);
62234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62236         this_arg_conv.is_owned = false;
62237         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
62238         return ret_conv;
62239 }
62240
62241 jboolean  CS_LDK_InitFeatures_requires_onion_messages(int64_t this_arg) {
62242         LDKInitFeatures this_arg_conv;
62243         this_arg_conv.inner = untag_ptr(this_arg);
62244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62246         this_arg_conv.is_owned = false;
62247         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
62248         return ret_conv;
62249 }
62250
62251 jboolean  CS_LDK_NodeFeatures_requires_onion_messages(int64_t this_arg) {
62252         LDKNodeFeatures this_arg_conv;
62253         this_arg_conv.inner = untag_ptr(this_arg);
62254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62256         this_arg_conv.is_owned = false;
62257         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
62258         return ret_conv;
62259 }
62260
62261 void  CS_LDK_InitFeatures_set_channel_type_optional(int64_t this_arg) {
62262         LDKInitFeatures this_arg_conv;
62263         this_arg_conv.inner = untag_ptr(this_arg);
62264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62266         this_arg_conv.is_owned = false;
62267         InitFeatures_set_channel_type_optional(&this_arg_conv);
62268 }
62269
62270 void  CS_LDK_InitFeatures_set_channel_type_required(int64_t this_arg) {
62271         LDKInitFeatures this_arg_conv;
62272         this_arg_conv.inner = untag_ptr(this_arg);
62273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62275         this_arg_conv.is_owned = false;
62276         InitFeatures_set_channel_type_required(&this_arg_conv);
62277 }
62278
62279 jboolean  CS_LDK_InitFeatures_supports_channel_type(int64_t this_arg) {
62280         LDKInitFeatures this_arg_conv;
62281         this_arg_conv.inner = untag_ptr(this_arg);
62282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62284         this_arg_conv.is_owned = false;
62285         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
62286         return ret_conv;
62287 }
62288
62289 void  CS_LDK_NodeFeatures_set_channel_type_optional(int64_t this_arg) {
62290         LDKNodeFeatures this_arg_conv;
62291         this_arg_conv.inner = untag_ptr(this_arg);
62292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62294         this_arg_conv.is_owned = false;
62295         NodeFeatures_set_channel_type_optional(&this_arg_conv);
62296 }
62297
62298 void  CS_LDK_NodeFeatures_set_channel_type_required(int64_t this_arg) {
62299         LDKNodeFeatures this_arg_conv;
62300         this_arg_conv.inner = untag_ptr(this_arg);
62301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62303         this_arg_conv.is_owned = false;
62304         NodeFeatures_set_channel_type_required(&this_arg_conv);
62305 }
62306
62307 jboolean  CS_LDK_NodeFeatures_supports_channel_type(int64_t this_arg) {
62308         LDKNodeFeatures this_arg_conv;
62309         this_arg_conv.inner = untag_ptr(this_arg);
62310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62312         this_arg_conv.is_owned = false;
62313         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
62314         return ret_conv;
62315 }
62316
62317 jboolean  CS_LDK_InitFeatures_requires_channel_type(int64_t this_arg) {
62318         LDKInitFeatures this_arg_conv;
62319         this_arg_conv.inner = untag_ptr(this_arg);
62320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62322         this_arg_conv.is_owned = false;
62323         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
62324         return ret_conv;
62325 }
62326
62327 jboolean  CS_LDK_NodeFeatures_requires_channel_type(int64_t this_arg) {
62328         LDKNodeFeatures this_arg_conv;
62329         this_arg_conv.inner = untag_ptr(this_arg);
62330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62332         this_arg_conv.is_owned = false;
62333         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
62334         return ret_conv;
62335 }
62336
62337 void  CS_LDK_InitFeatures_set_scid_privacy_optional(int64_t this_arg) {
62338         LDKInitFeatures this_arg_conv;
62339         this_arg_conv.inner = untag_ptr(this_arg);
62340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62342         this_arg_conv.is_owned = false;
62343         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
62344 }
62345
62346 void  CS_LDK_InitFeatures_set_scid_privacy_required(int64_t this_arg) {
62347         LDKInitFeatures this_arg_conv;
62348         this_arg_conv.inner = untag_ptr(this_arg);
62349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62351         this_arg_conv.is_owned = false;
62352         InitFeatures_set_scid_privacy_required(&this_arg_conv);
62353 }
62354
62355 jboolean  CS_LDK_InitFeatures_supports_scid_privacy(int64_t this_arg) {
62356         LDKInitFeatures this_arg_conv;
62357         this_arg_conv.inner = untag_ptr(this_arg);
62358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62360         this_arg_conv.is_owned = false;
62361         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
62362         return ret_conv;
62363 }
62364
62365 void  CS_LDK_NodeFeatures_set_scid_privacy_optional(int64_t this_arg) {
62366         LDKNodeFeatures this_arg_conv;
62367         this_arg_conv.inner = untag_ptr(this_arg);
62368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62370         this_arg_conv.is_owned = false;
62371         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
62372 }
62373
62374 void  CS_LDK_NodeFeatures_set_scid_privacy_required(int64_t this_arg) {
62375         LDKNodeFeatures this_arg_conv;
62376         this_arg_conv.inner = untag_ptr(this_arg);
62377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62379         this_arg_conv.is_owned = false;
62380         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
62381 }
62382
62383 jboolean  CS_LDK_NodeFeatures_supports_scid_privacy(int64_t this_arg) {
62384         LDKNodeFeatures this_arg_conv;
62385         this_arg_conv.inner = untag_ptr(this_arg);
62386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62388         this_arg_conv.is_owned = false;
62389         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
62390         return ret_conv;
62391 }
62392
62393 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_optional(int64_t this_arg) {
62394         LDKChannelTypeFeatures this_arg_conv;
62395         this_arg_conv.inner = untag_ptr(this_arg);
62396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62398         this_arg_conv.is_owned = false;
62399         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
62400 }
62401
62402 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_required(int64_t this_arg) {
62403         LDKChannelTypeFeatures this_arg_conv;
62404         this_arg_conv.inner = untag_ptr(this_arg);
62405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62407         this_arg_conv.is_owned = false;
62408         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
62409 }
62410
62411 jboolean  CS_LDK_ChannelTypeFeatures_supports_scid_privacy(int64_t this_arg) {
62412         LDKChannelTypeFeatures this_arg_conv;
62413         this_arg_conv.inner = untag_ptr(this_arg);
62414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62416         this_arg_conv.is_owned = false;
62417         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
62418         return ret_conv;
62419 }
62420
62421 jboolean  CS_LDK_InitFeatures_requires_scid_privacy(int64_t this_arg) {
62422         LDKInitFeatures this_arg_conv;
62423         this_arg_conv.inner = untag_ptr(this_arg);
62424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62426         this_arg_conv.is_owned = false;
62427         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
62428         return ret_conv;
62429 }
62430
62431 jboolean  CS_LDK_NodeFeatures_requires_scid_privacy(int64_t this_arg) {
62432         LDKNodeFeatures this_arg_conv;
62433         this_arg_conv.inner = untag_ptr(this_arg);
62434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62436         this_arg_conv.is_owned = false;
62437         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
62438         return ret_conv;
62439 }
62440
62441 jboolean  CS_LDK_ChannelTypeFeatures_requires_scid_privacy(int64_t this_arg) {
62442         LDKChannelTypeFeatures this_arg_conv;
62443         this_arg_conv.inner = untag_ptr(this_arg);
62444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62446         this_arg_conv.is_owned = false;
62447         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
62448         return ret_conv;
62449 }
62450
62451 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_optional(int64_t this_arg) {
62452         LDKBolt11InvoiceFeatures this_arg_conv;
62453         this_arg_conv.inner = untag_ptr(this_arg);
62454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62456         this_arg_conv.is_owned = false;
62457         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
62458 }
62459
62460 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_required(int64_t this_arg) {
62461         LDKBolt11InvoiceFeatures this_arg_conv;
62462         this_arg_conv.inner = untag_ptr(this_arg);
62463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62465         this_arg_conv.is_owned = false;
62466         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
62467 }
62468
62469 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_metadata(int64_t this_arg) {
62470         LDKBolt11InvoiceFeatures this_arg_conv;
62471         this_arg_conv.inner = untag_ptr(this_arg);
62472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62474         this_arg_conv.is_owned = false;
62475         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
62476         return ret_conv;
62477 }
62478
62479 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_metadata(int64_t this_arg) {
62480         LDKBolt11InvoiceFeatures this_arg_conv;
62481         this_arg_conv.inner = untag_ptr(this_arg);
62482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62484         this_arg_conv.is_owned = false;
62485         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
62486         return ret_conv;
62487 }
62488
62489 void  CS_LDK_InitFeatures_set_zero_conf_optional(int64_t this_arg) {
62490         LDKInitFeatures this_arg_conv;
62491         this_arg_conv.inner = untag_ptr(this_arg);
62492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62494         this_arg_conv.is_owned = false;
62495         InitFeatures_set_zero_conf_optional(&this_arg_conv);
62496 }
62497
62498 void  CS_LDK_InitFeatures_set_zero_conf_required(int64_t this_arg) {
62499         LDKInitFeatures this_arg_conv;
62500         this_arg_conv.inner = untag_ptr(this_arg);
62501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62503         this_arg_conv.is_owned = false;
62504         InitFeatures_set_zero_conf_required(&this_arg_conv);
62505 }
62506
62507 jboolean  CS_LDK_InitFeatures_supports_zero_conf(int64_t this_arg) {
62508         LDKInitFeatures this_arg_conv;
62509         this_arg_conv.inner = untag_ptr(this_arg);
62510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62512         this_arg_conv.is_owned = false;
62513         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
62514         return ret_conv;
62515 }
62516
62517 void  CS_LDK_NodeFeatures_set_zero_conf_optional(int64_t this_arg) {
62518         LDKNodeFeatures this_arg_conv;
62519         this_arg_conv.inner = untag_ptr(this_arg);
62520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62522         this_arg_conv.is_owned = false;
62523         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
62524 }
62525
62526 void  CS_LDK_NodeFeatures_set_zero_conf_required(int64_t this_arg) {
62527         LDKNodeFeatures this_arg_conv;
62528         this_arg_conv.inner = untag_ptr(this_arg);
62529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62531         this_arg_conv.is_owned = false;
62532         NodeFeatures_set_zero_conf_required(&this_arg_conv);
62533 }
62534
62535 jboolean  CS_LDK_NodeFeatures_supports_zero_conf(int64_t this_arg) {
62536         LDKNodeFeatures this_arg_conv;
62537         this_arg_conv.inner = untag_ptr(this_arg);
62538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62540         this_arg_conv.is_owned = false;
62541         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
62542         return ret_conv;
62543 }
62544
62545 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_optional(int64_t this_arg) {
62546         LDKChannelTypeFeatures this_arg_conv;
62547         this_arg_conv.inner = untag_ptr(this_arg);
62548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62550         this_arg_conv.is_owned = false;
62551         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
62552 }
62553
62554 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_required(int64_t this_arg) {
62555         LDKChannelTypeFeatures this_arg_conv;
62556         this_arg_conv.inner = untag_ptr(this_arg);
62557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62559         this_arg_conv.is_owned = false;
62560         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
62561 }
62562
62563 jboolean  CS_LDK_ChannelTypeFeatures_supports_zero_conf(int64_t this_arg) {
62564         LDKChannelTypeFeatures this_arg_conv;
62565         this_arg_conv.inner = untag_ptr(this_arg);
62566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62568         this_arg_conv.is_owned = false;
62569         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
62570         return ret_conv;
62571 }
62572
62573 jboolean  CS_LDK_InitFeatures_requires_zero_conf(int64_t this_arg) {
62574         LDKInitFeatures this_arg_conv;
62575         this_arg_conv.inner = untag_ptr(this_arg);
62576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62578         this_arg_conv.is_owned = false;
62579         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
62580         return ret_conv;
62581 }
62582
62583 jboolean  CS_LDK_NodeFeatures_requires_zero_conf(int64_t this_arg) {
62584         LDKNodeFeatures this_arg_conv;
62585         this_arg_conv.inner = untag_ptr(this_arg);
62586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62588         this_arg_conv.is_owned = false;
62589         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
62590         return ret_conv;
62591 }
62592
62593 jboolean  CS_LDK_ChannelTypeFeatures_requires_zero_conf(int64_t this_arg) {
62594         LDKChannelTypeFeatures this_arg_conv;
62595         this_arg_conv.inner = untag_ptr(this_arg);
62596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62598         this_arg_conv.is_owned = false;
62599         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
62600         return ret_conv;
62601 }
62602
62603 void  CS_LDK_NodeFeatures_set_keysend_optional(int64_t this_arg) {
62604         LDKNodeFeatures this_arg_conv;
62605         this_arg_conv.inner = untag_ptr(this_arg);
62606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62608         this_arg_conv.is_owned = false;
62609         NodeFeatures_set_keysend_optional(&this_arg_conv);
62610 }
62611
62612 void  CS_LDK_NodeFeatures_set_keysend_required(int64_t this_arg) {
62613         LDKNodeFeatures this_arg_conv;
62614         this_arg_conv.inner = untag_ptr(this_arg);
62615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62617         this_arg_conv.is_owned = false;
62618         NodeFeatures_set_keysend_required(&this_arg_conv);
62619 }
62620
62621 jboolean  CS_LDK_NodeFeatures_supports_keysend(int64_t this_arg) {
62622         LDKNodeFeatures this_arg_conv;
62623         this_arg_conv.inner = untag_ptr(this_arg);
62624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62626         this_arg_conv.is_owned = false;
62627         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
62628         return ret_conv;
62629 }
62630
62631 jboolean  CS_LDK_NodeFeatures_requires_keysend(int64_t this_arg) {
62632         LDKNodeFeatures this_arg_conv;
62633         this_arg_conv.inner = untag_ptr(this_arg);
62634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62636         this_arg_conv.is_owned = false;
62637         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
62638         return ret_conv;
62639 }
62640
62641 void  CS_LDK_InitFeatures_set_trampoline_routing_optional(int64_t this_arg) {
62642         LDKInitFeatures this_arg_conv;
62643         this_arg_conv.inner = untag_ptr(this_arg);
62644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62646         this_arg_conv.is_owned = false;
62647         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
62648 }
62649
62650 void  CS_LDK_InitFeatures_set_trampoline_routing_required(int64_t this_arg) {
62651         LDKInitFeatures this_arg_conv;
62652         this_arg_conv.inner = untag_ptr(this_arg);
62653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62655         this_arg_conv.is_owned = false;
62656         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
62657 }
62658
62659 jboolean  CS_LDK_InitFeatures_supports_trampoline_routing(int64_t this_arg) {
62660         LDKInitFeatures this_arg_conv;
62661         this_arg_conv.inner = untag_ptr(this_arg);
62662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62664         this_arg_conv.is_owned = false;
62665         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
62666         return ret_conv;
62667 }
62668
62669 void  CS_LDK_NodeFeatures_set_trampoline_routing_optional(int64_t this_arg) {
62670         LDKNodeFeatures this_arg_conv;
62671         this_arg_conv.inner = untag_ptr(this_arg);
62672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62674         this_arg_conv.is_owned = false;
62675         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
62676 }
62677
62678 void  CS_LDK_NodeFeatures_set_trampoline_routing_required(int64_t this_arg) {
62679         LDKNodeFeatures this_arg_conv;
62680         this_arg_conv.inner = untag_ptr(this_arg);
62681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62683         this_arg_conv.is_owned = false;
62684         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
62685 }
62686
62687 jboolean  CS_LDK_NodeFeatures_supports_trampoline_routing(int64_t this_arg) {
62688         LDKNodeFeatures this_arg_conv;
62689         this_arg_conv.inner = untag_ptr(this_arg);
62690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62692         this_arg_conv.is_owned = false;
62693         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
62694         return ret_conv;
62695 }
62696
62697 void  CS_LDK_Bolt11InvoiceFeatures_set_trampoline_routing_optional(int64_t this_arg) {
62698         LDKBolt11InvoiceFeatures this_arg_conv;
62699         this_arg_conv.inner = untag_ptr(this_arg);
62700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62702         this_arg_conv.is_owned = false;
62703         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
62704 }
62705
62706 void  CS_LDK_Bolt11InvoiceFeatures_set_trampoline_routing_required(int64_t this_arg) {
62707         LDKBolt11InvoiceFeatures this_arg_conv;
62708         this_arg_conv.inner = untag_ptr(this_arg);
62709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62711         this_arg_conv.is_owned = false;
62712         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
62713 }
62714
62715 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_trampoline_routing(int64_t this_arg) {
62716         LDKBolt11InvoiceFeatures this_arg_conv;
62717         this_arg_conv.inner = untag_ptr(this_arg);
62718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62720         this_arg_conv.is_owned = false;
62721         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
62722         return ret_conv;
62723 }
62724
62725 jboolean  CS_LDK_InitFeatures_requires_trampoline_routing(int64_t this_arg) {
62726         LDKInitFeatures this_arg_conv;
62727         this_arg_conv.inner = untag_ptr(this_arg);
62728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62730         this_arg_conv.is_owned = false;
62731         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
62732         return ret_conv;
62733 }
62734
62735 jboolean  CS_LDK_NodeFeatures_requires_trampoline_routing(int64_t this_arg) {
62736         LDKNodeFeatures this_arg_conv;
62737         this_arg_conv.inner = untag_ptr(this_arg);
62738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62740         this_arg_conv.is_owned = false;
62741         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
62742         return ret_conv;
62743 }
62744
62745 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_trampoline_routing(int64_t this_arg) {
62746         LDKBolt11InvoiceFeatures this_arg_conv;
62747         this_arg_conv.inner = untag_ptr(this_arg);
62748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62750         this_arg_conv.is_owned = false;
62751         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
62752         return ret_conv;
62753 }
62754
62755 void  CS_LDK_ShutdownScript_free(int64_t this_obj) {
62756         LDKShutdownScript this_obj_conv;
62757         this_obj_conv.inner = untag_ptr(this_obj);
62758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62760         ShutdownScript_free(this_obj_conv);
62761 }
62762
62763 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
62764         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
62765         int64_t ret_ref = 0;
62766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62768         return ret_ref;
62769 }
62770 int64_t  CS_LDK_ShutdownScript_clone_ptr(int64_t arg) {
62771         LDKShutdownScript arg_conv;
62772         arg_conv.inner = untag_ptr(arg);
62773         arg_conv.is_owned = ptr_is_owned(arg);
62774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62775         arg_conv.is_owned = false;
62776         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
62777         return ret_conv;
62778 }
62779
62780 int64_t  CS_LDK_ShutdownScript_clone(int64_t orig) {
62781         LDKShutdownScript orig_conv;
62782         orig_conv.inner = untag_ptr(orig);
62783         orig_conv.is_owned = ptr_is_owned(orig);
62784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62785         orig_conv.is_owned = false;
62786         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
62787         int64_t ret_ref = 0;
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62790         return ret_ref;
62791 }
62792
62793 jboolean  CS_LDK_ShutdownScript_eq(int64_t a, int64_t b) {
62794         LDKShutdownScript a_conv;
62795         a_conv.inner = untag_ptr(a);
62796         a_conv.is_owned = ptr_is_owned(a);
62797         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62798         a_conv.is_owned = false;
62799         LDKShutdownScript b_conv;
62800         b_conv.inner = untag_ptr(b);
62801         b_conv.is_owned = ptr_is_owned(b);
62802         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62803         b_conv.is_owned = false;
62804         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
62805         return ret_conv;
62806 }
62807
62808 void  CS_LDK_InvalidShutdownScript_free(int64_t this_obj) {
62809         LDKInvalidShutdownScript this_obj_conv;
62810         this_obj_conv.inner = untag_ptr(this_obj);
62811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62813         InvalidShutdownScript_free(this_obj_conv);
62814 }
62815
62816 int8_tArray  CS_LDK_InvalidShutdownScript_get_script(int64_t this_ptr) {
62817         LDKInvalidShutdownScript this_ptr_conv;
62818         this_ptr_conv.inner = untag_ptr(this_ptr);
62819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62821         this_ptr_conv.is_owned = false;
62822         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
62823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62825         CVec_u8Z_free(ret_var);
62826         return ret_arr;
62827 }
62828
62829 void  CS_LDK_InvalidShutdownScript_set_script(int64_t this_ptr, int8_tArray val) {
62830         LDKInvalidShutdownScript this_ptr_conv;
62831         this_ptr_conv.inner = untag_ptr(this_ptr);
62832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62834         this_ptr_conv.is_owned = false;
62835         LDKCVec_u8Z val_ref;
62836         val_ref.datalen = val->arr_len;
62837         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
62838         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
62839         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
62840 }
62841
62842 int64_t  CS_LDK_InvalidShutdownScript_new(int8_tArray script_arg) {
62843         LDKCVec_u8Z script_arg_ref;
62844         script_arg_ref.datalen = script_arg->arr_len;
62845         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
62846         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
62847         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
62848         int64_t ret_ref = 0;
62849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62851         return ret_ref;
62852 }
62853
62854 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
62855         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
62856         int64_t ret_ref = 0;
62857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62859         return ret_ref;
62860 }
62861 int64_t  CS_LDK_InvalidShutdownScript_clone_ptr(int64_t arg) {
62862         LDKInvalidShutdownScript arg_conv;
62863         arg_conv.inner = untag_ptr(arg);
62864         arg_conv.is_owned = ptr_is_owned(arg);
62865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62866         arg_conv.is_owned = false;
62867         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
62868         return ret_conv;
62869 }
62870
62871 int64_t  CS_LDK_InvalidShutdownScript_clone(int64_t orig) {
62872         LDKInvalidShutdownScript orig_conv;
62873         orig_conv.inner = untag_ptr(orig);
62874         orig_conv.is_owned = ptr_is_owned(orig);
62875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62876         orig_conv.is_owned = false;
62877         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
62878         int64_t ret_ref = 0;
62879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62881         return ret_ref;
62882 }
62883
62884 int8_tArray  CS_LDK_ShutdownScript_write(int64_t obj) {
62885         LDKShutdownScript obj_conv;
62886         obj_conv.inner = untag_ptr(obj);
62887         obj_conv.is_owned = ptr_is_owned(obj);
62888         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62889         obj_conv.is_owned = false;
62890         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
62891         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62892         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62893         CVec_u8Z_free(ret_var);
62894         return ret_arr;
62895 }
62896
62897 int64_t  CS_LDK_ShutdownScript_read(int8_tArray ser) {
62898         LDKu8slice ser_ref;
62899         ser_ref.datalen = ser->arr_len;
62900         ser_ref.data = ser->elems;
62901         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
62902         *ret_conv = ShutdownScript_read(ser_ref);
62903         FREE(ser);
62904         return tag_ptr(ret_conv, true);
62905 }
62906
62907 int64_t  CS_LDK_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
62908         uint8_t pubkey_hash_arr[20];
62909         CHECK(pubkey_hash->arr_len == 20);
62910         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
62911         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
62912         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
62913         int64_t ret_ref = 0;
62914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62916         return ret_ref;
62917 }
62918
62919 int64_t  CS_LDK_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
62920         uint8_t script_hash_arr[32];
62921         CHECK(script_hash->arr_len == 32);
62922         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
62923         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
62924         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
62925         int64_t ret_ref = 0;
62926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62928         return ret_ref;
62929 }
62930
62931 int64_t  CS_LDK_ShutdownScript_new_witness_program(int64_t witness_program) {
62932         void* witness_program_ptr = untag_ptr(witness_program);
62933         CHECK_ACCESS(witness_program_ptr);
62934         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
62935         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
62936         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
62937         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
62938         return tag_ptr(ret_conv, true);
62939 }
62940
62941 int8_tArray  CS_LDK_ShutdownScript_into_inner(int64_t this_arg) {
62942         LDKShutdownScript this_arg_conv;
62943         this_arg_conv.inner = untag_ptr(this_arg);
62944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62946         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
62947         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
62948         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62949         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62950         CVec_u8Z_free(ret_var);
62951         return ret_arr;
62952 }
62953
62954 int8_tArray  CS_LDK_ShutdownScript_as_legacy_pubkey(int64_t this_arg) {
62955         LDKShutdownScript this_arg_conv;
62956         this_arg_conv.inner = untag_ptr(this_arg);
62957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62959         this_arg_conv.is_owned = false;
62960         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62961         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
62962         return ret_arr;
62963 }
62964
62965 jboolean  CS_LDK_ShutdownScript_is_compatible(int64_t this_arg, int64_t features) {
62966         LDKShutdownScript this_arg_conv;
62967         this_arg_conv.inner = untag_ptr(this_arg);
62968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62970         this_arg_conv.is_owned = false;
62971         LDKInitFeatures features_conv;
62972         features_conv.inner = untag_ptr(features);
62973         features_conv.is_owned = ptr_is_owned(features);
62974         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
62975         features_conv.is_owned = false;
62976         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
62977         return ret_conv;
62978 }
62979
62980 void  CS_LDK_ChannelId_free(int64_t this_obj) {
62981         LDKChannelId this_obj_conv;
62982         this_obj_conv.inner = untag_ptr(this_obj);
62983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62985         ChannelId_free(this_obj_conv);
62986 }
62987
62988 int8_tArray  CS_LDK_ChannelId_get_a(int64_t this_ptr) {
62989         LDKChannelId this_ptr_conv;
62990         this_ptr_conv.inner = untag_ptr(this_ptr);
62991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62993         this_ptr_conv.is_owned = false;
62994         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62995         memcpy(ret_arr->elems, *ChannelId_get_a(&this_ptr_conv), 32);
62996         return ret_arr;
62997 }
62998
62999 void  CS_LDK_ChannelId_set_a(int64_t this_ptr, int8_tArray val) {
63000         LDKChannelId this_ptr_conv;
63001         this_ptr_conv.inner = untag_ptr(this_ptr);
63002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63004         this_ptr_conv.is_owned = false;
63005         LDKThirtyTwoBytes val_ref;
63006         CHECK(val->arr_len == 32);
63007         memcpy(val_ref.data, val->elems, 32); FREE(val);
63008         ChannelId_set_a(&this_ptr_conv, val_ref);
63009 }
63010
63011 int64_t  CS_LDK_ChannelId_new(int8_tArray a_arg) {
63012         LDKThirtyTwoBytes a_arg_ref;
63013         CHECK(a_arg->arr_len == 32);
63014         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63015         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
63016         int64_t ret_ref = 0;
63017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63019         return ret_ref;
63020 }
63021
63022 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
63023         LDKChannelId ret_var = ChannelId_clone(arg);
63024         int64_t ret_ref = 0;
63025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63027         return ret_ref;
63028 }
63029 int64_t  CS_LDK_ChannelId_clone_ptr(int64_t arg) {
63030         LDKChannelId arg_conv;
63031         arg_conv.inner = untag_ptr(arg);
63032         arg_conv.is_owned = ptr_is_owned(arg);
63033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63034         arg_conv.is_owned = false;
63035         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
63036         return ret_conv;
63037 }
63038
63039 int64_t  CS_LDK_ChannelId_clone(int64_t orig) {
63040         LDKChannelId orig_conv;
63041         orig_conv.inner = untag_ptr(orig);
63042         orig_conv.is_owned = ptr_is_owned(orig);
63043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63044         orig_conv.is_owned = false;
63045         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
63046         int64_t ret_ref = 0;
63047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63049         return ret_ref;
63050 }
63051
63052 jboolean  CS_LDK_ChannelId_eq(int64_t a, int64_t b) {
63053         LDKChannelId a_conv;
63054         a_conv.inner = untag_ptr(a);
63055         a_conv.is_owned = ptr_is_owned(a);
63056         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63057         a_conv.is_owned = false;
63058         LDKChannelId b_conv;
63059         b_conv.inner = untag_ptr(b);
63060         b_conv.is_owned = ptr_is_owned(b);
63061         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63062         b_conv.is_owned = false;
63063         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
63064         return ret_conv;
63065 }
63066
63067 int64_t  CS_LDK_ChannelId_hash(int64_t o) {
63068         LDKChannelId o_conv;
63069         o_conv.inner = untag_ptr(o);
63070         o_conv.is_owned = ptr_is_owned(o);
63071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63072         o_conv.is_owned = false;
63073         int64_t ret_conv = ChannelId_hash(&o_conv);
63074         return ret_conv;
63075 }
63076
63077 int64_t  CS_LDK_ChannelId_v1_from_funding_txid(int8_tArray txid, int16_t output_index) {
63078         uint8_t txid_arr[32];
63079         CHECK(txid->arr_len == 32);
63080         memcpy(txid_arr, txid->elems, 32); FREE(txid);
63081         uint8_t (*txid_ref)[32] = &txid_arr;
63082         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
63083         int64_t ret_ref = 0;
63084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63086         return ret_ref;
63087 }
63088
63089 int64_t  CS_LDK_ChannelId_v1_from_funding_outpoint(int64_t outpoint) {
63090         LDKOutPoint outpoint_conv;
63091         outpoint_conv.inner = untag_ptr(outpoint);
63092         outpoint_conv.is_owned = ptr_is_owned(outpoint);
63093         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
63094         outpoint_conv = OutPoint_clone(&outpoint_conv);
63095         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
63096         int64_t ret_ref = 0;
63097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63099         return ret_ref;
63100 }
63101
63102 int64_t  CS_LDK_ChannelId_temporary_from_entropy_source(int64_t entropy_source) {
63103         void* entropy_source_ptr = untag_ptr(entropy_source);
63104         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
63105         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
63106         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
63107         int64_t ret_ref = 0;
63108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63110         return ret_ref;
63111 }
63112
63113 int64_t  CS_LDK_ChannelId_from_bytes(int8_tArray data) {
63114         LDKThirtyTwoBytes data_ref;
63115         CHECK(data->arr_len == 32);
63116         memcpy(data_ref.data, data->elems, 32); FREE(data);
63117         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
63118         int64_t ret_ref = 0;
63119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63121         return ret_ref;
63122 }
63123
63124 int64_t  CS_LDK_ChannelId_new_zero() {
63125         LDKChannelId ret_var = ChannelId_new_zero();
63126         int64_t ret_ref = 0;
63127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63129         return ret_ref;
63130 }
63131
63132 jboolean  CS_LDK_ChannelId_is_zero(int64_t this_arg) {
63133         LDKChannelId this_arg_conv;
63134         this_arg_conv.inner = untag_ptr(this_arg);
63135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63137         this_arg_conv.is_owned = false;
63138         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
63139         return ret_conv;
63140 }
63141
63142 int64_t  CS_LDK_ChannelId_v2_from_revocation_basepoints(int64_t ours, int64_t theirs) {
63143         LDKRevocationBasepoint ours_conv;
63144         ours_conv.inner = untag_ptr(ours);
63145         ours_conv.is_owned = ptr_is_owned(ours);
63146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
63147         ours_conv.is_owned = false;
63148         LDKRevocationBasepoint theirs_conv;
63149         theirs_conv.inner = untag_ptr(theirs);
63150         theirs_conv.is_owned = ptr_is_owned(theirs);
63151         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
63152         theirs_conv.is_owned = false;
63153         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
63154         int64_t ret_ref = 0;
63155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63157         return ret_ref;
63158 }
63159
63160 int64_t  CS_LDK_ChannelId_temporary_v2_from_revocation_basepoint(int64_t our_revocation_basepoint) {
63161         LDKRevocationBasepoint our_revocation_basepoint_conv;
63162         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
63163         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
63164         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
63165         our_revocation_basepoint_conv.is_owned = false;
63166         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
63167         int64_t ret_ref = 0;
63168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63170         return ret_ref;
63171 }
63172
63173 int8_tArray  CS_LDK_ChannelId_write(int64_t obj) {
63174         LDKChannelId obj_conv;
63175         obj_conv.inner = untag_ptr(obj);
63176         obj_conv.is_owned = ptr_is_owned(obj);
63177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63178         obj_conv.is_owned = false;
63179         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
63180         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63181         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63182         CVec_u8Z_free(ret_var);
63183         return ret_arr;
63184 }
63185
63186 int64_t  CS_LDK_ChannelId_read(int8_tArray ser) {
63187         LDKu8slice ser_ref;
63188         ser_ref.datalen = ser->arr_len;
63189         ser_ref.data = ser->elems;
63190         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
63191         *ret_conv = ChannelId_read(ser_ref);
63192         FREE(ser);
63193         return tag_ptr(ret_conv, true);
63194 }
63195
63196 void  CS_LDK_Retry_free(int64_t this_ptr) {
63197         if (!ptr_is_owned(this_ptr)) return;
63198         void* this_ptr_ptr = untag_ptr(this_ptr);
63199         CHECK_ACCESS(this_ptr_ptr);
63200         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
63201         FREE(untag_ptr(this_ptr));
63202         Retry_free(this_ptr_conv);
63203 }
63204
63205 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
63206         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63207         *ret_copy = Retry_clone(arg);
63208         int64_t ret_ref = tag_ptr(ret_copy, true);
63209         return ret_ref;
63210 }
63211 int64_t  CS_LDK_Retry_clone_ptr(int64_t arg) {
63212         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
63213         int64_t ret_conv = Retry_clone_ptr(arg_conv);
63214         return ret_conv;
63215 }
63216
63217 int64_t  CS_LDK_Retry_clone(int64_t orig) {
63218         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
63219         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63220         *ret_copy = Retry_clone(orig_conv);
63221         int64_t ret_ref = tag_ptr(ret_copy, true);
63222         return ret_ref;
63223 }
63224
63225 int64_t  CS_LDK_Retry_attempts(int32_t a) {
63226         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63227         *ret_copy = Retry_attempts(a);
63228         int64_t ret_ref = tag_ptr(ret_copy, true);
63229         return ret_ref;
63230 }
63231
63232 int64_t  CS_LDK_Retry_timeout(int64_t a) {
63233         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63234         *ret_copy = Retry_timeout(a);
63235         int64_t ret_ref = tag_ptr(ret_copy, true);
63236         return ret_ref;
63237 }
63238
63239 jboolean  CS_LDK_Retry_eq(int64_t a, int64_t b) {
63240         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
63241         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
63242         jboolean ret_conv = Retry_eq(a_conv, b_conv);
63243         return ret_conv;
63244 }
63245
63246 int64_t  CS_LDK_Retry_hash(int64_t o) {
63247         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
63248         int64_t ret_conv = Retry_hash(o_conv);
63249         return ret_conv;
63250 }
63251
63252 int8_tArray  CS_LDK_Retry_write(int64_t obj) {
63253         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
63254         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
63255         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63256         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63257         CVec_u8Z_free(ret_var);
63258         return ret_arr;
63259 }
63260
63261 int64_t  CS_LDK_Retry_read(int8_tArray ser) {
63262         LDKu8slice ser_ref;
63263         ser_ref.datalen = ser->arr_len;
63264         ser_ref.data = ser->elems;
63265         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
63266         *ret_conv = Retry_read(ser_ref);
63267         FREE(ser);
63268         return tag_ptr(ret_conv, true);
63269 }
63270
63271 int32_t  CS_LDK_RetryableSendFailure_clone(int64_t orig) {
63272         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
63273         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_clone(orig_conv));
63274         return ret_conv;
63275 }
63276
63277 int32_t  CS_LDK_RetryableSendFailure_payment_expired() {
63278         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_payment_expired());
63279         return ret_conv;
63280 }
63281
63282 int32_t  CS_LDK_RetryableSendFailure_route_not_found() {
63283         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_route_not_found());
63284         return ret_conv;
63285 }
63286
63287 int32_t  CS_LDK_RetryableSendFailure_duplicate_payment() {
63288         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_duplicate_payment());
63289         return ret_conv;
63290 }
63291
63292 jboolean  CS_LDK_RetryableSendFailure_eq(int64_t a, int64_t b) {
63293         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
63294         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
63295         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
63296         return ret_conv;
63297 }
63298
63299 void  CS_LDK_PaymentSendFailure_free(int64_t this_ptr) {
63300         if (!ptr_is_owned(this_ptr)) return;
63301         void* this_ptr_ptr = untag_ptr(this_ptr);
63302         CHECK_ACCESS(this_ptr_ptr);
63303         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
63304         FREE(untag_ptr(this_ptr));
63305         PaymentSendFailure_free(this_ptr_conv);
63306 }
63307
63308 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
63309         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63310         *ret_copy = PaymentSendFailure_clone(arg);
63311         int64_t ret_ref = tag_ptr(ret_copy, true);
63312         return ret_ref;
63313 }
63314 int64_t  CS_LDK_PaymentSendFailure_clone_ptr(int64_t arg) {
63315         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
63316         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
63317         return ret_conv;
63318 }
63319
63320 int64_t  CS_LDK_PaymentSendFailure_clone(int64_t orig) {
63321         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
63322         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63323         *ret_copy = PaymentSendFailure_clone(orig_conv);
63324         int64_t ret_ref = tag_ptr(ret_copy, true);
63325         return ret_ref;
63326 }
63327
63328 int64_t  CS_LDK_PaymentSendFailure_parameter_error(int64_t a) {
63329         void* a_ptr = untag_ptr(a);
63330         CHECK_ACCESS(a_ptr);
63331         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
63332         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
63333         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63334         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
63335         int64_t ret_ref = tag_ptr(ret_copy, true);
63336         return ret_ref;
63337 }
63338
63339 int64_t  CS_LDK_PaymentSendFailure_path_parameter_error(int64_tArray a) {
63340         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
63341         a_constr.datalen = a->arr_len;
63342         if (a_constr.datalen > 0)
63343                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
63344         else
63345                 a_constr.data = NULL;
63346         int64_t* a_vals = a->elems;
63347         for (size_t w = 0; w < a_constr.datalen; w++) {
63348                 int64_t a_conv_22 = a_vals[w];
63349                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
63350                 CHECK_ACCESS(a_conv_22_ptr);
63351                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
63352                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
63353                 a_constr.data[w] = a_conv_22_conv;
63354         }
63355         FREE(a);
63356         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63357         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
63358         int64_t ret_ref = tag_ptr(ret_copy, true);
63359         return ret_ref;
63360 }
63361
63362 int64_t  CS_LDK_PaymentSendFailure_all_failed_resend_safe(int64_tArray a) {
63363         LDKCVec_APIErrorZ a_constr;
63364         a_constr.datalen = a->arr_len;
63365         if (a_constr.datalen > 0)
63366                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
63367         else
63368                 a_constr.data = NULL;
63369         int64_t* a_vals = a->elems;
63370         for (size_t k = 0; k < a_constr.datalen; k++) {
63371                 int64_t a_conv_10 = a_vals[k];
63372                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
63373                 CHECK_ACCESS(a_conv_10_ptr);
63374                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
63375                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
63376                 a_constr.data[k] = a_conv_10_conv;
63377         }
63378         FREE(a);
63379         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63380         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
63381         int64_t ret_ref = tag_ptr(ret_copy, true);
63382         return ret_ref;
63383 }
63384
63385 int64_t  CS_LDK_PaymentSendFailure_duplicate_payment() {
63386         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63387         *ret_copy = PaymentSendFailure_duplicate_payment();
63388         int64_t ret_ref = tag_ptr(ret_copy, true);
63389         return ret_ref;
63390 }
63391
63392 int64_t  CS_LDK_PaymentSendFailure_partial_failure(int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
63393         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
63394         results_constr.datalen = results->arr_len;
63395         if (results_constr.datalen > 0)
63396                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
63397         else
63398                 results_constr.data = NULL;
63399         int64_t* results_vals = results->elems;
63400         for (size_t w = 0; w < results_constr.datalen; w++) {
63401                 int64_t results_conv_22 = results_vals[w];
63402                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
63403                 CHECK_ACCESS(results_conv_22_ptr);
63404                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
63405                 results_constr.data[w] = results_conv_22_conv;
63406         }
63407         FREE(results);
63408         LDKRouteParameters failed_paths_retry_conv;
63409         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
63410         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
63411         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
63412         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
63413         LDKThirtyTwoBytes payment_id_ref;
63414         CHECK(payment_id->arr_len == 32);
63415         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63416         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
63417         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
63418         int64_t ret_ref = tag_ptr(ret_copy, true);
63419         return ret_ref;
63420 }
63421
63422 jboolean  CS_LDK_PaymentSendFailure_eq(int64_t a, int64_t b) {
63423         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
63424         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
63425         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
63426         return ret_conv;
63427 }
63428
63429 void  CS_LDK_ProbeSendFailure_free(int64_t this_ptr) {
63430         if (!ptr_is_owned(this_ptr)) return;
63431         void* this_ptr_ptr = untag_ptr(this_ptr);
63432         CHECK_ACCESS(this_ptr_ptr);
63433         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
63434         FREE(untag_ptr(this_ptr));
63435         ProbeSendFailure_free(this_ptr_conv);
63436 }
63437
63438 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
63439         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63440         *ret_copy = ProbeSendFailure_clone(arg);
63441         int64_t ret_ref = tag_ptr(ret_copy, true);
63442         return ret_ref;
63443 }
63444 int64_t  CS_LDK_ProbeSendFailure_clone_ptr(int64_t arg) {
63445         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
63446         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
63447         return ret_conv;
63448 }
63449
63450 int64_t  CS_LDK_ProbeSendFailure_clone(int64_t orig) {
63451         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
63452         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63453         *ret_copy = ProbeSendFailure_clone(orig_conv);
63454         int64_t ret_ref = tag_ptr(ret_copy, true);
63455         return ret_ref;
63456 }
63457
63458 int64_t  CS_LDK_ProbeSendFailure_route_not_found() {
63459         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63460         *ret_copy = ProbeSendFailure_route_not_found();
63461         int64_t ret_ref = tag_ptr(ret_copy, true);
63462         return ret_ref;
63463 }
63464
63465 int64_t  CS_LDK_ProbeSendFailure_sending_failed(int64_t a) {
63466         void* a_ptr = untag_ptr(a);
63467         CHECK_ACCESS(a_ptr);
63468         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
63469         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
63470         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
63471         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
63472         int64_t ret_ref = tag_ptr(ret_copy, true);
63473         return ret_ref;
63474 }
63475
63476 jboolean  CS_LDK_ProbeSendFailure_eq(int64_t a, int64_t b) {
63477         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
63478         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
63479         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
63480         return ret_conv;
63481 }
63482
63483 void  CS_LDK_RecipientOnionFields_free(int64_t this_obj) {
63484         LDKRecipientOnionFields this_obj_conv;
63485         this_obj_conv.inner = untag_ptr(this_obj);
63486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63488         RecipientOnionFields_free(this_obj_conv);
63489 }
63490
63491 int64_t  CS_LDK_RecipientOnionFields_get_payment_secret(int64_t this_ptr) {
63492         LDKRecipientOnionFields this_ptr_conv;
63493         this_ptr_conv.inner = untag_ptr(this_ptr);
63494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63496         this_ptr_conv.is_owned = false;
63497         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
63498         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
63499         int64_t ret_ref = tag_ptr(ret_copy, true);
63500         return ret_ref;
63501 }
63502
63503 void  CS_LDK_RecipientOnionFields_set_payment_secret(int64_t this_ptr, int64_t val) {
63504         LDKRecipientOnionFields this_ptr_conv;
63505         this_ptr_conv.inner = untag_ptr(this_ptr);
63506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63508         this_ptr_conv.is_owned = false;
63509         void* val_ptr = untag_ptr(val);
63510         CHECK_ACCESS(val_ptr);
63511         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
63512         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
63513         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
63514 }
63515
63516 int64_t  CS_LDK_RecipientOnionFields_get_payment_metadata(int64_t this_ptr) {
63517         LDKRecipientOnionFields this_ptr_conv;
63518         this_ptr_conv.inner = untag_ptr(this_ptr);
63519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63521         this_ptr_conv.is_owned = false;
63522         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63523         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
63524         int64_t ret_ref = tag_ptr(ret_copy, true);
63525         return ret_ref;
63526 }
63527
63528 void  CS_LDK_RecipientOnionFields_set_payment_metadata(int64_t this_ptr, int64_t val) {
63529         LDKRecipientOnionFields this_ptr_conv;
63530         this_ptr_conv.inner = untag_ptr(this_ptr);
63531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63533         this_ptr_conv.is_owned = false;
63534         void* val_ptr = untag_ptr(val);
63535         CHECK_ACCESS(val_ptr);
63536         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
63537         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
63538         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
63539 }
63540
63541 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
63542         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
63543         int64_t ret_ref = 0;
63544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63546         return ret_ref;
63547 }
63548 int64_t  CS_LDK_RecipientOnionFields_clone_ptr(int64_t arg) {
63549         LDKRecipientOnionFields arg_conv;
63550         arg_conv.inner = untag_ptr(arg);
63551         arg_conv.is_owned = ptr_is_owned(arg);
63552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63553         arg_conv.is_owned = false;
63554         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
63555         return ret_conv;
63556 }
63557
63558 int64_t  CS_LDK_RecipientOnionFields_clone(int64_t orig) {
63559         LDKRecipientOnionFields orig_conv;
63560         orig_conv.inner = untag_ptr(orig);
63561         orig_conv.is_owned = ptr_is_owned(orig);
63562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63563         orig_conv.is_owned = false;
63564         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
63565         int64_t ret_ref = 0;
63566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63568         return ret_ref;
63569 }
63570
63571 jboolean  CS_LDK_RecipientOnionFields_eq(int64_t a, int64_t b) {
63572         LDKRecipientOnionFields a_conv;
63573         a_conv.inner = untag_ptr(a);
63574         a_conv.is_owned = ptr_is_owned(a);
63575         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63576         a_conv.is_owned = false;
63577         LDKRecipientOnionFields b_conv;
63578         b_conv.inner = untag_ptr(b);
63579         b_conv.is_owned = ptr_is_owned(b);
63580         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63581         b_conv.is_owned = false;
63582         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
63583         return ret_conv;
63584 }
63585
63586 int8_tArray  CS_LDK_RecipientOnionFields_write(int64_t obj) {
63587         LDKRecipientOnionFields obj_conv;
63588         obj_conv.inner = untag_ptr(obj);
63589         obj_conv.is_owned = ptr_is_owned(obj);
63590         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63591         obj_conv.is_owned = false;
63592         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
63593         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63594         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63595         CVec_u8Z_free(ret_var);
63596         return ret_arr;
63597 }
63598
63599 int64_t  CS_LDK_RecipientOnionFields_read(int8_tArray ser) {
63600         LDKu8slice ser_ref;
63601         ser_ref.datalen = ser->arr_len;
63602         ser_ref.data = ser->elems;
63603         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
63604         *ret_conv = RecipientOnionFields_read(ser_ref);
63605         FREE(ser);
63606         return tag_ptr(ret_conv, true);
63607 }
63608
63609 int64_t  CS_LDK_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
63610         LDKThirtyTwoBytes payment_secret_ref;
63611         CHECK(payment_secret->arr_len == 32);
63612         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
63613         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
63614         int64_t ret_ref = 0;
63615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63617         return ret_ref;
63618 }
63619
63620 int64_t  CS_LDK_RecipientOnionFields_spontaneous_empty() {
63621         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
63622         int64_t ret_ref = 0;
63623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63625         return ret_ref;
63626 }
63627
63628 int64_t  CS_LDK_RecipientOnionFields_with_custom_tlvs(int64_t this_arg, int64_tArray custom_tlvs) {
63629         LDKRecipientOnionFields this_arg_conv;
63630         this_arg_conv.inner = untag_ptr(this_arg);
63631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63633         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
63634         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
63635         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
63636         if (custom_tlvs_constr.datalen > 0)
63637                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
63638         else
63639                 custom_tlvs_constr.data = NULL;
63640         int64_t* custom_tlvs_vals = custom_tlvs->elems;
63641         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
63642                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
63643                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
63644                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
63645                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
63646                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
63647                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
63648         }
63649         FREE(custom_tlvs);
63650         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
63651         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
63652         return tag_ptr(ret_conv, true);
63653 }
63654
63655 int64_tArray  CS_LDK_RecipientOnionFields_custom_tlvs(int64_t this_arg) {
63656         LDKRecipientOnionFields this_arg_conv;
63657         this_arg_conv.inner = untag_ptr(this_arg);
63658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63660         this_arg_conv.is_owned = false;
63661         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
63662         int64_tArray ret_arr = NULL;
63663         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63664         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63665         for (size_t x = 0; x < ret_var.datalen; x++) {
63666                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
63667                 *ret_conv_23_conv = ret_var.data[x];
63668                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
63669         }
63670         
63671         FREE(ret_var.data);
63672         return ret_arr;
63673 }
63674
63675 void  CS_LDK_CustomMessageReader_free(int64_t this_ptr) {
63676         if (!ptr_is_owned(this_ptr)) return;
63677         void* this_ptr_ptr = untag_ptr(this_ptr);
63678         CHECK_ACCESS(this_ptr_ptr);
63679         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
63680         FREE(untag_ptr(this_ptr));
63681         CustomMessageReader_free(this_ptr_conv);
63682 }
63683
63684 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
63685         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63686         *ret_ret = Type_clone(arg);
63687         return tag_ptr(ret_ret, true);
63688 }
63689 int64_t  CS_LDK_Type_clone_ptr(int64_t arg) {
63690         void* arg_ptr = untag_ptr(arg);
63691         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
63692         LDKType* arg_conv = (LDKType*)arg_ptr;
63693         int64_t ret_conv = Type_clone_ptr(arg_conv);
63694         return ret_conv;
63695 }
63696
63697 int64_t  CS_LDK_Type_clone(int64_t orig) {
63698         void* orig_ptr = untag_ptr(orig);
63699         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
63700         LDKType* orig_conv = (LDKType*)orig_ptr;
63701         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
63702         *ret_ret = Type_clone(orig_conv);
63703         return tag_ptr(ret_ret, true);
63704 }
63705
63706 void  CS_LDK_Type_free(int64_t this_ptr) {
63707         if (!ptr_is_owned(this_ptr)) return;
63708         void* this_ptr_ptr = untag_ptr(this_ptr);
63709         CHECK_ACCESS(this_ptr_ptr);
63710         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
63711         FREE(untag_ptr(this_ptr));
63712         Type_free(this_ptr_conv);
63713 }
63714
63715 void  CS_LDK_OfferId_free(int64_t this_obj) {
63716         LDKOfferId this_obj_conv;
63717         this_obj_conv.inner = untag_ptr(this_obj);
63718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63720         OfferId_free(this_obj_conv);
63721 }
63722
63723 int8_tArray  CS_LDK_OfferId_get_a(int64_t this_ptr) {
63724         LDKOfferId this_ptr_conv;
63725         this_ptr_conv.inner = untag_ptr(this_ptr);
63726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63728         this_ptr_conv.is_owned = false;
63729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63730         memcpy(ret_arr->elems, *OfferId_get_a(&this_ptr_conv), 32);
63731         return ret_arr;
63732 }
63733
63734 void  CS_LDK_OfferId_set_a(int64_t this_ptr, int8_tArray val) {
63735         LDKOfferId this_ptr_conv;
63736         this_ptr_conv.inner = untag_ptr(this_ptr);
63737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63739         this_ptr_conv.is_owned = false;
63740         LDKThirtyTwoBytes val_ref;
63741         CHECK(val->arr_len == 32);
63742         memcpy(val_ref.data, val->elems, 32); FREE(val);
63743         OfferId_set_a(&this_ptr_conv, val_ref);
63744 }
63745
63746 int64_t  CS_LDK_OfferId_new(int8_tArray a_arg) {
63747         LDKThirtyTwoBytes a_arg_ref;
63748         CHECK(a_arg->arr_len == 32);
63749         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63750         LDKOfferId ret_var = OfferId_new(a_arg_ref);
63751         int64_t ret_ref = 0;
63752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63754         return ret_ref;
63755 }
63756
63757 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
63758         LDKOfferId ret_var = OfferId_clone(arg);
63759         int64_t ret_ref = 0;
63760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63762         return ret_ref;
63763 }
63764 int64_t  CS_LDK_OfferId_clone_ptr(int64_t arg) {
63765         LDKOfferId arg_conv;
63766         arg_conv.inner = untag_ptr(arg);
63767         arg_conv.is_owned = ptr_is_owned(arg);
63768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63769         arg_conv.is_owned = false;
63770         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
63771         return ret_conv;
63772 }
63773
63774 int64_t  CS_LDK_OfferId_clone(int64_t orig) {
63775         LDKOfferId orig_conv;
63776         orig_conv.inner = untag_ptr(orig);
63777         orig_conv.is_owned = ptr_is_owned(orig);
63778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63779         orig_conv.is_owned = false;
63780         LDKOfferId ret_var = OfferId_clone(&orig_conv);
63781         int64_t ret_ref = 0;
63782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63784         return ret_ref;
63785 }
63786
63787 jboolean  CS_LDK_OfferId_eq(int64_t a, int64_t b) {
63788         LDKOfferId a_conv;
63789         a_conv.inner = untag_ptr(a);
63790         a_conv.is_owned = ptr_is_owned(a);
63791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63792         a_conv.is_owned = false;
63793         LDKOfferId b_conv;
63794         b_conv.inner = untag_ptr(b);
63795         b_conv.is_owned = ptr_is_owned(b);
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63797         b_conv.is_owned = false;
63798         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
63799         return ret_conv;
63800 }
63801
63802 int8_tArray  CS_LDK_OfferId_write(int64_t obj) {
63803         LDKOfferId obj_conv;
63804         obj_conv.inner = untag_ptr(obj);
63805         obj_conv.is_owned = ptr_is_owned(obj);
63806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63807         obj_conv.is_owned = false;
63808         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
63809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63811         CVec_u8Z_free(ret_var);
63812         return ret_arr;
63813 }
63814
63815 int64_t  CS_LDK_OfferId_read(int8_tArray ser) {
63816         LDKu8slice ser_ref;
63817         ser_ref.datalen = ser->arr_len;
63818         ser_ref.data = ser->elems;
63819         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
63820         *ret_conv = OfferId_read(ser_ref);
63821         FREE(ser);
63822         return tag_ptr(ret_conv, true);
63823 }
63824
63825 void  CS_LDK_OfferWithExplicitMetadataBuilder_free(int64_t this_obj) {
63826         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
63827         this_obj_conv.inner = untag_ptr(this_obj);
63828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63830         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
63831 }
63832
63833 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
63834         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
63835         int64_t ret_ref = 0;
63836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63838         return ret_ref;
63839 }
63840 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_clone_ptr(int64_t arg) {
63841         LDKOfferWithExplicitMetadataBuilder arg_conv;
63842         arg_conv.inner = untag_ptr(arg);
63843         arg_conv.is_owned = ptr_is_owned(arg);
63844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63845         arg_conv.is_owned = false;
63846         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
63847         return ret_conv;
63848 }
63849
63850 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_clone(int64_t orig) {
63851         LDKOfferWithExplicitMetadataBuilder orig_conv;
63852         orig_conv.inner = untag_ptr(orig);
63853         orig_conv.is_owned = ptr_is_owned(orig);
63854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63855         orig_conv.is_owned = false;
63856         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
63857         int64_t ret_ref = 0;
63858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63860         return ret_ref;
63861 }
63862
63863 void  CS_LDK_OfferWithDerivedMetadataBuilder_free(int64_t this_obj) {
63864         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
63865         this_obj_conv.inner = untag_ptr(this_obj);
63866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63868         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
63869 }
63870
63871 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
63872         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
63873         int64_t ret_ref = 0;
63874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63876         return ret_ref;
63877 }
63878 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_clone_ptr(int64_t arg) {
63879         LDKOfferWithDerivedMetadataBuilder arg_conv;
63880         arg_conv.inner = untag_ptr(arg);
63881         arg_conv.is_owned = ptr_is_owned(arg);
63882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63883         arg_conv.is_owned = false;
63884         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
63885         return ret_conv;
63886 }
63887
63888 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_clone(int64_t orig) {
63889         LDKOfferWithDerivedMetadataBuilder orig_conv;
63890         orig_conv.inner = untag_ptr(orig);
63891         orig_conv.is_owned = ptr_is_owned(orig);
63892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63893         orig_conv.is_owned = false;
63894         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
63895         int64_t ret_ref = 0;
63896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63898         return ret_ref;
63899 }
63900
63901 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_new(int8_tArray signing_pubkey) {
63902         LDKPublicKey signing_pubkey_ref;
63903         CHECK(signing_pubkey->arr_len == 33);
63904         memcpy(signing_pubkey_ref.compressed_form, signing_pubkey->elems, 33); FREE(signing_pubkey);
63905         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
63906         int64_t ret_ref = 0;
63907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63909         return ret_ref;
63910 }
63911
63912 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_metadata(int64_t this_arg, int8_tArray metadata) {
63913         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63914         this_arg_conv.inner = untag_ptr(this_arg);
63915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63917         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63918         LDKCVec_u8Z metadata_ref;
63919         metadata_ref.datalen = metadata->arr_len;
63920         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
63921         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
63922         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
63923         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
63924         return tag_ptr(ret_conv, true);
63925 }
63926
63927 void  CS_LDK_OfferWithExplicitMetadataBuilder_chain(int64_t this_arg, int32_t network) {
63928         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63929         this_arg_conv.inner = untag_ptr(this_arg);
63930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63932         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63933         LDKNetwork network_conv = LDKNetwork_from_cs(network);
63934         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
63935 }
63936
63937 void  CS_LDK_OfferWithExplicitMetadataBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
63938         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63939         this_arg_conv.inner = untag_ptr(this_arg);
63940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63942         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63943         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
63944 }
63945
63946 void  CS_LDK_OfferWithExplicitMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
63947         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63948         this_arg_conv.inner = untag_ptr(this_arg);
63949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63951         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63952         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
63953 }
63954
63955 void  CS_LDK_OfferWithExplicitMetadataBuilder_description(int64_t this_arg, jstring description) {
63956         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63957         this_arg_conv.inner = untag_ptr(this_arg);
63958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63960         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63961         LDKStr description_conv = str_ref_to_owned_c(description);
63962         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
63963 }
63964
63965 void  CS_LDK_OfferWithExplicitMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
63966         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63967         this_arg_conv.inner = untag_ptr(this_arg);
63968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63970         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63971         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
63972         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
63973 }
63974
63975 void  CS_LDK_OfferWithExplicitMetadataBuilder_path(int64_t this_arg, int64_t path) {
63976         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63977         this_arg_conv.inner = untag_ptr(this_arg);
63978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63980         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63981         LDKBlindedPath path_conv;
63982         path_conv.inner = untag_ptr(path);
63983         path_conv.is_owned = ptr_is_owned(path);
63984         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63985         path_conv = BlindedPath_clone(&path_conv);
63986         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
63987 }
63988
63989 void  CS_LDK_OfferWithExplicitMetadataBuilder_supported_quantity(int64_t this_arg, int64_t quantity) {
63990         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
63991         this_arg_conv.inner = untag_ptr(this_arg);
63992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63994         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
63995         void* quantity_ptr = untag_ptr(quantity);
63996         CHECK_ACCESS(quantity_ptr);
63997         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
63998         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
63999         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
64000 }
64001
64002 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_build(int64_t this_arg) {
64003         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
64004         this_arg_conv.inner = untag_ptr(this_arg);
64005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64007         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
64008         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
64009         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
64010         return tag_ptr(ret_conv, true);
64011 }
64012
64013 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(int8_tArray node_id, int64_t expanded_key, int64_t entropy_source) {
64014         LDKPublicKey node_id_ref;
64015         CHECK(node_id->arr_len == 33);
64016         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64017         LDKExpandedKey expanded_key_conv;
64018         expanded_key_conv.inner = untag_ptr(expanded_key);
64019         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
64020         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
64021         expanded_key_conv.is_owned = false;
64022         void* entropy_source_ptr = untag_ptr(entropy_source);
64023         CHECK_ACCESS(entropy_source_ptr);
64024         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64025         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64026                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64027                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64028         }
64029         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
64030         int64_t ret_ref = 0;
64031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64033         return ret_ref;
64034 }
64035
64036 void  CS_LDK_OfferWithDerivedMetadataBuilder_chain(int64_t this_arg, int32_t network) {
64037         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64038         this_arg_conv.inner = untag_ptr(this_arg);
64039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64041         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64042         LDKNetwork network_conv = LDKNetwork_from_cs(network);
64043         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
64044 }
64045
64046 void  CS_LDK_OfferWithDerivedMetadataBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
64047         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64048         this_arg_conv.inner = untag_ptr(this_arg);
64049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64051         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64052         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
64053 }
64054
64055 void  CS_LDK_OfferWithDerivedMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
64056         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64057         this_arg_conv.inner = untag_ptr(this_arg);
64058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64060         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64061         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
64062 }
64063
64064 void  CS_LDK_OfferWithDerivedMetadataBuilder_description(int64_t this_arg, jstring description) {
64065         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64066         this_arg_conv.inner = untag_ptr(this_arg);
64067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64069         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64070         LDKStr description_conv = str_ref_to_owned_c(description);
64071         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
64072 }
64073
64074 void  CS_LDK_OfferWithDerivedMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
64075         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64076         this_arg_conv.inner = untag_ptr(this_arg);
64077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64079         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64080         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
64081         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
64082 }
64083
64084 void  CS_LDK_OfferWithDerivedMetadataBuilder_path(int64_t this_arg, int64_t path) {
64085         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64086         this_arg_conv.inner = untag_ptr(this_arg);
64087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64089         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64090         LDKBlindedPath path_conv;
64091         path_conv.inner = untag_ptr(path);
64092         path_conv.is_owned = ptr_is_owned(path);
64093         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64094         path_conv = BlindedPath_clone(&path_conv);
64095         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
64096 }
64097
64098 void  CS_LDK_OfferWithDerivedMetadataBuilder_supported_quantity(int64_t this_arg, int64_t quantity) {
64099         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64100         this_arg_conv.inner = untag_ptr(this_arg);
64101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64103         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64104         void* quantity_ptr = untag_ptr(quantity);
64105         CHECK_ACCESS(quantity_ptr);
64106         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
64107         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
64108         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
64109 }
64110
64111 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_build(int64_t this_arg) {
64112         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
64113         this_arg_conv.inner = untag_ptr(this_arg);
64114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64116         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
64117         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
64118         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
64119         return tag_ptr(ret_conv, true);
64120 }
64121
64122 void  CS_LDK_Offer_free(int64_t this_obj) {
64123         LDKOffer this_obj_conv;
64124         this_obj_conv.inner = untag_ptr(this_obj);
64125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64127         Offer_free(this_obj_conv);
64128 }
64129
64130 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
64131         LDKOffer ret_var = Offer_clone(arg);
64132         int64_t ret_ref = 0;
64133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64135         return ret_ref;
64136 }
64137 int64_t  CS_LDK_Offer_clone_ptr(int64_t arg) {
64138         LDKOffer arg_conv;
64139         arg_conv.inner = untag_ptr(arg);
64140         arg_conv.is_owned = ptr_is_owned(arg);
64141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64142         arg_conv.is_owned = false;
64143         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
64144         return ret_conv;
64145 }
64146
64147 int64_t  CS_LDK_Offer_clone(int64_t orig) {
64148         LDKOffer orig_conv;
64149         orig_conv.inner = untag_ptr(orig);
64150         orig_conv.is_owned = ptr_is_owned(orig);
64151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64152         orig_conv.is_owned = false;
64153         LDKOffer ret_var = Offer_clone(&orig_conv);
64154         int64_t ret_ref = 0;
64155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64157         return ret_ref;
64158 }
64159
64160 ptrArray  CS_LDK_Offer_chains(int64_t this_arg) {
64161         LDKOffer this_arg_conv;
64162         this_arg_conv.inner = untag_ptr(this_arg);
64163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64165         this_arg_conv.is_owned = false;
64166         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
64167         ptrArray ret_arr = NULL;
64168         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
64169         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
64170         for (size_t i = 0; i < ret_var.datalen; i++) {
64171                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
64172                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
64173                 ret_arr_ptr[i] = ret_conv_8_arr;
64174         }
64175         
64176         FREE(ret_var.data);
64177         return ret_arr;
64178 }
64179
64180 int64_t  CS_LDK_Offer_metadata(int64_t this_arg) {
64181         LDKOffer this_arg_conv;
64182         this_arg_conv.inner = untag_ptr(this_arg);
64183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64185         this_arg_conv.is_owned = false;
64186         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64187         *ret_copy = Offer_metadata(&this_arg_conv);
64188         int64_t ret_ref = tag_ptr(ret_copy, true);
64189         return ret_ref;
64190 }
64191
64192 int64_t  CS_LDK_Offer_amount(int64_t this_arg) {
64193         LDKOffer this_arg_conv;
64194         this_arg_conv.inner = untag_ptr(this_arg);
64195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64197         this_arg_conv.is_owned = false;
64198         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64199         *ret_copy = Offer_amount(&this_arg_conv);
64200         int64_t ret_ref = tag_ptr(ret_copy, true);
64201         return ret_ref;
64202 }
64203
64204 int64_t  CS_LDK_Offer_description(int64_t this_arg) {
64205         LDKOffer this_arg_conv;
64206         this_arg_conv.inner = untag_ptr(this_arg);
64207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64209         this_arg_conv.is_owned = false;
64210         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
64211         int64_t ret_ref = 0;
64212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64214         return ret_ref;
64215 }
64216
64217 int64_t  CS_LDK_Offer_offer_features(int64_t this_arg) {
64218         LDKOffer this_arg_conv;
64219         this_arg_conv.inner = untag_ptr(this_arg);
64220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64222         this_arg_conv.is_owned = false;
64223         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
64224         int64_t ret_ref = 0;
64225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64227         return ret_ref;
64228 }
64229
64230 int64_t  CS_LDK_Offer_absolute_expiry(int64_t this_arg) {
64231         LDKOffer this_arg_conv;
64232         this_arg_conv.inner = untag_ptr(this_arg);
64233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64235         this_arg_conv.is_owned = false;
64236         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64237         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
64238         int64_t ret_ref = tag_ptr(ret_copy, true);
64239         return ret_ref;
64240 }
64241
64242 int64_t  CS_LDK_Offer_issuer(int64_t this_arg) {
64243         LDKOffer this_arg_conv;
64244         this_arg_conv.inner = untag_ptr(this_arg);
64245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64247         this_arg_conv.is_owned = false;
64248         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
64249         int64_t ret_ref = 0;
64250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64252         return ret_ref;
64253 }
64254
64255 int64_tArray  CS_LDK_Offer_paths(int64_t this_arg) {
64256         LDKOffer this_arg_conv;
64257         this_arg_conv.inner = untag_ptr(this_arg);
64258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64260         this_arg_conv.is_owned = false;
64261         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
64262         int64_tArray ret_arr = NULL;
64263         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64264         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64265         for (size_t n = 0; n < ret_var.datalen; n++) {
64266                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64267                 int64_t ret_conv_13_ref = 0;
64268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64269                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64270                 ret_arr_ptr[n] = ret_conv_13_ref;
64271         }
64272         
64273         FREE(ret_var.data);
64274         return ret_arr;
64275 }
64276
64277 int64_t  CS_LDK_Offer_supported_quantity(int64_t this_arg) {
64278         LDKOffer this_arg_conv;
64279         this_arg_conv.inner = untag_ptr(this_arg);
64280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64282         this_arg_conv.is_owned = false;
64283         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64284         *ret_copy = Offer_supported_quantity(&this_arg_conv);
64285         int64_t ret_ref = tag_ptr(ret_copy, true);
64286         return ret_ref;
64287 }
64288
64289 int8_tArray  CS_LDK_Offer_signing_pubkey(int64_t this_arg) {
64290         LDKOffer this_arg_conv;
64291         this_arg_conv.inner = untag_ptr(this_arg);
64292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64294         this_arg_conv.is_owned = false;
64295         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64296         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
64297         return ret_arr;
64298 }
64299
64300 int64_t  CS_LDK_Offer_id(int64_t this_arg) {
64301         LDKOffer this_arg_conv;
64302         this_arg_conv.inner = untag_ptr(this_arg);
64303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64305         this_arg_conv.is_owned = false;
64306         LDKOfferId ret_var = Offer_id(&this_arg_conv);
64307         int64_t ret_ref = 0;
64308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64310         return ret_ref;
64311 }
64312
64313 jboolean  CS_LDK_Offer_supports_chain(int64_t this_arg, int8_tArray chain) {
64314         LDKOffer this_arg_conv;
64315         this_arg_conv.inner = untag_ptr(this_arg);
64316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64318         this_arg_conv.is_owned = false;
64319         LDKThirtyTwoBytes chain_ref;
64320         CHECK(chain->arr_len == 32);
64321         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
64322         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
64323         return ret_conv;
64324 }
64325
64326 jboolean  CS_LDK_Offer_is_expired(int64_t this_arg) {
64327         LDKOffer this_arg_conv;
64328         this_arg_conv.inner = untag_ptr(this_arg);
64329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64331         this_arg_conv.is_owned = false;
64332         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
64333         return ret_conv;
64334 }
64335
64336 jboolean  CS_LDK_Offer_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
64337         LDKOffer this_arg_conv;
64338         this_arg_conv.inner = untag_ptr(this_arg);
64339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64341         this_arg_conv.is_owned = false;
64342         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
64343         return ret_conv;
64344 }
64345
64346 jboolean  CS_LDK_Offer_is_valid_quantity(int64_t this_arg, int64_t quantity) {
64347         LDKOffer this_arg_conv;
64348         this_arg_conv.inner = untag_ptr(this_arg);
64349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64351         this_arg_conv.is_owned = false;
64352         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
64353         return ret_conv;
64354 }
64355
64356 jboolean  CS_LDK_Offer_expects_quantity(int64_t this_arg) {
64357         LDKOffer this_arg_conv;
64358         this_arg_conv.inner = untag_ptr(this_arg);
64359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64361         this_arg_conv.is_owned = false;
64362         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
64363         return ret_conv;
64364 }
64365
64366 int64_t  CS_LDK_Offer_request_invoice_deriving_payer_id(int64_t this_arg, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
64367         LDKOffer this_arg_conv;
64368         this_arg_conv.inner = untag_ptr(this_arg);
64369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64371         this_arg_conv.is_owned = false;
64372         LDKExpandedKey expanded_key_conv;
64373         expanded_key_conv.inner = untag_ptr(expanded_key);
64374         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
64375         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
64376         expanded_key_conv.is_owned = false;
64377         void* entropy_source_ptr = untag_ptr(entropy_source);
64378         CHECK_ACCESS(entropy_source_ptr);
64379         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64380         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64382                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64383         }
64384         LDKThirtyTwoBytes payment_id_ref;
64385         CHECK(payment_id->arr_len == 32);
64386         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64387         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
64388         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
64389         return tag_ptr(ret_conv, true);
64390 }
64391
64392 int64_t  CS_LDK_Offer_request_invoice_deriving_metadata(int64_t this_arg, int8_tArray payer_id, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
64393         LDKOffer this_arg_conv;
64394         this_arg_conv.inner = untag_ptr(this_arg);
64395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64397         this_arg_conv.is_owned = false;
64398         LDKPublicKey payer_id_ref;
64399         CHECK(payer_id->arr_len == 33);
64400         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
64401         LDKExpandedKey expanded_key_conv;
64402         expanded_key_conv.inner = untag_ptr(expanded_key);
64403         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
64404         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
64405         expanded_key_conv.is_owned = false;
64406         void* entropy_source_ptr = untag_ptr(entropy_source);
64407         CHECK_ACCESS(entropy_source_ptr);
64408         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64409         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64410                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64411                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64412         }
64413         LDKThirtyTwoBytes payment_id_ref;
64414         CHECK(payment_id->arr_len == 32);
64415         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64416         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
64417         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
64418         return tag_ptr(ret_conv, true);
64419 }
64420
64421 int64_t  CS_LDK_Offer_request_invoice(int64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
64422         LDKOffer this_arg_conv;
64423         this_arg_conv.inner = untag_ptr(this_arg);
64424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64426         this_arg_conv.is_owned = false;
64427         LDKCVec_u8Z metadata_ref;
64428         metadata_ref.datalen = metadata->arr_len;
64429         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
64430         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
64431         LDKPublicKey payer_id_ref;
64432         CHECK(payer_id->arr_len == 33);
64433         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
64434         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
64435         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
64436         return tag_ptr(ret_conv, true);
64437 }
64438
64439 int64_t  CS_LDK_Offer_hash(int64_t o) {
64440         LDKOffer o_conv;
64441         o_conv.inner = untag_ptr(o);
64442         o_conv.is_owned = ptr_is_owned(o);
64443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64444         o_conv.is_owned = false;
64445         int64_t ret_conv = Offer_hash(&o_conv);
64446         return ret_conv;
64447 }
64448
64449 int8_tArray  CS_LDK_Offer_write(int64_t obj) {
64450         LDKOffer obj_conv;
64451         obj_conv.inner = untag_ptr(obj);
64452         obj_conv.is_owned = ptr_is_owned(obj);
64453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64454         obj_conv.is_owned = false;
64455         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
64456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64458         CVec_u8Z_free(ret_var);
64459         return ret_arr;
64460 }
64461
64462 void  CS_LDK_Amount_free(int64_t this_ptr) {
64463         if (!ptr_is_owned(this_ptr)) return;
64464         void* this_ptr_ptr = untag_ptr(this_ptr);
64465         CHECK_ACCESS(this_ptr_ptr);
64466         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
64467         FREE(untag_ptr(this_ptr));
64468         Amount_free(this_ptr_conv);
64469 }
64470
64471 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
64472         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64473         *ret_copy = Amount_clone(arg);
64474         int64_t ret_ref = tag_ptr(ret_copy, true);
64475         return ret_ref;
64476 }
64477 int64_t  CS_LDK_Amount_clone_ptr(int64_t arg) {
64478         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
64479         int64_t ret_conv = Amount_clone_ptr(arg_conv);
64480         return ret_conv;
64481 }
64482
64483 int64_t  CS_LDK_Amount_clone(int64_t orig) {
64484         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
64485         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64486         *ret_copy = Amount_clone(orig_conv);
64487         int64_t ret_ref = tag_ptr(ret_copy, true);
64488         return ret_ref;
64489 }
64490
64491 int64_t  CS_LDK_Amount_bitcoin(int64_t amount_msats) {
64492         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64493         *ret_copy = Amount_bitcoin(amount_msats);
64494         int64_t ret_ref = tag_ptr(ret_copy, true);
64495         return ret_ref;
64496 }
64497
64498 int64_t  CS_LDK_Amount_currency(int8_tArray iso4217_code, int64_t amount) {
64499         LDKThreeBytes iso4217_code_ref;
64500         CHECK(iso4217_code->arr_len == 3);
64501         memcpy(iso4217_code_ref.data, iso4217_code->elems, 3); FREE(iso4217_code);
64502         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
64503         *ret_copy = Amount_currency(iso4217_code_ref, amount);
64504         int64_t ret_ref = tag_ptr(ret_copy, true);
64505         return ret_ref;
64506 }
64507
64508 void  CS_LDK_Quantity_free(int64_t this_ptr) {
64509         if (!ptr_is_owned(this_ptr)) return;
64510         void* this_ptr_ptr = untag_ptr(this_ptr);
64511         CHECK_ACCESS(this_ptr_ptr);
64512         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
64513         FREE(untag_ptr(this_ptr));
64514         Quantity_free(this_ptr_conv);
64515 }
64516
64517 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
64518         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64519         *ret_copy = Quantity_clone(arg);
64520         int64_t ret_ref = tag_ptr(ret_copy, true);
64521         return ret_ref;
64522 }
64523 int64_t  CS_LDK_Quantity_clone_ptr(int64_t arg) {
64524         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
64525         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
64526         return ret_conv;
64527 }
64528
64529 int64_t  CS_LDK_Quantity_clone(int64_t orig) {
64530         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
64531         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64532         *ret_copy = Quantity_clone(orig_conv);
64533         int64_t ret_ref = tag_ptr(ret_copy, true);
64534         return ret_ref;
64535 }
64536
64537 int64_t  CS_LDK_Quantity_bounded(int64_t a) {
64538         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64539         *ret_copy = Quantity_bounded(a);
64540         int64_t ret_ref = tag_ptr(ret_copy, true);
64541         return ret_ref;
64542 }
64543
64544 int64_t  CS_LDK_Quantity_unbounded() {
64545         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64546         *ret_copy = Quantity_unbounded();
64547         int64_t ret_ref = tag_ptr(ret_copy, true);
64548         return ret_ref;
64549 }
64550
64551 int64_t  CS_LDK_Quantity_one() {
64552         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
64553         *ret_copy = Quantity_one();
64554         int64_t ret_ref = tag_ptr(ret_copy, true);
64555         return ret_ref;
64556 }
64557
64558 int64_t  CS_LDK_Offer_from_str(jstring s) {
64559         LDKStr s_conv = str_ref_to_owned_c(s);
64560         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
64561         *ret_conv = Offer_from_str(s_conv);
64562         return tag_ptr(ret_conv, true);
64563 }
64564
64565 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_free(int64_t this_obj) {
64566         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
64567         this_obj_conv.inner = untag_ptr(this_obj);
64568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64570         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
64571 }
64572
64573 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_free(int64_t this_obj) {
64574         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
64575         this_obj_conv.inner = untag_ptr(this_obj);
64576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64578         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
64579 }
64580
64581 int64_t  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_build(int64_t this_arg) {
64582         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64583         this_arg_conv.inner = untag_ptr(this_arg);
64584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64586         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64587         
64588         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
64589         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
64590         return tag_ptr(ret_conv, true);
64591 }
64592
64593 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(int64_t this_arg, int32_t relative_expiry_secs) {
64594         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64595         this_arg_conv.inner = untag_ptr(this_arg);
64596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64598         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64599         
64600         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64601 }
64602
64603 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(int64_t this_arg, int8_tArray script_hash) {
64604         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64605         this_arg_conv.inner = untag_ptr(this_arg);
64606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64608         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64609         
64610         uint8_t script_hash_arr[32];
64611         CHECK(script_hash->arr_len == 32);
64612         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64613         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64614         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64615 }
64616
64617 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(int64_t this_arg, int8_tArray pubkey_hash) {
64618         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64619         this_arg_conv.inner = untag_ptr(this_arg);
64620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64622         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64623         
64624         uint8_t pubkey_hash_arr[20];
64625         CHECK(pubkey_hash->arr_len == 20);
64626         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64627         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64628         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64629 }
64630
64631 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(int64_t this_arg, int8_tArray utput_key) {
64632         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64633         this_arg_conv.inner = untag_ptr(this_arg);
64634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64636         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64637         
64638         LDKTweakedPublicKey utput_key_ref;
64639         CHECK(utput_key->arr_len == 32);
64640         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64641         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64642 }
64643
64644 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(int64_t this_arg) {
64645         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
64646         this_arg_conv.inner = untag_ptr(this_arg);
64647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64649         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
64650         
64651         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64652 }
64653
64654 int64_t  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(int64_t this_arg) {
64655         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64656         this_arg_conv.inner = untag_ptr(this_arg);
64657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64659         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64660         
64661         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
64662         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
64663         return tag_ptr(ret_conv, true);
64664 }
64665
64666 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(int64_t this_arg, int32_t relative_expiry_secs) {
64667         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64668         this_arg_conv.inner = untag_ptr(this_arg);
64669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64671         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64672         
64673         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
64674 }
64675
64676 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(int64_t this_arg, int8_tArray script_hash) {
64677         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64678         this_arg_conv.inner = untag_ptr(this_arg);
64679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64681         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64682         
64683         uint8_t script_hash_arr[32];
64684         CHECK(script_hash->arr_len == 32);
64685         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64686         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64687         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
64688 }
64689
64690 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(int64_t this_arg, int8_tArray pubkey_hash) {
64691         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64692         this_arg_conv.inner = untag_ptr(this_arg);
64693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64695         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64696         
64697         uint8_t pubkey_hash_arr[20];
64698         CHECK(pubkey_hash->arr_len == 20);
64699         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64700         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64701         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
64702 }
64703
64704 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(int64_t this_arg, int8_tArray utput_key) {
64705         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64706         this_arg_conv.inner = untag_ptr(this_arg);
64707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64709         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64710         
64711         LDKTweakedPublicKey utput_key_ref;
64712         CHECK(utput_key->arr_len == 32);
64713         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
64714         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
64715 }
64716
64717 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(int64_t this_arg) {
64718         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
64719         this_arg_conv.inner = untag_ptr(this_arg);
64720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64722         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
64723         
64724         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
64725 }
64726
64727 void  CS_LDK_UnsignedBolt12Invoice_free(int64_t this_obj) {
64728         LDKUnsignedBolt12Invoice this_obj_conv;
64729         this_obj_conv.inner = untag_ptr(this_obj);
64730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64732         UnsignedBolt12Invoice_free(this_obj_conv);
64733 }
64734
64735 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
64736         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
64737         int64_t ret_ref = 0;
64738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64740         return ret_ref;
64741 }
64742 int64_t  CS_LDK_UnsignedBolt12Invoice_clone_ptr(int64_t arg) {
64743         LDKUnsignedBolt12Invoice arg_conv;
64744         arg_conv.inner = untag_ptr(arg);
64745         arg_conv.is_owned = ptr_is_owned(arg);
64746         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64747         arg_conv.is_owned = false;
64748         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
64749         return ret_conv;
64750 }
64751
64752 int64_t  CS_LDK_UnsignedBolt12Invoice_clone(int64_t orig) {
64753         LDKUnsignedBolt12Invoice orig_conv;
64754         orig_conv.inner = untag_ptr(orig);
64755         orig_conv.is_owned = ptr_is_owned(orig);
64756         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64757         orig_conv.is_owned = false;
64758         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
64759         int64_t ret_ref = 0;
64760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64762         return ret_ref;
64763 }
64764
64765 void  CS_LDK_SignBolt12InvoiceFn_free(int64_t this_ptr) {
64766         if (!ptr_is_owned(this_ptr)) return;
64767         void* this_ptr_ptr = untag_ptr(this_ptr);
64768         CHECK_ACCESS(this_ptr_ptr);
64769         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
64770         FREE(untag_ptr(this_ptr));
64771         SignBolt12InvoiceFn_free(this_ptr_conv);
64772 }
64773
64774 int64_t  CS_LDK_UnsignedBolt12Invoice_tagged_hash(int64_t this_arg) {
64775         LDKUnsignedBolt12Invoice this_arg_conv;
64776         this_arg_conv.inner = untag_ptr(this_arg);
64777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64779         this_arg_conv.is_owned = false;
64780         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
64781         int64_t ret_ref = 0;
64782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64784         return ret_ref;
64785 }
64786
64787 void  CS_LDK_Bolt12Invoice_free(int64_t this_obj) {
64788         LDKBolt12Invoice this_obj_conv;
64789         this_obj_conv.inner = untag_ptr(this_obj);
64790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64792         Bolt12Invoice_free(this_obj_conv);
64793 }
64794
64795 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
64796         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
64797         int64_t ret_ref = 0;
64798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64800         return ret_ref;
64801 }
64802 int64_t  CS_LDK_Bolt12Invoice_clone_ptr(int64_t arg) {
64803         LDKBolt12Invoice arg_conv;
64804         arg_conv.inner = untag_ptr(arg);
64805         arg_conv.is_owned = ptr_is_owned(arg);
64806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64807         arg_conv.is_owned = false;
64808         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
64809         return ret_conv;
64810 }
64811
64812 int64_t  CS_LDK_Bolt12Invoice_clone(int64_t orig) {
64813         LDKBolt12Invoice orig_conv;
64814         orig_conv.inner = untag_ptr(orig);
64815         orig_conv.is_owned = ptr_is_owned(orig);
64816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64817         orig_conv.is_owned = false;
64818         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
64819         int64_t ret_ref = 0;
64820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64822         return ret_ref;
64823 }
64824
64825 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_chains(int64_t this_arg) {
64826         LDKUnsignedBolt12Invoice this_arg_conv;
64827         this_arg_conv.inner = untag_ptr(this_arg);
64828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64830         this_arg_conv.is_owned = false;
64831         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64832         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
64833         int64_t ret_ref = tag_ptr(ret_copy, true);
64834         return ret_ref;
64835 }
64836
64837 int8_tArray  CS_LDK_UnsignedBolt12Invoice_chain(int64_t this_arg) {
64838         LDKUnsignedBolt12Invoice this_arg_conv;
64839         this_arg_conv.inner = untag_ptr(this_arg);
64840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64842         this_arg_conv.is_owned = false;
64843         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64844         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
64845         return ret_arr;
64846 }
64847
64848 int64_t  CS_LDK_UnsignedBolt12Invoice_metadata(int64_t this_arg) {
64849         LDKUnsignedBolt12Invoice this_arg_conv;
64850         this_arg_conv.inner = untag_ptr(this_arg);
64851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64853         this_arg_conv.is_owned = false;
64854         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64855         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
64856         int64_t ret_ref = tag_ptr(ret_copy, true);
64857         return ret_ref;
64858 }
64859
64860 int64_t  CS_LDK_UnsignedBolt12Invoice_amount(int64_t this_arg) {
64861         LDKUnsignedBolt12Invoice this_arg_conv;
64862         this_arg_conv.inner = untag_ptr(this_arg);
64863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64865         this_arg_conv.is_owned = false;
64866         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
64867         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
64868         int64_t ret_ref = tag_ptr(ret_copy, true);
64869         return ret_ref;
64870 }
64871
64872 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_features(int64_t this_arg) {
64873         LDKUnsignedBolt12Invoice this_arg_conv;
64874         this_arg_conv.inner = untag_ptr(this_arg);
64875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64877         this_arg_conv.is_owned = false;
64878         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
64879         int64_t ret_ref = 0;
64880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64882         return ret_ref;
64883 }
64884
64885 int64_t  CS_LDK_UnsignedBolt12Invoice_description(int64_t this_arg) {
64886         LDKUnsignedBolt12Invoice this_arg_conv;
64887         this_arg_conv.inner = untag_ptr(this_arg);
64888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64890         this_arg_conv.is_owned = false;
64891         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
64892         int64_t ret_ref = 0;
64893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64895         return ret_ref;
64896 }
64897
64898 int64_t  CS_LDK_UnsignedBolt12Invoice_absolute_expiry(int64_t this_arg) {
64899         LDKUnsignedBolt12Invoice this_arg_conv;
64900         this_arg_conv.inner = untag_ptr(this_arg);
64901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64903         this_arg_conv.is_owned = false;
64904         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64905         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
64906         int64_t ret_ref = tag_ptr(ret_copy, true);
64907         return ret_ref;
64908 }
64909
64910 int64_t  CS_LDK_UnsignedBolt12Invoice_issuer(int64_t this_arg) {
64911         LDKUnsignedBolt12Invoice this_arg_conv;
64912         this_arg_conv.inner = untag_ptr(this_arg);
64913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64915         this_arg_conv.is_owned = false;
64916         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
64917         int64_t ret_ref = 0;
64918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64920         return ret_ref;
64921 }
64922
64923 int64_tArray  CS_LDK_UnsignedBolt12Invoice_message_paths(int64_t this_arg) {
64924         LDKUnsignedBolt12Invoice this_arg_conv;
64925         this_arg_conv.inner = untag_ptr(this_arg);
64926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64928         this_arg_conv.is_owned = false;
64929         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
64930         int64_tArray ret_arr = NULL;
64931         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64932         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64933         for (size_t n = 0; n < ret_var.datalen; n++) {
64934                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64935                 int64_t ret_conv_13_ref = 0;
64936                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64937                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64938                 ret_arr_ptr[n] = ret_conv_13_ref;
64939         }
64940         
64941         FREE(ret_var.data);
64942         return ret_arr;
64943 }
64944
64945 int64_t  CS_LDK_UnsignedBolt12Invoice_supported_quantity(int64_t this_arg) {
64946         LDKUnsignedBolt12Invoice this_arg_conv;
64947         this_arg_conv.inner = untag_ptr(this_arg);
64948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64950         this_arg_conv.is_owned = false;
64951         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
64952         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
64953         int64_t ret_ref = tag_ptr(ret_copy, true);
64954         return ret_ref;
64955 }
64956
64957 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_metadata(int64_t this_arg) {
64958         LDKUnsignedBolt12Invoice this_arg_conv;
64959         this_arg_conv.inner = untag_ptr(this_arg);
64960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64962         this_arg_conv.is_owned = false;
64963         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
64964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64966         return ret_arr;
64967 }
64968
64969 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_request_features(int64_t this_arg) {
64970         LDKUnsignedBolt12Invoice this_arg_conv;
64971         this_arg_conv.inner = untag_ptr(this_arg);
64972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64974         this_arg_conv.is_owned = false;
64975         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
64976         int64_t ret_ref = 0;
64977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64979         return ret_ref;
64980 }
64981
64982 int64_t  CS_LDK_UnsignedBolt12Invoice_quantity(int64_t this_arg) {
64983         LDKUnsignedBolt12Invoice this_arg_conv;
64984         this_arg_conv.inner = untag_ptr(this_arg);
64985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64987         this_arg_conv.is_owned = false;
64988         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64989         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
64990         int64_t ret_ref = tag_ptr(ret_copy, true);
64991         return ret_ref;
64992 }
64993
64994 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_id(int64_t this_arg) {
64995         LDKUnsignedBolt12Invoice this_arg_conv;
64996         this_arg_conv.inner = untag_ptr(this_arg);
64997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64999         this_arg_conv.is_owned = false;
65000         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65001         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
65002         return ret_arr;
65003 }
65004
65005 int64_t  CS_LDK_UnsignedBolt12Invoice_payer_note(int64_t this_arg) {
65006         LDKUnsignedBolt12Invoice this_arg_conv;
65007         this_arg_conv.inner = untag_ptr(this_arg);
65008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65010         this_arg_conv.is_owned = false;
65011         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
65012         int64_t ret_ref = 0;
65013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65015         return ret_ref;
65016 }
65017
65018 int64_t  CS_LDK_UnsignedBolt12Invoice_created_at(int64_t this_arg) {
65019         LDKUnsignedBolt12Invoice this_arg_conv;
65020         this_arg_conv.inner = untag_ptr(this_arg);
65021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65023         this_arg_conv.is_owned = false;
65024         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
65025         return ret_conv;
65026 }
65027
65028 int64_t  CS_LDK_UnsignedBolt12Invoice_relative_expiry(int64_t this_arg) {
65029         LDKUnsignedBolt12Invoice this_arg_conv;
65030         this_arg_conv.inner = untag_ptr(this_arg);
65031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65033         this_arg_conv.is_owned = false;
65034         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
65035         return ret_conv;
65036 }
65037
65038 jboolean  CS_LDK_UnsignedBolt12Invoice_is_expired(int64_t this_arg) {
65039         LDKUnsignedBolt12Invoice this_arg_conv;
65040         this_arg_conv.inner = untag_ptr(this_arg);
65041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65043         this_arg_conv.is_owned = false;
65044         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
65045         return ret_conv;
65046 }
65047
65048 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payment_hash(int64_t this_arg) {
65049         LDKUnsignedBolt12Invoice this_arg_conv;
65050         this_arg_conv.inner = untag_ptr(this_arg);
65051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65053         this_arg_conv.is_owned = false;
65054         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65055         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
65056         return ret_arr;
65057 }
65058
65059 int64_t  CS_LDK_UnsignedBolt12Invoice_amount_msats(int64_t this_arg) {
65060         LDKUnsignedBolt12Invoice this_arg_conv;
65061         this_arg_conv.inner = untag_ptr(this_arg);
65062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65064         this_arg_conv.is_owned = false;
65065         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
65066         return ret_conv;
65067 }
65068
65069 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_features(int64_t this_arg) {
65070         LDKUnsignedBolt12Invoice this_arg_conv;
65071         this_arg_conv.inner = untag_ptr(this_arg);
65072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65074         this_arg_conv.is_owned = false;
65075         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
65076         int64_t ret_ref = 0;
65077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65079         return ret_ref;
65080 }
65081
65082 int8_tArray  CS_LDK_UnsignedBolt12Invoice_signing_pubkey(int64_t this_arg) {
65083         LDKUnsignedBolt12Invoice this_arg_conv;
65084         this_arg_conv.inner = untag_ptr(this_arg);
65085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65087         this_arg_conv.is_owned = false;
65088         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65089         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
65090         return ret_arr;
65091 }
65092
65093 int64_t  CS_LDK_Bolt12Invoice_offer_chains(int64_t this_arg) {
65094         LDKBolt12Invoice this_arg_conv;
65095         this_arg_conv.inner = untag_ptr(this_arg);
65096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65098         this_arg_conv.is_owned = false;
65099         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
65100         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
65101         int64_t ret_ref = tag_ptr(ret_copy, true);
65102         return ret_ref;
65103 }
65104
65105 int8_tArray  CS_LDK_Bolt12Invoice_chain(int64_t this_arg) {
65106         LDKBolt12Invoice this_arg_conv;
65107         this_arg_conv.inner = untag_ptr(this_arg);
65108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65110         this_arg_conv.is_owned = false;
65111         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65112         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
65113         return ret_arr;
65114 }
65115
65116 int64_t  CS_LDK_Bolt12Invoice_metadata(int64_t this_arg) {
65117         LDKBolt12Invoice this_arg_conv;
65118         this_arg_conv.inner = untag_ptr(this_arg);
65119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65121         this_arg_conv.is_owned = false;
65122         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65123         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
65124         int64_t ret_ref = tag_ptr(ret_copy, true);
65125         return ret_ref;
65126 }
65127
65128 int64_t  CS_LDK_Bolt12Invoice_amount(int64_t this_arg) {
65129         LDKBolt12Invoice this_arg_conv;
65130         this_arg_conv.inner = untag_ptr(this_arg);
65131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65133         this_arg_conv.is_owned = false;
65134         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65135         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
65136         int64_t ret_ref = tag_ptr(ret_copy, true);
65137         return ret_ref;
65138 }
65139
65140 int64_t  CS_LDK_Bolt12Invoice_offer_features(int64_t this_arg) {
65141         LDKBolt12Invoice this_arg_conv;
65142         this_arg_conv.inner = untag_ptr(this_arg);
65143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65145         this_arg_conv.is_owned = false;
65146         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
65147         int64_t ret_ref = 0;
65148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65150         return ret_ref;
65151 }
65152
65153 int64_t  CS_LDK_Bolt12Invoice_description(int64_t this_arg) {
65154         LDKBolt12Invoice this_arg_conv;
65155         this_arg_conv.inner = untag_ptr(this_arg);
65156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65158         this_arg_conv.is_owned = false;
65159         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
65160         int64_t ret_ref = 0;
65161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65163         return ret_ref;
65164 }
65165
65166 int64_t  CS_LDK_Bolt12Invoice_absolute_expiry(int64_t this_arg) {
65167         LDKBolt12Invoice this_arg_conv;
65168         this_arg_conv.inner = untag_ptr(this_arg);
65169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65171         this_arg_conv.is_owned = false;
65172         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65173         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
65174         int64_t ret_ref = tag_ptr(ret_copy, true);
65175         return ret_ref;
65176 }
65177
65178 int64_t  CS_LDK_Bolt12Invoice_issuer(int64_t this_arg) {
65179         LDKBolt12Invoice this_arg_conv;
65180         this_arg_conv.inner = untag_ptr(this_arg);
65181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65183         this_arg_conv.is_owned = false;
65184         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
65185         int64_t ret_ref = 0;
65186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65188         return ret_ref;
65189 }
65190
65191 int64_tArray  CS_LDK_Bolt12Invoice_message_paths(int64_t this_arg) {
65192         LDKBolt12Invoice this_arg_conv;
65193         this_arg_conv.inner = untag_ptr(this_arg);
65194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65196         this_arg_conv.is_owned = false;
65197         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
65198         int64_tArray ret_arr = NULL;
65199         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65200         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65201         for (size_t n = 0; n < ret_var.datalen; n++) {
65202                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65203                 int64_t ret_conv_13_ref = 0;
65204                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65205                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65206                 ret_arr_ptr[n] = ret_conv_13_ref;
65207         }
65208         
65209         FREE(ret_var.data);
65210         return ret_arr;
65211 }
65212
65213 int64_t  CS_LDK_Bolt12Invoice_supported_quantity(int64_t this_arg) {
65214         LDKBolt12Invoice this_arg_conv;
65215         this_arg_conv.inner = untag_ptr(this_arg);
65216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65218         this_arg_conv.is_owned = false;
65219         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
65220         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
65221         int64_t ret_ref = tag_ptr(ret_copy, true);
65222         return ret_ref;
65223 }
65224
65225 int8_tArray  CS_LDK_Bolt12Invoice_payer_metadata(int64_t this_arg) {
65226         LDKBolt12Invoice this_arg_conv;
65227         this_arg_conv.inner = untag_ptr(this_arg);
65228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65230         this_arg_conv.is_owned = false;
65231         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
65232         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65233         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65234         return ret_arr;
65235 }
65236
65237 int64_t  CS_LDK_Bolt12Invoice_invoice_request_features(int64_t this_arg) {
65238         LDKBolt12Invoice this_arg_conv;
65239         this_arg_conv.inner = untag_ptr(this_arg);
65240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65242         this_arg_conv.is_owned = false;
65243         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
65244         int64_t ret_ref = 0;
65245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65247         return ret_ref;
65248 }
65249
65250 int64_t  CS_LDK_Bolt12Invoice_quantity(int64_t this_arg) {
65251         LDKBolt12Invoice this_arg_conv;
65252         this_arg_conv.inner = untag_ptr(this_arg);
65253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65255         this_arg_conv.is_owned = false;
65256         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65257         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
65258         int64_t ret_ref = tag_ptr(ret_copy, true);
65259         return ret_ref;
65260 }
65261
65262 int8_tArray  CS_LDK_Bolt12Invoice_payer_id(int64_t this_arg) {
65263         LDKBolt12Invoice this_arg_conv;
65264         this_arg_conv.inner = untag_ptr(this_arg);
65265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65267         this_arg_conv.is_owned = false;
65268         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65269         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
65270         return ret_arr;
65271 }
65272
65273 int64_t  CS_LDK_Bolt12Invoice_payer_note(int64_t this_arg) {
65274         LDKBolt12Invoice this_arg_conv;
65275         this_arg_conv.inner = untag_ptr(this_arg);
65276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65278         this_arg_conv.is_owned = false;
65279         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
65280         int64_t ret_ref = 0;
65281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65283         return ret_ref;
65284 }
65285
65286 int64_t  CS_LDK_Bolt12Invoice_created_at(int64_t this_arg) {
65287         LDKBolt12Invoice this_arg_conv;
65288         this_arg_conv.inner = untag_ptr(this_arg);
65289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65291         this_arg_conv.is_owned = false;
65292         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
65293         return ret_conv;
65294 }
65295
65296 int64_t  CS_LDK_Bolt12Invoice_relative_expiry(int64_t this_arg) {
65297         LDKBolt12Invoice this_arg_conv;
65298         this_arg_conv.inner = untag_ptr(this_arg);
65299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65301         this_arg_conv.is_owned = false;
65302         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
65303         return ret_conv;
65304 }
65305
65306 jboolean  CS_LDK_Bolt12Invoice_is_expired(int64_t this_arg) {
65307         LDKBolt12Invoice this_arg_conv;
65308         this_arg_conv.inner = untag_ptr(this_arg);
65309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65311         this_arg_conv.is_owned = false;
65312         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
65313         return ret_conv;
65314 }
65315
65316 int8_tArray  CS_LDK_Bolt12Invoice_payment_hash(int64_t this_arg) {
65317         LDKBolt12Invoice this_arg_conv;
65318         this_arg_conv.inner = untag_ptr(this_arg);
65319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65321         this_arg_conv.is_owned = false;
65322         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65323         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
65324         return ret_arr;
65325 }
65326
65327 int64_t  CS_LDK_Bolt12Invoice_amount_msats(int64_t this_arg) {
65328         LDKBolt12Invoice this_arg_conv;
65329         this_arg_conv.inner = untag_ptr(this_arg);
65330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65332         this_arg_conv.is_owned = false;
65333         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
65334         return ret_conv;
65335 }
65336
65337 int64_t  CS_LDK_Bolt12Invoice_invoice_features(int64_t this_arg) {
65338         LDKBolt12Invoice this_arg_conv;
65339         this_arg_conv.inner = untag_ptr(this_arg);
65340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65342         this_arg_conv.is_owned = false;
65343         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
65344         int64_t ret_ref = 0;
65345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65347         return ret_ref;
65348 }
65349
65350 int8_tArray  CS_LDK_Bolt12Invoice_signing_pubkey(int64_t this_arg) {
65351         LDKBolt12Invoice this_arg_conv;
65352         this_arg_conv.inner = untag_ptr(this_arg);
65353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65355         this_arg_conv.is_owned = false;
65356         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65357         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
65358         return ret_arr;
65359 }
65360
65361 int8_tArray  CS_LDK_Bolt12Invoice_signature(int64_t this_arg) {
65362         LDKBolt12Invoice this_arg_conv;
65363         this_arg_conv.inner = untag_ptr(this_arg);
65364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65366         this_arg_conv.is_owned = false;
65367         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
65368         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
65369         return ret_arr;
65370 }
65371
65372 int8_tArray  CS_LDK_Bolt12Invoice_signable_hash(int64_t this_arg) {
65373         LDKBolt12Invoice this_arg_conv;
65374         this_arg_conv.inner = untag_ptr(this_arg);
65375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65377         this_arg_conv.is_owned = false;
65378         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65379         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
65380         return ret_arr;
65381 }
65382
65383 int64_t  CS_LDK_Bolt12Invoice_verify(int64_t this_arg, int64_t key) {
65384         LDKBolt12Invoice this_arg_conv;
65385         this_arg_conv.inner = untag_ptr(this_arg);
65386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65388         this_arg_conv.is_owned = false;
65389         LDKExpandedKey key_conv;
65390         key_conv.inner = untag_ptr(key);
65391         key_conv.is_owned = ptr_is_owned(key);
65392         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
65393         key_conv.is_owned = false;
65394         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
65395         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
65396         return tag_ptr(ret_conv, true);
65397 }
65398
65399 int64_t  CS_LDK_Bolt12Invoice_hash(int64_t o) {
65400         LDKBolt12Invoice o_conv;
65401         o_conv.inner = untag_ptr(o);
65402         o_conv.is_owned = ptr_is_owned(o);
65403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65404         o_conv.is_owned = false;
65405         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
65406         return ret_conv;
65407 }
65408
65409 int8_tArray  CS_LDK_UnsignedBolt12Invoice_write(int64_t obj) {
65410         LDKUnsignedBolt12Invoice obj_conv;
65411         obj_conv.inner = untag_ptr(obj);
65412         obj_conv.is_owned = ptr_is_owned(obj);
65413         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65414         obj_conv.is_owned = false;
65415         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
65416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65418         CVec_u8Z_free(ret_var);
65419         return ret_arr;
65420 }
65421
65422 int8_tArray  CS_LDK_Bolt12Invoice_write(int64_t obj) {
65423         LDKBolt12Invoice obj_conv;
65424         obj_conv.inner = untag_ptr(obj);
65425         obj_conv.is_owned = ptr_is_owned(obj);
65426         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65427         obj_conv.is_owned = false;
65428         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
65429         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65430         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65431         CVec_u8Z_free(ret_var);
65432         return ret_arr;
65433 }
65434
65435 void  CS_LDK_BlindedPayInfo_free(int64_t this_obj) {
65436         LDKBlindedPayInfo this_obj_conv;
65437         this_obj_conv.inner = untag_ptr(this_obj);
65438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65440         BlindedPayInfo_free(this_obj_conv);
65441 }
65442
65443 int32_t  CS_LDK_BlindedPayInfo_get_fee_base_msat(int64_t this_ptr) {
65444         LDKBlindedPayInfo this_ptr_conv;
65445         this_ptr_conv.inner = untag_ptr(this_ptr);
65446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65448         this_ptr_conv.is_owned = false;
65449         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
65450         return ret_conv;
65451 }
65452
65453 void  CS_LDK_BlindedPayInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
65454         LDKBlindedPayInfo this_ptr_conv;
65455         this_ptr_conv.inner = untag_ptr(this_ptr);
65456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65458         this_ptr_conv.is_owned = false;
65459         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
65460 }
65461
65462 int32_t  CS_LDK_BlindedPayInfo_get_fee_proportional_millionths(int64_t this_ptr) {
65463         LDKBlindedPayInfo this_ptr_conv;
65464         this_ptr_conv.inner = untag_ptr(this_ptr);
65465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65467         this_ptr_conv.is_owned = false;
65468         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
65469         return ret_conv;
65470 }
65471
65472 void  CS_LDK_BlindedPayInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
65473         LDKBlindedPayInfo this_ptr_conv;
65474         this_ptr_conv.inner = untag_ptr(this_ptr);
65475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65477         this_ptr_conv.is_owned = false;
65478         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
65479 }
65480
65481 int16_t  CS_LDK_BlindedPayInfo_get_cltv_expiry_delta(int64_t this_ptr) {
65482         LDKBlindedPayInfo this_ptr_conv;
65483         this_ptr_conv.inner = untag_ptr(this_ptr);
65484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65486         this_ptr_conv.is_owned = false;
65487         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
65488         return ret_conv;
65489 }
65490
65491 void  CS_LDK_BlindedPayInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
65492         LDKBlindedPayInfo this_ptr_conv;
65493         this_ptr_conv.inner = untag_ptr(this_ptr);
65494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65496         this_ptr_conv.is_owned = false;
65497         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
65498 }
65499
65500 int64_t  CS_LDK_BlindedPayInfo_get_htlc_minimum_msat(int64_t this_ptr) {
65501         LDKBlindedPayInfo this_ptr_conv;
65502         this_ptr_conv.inner = untag_ptr(this_ptr);
65503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65505         this_ptr_conv.is_owned = false;
65506         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
65507         return ret_conv;
65508 }
65509
65510 void  CS_LDK_BlindedPayInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
65511         LDKBlindedPayInfo this_ptr_conv;
65512         this_ptr_conv.inner = untag_ptr(this_ptr);
65513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65515         this_ptr_conv.is_owned = false;
65516         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
65517 }
65518
65519 int64_t  CS_LDK_BlindedPayInfo_get_htlc_maximum_msat(int64_t this_ptr) {
65520         LDKBlindedPayInfo this_ptr_conv;
65521         this_ptr_conv.inner = untag_ptr(this_ptr);
65522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65524         this_ptr_conv.is_owned = false;
65525         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
65526         return ret_conv;
65527 }
65528
65529 void  CS_LDK_BlindedPayInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
65530         LDKBlindedPayInfo this_ptr_conv;
65531         this_ptr_conv.inner = untag_ptr(this_ptr);
65532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65534         this_ptr_conv.is_owned = false;
65535         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
65536 }
65537
65538 int64_t  CS_LDK_BlindedPayInfo_get_features(int64_t this_ptr) {
65539         LDKBlindedPayInfo this_ptr_conv;
65540         this_ptr_conv.inner = untag_ptr(this_ptr);
65541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65543         this_ptr_conv.is_owned = false;
65544         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
65545         int64_t ret_ref = 0;
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65548         return ret_ref;
65549 }
65550
65551 void  CS_LDK_BlindedPayInfo_set_features(int64_t this_ptr, int64_t val) {
65552         LDKBlindedPayInfo this_ptr_conv;
65553         this_ptr_conv.inner = untag_ptr(this_ptr);
65554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65556         this_ptr_conv.is_owned = false;
65557         LDKBlindedHopFeatures val_conv;
65558         val_conv.inner = untag_ptr(val);
65559         val_conv.is_owned = ptr_is_owned(val);
65560         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65561         val_conv = BlindedHopFeatures_clone(&val_conv);
65562         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
65563 }
65564
65565 int64_t  CS_LDK_BlindedPayInfo_new(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) {
65566         LDKBlindedHopFeatures features_arg_conv;
65567         features_arg_conv.inner = untag_ptr(features_arg);
65568         features_arg_conv.is_owned = ptr_is_owned(features_arg);
65569         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
65570         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
65571         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);
65572         int64_t ret_ref = 0;
65573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65575         return ret_ref;
65576 }
65577
65578 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
65579         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
65580         int64_t ret_ref = 0;
65581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65583         return ret_ref;
65584 }
65585 int64_t  CS_LDK_BlindedPayInfo_clone_ptr(int64_t arg) {
65586         LDKBlindedPayInfo arg_conv;
65587         arg_conv.inner = untag_ptr(arg);
65588         arg_conv.is_owned = ptr_is_owned(arg);
65589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65590         arg_conv.is_owned = false;
65591         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
65592         return ret_conv;
65593 }
65594
65595 int64_t  CS_LDK_BlindedPayInfo_clone(int64_t orig) {
65596         LDKBlindedPayInfo orig_conv;
65597         orig_conv.inner = untag_ptr(orig);
65598         orig_conv.is_owned = ptr_is_owned(orig);
65599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65600         orig_conv.is_owned = false;
65601         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
65602         int64_t ret_ref = 0;
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65605         return ret_ref;
65606 }
65607
65608 int64_t  CS_LDK_BlindedPayInfo_hash(int64_t o) {
65609         LDKBlindedPayInfo o_conv;
65610         o_conv.inner = untag_ptr(o);
65611         o_conv.is_owned = ptr_is_owned(o);
65612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65613         o_conv.is_owned = false;
65614         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
65615         return ret_conv;
65616 }
65617
65618 jboolean  CS_LDK_BlindedPayInfo_eq(int64_t a, int64_t b) {
65619         LDKBlindedPayInfo a_conv;
65620         a_conv.inner = untag_ptr(a);
65621         a_conv.is_owned = ptr_is_owned(a);
65622         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65623         a_conv.is_owned = false;
65624         LDKBlindedPayInfo b_conv;
65625         b_conv.inner = untag_ptr(b);
65626         b_conv.is_owned = ptr_is_owned(b);
65627         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65628         b_conv.is_owned = false;
65629         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
65630         return ret_conv;
65631 }
65632
65633 int8_tArray  CS_LDK_BlindedPayInfo_write(int64_t obj) {
65634         LDKBlindedPayInfo obj_conv;
65635         obj_conv.inner = untag_ptr(obj);
65636         obj_conv.is_owned = ptr_is_owned(obj);
65637         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65638         obj_conv.is_owned = false;
65639         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
65640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65642         CVec_u8Z_free(ret_var);
65643         return ret_arr;
65644 }
65645
65646 int64_t  CS_LDK_BlindedPayInfo_read(int8_tArray ser) {
65647         LDKu8slice ser_ref;
65648         ser_ref.datalen = ser->arr_len;
65649         ser_ref.data = ser->elems;
65650         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
65651         *ret_conv = BlindedPayInfo_read(ser_ref);
65652         FREE(ser);
65653         return tag_ptr(ret_conv, true);
65654 }
65655
65656 void  CS_LDK_InvoiceError_free(int64_t this_obj) {
65657         LDKInvoiceError this_obj_conv;
65658         this_obj_conv.inner = untag_ptr(this_obj);
65659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65661         InvoiceError_free(this_obj_conv);
65662 }
65663
65664 int64_t  CS_LDK_InvoiceError_get_erroneous_field(int64_t this_ptr) {
65665         LDKInvoiceError this_ptr_conv;
65666         this_ptr_conv.inner = untag_ptr(this_ptr);
65667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65669         this_ptr_conv.is_owned = false;
65670         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
65671         int64_t ret_ref = 0;
65672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65674         return ret_ref;
65675 }
65676
65677 void  CS_LDK_InvoiceError_set_erroneous_field(int64_t this_ptr, int64_t val) {
65678         LDKInvoiceError this_ptr_conv;
65679         this_ptr_conv.inner = untag_ptr(this_ptr);
65680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65682         this_ptr_conv.is_owned = false;
65683         LDKErroneousField val_conv;
65684         val_conv.inner = untag_ptr(val);
65685         val_conv.is_owned = ptr_is_owned(val);
65686         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65687         val_conv = ErroneousField_clone(&val_conv);
65688         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
65689 }
65690
65691 int64_t  CS_LDK_InvoiceError_get_message(int64_t this_ptr) {
65692         LDKInvoiceError this_ptr_conv;
65693         this_ptr_conv.inner = untag_ptr(this_ptr);
65694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65696         this_ptr_conv.is_owned = false;
65697         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
65698         int64_t ret_ref = 0;
65699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65701         return ret_ref;
65702 }
65703
65704 void  CS_LDK_InvoiceError_set_message(int64_t this_ptr, int64_t val) {
65705         LDKInvoiceError this_ptr_conv;
65706         this_ptr_conv.inner = untag_ptr(this_ptr);
65707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65709         this_ptr_conv.is_owned = false;
65710         LDKUntrustedString val_conv;
65711         val_conv.inner = untag_ptr(val);
65712         val_conv.is_owned = ptr_is_owned(val);
65713         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65714         val_conv = UntrustedString_clone(&val_conv);
65715         InvoiceError_set_message(&this_ptr_conv, val_conv);
65716 }
65717
65718 int64_t  CS_LDK_InvoiceError_new(int64_t erroneous_field_arg, int64_t message_arg) {
65719         LDKErroneousField erroneous_field_arg_conv;
65720         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
65721         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
65722         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
65723         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
65724         LDKUntrustedString message_arg_conv;
65725         message_arg_conv.inner = untag_ptr(message_arg);
65726         message_arg_conv.is_owned = ptr_is_owned(message_arg);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
65728         message_arg_conv = UntrustedString_clone(&message_arg_conv);
65729         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
65730         int64_t ret_ref = 0;
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65733         return ret_ref;
65734 }
65735
65736 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
65737         LDKInvoiceError ret_var = InvoiceError_clone(arg);
65738         int64_t ret_ref = 0;
65739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65741         return ret_ref;
65742 }
65743 int64_t  CS_LDK_InvoiceError_clone_ptr(int64_t arg) {
65744         LDKInvoiceError arg_conv;
65745         arg_conv.inner = untag_ptr(arg);
65746         arg_conv.is_owned = ptr_is_owned(arg);
65747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65748         arg_conv.is_owned = false;
65749         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
65750         return ret_conv;
65751 }
65752
65753 int64_t  CS_LDK_InvoiceError_clone(int64_t orig) {
65754         LDKInvoiceError orig_conv;
65755         orig_conv.inner = untag_ptr(orig);
65756         orig_conv.is_owned = ptr_is_owned(orig);
65757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65758         orig_conv.is_owned = false;
65759         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
65760         int64_t ret_ref = 0;
65761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65763         return ret_ref;
65764 }
65765
65766 void  CS_LDK_ErroneousField_free(int64_t this_obj) {
65767         LDKErroneousField this_obj_conv;
65768         this_obj_conv.inner = untag_ptr(this_obj);
65769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65771         ErroneousField_free(this_obj_conv);
65772 }
65773
65774 int64_t  CS_LDK_ErroneousField_get_tlv_fieldnum(int64_t this_ptr) {
65775         LDKErroneousField this_ptr_conv;
65776         this_ptr_conv.inner = untag_ptr(this_ptr);
65777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65779         this_ptr_conv.is_owned = false;
65780         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
65781         return ret_conv;
65782 }
65783
65784 void  CS_LDK_ErroneousField_set_tlv_fieldnum(int64_t this_ptr, int64_t val) {
65785         LDKErroneousField this_ptr_conv;
65786         this_ptr_conv.inner = untag_ptr(this_ptr);
65787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65789         this_ptr_conv.is_owned = false;
65790         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
65791 }
65792
65793 int64_t  CS_LDK_ErroneousField_get_suggested_value(int64_t this_ptr) {
65794         LDKErroneousField this_ptr_conv;
65795         this_ptr_conv.inner = untag_ptr(this_ptr);
65796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65798         this_ptr_conv.is_owned = false;
65799         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65800         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
65801         int64_t ret_ref = tag_ptr(ret_copy, true);
65802         return ret_ref;
65803 }
65804
65805 void  CS_LDK_ErroneousField_set_suggested_value(int64_t this_ptr, int64_t val) {
65806         LDKErroneousField this_ptr_conv;
65807         this_ptr_conv.inner = untag_ptr(this_ptr);
65808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65810         this_ptr_conv.is_owned = false;
65811         void* val_ptr = untag_ptr(val);
65812         CHECK_ACCESS(val_ptr);
65813         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
65814         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
65815         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
65816 }
65817
65818 int64_t  CS_LDK_ErroneousField_new(int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
65819         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
65820         CHECK_ACCESS(suggested_value_arg_ptr);
65821         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
65822         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
65823         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
65824         int64_t ret_ref = 0;
65825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65827         return ret_ref;
65828 }
65829
65830 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
65831         LDKErroneousField ret_var = ErroneousField_clone(arg);
65832         int64_t ret_ref = 0;
65833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65835         return ret_ref;
65836 }
65837 int64_t  CS_LDK_ErroneousField_clone_ptr(int64_t arg) {
65838         LDKErroneousField arg_conv;
65839         arg_conv.inner = untag_ptr(arg);
65840         arg_conv.is_owned = ptr_is_owned(arg);
65841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65842         arg_conv.is_owned = false;
65843         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
65844         return ret_conv;
65845 }
65846
65847 int64_t  CS_LDK_ErroneousField_clone(int64_t orig) {
65848         LDKErroneousField orig_conv;
65849         orig_conv.inner = untag_ptr(orig);
65850         orig_conv.is_owned = ptr_is_owned(orig);
65851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65852         orig_conv.is_owned = false;
65853         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
65854         int64_t ret_ref = 0;
65855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65857         return ret_ref;
65858 }
65859
65860 int64_t  CS_LDK_InvoiceError_from_string(jstring s) {
65861         LDKStr s_conv = str_ref_to_owned_c(s);
65862         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
65863         int64_t ret_ref = 0;
65864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65866         return ret_ref;
65867 }
65868
65869 int8_tArray  CS_LDK_InvoiceError_write(int64_t obj) {
65870         LDKInvoiceError obj_conv;
65871         obj_conv.inner = untag_ptr(obj);
65872         obj_conv.is_owned = ptr_is_owned(obj);
65873         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65874         obj_conv.is_owned = false;
65875         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
65876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65878         CVec_u8Z_free(ret_var);
65879         return ret_arr;
65880 }
65881
65882 int64_t  CS_LDK_InvoiceError_read(int8_tArray ser) {
65883         LDKu8slice ser_ref;
65884         ser_ref.datalen = ser->arr_len;
65885         ser_ref.data = ser->elems;
65886         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
65887         *ret_conv = InvoiceError_read(ser_ref);
65888         FREE(ser);
65889         return tag_ptr(ret_conv, true);
65890 }
65891
65892 void  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_free(int64_t this_obj) {
65893         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
65894         this_obj_conv.inner = untag_ptr(this_obj);
65895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65897         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
65898 }
65899
65900 void  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_free(int64_t this_obj) {
65901         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
65902         this_obj_conv.inner = untag_ptr(this_obj);
65903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65905         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
65906 }
65907
65908 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_build(int64_t this_arg) {
65909         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65910         this_arg_conv.inner = untag_ptr(this_arg);
65911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65913         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65914         
65915         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
65916         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
65917         return tag_ptr(ret_conv, true);
65918 }
65919
65920 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_chain(int64_t this_arg, int32_t network) {
65921         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65922         this_arg_conv.inner = untag_ptr(this_arg);
65923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65925         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65926         
65927         LDKNetwork network_conv = LDKNetwork_from_cs(network);
65928         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65929         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
65930         return tag_ptr(ret_conv, true);
65931 }
65932
65933 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
65934         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65935         this_arg_conv.inner = untag_ptr(this_arg);
65936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65938         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65939         
65940         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65941         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
65942         return tag_ptr(ret_conv, true);
65943 }
65944
65945 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_quantity(int64_t this_arg, int64_t quantity) {
65946         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65947         this_arg_conv.inner = untag_ptr(this_arg);
65948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65950         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65951         
65952         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65953         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
65954         return tag_ptr(ret_conv, true);
65955 }
65956
65957 void  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_payer_note(int64_t this_arg, jstring payer_note) {
65958         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
65959         this_arg_conv.inner = untag_ptr(this_arg);
65960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65962         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
65963         
65964         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
65965         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
65966 }
65967
65968 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(int64_t this_arg) {
65969         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65970         this_arg_conv.inner = untag_ptr(this_arg);
65971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65973         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65974         
65975         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
65976         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
65977         return tag_ptr(ret_conv, true);
65978 }
65979
65980 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_chain(int64_t this_arg, int32_t network) {
65981         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65982         this_arg_conv.inner = untag_ptr(this_arg);
65983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65985         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65986         
65987         LDKNetwork network_conv = LDKNetwork_from_cs(network);
65988         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65989         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
65990         return tag_ptr(ret_conv, true);
65991 }
65992
65993 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
65994         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
65995         this_arg_conv.inner = untag_ptr(this_arg);
65996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65998         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
65999         
66000         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66001         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
66002         return tag_ptr(ret_conv, true);
66003 }
66004
66005 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_quantity(int64_t this_arg, int64_t quantity) {
66006         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66007         this_arg_conv.inner = untag_ptr(this_arg);
66008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66010         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66011         
66012         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
66013         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
66014         return tag_ptr(ret_conv, true);
66015 }
66016
66017 void  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_payer_note(int64_t this_arg, jstring payer_note) {
66018         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
66019         this_arg_conv.inner = untag_ptr(this_arg);
66020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66022         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
66023         
66024         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
66025         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
66026 }
66027
66028 void  CS_LDK_UnsignedInvoiceRequest_free(int64_t this_obj) {
66029         LDKUnsignedInvoiceRequest this_obj_conv;
66030         this_obj_conv.inner = untag_ptr(this_obj);
66031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66033         UnsignedInvoiceRequest_free(this_obj_conv);
66034 }
66035
66036 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
66037         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
66038         int64_t ret_ref = 0;
66039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66041         return ret_ref;
66042 }
66043 int64_t  CS_LDK_UnsignedInvoiceRequest_clone_ptr(int64_t arg) {
66044         LDKUnsignedInvoiceRequest arg_conv;
66045         arg_conv.inner = untag_ptr(arg);
66046         arg_conv.is_owned = ptr_is_owned(arg);
66047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66048         arg_conv.is_owned = false;
66049         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
66050         return ret_conv;
66051 }
66052
66053 int64_t  CS_LDK_UnsignedInvoiceRequest_clone(int64_t orig) {
66054         LDKUnsignedInvoiceRequest orig_conv;
66055         orig_conv.inner = untag_ptr(orig);
66056         orig_conv.is_owned = ptr_is_owned(orig);
66057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66058         orig_conv.is_owned = false;
66059         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
66060         int64_t ret_ref = 0;
66061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66063         return ret_ref;
66064 }
66065
66066 void  CS_LDK_SignInvoiceRequestFn_free(int64_t this_ptr) {
66067         if (!ptr_is_owned(this_ptr)) return;
66068         void* this_ptr_ptr = untag_ptr(this_ptr);
66069         CHECK_ACCESS(this_ptr_ptr);
66070         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
66071         FREE(untag_ptr(this_ptr));
66072         SignInvoiceRequestFn_free(this_ptr_conv);
66073 }
66074
66075 int64_t  CS_LDK_UnsignedInvoiceRequest_tagged_hash(int64_t this_arg) {
66076         LDKUnsignedInvoiceRequest this_arg_conv;
66077         this_arg_conv.inner = untag_ptr(this_arg);
66078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66080         this_arg_conv.is_owned = false;
66081         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
66082         int64_t ret_ref = 0;
66083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66085         return ret_ref;
66086 }
66087
66088 void  CS_LDK_InvoiceRequest_free(int64_t this_obj) {
66089         LDKInvoiceRequest this_obj_conv;
66090         this_obj_conv.inner = untag_ptr(this_obj);
66091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66093         InvoiceRequest_free(this_obj_conv);
66094 }
66095
66096 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
66097         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
66098         int64_t ret_ref = 0;
66099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66101         return ret_ref;
66102 }
66103 int64_t  CS_LDK_InvoiceRequest_clone_ptr(int64_t arg) {
66104         LDKInvoiceRequest arg_conv;
66105         arg_conv.inner = untag_ptr(arg);
66106         arg_conv.is_owned = ptr_is_owned(arg);
66107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66108         arg_conv.is_owned = false;
66109         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
66110         return ret_conv;
66111 }
66112
66113 int64_t  CS_LDK_InvoiceRequest_clone(int64_t orig) {
66114         LDKInvoiceRequest orig_conv;
66115         orig_conv.inner = untag_ptr(orig);
66116         orig_conv.is_owned = ptr_is_owned(orig);
66117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66118         orig_conv.is_owned = false;
66119         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
66120         int64_t ret_ref = 0;
66121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66123         return ret_ref;
66124 }
66125
66126 void  CS_LDK_VerifiedInvoiceRequest_free(int64_t this_obj) {
66127         LDKVerifiedInvoiceRequest this_obj_conv;
66128         this_obj_conv.inner = untag_ptr(this_obj);
66129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66131         VerifiedInvoiceRequest_free(this_obj_conv);
66132 }
66133
66134 int64_t  CS_LDK_VerifiedInvoiceRequest_get_offer_id(int64_t this_ptr) {
66135         LDKVerifiedInvoiceRequest this_ptr_conv;
66136         this_ptr_conv.inner = untag_ptr(this_ptr);
66137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66139         this_ptr_conv.is_owned = false;
66140         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
66141         int64_t ret_ref = 0;
66142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66144         return ret_ref;
66145 }
66146
66147 void  CS_LDK_VerifiedInvoiceRequest_set_offer_id(int64_t this_ptr, int64_t val) {
66148         LDKVerifiedInvoiceRequest this_ptr_conv;
66149         this_ptr_conv.inner = untag_ptr(this_ptr);
66150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66152         this_ptr_conv.is_owned = false;
66153         LDKOfferId val_conv;
66154         val_conv.inner = untag_ptr(val);
66155         val_conv.is_owned = ptr_is_owned(val);
66156         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66157         val_conv = OfferId_clone(&val_conv);
66158         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
66159 }
66160
66161 int64_t  CS_LDK_VerifiedInvoiceRequest_get_keys(int64_t this_ptr) {
66162         LDKVerifiedInvoiceRequest this_ptr_conv;
66163         this_ptr_conv.inner = untag_ptr(this_ptr);
66164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66166         this_ptr_conv.is_owned = false;
66167         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
66168         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
66169         int64_t ret_ref = tag_ptr(ret_copy, true);
66170         return ret_ref;
66171 }
66172
66173 void  CS_LDK_VerifiedInvoiceRequest_set_keys(int64_t this_ptr, int64_t val) {
66174         LDKVerifiedInvoiceRequest this_ptr_conv;
66175         this_ptr_conv.inner = untag_ptr(this_ptr);
66176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66178         this_ptr_conv.is_owned = false;
66179         void* val_ptr = untag_ptr(val);
66180         CHECK_ACCESS(val_ptr);
66181         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
66182         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
66183         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
66184 }
66185
66186 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
66187         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
66188         int64_t ret_ref = 0;
66189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66191         return ret_ref;
66192 }
66193 int64_t  CS_LDK_VerifiedInvoiceRequest_clone_ptr(int64_t arg) {
66194         LDKVerifiedInvoiceRequest arg_conv;
66195         arg_conv.inner = untag_ptr(arg);
66196         arg_conv.is_owned = ptr_is_owned(arg);
66197         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66198         arg_conv.is_owned = false;
66199         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
66200         return ret_conv;
66201 }
66202
66203 int64_t  CS_LDK_VerifiedInvoiceRequest_clone(int64_t orig) {
66204         LDKVerifiedInvoiceRequest orig_conv;
66205         orig_conv.inner = untag_ptr(orig);
66206         orig_conv.is_owned = ptr_is_owned(orig);
66207         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66208         orig_conv.is_owned = false;
66209         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
66210         int64_t ret_ref = 0;
66211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66213         return ret_ref;
66214 }
66215
66216 ptrArray  CS_LDK_UnsignedInvoiceRequest_chains(int64_t this_arg) {
66217         LDKUnsignedInvoiceRequest 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         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
66223         ptrArray ret_arr = NULL;
66224         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66225         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66226         for (size_t i = 0; i < ret_var.datalen; i++) {
66227                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
66228                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
66229                 ret_arr_ptr[i] = ret_conv_8_arr;
66230         }
66231         
66232         FREE(ret_var.data);
66233         return ret_arr;
66234 }
66235
66236 int64_t  CS_LDK_UnsignedInvoiceRequest_metadata(int64_t this_arg) {
66237         LDKUnsignedInvoiceRequest 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66243         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
66244         int64_t ret_ref = tag_ptr(ret_copy, true);
66245         return ret_ref;
66246 }
66247
66248 int64_t  CS_LDK_UnsignedInvoiceRequest_amount(int64_t this_arg) {
66249         LDKUnsignedInvoiceRequest this_arg_conv;
66250         this_arg_conv.inner = untag_ptr(this_arg);
66251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66253         this_arg_conv.is_owned = false;
66254         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66255         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
66256         int64_t ret_ref = tag_ptr(ret_copy, true);
66257         return ret_ref;
66258 }
66259
66260 int64_t  CS_LDK_UnsignedInvoiceRequest_description(int64_t this_arg) {
66261         LDKUnsignedInvoiceRequest this_arg_conv;
66262         this_arg_conv.inner = untag_ptr(this_arg);
66263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66265         this_arg_conv.is_owned = false;
66266         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
66267         int64_t ret_ref = 0;
66268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66270         return ret_ref;
66271 }
66272
66273 int64_t  CS_LDK_UnsignedInvoiceRequest_offer_features(int64_t this_arg) {
66274         LDKUnsignedInvoiceRequest this_arg_conv;
66275         this_arg_conv.inner = untag_ptr(this_arg);
66276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66278         this_arg_conv.is_owned = false;
66279         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
66280         int64_t ret_ref = 0;
66281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66283         return ret_ref;
66284 }
66285
66286 int64_t  CS_LDK_UnsignedInvoiceRequest_absolute_expiry(int64_t this_arg) {
66287         LDKUnsignedInvoiceRequest this_arg_conv;
66288         this_arg_conv.inner = untag_ptr(this_arg);
66289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66291         this_arg_conv.is_owned = false;
66292         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66293         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
66294         int64_t ret_ref = tag_ptr(ret_copy, true);
66295         return ret_ref;
66296 }
66297
66298 int64_t  CS_LDK_UnsignedInvoiceRequest_issuer(int64_t this_arg) {
66299         LDKUnsignedInvoiceRequest this_arg_conv;
66300         this_arg_conv.inner = untag_ptr(this_arg);
66301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66303         this_arg_conv.is_owned = false;
66304         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
66305         int64_t ret_ref = 0;
66306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66308         return ret_ref;
66309 }
66310
66311 int64_tArray  CS_LDK_UnsignedInvoiceRequest_paths(int64_t this_arg) {
66312         LDKUnsignedInvoiceRequest this_arg_conv;
66313         this_arg_conv.inner = untag_ptr(this_arg);
66314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66316         this_arg_conv.is_owned = false;
66317         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
66318         int64_tArray ret_arr = NULL;
66319         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66320         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66321         for (size_t n = 0; n < ret_var.datalen; n++) {
66322                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66323                 int64_t ret_conv_13_ref = 0;
66324                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66325                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66326                 ret_arr_ptr[n] = ret_conv_13_ref;
66327         }
66328         
66329         FREE(ret_var.data);
66330         return ret_arr;
66331 }
66332
66333 int64_t  CS_LDK_UnsignedInvoiceRequest_supported_quantity(int64_t this_arg) {
66334         LDKUnsignedInvoiceRequest 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         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66340         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
66341         int64_t ret_ref = tag_ptr(ret_copy, true);
66342         return ret_ref;
66343 }
66344
66345 int8_tArray  CS_LDK_UnsignedInvoiceRequest_signing_pubkey(int64_t this_arg) {
66346         LDKUnsignedInvoiceRequest this_arg_conv;
66347         this_arg_conv.inner = untag_ptr(this_arg);
66348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66350         this_arg_conv.is_owned = false;
66351         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66352         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66353         return ret_arr;
66354 }
66355
66356 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_metadata(int64_t this_arg) {
66357         LDKUnsignedInvoiceRequest 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         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
66363         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66364         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66365         return ret_arr;
66366 }
66367
66368 int8_tArray  CS_LDK_UnsignedInvoiceRequest_chain(int64_t this_arg) {
66369         LDKUnsignedInvoiceRequest 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66375         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
66376         return ret_arr;
66377 }
66378
66379 int64_t  CS_LDK_UnsignedInvoiceRequest_amount_msats(int64_t this_arg) {
66380         LDKUnsignedInvoiceRequest this_arg_conv;
66381         this_arg_conv.inner = untag_ptr(this_arg);
66382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66384         this_arg_conv.is_owned = false;
66385         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66386         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
66387         int64_t ret_ref = tag_ptr(ret_copy, true);
66388         return ret_ref;
66389 }
66390
66391 int64_t  CS_LDK_UnsignedInvoiceRequest_invoice_request_features(int64_t this_arg) {
66392         LDKUnsignedInvoiceRequest this_arg_conv;
66393         this_arg_conv.inner = untag_ptr(this_arg);
66394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66396         this_arg_conv.is_owned = false;
66397         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
66398         int64_t ret_ref = 0;
66399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66401         return ret_ref;
66402 }
66403
66404 int64_t  CS_LDK_UnsignedInvoiceRequest_quantity(int64_t this_arg) {
66405         LDKUnsignedInvoiceRequest this_arg_conv;
66406         this_arg_conv.inner = untag_ptr(this_arg);
66407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66409         this_arg_conv.is_owned = false;
66410         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66411         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
66412         int64_t ret_ref = tag_ptr(ret_copy, true);
66413         return ret_ref;
66414 }
66415
66416 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_id(int64_t this_arg) {
66417         LDKUnsignedInvoiceRequest this_arg_conv;
66418         this_arg_conv.inner = untag_ptr(this_arg);
66419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66421         this_arg_conv.is_owned = false;
66422         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66423         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66424         return ret_arr;
66425 }
66426
66427 int64_t  CS_LDK_UnsignedInvoiceRequest_payer_note(int64_t this_arg) {
66428         LDKUnsignedInvoiceRequest this_arg_conv;
66429         this_arg_conv.inner = untag_ptr(this_arg);
66430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66432         this_arg_conv.is_owned = false;
66433         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
66434         int64_t ret_ref = 0;
66435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66437         return ret_ref;
66438 }
66439
66440 ptrArray  CS_LDK_InvoiceRequest_chains(int64_t this_arg) {
66441         LDKInvoiceRequest this_arg_conv;
66442         this_arg_conv.inner = untag_ptr(this_arg);
66443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66445         this_arg_conv.is_owned = false;
66446         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
66447         ptrArray ret_arr = NULL;
66448         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66449         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66450         for (size_t i = 0; i < ret_var.datalen; i++) {
66451                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
66452                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
66453                 ret_arr_ptr[i] = ret_conv_8_arr;
66454         }
66455         
66456         FREE(ret_var.data);
66457         return ret_arr;
66458 }
66459
66460 int64_t  CS_LDK_InvoiceRequest_metadata(int64_t this_arg) {
66461         LDKInvoiceRequest this_arg_conv;
66462         this_arg_conv.inner = untag_ptr(this_arg);
66463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66465         this_arg_conv.is_owned = false;
66466         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66467         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
66468         int64_t ret_ref = tag_ptr(ret_copy, true);
66469         return ret_ref;
66470 }
66471
66472 int64_t  CS_LDK_InvoiceRequest_amount(int64_t this_arg) {
66473         LDKInvoiceRequest this_arg_conv;
66474         this_arg_conv.inner = untag_ptr(this_arg);
66475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66477         this_arg_conv.is_owned = false;
66478         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66479         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
66480         int64_t ret_ref = tag_ptr(ret_copy, true);
66481         return ret_ref;
66482 }
66483
66484 int64_t  CS_LDK_InvoiceRequest_description(int64_t this_arg) {
66485         LDKInvoiceRequest this_arg_conv;
66486         this_arg_conv.inner = untag_ptr(this_arg);
66487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66489         this_arg_conv.is_owned = false;
66490         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
66491         int64_t ret_ref = 0;
66492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66494         return ret_ref;
66495 }
66496
66497 int64_t  CS_LDK_InvoiceRequest_offer_features(int64_t this_arg) {
66498         LDKInvoiceRequest this_arg_conv;
66499         this_arg_conv.inner = untag_ptr(this_arg);
66500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66502         this_arg_conv.is_owned = false;
66503         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
66504         int64_t ret_ref = 0;
66505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66507         return ret_ref;
66508 }
66509
66510 int64_t  CS_LDK_InvoiceRequest_absolute_expiry(int64_t this_arg) {
66511         LDKInvoiceRequest this_arg_conv;
66512         this_arg_conv.inner = untag_ptr(this_arg);
66513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66515         this_arg_conv.is_owned = false;
66516         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66517         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
66518         int64_t ret_ref = tag_ptr(ret_copy, true);
66519         return ret_ref;
66520 }
66521
66522 int64_t  CS_LDK_InvoiceRequest_issuer(int64_t this_arg) {
66523         LDKInvoiceRequest this_arg_conv;
66524         this_arg_conv.inner = untag_ptr(this_arg);
66525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66527         this_arg_conv.is_owned = false;
66528         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
66529         int64_t ret_ref = 0;
66530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66532         return ret_ref;
66533 }
66534
66535 int64_tArray  CS_LDK_InvoiceRequest_paths(int64_t this_arg) {
66536         LDKInvoiceRequest this_arg_conv;
66537         this_arg_conv.inner = untag_ptr(this_arg);
66538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66540         this_arg_conv.is_owned = false;
66541         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
66542         int64_tArray ret_arr = NULL;
66543         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66544         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66545         for (size_t n = 0; n < ret_var.datalen; n++) {
66546                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66547                 int64_t ret_conv_13_ref = 0;
66548                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66549                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66550                 ret_arr_ptr[n] = ret_conv_13_ref;
66551         }
66552         
66553         FREE(ret_var.data);
66554         return ret_arr;
66555 }
66556
66557 int64_t  CS_LDK_InvoiceRequest_supported_quantity(int64_t this_arg) {
66558         LDKInvoiceRequest this_arg_conv;
66559         this_arg_conv.inner = untag_ptr(this_arg);
66560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66562         this_arg_conv.is_owned = false;
66563         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66564         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
66565         int64_t ret_ref = tag_ptr(ret_copy, true);
66566         return ret_ref;
66567 }
66568
66569 int8_tArray  CS_LDK_InvoiceRequest_signing_pubkey(int64_t this_arg) {
66570         LDKInvoiceRequest this_arg_conv;
66571         this_arg_conv.inner = untag_ptr(this_arg);
66572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66574         this_arg_conv.is_owned = false;
66575         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66576         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66577         return ret_arr;
66578 }
66579
66580 int8_tArray  CS_LDK_InvoiceRequest_payer_metadata(int64_t this_arg) {
66581         LDKInvoiceRequest this_arg_conv;
66582         this_arg_conv.inner = untag_ptr(this_arg);
66583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66585         this_arg_conv.is_owned = false;
66586         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
66587         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66588         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66589         return ret_arr;
66590 }
66591
66592 int8_tArray  CS_LDK_InvoiceRequest_chain(int64_t this_arg) {
66593         LDKInvoiceRequest this_arg_conv;
66594         this_arg_conv.inner = untag_ptr(this_arg);
66595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66597         this_arg_conv.is_owned = false;
66598         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66599         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
66600         return ret_arr;
66601 }
66602
66603 int64_t  CS_LDK_InvoiceRequest_amount_msats(int64_t this_arg) {
66604         LDKInvoiceRequest this_arg_conv;
66605         this_arg_conv.inner = untag_ptr(this_arg);
66606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66608         this_arg_conv.is_owned = false;
66609         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66610         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
66611         int64_t ret_ref = tag_ptr(ret_copy, true);
66612         return ret_ref;
66613 }
66614
66615 int64_t  CS_LDK_InvoiceRequest_invoice_request_features(int64_t this_arg) {
66616         LDKInvoiceRequest this_arg_conv;
66617         this_arg_conv.inner = untag_ptr(this_arg);
66618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66620         this_arg_conv.is_owned = false;
66621         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
66622         int64_t ret_ref = 0;
66623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66625         return ret_ref;
66626 }
66627
66628 int64_t  CS_LDK_InvoiceRequest_quantity(int64_t this_arg) {
66629         LDKInvoiceRequest this_arg_conv;
66630         this_arg_conv.inner = untag_ptr(this_arg);
66631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66633         this_arg_conv.is_owned = false;
66634         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66635         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
66636         int64_t ret_ref = tag_ptr(ret_copy, true);
66637         return ret_ref;
66638 }
66639
66640 int8_tArray  CS_LDK_InvoiceRequest_payer_id(int64_t this_arg) {
66641         LDKInvoiceRequest this_arg_conv;
66642         this_arg_conv.inner = untag_ptr(this_arg);
66643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66645         this_arg_conv.is_owned = false;
66646         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66647         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66648         return ret_arr;
66649 }
66650
66651 int64_t  CS_LDK_InvoiceRequest_payer_note(int64_t this_arg) {
66652         LDKInvoiceRequest this_arg_conv;
66653         this_arg_conv.inner = untag_ptr(this_arg);
66654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66656         this_arg_conv.is_owned = false;
66657         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
66658         int64_t ret_ref = 0;
66659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66661         return ret_ref;
66662 }
66663
66664 int64_t  CS_LDK_InvoiceRequest_respond_with(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
66665         LDKInvoiceRequest this_arg_conv;
66666         this_arg_conv.inner = untag_ptr(this_arg);
66667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66669         this_arg_conv.is_owned = false;
66670         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66671         payment_paths_constr.datalen = payment_paths->arr_len;
66672         if (payment_paths_constr.datalen > 0)
66673                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66674         else
66675                 payment_paths_constr.data = NULL;
66676         int64_t* payment_paths_vals = payment_paths->elems;
66677         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66678                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
66679                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66680                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66681                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66682                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66683                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66684         }
66685         FREE(payment_paths);
66686         LDKThirtyTwoBytes payment_hash_ref;
66687         CHECK(payment_hash->arr_len == 32);
66688         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66689         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66690         *ret_conv = InvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
66691         return tag_ptr(ret_conv, true);
66692 }
66693
66694 int64_t  CS_LDK_InvoiceRequest_respond_with_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
66695         LDKInvoiceRequest this_arg_conv;
66696         this_arg_conv.inner = untag_ptr(this_arg);
66697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66699         this_arg_conv.is_owned = false;
66700         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66701         payment_paths_constr.datalen = payment_paths->arr_len;
66702         if (payment_paths_constr.datalen > 0)
66703                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66704         else
66705                 payment_paths_constr.data = NULL;
66706         int64_t* payment_paths_vals = payment_paths->elems;
66707         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66708                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
66709                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66710                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66711                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66712                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66713                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66714         }
66715         FREE(payment_paths);
66716         LDKThirtyTwoBytes payment_hash_ref;
66717         CHECK(payment_hash->arr_len == 32);
66718         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
66719         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
66720         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
66721         return tag_ptr(ret_conv, true);
66722 }
66723
66724 int64_t  CS_LDK_InvoiceRequest_verify(int64_t this_arg, int64_t key) {
66725         LDKInvoiceRequest this_arg_conv;
66726         this_arg_conv.inner = untag_ptr(this_arg);
66727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66729         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
66730         LDKExpandedKey key_conv;
66731         key_conv.inner = untag_ptr(key);
66732         key_conv.is_owned = ptr_is_owned(key);
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66734         key_conv.is_owned = false;
66735         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
66736         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
66737         return tag_ptr(ret_conv, true);
66738 }
66739
66740 int8_tArray  CS_LDK_InvoiceRequest_signature(int64_t this_arg) {
66741         LDKInvoiceRequest this_arg_conv;
66742         this_arg_conv.inner = untag_ptr(this_arg);
66743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66745         this_arg_conv.is_owned = false;
66746         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66747         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
66748         return ret_arr;
66749 }
66750
66751 ptrArray  CS_LDK_VerifiedInvoiceRequest_chains(int64_t this_arg) {
66752         LDKVerifiedInvoiceRequest this_arg_conv;
66753         this_arg_conv.inner = untag_ptr(this_arg);
66754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66756         this_arg_conv.is_owned = false;
66757         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
66758         ptrArray ret_arr = NULL;
66759         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
66760         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
66761         for (size_t i = 0; i < ret_var.datalen; i++) {
66762                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
66763                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
66764                 ret_arr_ptr[i] = ret_conv_8_arr;
66765         }
66766         
66767         FREE(ret_var.data);
66768         return ret_arr;
66769 }
66770
66771 int64_t  CS_LDK_VerifiedInvoiceRequest_metadata(int64_t this_arg) {
66772         LDKVerifiedInvoiceRequest this_arg_conv;
66773         this_arg_conv.inner = untag_ptr(this_arg);
66774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66776         this_arg_conv.is_owned = false;
66777         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66778         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
66779         int64_t ret_ref = tag_ptr(ret_copy, true);
66780         return ret_ref;
66781 }
66782
66783 int64_t  CS_LDK_VerifiedInvoiceRequest_amount(int64_t this_arg) {
66784         LDKVerifiedInvoiceRequest this_arg_conv;
66785         this_arg_conv.inner = untag_ptr(this_arg);
66786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66788         this_arg_conv.is_owned = false;
66789         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66790         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
66791         int64_t ret_ref = tag_ptr(ret_copy, true);
66792         return ret_ref;
66793 }
66794
66795 int64_t  CS_LDK_VerifiedInvoiceRequest_description(int64_t this_arg) {
66796         LDKVerifiedInvoiceRequest this_arg_conv;
66797         this_arg_conv.inner = untag_ptr(this_arg);
66798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66800         this_arg_conv.is_owned = false;
66801         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
66802         int64_t ret_ref = 0;
66803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66805         return ret_ref;
66806 }
66807
66808 int64_t  CS_LDK_VerifiedInvoiceRequest_offer_features(int64_t this_arg) {
66809         LDKVerifiedInvoiceRequest this_arg_conv;
66810         this_arg_conv.inner = untag_ptr(this_arg);
66811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66813         this_arg_conv.is_owned = false;
66814         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
66815         int64_t ret_ref = 0;
66816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66818         return ret_ref;
66819 }
66820
66821 int64_t  CS_LDK_VerifiedInvoiceRequest_absolute_expiry(int64_t this_arg) {
66822         LDKVerifiedInvoiceRequest this_arg_conv;
66823         this_arg_conv.inner = untag_ptr(this_arg);
66824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66826         this_arg_conv.is_owned = false;
66827         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66828         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
66829         int64_t ret_ref = tag_ptr(ret_copy, true);
66830         return ret_ref;
66831 }
66832
66833 int64_t  CS_LDK_VerifiedInvoiceRequest_issuer(int64_t this_arg) {
66834         LDKVerifiedInvoiceRequest this_arg_conv;
66835         this_arg_conv.inner = untag_ptr(this_arg);
66836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66838         this_arg_conv.is_owned = false;
66839         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
66840         int64_t ret_ref = 0;
66841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66843         return ret_ref;
66844 }
66845
66846 int64_tArray  CS_LDK_VerifiedInvoiceRequest_paths(int64_t this_arg) {
66847         LDKVerifiedInvoiceRequest this_arg_conv;
66848         this_arg_conv.inner = untag_ptr(this_arg);
66849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66851         this_arg_conv.is_owned = false;
66852         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
66853         int64_tArray ret_arr = NULL;
66854         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66855         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66856         for (size_t n = 0; n < ret_var.datalen; n++) {
66857                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66858                 int64_t ret_conv_13_ref = 0;
66859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66860                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66861                 ret_arr_ptr[n] = ret_conv_13_ref;
66862         }
66863         
66864         FREE(ret_var.data);
66865         return ret_arr;
66866 }
66867
66868 int64_t  CS_LDK_VerifiedInvoiceRequest_supported_quantity(int64_t this_arg) {
66869         LDKVerifiedInvoiceRequest this_arg_conv;
66870         this_arg_conv.inner = untag_ptr(this_arg);
66871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66873         this_arg_conv.is_owned = false;
66874         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
66875         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
66876         int64_t ret_ref = tag_ptr(ret_copy, true);
66877         return ret_ref;
66878 }
66879
66880 int8_tArray  CS_LDK_VerifiedInvoiceRequest_signing_pubkey(int64_t this_arg) {
66881         LDKVerifiedInvoiceRequest this_arg_conv;
66882         this_arg_conv.inner = untag_ptr(this_arg);
66883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66885         this_arg_conv.is_owned = false;
66886         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66887         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
66888         return ret_arr;
66889 }
66890
66891 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_metadata(int64_t this_arg) {
66892         LDKVerifiedInvoiceRequest this_arg_conv;
66893         this_arg_conv.inner = untag_ptr(this_arg);
66894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66896         this_arg_conv.is_owned = false;
66897         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
66898         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66899         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66900         return ret_arr;
66901 }
66902
66903 int8_tArray  CS_LDK_VerifiedInvoiceRequest_chain(int64_t this_arg) {
66904         LDKVerifiedInvoiceRequest this_arg_conv;
66905         this_arg_conv.inner = untag_ptr(this_arg);
66906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66908         this_arg_conv.is_owned = false;
66909         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66910         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
66911         return ret_arr;
66912 }
66913
66914 int64_t  CS_LDK_VerifiedInvoiceRequest_amount_msats(int64_t this_arg) {
66915         LDKVerifiedInvoiceRequest this_arg_conv;
66916         this_arg_conv.inner = untag_ptr(this_arg);
66917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66919         this_arg_conv.is_owned = false;
66920         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66921         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
66922         int64_t ret_ref = tag_ptr(ret_copy, true);
66923         return ret_ref;
66924 }
66925
66926 int64_t  CS_LDK_VerifiedInvoiceRequest_invoice_request_features(int64_t this_arg) {
66927         LDKVerifiedInvoiceRequest this_arg_conv;
66928         this_arg_conv.inner = untag_ptr(this_arg);
66929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66931         this_arg_conv.is_owned = false;
66932         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
66933         int64_t ret_ref = 0;
66934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66936         return ret_ref;
66937 }
66938
66939 int64_t  CS_LDK_VerifiedInvoiceRequest_quantity(int64_t this_arg) {
66940         LDKVerifiedInvoiceRequest this_arg_conv;
66941         this_arg_conv.inner = untag_ptr(this_arg);
66942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66944         this_arg_conv.is_owned = false;
66945         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66946         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
66947         int64_t ret_ref = tag_ptr(ret_copy, true);
66948         return ret_ref;
66949 }
66950
66951 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_id(int64_t this_arg) {
66952         LDKVerifiedInvoiceRequest this_arg_conv;
66953         this_arg_conv.inner = untag_ptr(this_arg);
66954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66956         this_arg_conv.is_owned = false;
66957         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66958         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
66959         return ret_arr;
66960 }
66961
66962 int64_t  CS_LDK_VerifiedInvoiceRequest_payer_note(int64_t this_arg) {
66963         LDKVerifiedInvoiceRequest this_arg_conv;
66964         this_arg_conv.inner = untag_ptr(this_arg);
66965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66967         this_arg_conv.is_owned = false;
66968         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
66969         int64_t ret_ref = 0;
66970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66972         return ret_ref;
66973 }
66974
66975 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_with(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
66976         LDKVerifiedInvoiceRequest this_arg_conv;
66977         this_arg_conv.inner = untag_ptr(this_arg);
66978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66980         this_arg_conv.is_owned = false;
66981         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
66982         payment_paths_constr.datalen = payment_paths->arr_len;
66983         if (payment_paths_constr.datalen > 0)
66984                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
66985         else
66986                 payment_paths_constr.data = NULL;
66987         int64_t* payment_paths_vals = payment_paths->elems;
66988         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
66989                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
66990                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
66991                 CHECK_ACCESS(payment_paths_conv_37_ptr);
66992                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
66993                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
66994                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
66995         }
66996         FREE(payment_paths);
66997         LDKThirtyTwoBytes payment_hash_ref;
66998         CHECK(payment_hash->arr_len == 32);
66999         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67000         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
67001         *ret_conv = VerifiedInvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
67002         return tag_ptr(ret_conv, true);
67003 }
67004
67005 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_with_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
67006         LDKVerifiedInvoiceRequest 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         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67012         payment_paths_constr.datalen = payment_paths->arr_len;
67013         if (payment_paths_constr.datalen > 0)
67014                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67015         else
67016                 payment_paths_constr.data = NULL;
67017         int64_t* payment_paths_vals = payment_paths->elems;
67018         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67019                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
67020                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67021                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67022                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67023                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67024                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67025         }
67026         FREE(payment_paths);
67027         LDKThirtyTwoBytes payment_hash_ref;
67028         CHECK(payment_hash->arr_len == 32);
67029         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67030         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
67031         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
67032         return tag_ptr(ret_conv, true);
67033 }
67034
67035 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_using_derived_keys(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
67036         LDKVerifiedInvoiceRequest this_arg_conv;
67037         this_arg_conv.inner = untag_ptr(this_arg);
67038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67040         this_arg_conv.is_owned = false;
67041         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67042         payment_paths_constr.datalen = payment_paths->arr_len;
67043         if (payment_paths_constr.datalen > 0)
67044                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67045         else
67046                 payment_paths_constr.data = NULL;
67047         int64_t* payment_paths_vals = payment_paths->elems;
67048         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67049                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
67050                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67051                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67052                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67053                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67054                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67055         }
67056         FREE(payment_paths);
67057         LDKThirtyTwoBytes payment_hash_ref;
67058         CHECK(payment_hash->arr_len == 32);
67059         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67060         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
67061         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys(&this_arg_conv, payment_paths_constr, payment_hash_ref);
67062         return tag_ptr(ret_conv, true);
67063 }
67064
67065 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_using_derived_keys_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
67066         LDKVerifiedInvoiceRequest this_arg_conv;
67067         this_arg_conv.inner = untag_ptr(this_arg);
67068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67070         this_arg_conv.is_owned = false;
67071         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
67072         payment_paths_constr.datalen = payment_paths->arr_len;
67073         if (payment_paths_constr.datalen > 0)
67074                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
67075         else
67076                 payment_paths_constr.data = NULL;
67077         int64_t* payment_paths_vals = payment_paths->elems;
67078         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
67079                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
67080                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
67081                 CHECK_ACCESS(payment_paths_conv_37_ptr);
67082                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
67083                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
67084                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
67085         }
67086         FREE(payment_paths);
67087         LDKThirtyTwoBytes payment_hash_ref;
67088         CHECK(payment_hash->arr_len == 32);
67089         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
67090         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
67091         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
67092         return tag_ptr(ret_conv, true);
67093 }
67094
67095 int8_tArray  CS_LDK_UnsignedInvoiceRequest_write(int64_t obj) {
67096         LDKUnsignedInvoiceRequest obj_conv;
67097         obj_conv.inner = untag_ptr(obj);
67098         obj_conv.is_owned = ptr_is_owned(obj);
67099         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67100         obj_conv.is_owned = false;
67101         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
67102         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67103         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67104         CVec_u8Z_free(ret_var);
67105         return ret_arr;
67106 }
67107
67108 int8_tArray  CS_LDK_InvoiceRequest_write(int64_t obj) {
67109         LDKInvoiceRequest obj_conv;
67110         obj_conv.inner = untag_ptr(obj);
67111         obj_conv.is_owned = ptr_is_owned(obj);
67112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67113         obj_conv.is_owned = false;
67114         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
67115         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67116         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67117         CVec_u8Z_free(ret_var);
67118         return ret_arr;
67119 }
67120
67121 void  CS_LDK_InvoiceRequestFields_free(int64_t this_obj) {
67122         LDKInvoiceRequestFields this_obj_conv;
67123         this_obj_conv.inner = untag_ptr(this_obj);
67124         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67126         InvoiceRequestFields_free(this_obj_conv);
67127 }
67128
67129 int8_tArray  CS_LDK_InvoiceRequestFields_get_payer_id(int64_t this_ptr) {
67130         LDKInvoiceRequestFields this_ptr_conv;
67131         this_ptr_conv.inner = untag_ptr(this_ptr);
67132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67134         this_ptr_conv.is_owned = false;
67135         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67136         memcpy(ret_arr->elems, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form, 33);
67137         return ret_arr;
67138 }
67139
67140 void  CS_LDK_InvoiceRequestFields_set_payer_id(int64_t this_ptr, int8_tArray val) {
67141         LDKInvoiceRequestFields this_ptr_conv;
67142         this_ptr_conv.inner = untag_ptr(this_ptr);
67143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67145         this_ptr_conv.is_owned = false;
67146         LDKPublicKey val_ref;
67147         CHECK(val->arr_len == 33);
67148         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
67149         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
67150 }
67151
67152 int64_t  CS_LDK_InvoiceRequestFields_get_quantity(int64_t this_ptr) {
67153         LDKInvoiceRequestFields this_ptr_conv;
67154         this_ptr_conv.inner = untag_ptr(this_ptr);
67155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67157         this_ptr_conv.is_owned = false;
67158         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67159         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
67160         int64_t ret_ref = tag_ptr(ret_copy, true);
67161         return ret_ref;
67162 }
67163
67164 void  CS_LDK_InvoiceRequestFields_set_quantity(int64_t this_ptr, int64_t val) {
67165         LDKInvoiceRequestFields this_ptr_conv;
67166         this_ptr_conv.inner = untag_ptr(this_ptr);
67167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67169         this_ptr_conv.is_owned = false;
67170         void* val_ptr = untag_ptr(val);
67171         CHECK_ACCESS(val_ptr);
67172         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
67173         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
67174         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
67175 }
67176
67177 int64_t  CS_LDK_InvoiceRequestFields_get_payer_note_truncated(int64_t this_ptr) {
67178         LDKInvoiceRequestFields this_ptr_conv;
67179         this_ptr_conv.inner = untag_ptr(this_ptr);
67180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67182         this_ptr_conv.is_owned = false;
67183         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
67184         int64_t ret_ref = 0;
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67187         return ret_ref;
67188 }
67189
67190 void  CS_LDK_InvoiceRequestFields_set_payer_note_truncated(int64_t this_ptr, int64_t val) {
67191         LDKInvoiceRequestFields this_ptr_conv;
67192         this_ptr_conv.inner = untag_ptr(this_ptr);
67193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67195         this_ptr_conv.is_owned = false;
67196         LDKUntrustedString val_conv;
67197         val_conv.inner = untag_ptr(val);
67198         val_conv.is_owned = ptr_is_owned(val);
67199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67200         val_conv = UntrustedString_clone(&val_conv);
67201         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
67202 }
67203
67204 int64_t  CS_LDK_InvoiceRequestFields_new(int8_tArray payer_id_arg, int64_t quantity_arg, int64_t payer_note_truncated_arg) {
67205         LDKPublicKey payer_id_arg_ref;
67206         CHECK(payer_id_arg->arr_len == 33);
67207         memcpy(payer_id_arg_ref.compressed_form, payer_id_arg->elems, 33); FREE(payer_id_arg);
67208         void* quantity_arg_ptr = untag_ptr(quantity_arg);
67209         CHECK_ACCESS(quantity_arg_ptr);
67210         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
67211         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
67212         LDKUntrustedString payer_note_truncated_arg_conv;
67213         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
67214         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
67215         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
67216         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
67217         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
67218         int64_t ret_ref = 0;
67219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67221         return ret_ref;
67222 }
67223
67224 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
67225         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
67226         int64_t ret_ref = 0;
67227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67229         return ret_ref;
67230 }
67231 int64_t  CS_LDK_InvoiceRequestFields_clone_ptr(int64_t arg) {
67232         LDKInvoiceRequestFields arg_conv;
67233         arg_conv.inner = untag_ptr(arg);
67234         arg_conv.is_owned = ptr_is_owned(arg);
67235         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67236         arg_conv.is_owned = false;
67237         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
67238         return ret_conv;
67239 }
67240
67241 int64_t  CS_LDK_InvoiceRequestFields_clone(int64_t orig) {
67242         LDKInvoiceRequestFields orig_conv;
67243         orig_conv.inner = untag_ptr(orig);
67244         orig_conv.is_owned = ptr_is_owned(orig);
67245         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67246         orig_conv.is_owned = false;
67247         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
67248         int64_t ret_ref = 0;
67249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67251         return ret_ref;
67252 }
67253
67254 jboolean  CS_LDK_InvoiceRequestFields_eq(int64_t a, int64_t b) {
67255         LDKInvoiceRequestFields a_conv;
67256         a_conv.inner = untag_ptr(a);
67257         a_conv.is_owned = ptr_is_owned(a);
67258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67259         a_conv.is_owned = false;
67260         LDKInvoiceRequestFields b_conv;
67261         b_conv.inner = untag_ptr(b);
67262         b_conv.is_owned = ptr_is_owned(b);
67263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67264         b_conv.is_owned = false;
67265         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
67266         return ret_conv;
67267 }
67268
67269 int8_tArray  CS_LDK_InvoiceRequestFields_write(int64_t obj) {
67270         LDKInvoiceRequestFields obj_conv;
67271         obj_conv.inner = untag_ptr(obj);
67272         obj_conv.is_owned = ptr_is_owned(obj);
67273         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67274         obj_conv.is_owned = false;
67275         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
67276         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67277         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67278         CVec_u8Z_free(ret_var);
67279         return ret_arr;
67280 }
67281
67282 int64_t  CS_LDK_InvoiceRequestFields_read(int8_tArray ser) {
67283         LDKu8slice ser_ref;
67284         ser_ref.datalen = ser->arr_len;
67285         ser_ref.data = ser->elems;
67286         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
67287         *ret_conv = InvoiceRequestFields_read(ser_ref);
67288         FREE(ser);
67289         return tag_ptr(ret_conv, true);
67290 }
67291
67292 void  CS_LDK_TaggedHash_free(int64_t this_obj) {
67293         LDKTaggedHash this_obj_conv;
67294         this_obj_conv.inner = untag_ptr(this_obj);
67295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67297         TaggedHash_free(this_obj_conv);
67298 }
67299
67300 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
67301         LDKTaggedHash ret_var = TaggedHash_clone(arg);
67302         int64_t ret_ref = 0;
67303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67305         return ret_ref;
67306 }
67307 int64_t  CS_LDK_TaggedHash_clone_ptr(int64_t arg) {
67308         LDKTaggedHash arg_conv;
67309         arg_conv.inner = untag_ptr(arg);
67310         arg_conv.is_owned = ptr_is_owned(arg);
67311         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67312         arg_conv.is_owned = false;
67313         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
67314         return ret_conv;
67315 }
67316
67317 int64_t  CS_LDK_TaggedHash_clone(int64_t orig) {
67318         LDKTaggedHash orig_conv;
67319         orig_conv.inner = untag_ptr(orig);
67320         orig_conv.is_owned = ptr_is_owned(orig);
67321         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67322         orig_conv.is_owned = false;
67323         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
67324         int64_t ret_ref = 0;
67325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67327         return ret_ref;
67328 }
67329
67330 int8_tArray  CS_LDK_TaggedHash_as_digest(int64_t this_arg) {
67331         LDKTaggedHash this_arg_conv;
67332         this_arg_conv.inner = untag_ptr(this_arg);
67333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67335         this_arg_conv.is_owned = false;
67336         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67337         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
67338         return ret_arr;
67339 }
67340
67341 jstring  CS_LDK_TaggedHash_tag(int64_t this_arg) {
67342         LDKTaggedHash this_arg_conv;
67343         this_arg_conv.inner = untag_ptr(this_arg);
67344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67346         this_arg_conv.is_owned = false;
67347         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
67348         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
67349         Str_free(ret_str);
67350         return ret_conv;
67351 }
67352
67353 int8_tArray  CS_LDK_TaggedHash_merkle_root(int64_t this_arg) {
67354         LDKTaggedHash this_arg_conv;
67355         this_arg_conv.inner = untag_ptr(this_arg);
67356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67358         this_arg_conv.is_owned = false;
67359         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67360         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
67361         return ret_arr;
67362 }
67363
67364 void  CS_LDK_SignError_free(int64_t this_ptr) {
67365         if (!ptr_is_owned(this_ptr)) return;
67366         void* this_ptr_ptr = untag_ptr(this_ptr);
67367         CHECK_ACCESS(this_ptr_ptr);
67368         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
67369         FREE(untag_ptr(this_ptr));
67370         SignError_free(this_ptr_conv);
67371 }
67372
67373 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
67374         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
67375         *ret_copy = SignError_clone(arg);
67376         int64_t ret_ref = tag_ptr(ret_copy, true);
67377         return ret_ref;
67378 }
67379 int64_t  CS_LDK_SignError_clone_ptr(int64_t arg) {
67380         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
67381         int64_t ret_conv = SignError_clone_ptr(arg_conv);
67382         return ret_conv;
67383 }
67384
67385 int64_t  CS_LDK_SignError_clone(int64_t orig) {
67386         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
67387         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
67388         *ret_copy = SignError_clone(orig_conv);
67389         int64_t ret_ref = tag_ptr(ret_copy, true);
67390         return ret_ref;
67391 }
67392
67393 int64_t  CS_LDK_SignError_signing() {
67394         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
67395         *ret_copy = SignError_signing();
67396         int64_t ret_ref = tag_ptr(ret_copy, true);
67397         return ret_ref;
67398 }
67399
67400 int64_t  CS_LDK_SignError_verification(int32_t a) {
67401         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
67402         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
67403         *ret_copy = SignError_verification(a_conv);
67404         int64_t ret_ref = tag_ptr(ret_copy, true);
67405         return ret_ref;
67406 }
67407
67408 void  CS_LDK_Bolt12ParseError_free(int64_t this_obj) {
67409         LDKBolt12ParseError this_obj_conv;
67410         this_obj_conv.inner = untag_ptr(this_obj);
67411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67413         Bolt12ParseError_free(this_obj_conv);
67414 }
67415
67416 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
67417         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
67418         int64_t ret_ref = 0;
67419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67421         return ret_ref;
67422 }
67423 int64_t  CS_LDK_Bolt12ParseError_clone_ptr(int64_t arg) {
67424         LDKBolt12ParseError arg_conv;
67425         arg_conv.inner = untag_ptr(arg);
67426         arg_conv.is_owned = ptr_is_owned(arg);
67427         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67428         arg_conv.is_owned = false;
67429         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
67430         return ret_conv;
67431 }
67432
67433 int64_t  CS_LDK_Bolt12ParseError_clone(int64_t orig) {
67434         LDKBolt12ParseError orig_conv;
67435         orig_conv.inner = untag_ptr(orig);
67436         orig_conv.is_owned = ptr_is_owned(orig);
67437         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67438         orig_conv.is_owned = false;
67439         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
67440         int64_t ret_ref = 0;
67441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67443         return ret_ref;
67444 }
67445
67446 int32_t  CS_LDK_Bolt12SemanticError_clone(int64_t orig) {
67447         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
67448         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_clone(orig_conv));
67449         return ret_conv;
67450 }
67451
67452 int32_t  CS_LDK_Bolt12SemanticError_already_expired() {
67453         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_already_expired());
67454         return ret_conv;
67455 }
67456
67457 int32_t  CS_LDK_Bolt12SemanticError_unsupported_chain() {
67458         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_chain());
67459         return ret_conv;
67460 }
67461
67462 int32_t  CS_LDK_Bolt12SemanticError_unexpected_chain() {
67463         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_chain());
67464         return ret_conv;
67465 }
67466
67467 int32_t  CS_LDK_Bolt12SemanticError_missing_amount() {
67468         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_amount());
67469         return ret_conv;
67470 }
67471
67472 int32_t  CS_LDK_Bolt12SemanticError_invalid_amount() {
67473         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_amount());
67474         return ret_conv;
67475 }
67476
67477 int32_t  CS_LDK_Bolt12SemanticError_insufficient_amount() {
67478         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_insufficient_amount());
67479         return ret_conv;
67480 }
67481
67482 int32_t  CS_LDK_Bolt12SemanticError_unexpected_amount() {
67483         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_amount());
67484         return ret_conv;
67485 }
67486
67487 int32_t  CS_LDK_Bolt12SemanticError_unsupported_currency() {
67488         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_currency());
67489         return ret_conv;
67490 }
67491
67492 int32_t  CS_LDK_Bolt12SemanticError_unknown_required_features() {
67493         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unknown_required_features());
67494         return ret_conv;
67495 }
67496
67497 int32_t  CS_LDK_Bolt12SemanticError_unexpected_features() {
67498         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_features());
67499         return ret_conv;
67500 }
67501
67502 int32_t  CS_LDK_Bolt12SemanticError_missing_description() {
67503         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_description());
67504         return ret_conv;
67505 }
67506
67507 int32_t  CS_LDK_Bolt12SemanticError_missing_signing_pubkey() {
67508         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signing_pubkey());
67509         return ret_conv;
67510 }
67511
67512 int32_t  CS_LDK_Bolt12SemanticError_invalid_signing_pubkey() {
67513         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_signing_pubkey());
67514         return ret_conv;
67515 }
67516
67517 int32_t  CS_LDK_Bolt12SemanticError_unexpected_signing_pubkey() {
67518         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_signing_pubkey());
67519         return ret_conv;
67520 }
67521
67522 int32_t  CS_LDK_Bolt12SemanticError_missing_quantity() {
67523         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_quantity());
67524         return ret_conv;
67525 }
67526
67527 int32_t  CS_LDK_Bolt12SemanticError_invalid_quantity() {
67528         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_quantity());
67529         return ret_conv;
67530 }
67531
67532 int32_t  CS_LDK_Bolt12SemanticError_unexpected_quantity() {
67533         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_quantity());
67534         return ret_conv;
67535 }
67536
67537 int32_t  CS_LDK_Bolt12SemanticError_invalid_metadata() {
67538         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_metadata());
67539         return ret_conv;
67540 }
67541
67542 int32_t  CS_LDK_Bolt12SemanticError_unexpected_metadata() {
67543         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_metadata());
67544         return ret_conv;
67545 }
67546
67547 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_metadata() {
67548         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_metadata());
67549         return ret_conv;
67550 }
67551
67552 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_id() {
67553         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_id());
67554         return ret_conv;
67555 }
67556
67557 int32_t  CS_LDK_Bolt12SemanticError_duplicate_payment_id() {
67558         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_duplicate_payment_id());
67559         return ret_conv;
67560 }
67561
67562 int32_t  CS_LDK_Bolt12SemanticError_missing_paths() {
67563         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_paths());
67564         return ret_conv;
67565 }
67566
67567 int32_t  CS_LDK_Bolt12SemanticError_unexpected_paths() {
67568         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_paths());
67569         return ret_conv;
67570 }
67571
67572 int32_t  CS_LDK_Bolt12SemanticError_invalid_pay_info() {
67573         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_pay_info());
67574         return ret_conv;
67575 }
67576
67577 int32_t  CS_LDK_Bolt12SemanticError_missing_creation_time() {
67578         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_creation_time());
67579         return ret_conv;
67580 }
67581
67582 int32_t  CS_LDK_Bolt12SemanticError_missing_payment_hash() {
67583         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payment_hash());
67584         return ret_conv;
67585 }
67586
67587 int32_t  CS_LDK_Bolt12SemanticError_missing_signature() {
67588         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signature());
67589         return ret_conv;
67590 }
67591
67592 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_free(int64_t this_obj) {
67593         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
67594         this_obj_conv.inner = untag_ptr(this_obj);
67595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67597         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
67598 }
67599
67600 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
67601         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
67602         int64_t ret_ref = 0;
67603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67605         return ret_ref;
67606 }
67607 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_clone_ptr(int64_t arg) {
67608         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
67609         arg_conv.inner = untag_ptr(arg);
67610         arg_conv.is_owned = ptr_is_owned(arg);
67611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67612         arg_conv.is_owned = false;
67613         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
67614         return ret_conv;
67615 }
67616
67617 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_clone(int64_t orig) {
67618         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
67619         orig_conv.inner = untag_ptr(orig);
67620         orig_conv.is_owned = ptr_is_owned(orig);
67621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67622         orig_conv.is_owned = false;
67623         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
67624         int64_t ret_ref = 0;
67625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67627         return ret_ref;
67628 }
67629
67630 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_new(int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
67631         LDKCVec_u8Z metadata_ref;
67632         metadata_ref.datalen = metadata->arr_len;
67633         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
67634         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
67635         LDKPublicKey payer_id_ref;
67636         CHECK(payer_id->arr_len == 33);
67637         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
67638         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67639         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
67640         return tag_ptr(ret_conv, true);
67641 }
67642
67643 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(int8_tArray node_id, int64_t expanded_key, int64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
67644         LDKPublicKey node_id_ref;
67645         CHECK(node_id->arr_len == 33);
67646         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
67647         LDKExpandedKey expanded_key_conv;
67648         expanded_key_conv.inner = untag_ptr(expanded_key);
67649         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
67650         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
67651         expanded_key_conv.is_owned = false;
67652         void* entropy_source_ptr = untag_ptr(entropy_source);
67653         CHECK_ACCESS(entropy_source_ptr);
67654         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
67655         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
67656                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67657                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
67658         }
67659         LDKThirtyTwoBytes payment_id_ref;
67660         CHECK(payment_id->arr_len == 32);
67661         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
67662         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
67663         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
67664         return tag_ptr(ret_conv, true);
67665 }
67666
67667 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_description(int64_t this_arg, jstring description) {
67668         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67669         this_arg_conv.inner = untag_ptr(this_arg);
67670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67672         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67673         LDKStr description_conv = str_ref_to_owned_c(description);
67674         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
67675 }
67676
67677 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
67678         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67679         this_arg_conv.inner = untag_ptr(this_arg);
67680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67682         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67683         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
67684 }
67685
67686 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
67687         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67688         this_arg_conv.inner = untag_ptr(this_arg);
67689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67691         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67692         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
67693         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
67694 }
67695
67696 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_path(int64_t this_arg, int64_t path) {
67697         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67698         this_arg_conv.inner = untag_ptr(this_arg);
67699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67701         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67702         LDKBlindedPath path_conv;
67703         path_conv.inner = untag_ptr(path);
67704         path_conv.is_owned = ptr_is_owned(path);
67705         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
67706         path_conv = BlindedPath_clone(&path_conv);
67707         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
67708 }
67709
67710 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_chain(int64_t this_arg, int32_t network) {
67711         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67712         this_arg_conv.inner = untag_ptr(this_arg);
67713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67715         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67716         LDKNetwork network_conv = LDKNetwork_from_cs(network);
67717         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
67718 }
67719
67720 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_quantity(int64_t this_arg, int64_t quantity) {
67721         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67722         this_arg_conv.inner = untag_ptr(this_arg);
67723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67725         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67726         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
67727 }
67728
67729 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_payer_note(int64_t this_arg, jstring payer_note) {
67730         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67731         this_arg_conv.inner = untag_ptr(this_arg);
67732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67734         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67735         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
67736         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
67737 }
67738
67739 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_build(int64_t this_arg) {
67740         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
67741         this_arg_conv.inner = untag_ptr(this_arg);
67742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67744         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
67745         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
67746         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
67747         return tag_ptr(ret_conv, true);
67748 }
67749
67750 void  CS_LDK_Refund_free(int64_t this_obj) {
67751         LDKRefund this_obj_conv;
67752         this_obj_conv.inner = untag_ptr(this_obj);
67753         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67755         Refund_free(this_obj_conv);
67756 }
67757
67758 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
67759         LDKRefund ret_var = Refund_clone(arg);
67760         int64_t ret_ref = 0;
67761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67763         return ret_ref;
67764 }
67765 int64_t  CS_LDK_Refund_clone_ptr(int64_t arg) {
67766         LDKRefund arg_conv;
67767         arg_conv.inner = untag_ptr(arg);
67768         arg_conv.is_owned = ptr_is_owned(arg);
67769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67770         arg_conv.is_owned = false;
67771         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
67772         return ret_conv;
67773 }
67774
67775 int64_t  CS_LDK_Refund_clone(int64_t orig) {
67776         LDKRefund orig_conv;
67777         orig_conv.inner = untag_ptr(orig);
67778         orig_conv.is_owned = ptr_is_owned(orig);
67779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67780         orig_conv.is_owned = false;
67781         LDKRefund ret_var = Refund_clone(&orig_conv);
67782         int64_t ret_ref = 0;
67783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67785         return ret_ref;
67786 }
67787
67788 int64_t  CS_LDK_Refund_description(int64_t this_arg) {
67789         LDKRefund this_arg_conv;
67790         this_arg_conv.inner = untag_ptr(this_arg);
67791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67793         this_arg_conv.is_owned = false;
67794         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
67795         int64_t ret_ref = 0;
67796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67798         return ret_ref;
67799 }
67800
67801 int64_t  CS_LDK_Refund_absolute_expiry(int64_t this_arg) {
67802         LDKRefund this_arg_conv;
67803         this_arg_conv.inner = untag_ptr(this_arg);
67804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67806         this_arg_conv.is_owned = false;
67807         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67808         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
67809         int64_t ret_ref = tag_ptr(ret_copy, true);
67810         return ret_ref;
67811 }
67812
67813 jboolean  CS_LDK_Refund_is_expired(int64_t this_arg) {
67814         LDKRefund this_arg_conv;
67815         this_arg_conv.inner = untag_ptr(this_arg);
67816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67818         this_arg_conv.is_owned = false;
67819         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
67820         return ret_conv;
67821 }
67822
67823 jboolean  CS_LDK_Refund_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
67824         LDKRefund this_arg_conv;
67825         this_arg_conv.inner = untag_ptr(this_arg);
67826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67828         this_arg_conv.is_owned = false;
67829         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
67830         return ret_conv;
67831 }
67832
67833 int64_t  CS_LDK_Refund_issuer(int64_t this_arg) {
67834         LDKRefund 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         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
67840         int64_t ret_ref = 0;
67841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67843         return ret_ref;
67844 }
67845
67846 int64_tArray  CS_LDK_Refund_paths(int64_t this_arg) {
67847         LDKRefund this_arg_conv;
67848         this_arg_conv.inner = untag_ptr(this_arg);
67849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67851         this_arg_conv.is_owned = false;
67852         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
67853         int64_tArray ret_arr = NULL;
67854         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
67855         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
67856         for (size_t n = 0; n < ret_var.datalen; n++) {
67857                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67858                 int64_t ret_conv_13_ref = 0;
67859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67860                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67861                 ret_arr_ptr[n] = ret_conv_13_ref;
67862         }
67863         
67864         FREE(ret_var.data);
67865         return ret_arr;
67866 }
67867
67868 int8_tArray  CS_LDK_Refund_payer_metadata(int64_t this_arg) {
67869         LDKRefund this_arg_conv;
67870         this_arg_conv.inner = untag_ptr(this_arg);
67871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67873         this_arg_conv.is_owned = false;
67874         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
67875         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67876         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67877         return ret_arr;
67878 }
67879
67880 int8_tArray  CS_LDK_Refund_chain(int64_t this_arg) {
67881         LDKRefund this_arg_conv;
67882         this_arg_conv.inner = untag_ptr(this_arg);
67883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67885         this_arg_conv.is_owned = false;
67886         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67887         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
67888         return ret_arr;
67889 }
67890
67891 int64_t  CS_LDK_Refund_amount_msats(int64_t this_arg) {
67892         LDKRefund 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         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
67898         return ret_conv;
67899 }
67900
67901 int64_t  CS_LDK_Refund_features(int64_t this_arg) {
67902         LDKRefund this_arg_conv;
67903         this_arg_conv.inner = untag_ptr(this_arg);
67904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67906         this_arg_conv.is_owned = false;
67907         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
67908         int64_t ret_ref = 0;
67909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67911         return ret_ref;
67912 }
67913
67914 int64_t  CS_LDK_Refund_quantity(int64_t this_arg) {
67915         LDKRefund this_arg_conv;
67916         this_arg_conv.inner = untag_ptr(this_arg);
67917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67919         this_arg_conv.is_owned = false;
67920         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67921         *ret_copy = Refund_quantity(&this_arg_conv);
67922         int64_t ret_ref = tag_ptr(ret_copy, true);
67923         return ret_ref;
67924 }
67925
67926 int8_tArray  CS_LDK_Refund_payer_id(int64_t this_arg) {
67927         LDKRefund this_arg_conv;
67928         this_arg_conv.inner = untag_ptr(this_arg);
67929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67931         this_arg_conv.is_owned = false;
67932         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67933         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
67934         return ret_arr;
67935 }
67936
67937 int64_t  CS_LDK_Refund_payer_note(int64_t this_arg) {
67938         LDKRefund 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         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
67944         int64_t ret_ref = 0;
67945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67947         return ret_ref;
67948 }
67949
67950 int64_t  CS_LDK_Refund_hash(int64_t o) {
67951         LDKRefund o_conv;
67952         o_conv.inner = untag_ptr(o);
67953         o_conv.is_owned = ptr_is_owned(o);
67954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67955         o_conv.is_owned = false;
67956         int64_t ret_conv = Refund_hash(&o_conv);
67957         return ret_conv;
67958 }
67959
67960 int8_tArray  CS_LDK_Refund_write(int64_t obj) {
67961         LDKRefund obj_conv;
67962         obj_conv.inner = untag_ptr(obj);
67963         obj_conv.is_owned = ptr_is_owned(obj);
67964         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67965         obj_conv.is_owned = false;
67966         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
67967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67969         CVec_u8Z_free(ret_var);
67970         return ret_arr;
67971 }
67972
67973 int64_t  CS_LDK_Refund_from_str(jstring s) {
67974         LDKStr s_conv = str_ref_to_owned_c(s);
67975         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
67976         *ret_conv = Refund_from_str(s_conv);
67977         return tag_ptr(ret_conv, true);
67978 }
67979
67980 int32_t  CS_LDK_UtxoLookupError_clone(int64_t orig) {
67981         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
67982         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_clone(orig_conv));
67983         return ret_conv;
67984 }
67985
67986 int32_t  CS_LDK_UtxoLookupError_unknown_chain() {
67987         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_chain());
67988         return ret_conv;
67989 }
67990
67991 int32_t  CS_LDK_UtxoLookupError_unknown_tx() {
67992         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_tx());
67993         return ret_conv;
67994 }
67995
67996 void  CS_LDK_UtxoResult_free(int64_t this_ptr) {
67997         if (!ptr_is_owned(this_ptr)) return;
67998         void* this_ptr_ptr = untag_ptr(this_ptr);
67999         CHECK_ACCESS(this_ptr_ptr);
68000         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
68001         FREE(untag_ptr(this_ptr));
68002         UtxoResult_free(this_ptr_conv);
68003 }
68004
68005 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
68006         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68007         *ret_copy = UtxoResult_clone(arg);
68008         int64_t ret_ref = tag_ptr(ret_copy, true);
68009         return ret_ref;
68010 }
68011 int64_t  CS_LDK_UtxoResult_clone_ptr(int64_t arg) {
68012         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
68013         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
68014         return ret_conv;
68015 }
68016
68017 int64_t  CS_LDK_UtxoResult_clone(int64_t orig) {
68018         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
68019         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68020         *ret_copy = UtxoResult_clone(orig_conv);
68021         int64_t ret_ref = tag_ptr(ret_copy, true);
68022         return ret_ref;
68023 }
68024
68025 int64_t  CS_LDK_UtxoResult_sync(int64_t a) {
68026         void* a_ptr = untag_ptr(a);
68027         CHECK_ACCESS(a_ptr);
68028         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
68029         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
68030         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68031         *ret_copy = UtxoResult_sync(a_conv);
68032         int64_t ret_ref = tag_ptr(ret_copy, true);
68033         return ret_ref;
68034 }
68035
68036 int64_t  CS_LDK_UtxoResult_async(int64_t a) {
68037         LDKUtxoFuture a_conv;
68038         a_conv.inner = untag_ptr(a);
68039         a_conv.is_owned = ptr_is_owned(a);
68040         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68041         a_conv = UtxoFuture_clone(&a_conv);
68042         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
68043         *ret_copy = UtxoResult_async(a_conv);
68044         int64_t ret_ref = tag_ptr(ret_copy, true);
68045         return ret_ref;
68046 }
68047
68048 void  CS_LDK_UtxoLookup_free(int64_t this_ptr) {
68049         if (!ptr_is_owned(this_ptr)) return;
68050         void* this_ptr_ptr = untag_ptr(this_ptr);
68051         CHECK_ACCESS(this_ptr_ptr);
68052         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
68053         FREE(untag_ptr(this_ptr));
68054         UtxoLookup_free(this_ptr_conv);
68055 }
68056
68057 void  CS_LDK_UtxoFuture_free(int64_t this_obj) {
68058         LDKUtxoFuture this_obj_conv;
68059         this_obj_conv.inner = untag_ptr(this_obj);
68060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68062         UtxoFuture_free(this_obj_conv);
68063 }
68064
68065 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
68066         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
68067         int64_t ret_ref = 0;
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68070         return ret_ref;
68071 }
68072 int64_t  CS_LDK_UtxoFuture_clone_ptr(int64_t arg) {
68073         LDKUtxoFuture arg_conv;
68074         arg_conv.inner = untag_ptr(arg);
68075         arg_conv.is_owned = ptr_is_owned(arg);
68076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68077         arg_conv.is_owned = false;
68078         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
68079         return ret_conv;
68080 }
68081
68082 int64_t  CS_LDK_UtxoFuture_clone(int64_t orig) {
68083         LDKUtxoFuture orig_conv;
68084         orig_conv.inner = untag_ptr(orig);
68085         orig_conv.is_owned = ptr_is_owned(orig);
68086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68087         orig_conv.is_owned = false;
68088         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
68089         int64_t ret_ref = 0;
68090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68092         return ret_ref;
68093 }
68094
68095 int64_t  CS_LDK_UtxoFuture_new() {
68096         LDKUtxoFuture ret_var = UtxoFuture_new();
68097         int64_t ret_ref = 0;
68098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68100         return ret_ref;
68101 }
68102
68103 void  CS_LDK_UtxoFuture_resolve_without_forwarding(int64_t this_arg, int64_t graph, int64_t result) {
68104         LDKUtxoFuture this_arg_conv;
68105         this_arg_conv.inner = untag_ptr(this_arg);
68106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68108         this_arg_conv.is_owned = false;
68109         LDKNetworkGraph graph_conv;
68110         graph_conv.inner = untag_ptr(graph);
68111         graph_conv.is_owned = ptr_is_owned(graph);
68112         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
68113         graph_conv.is_owned = false;
68114         void* result_ptr = untag_ptr(result);
68115         CHECK_ACCESS(result_ptr);
68116         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
68117         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
68118 }
68119
68120 void  CS_LDK_UtxoFuture_resolve(int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
68121         LDKUtxoFuture this_arg_conv;
68122         this_arg_conv.inner = untag_ptr(this_arg);
68123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68125         this_arg_conv.is_owned = false;
68126         LDKNetworkGraph graph_conv;
68127         graph_conv.inner = untag_ptr(graph);
68128         graph_conv.is_owned = ptr_is_owned(graph);
68129         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
68130         graph_conv.is_owned = false;
68131         LDKP2PGossipSync gossip_conv;
68132         gossip_conv.inner = untag_ptr(gossip);
68133         gossip_conv.is_owned = ptr_is_owned(gossip);
68134         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
68135         gossip_conv.is_owned = false;
68136         void* result_ptr = untag_ptr(result);
68137         CHECK_ACCESS(result_ptr);
68138         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
68139         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
68140 }
68141
68142 void  CS_LDK_NodeId_free(int64_t this_obj) {
68143         LDKNodeId this_obj_conv;
68144         this_obj_conv.inner = untag_ptr(this_obj);
68145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68147         NodeId_free(this_obj_conv);
68148 }
68149
68150 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
68151         LDKNodeId ret_var = NodeId_clone(arg);
68152         int64_t ret_ref = 0;
68153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68155         return ret_ref;
68156 }
68157 int64_t  CS_LDK_NodeId_clone_ptr(int64_t arg) {
68158         LDKNodeId arg_conv;
68159         arg_conv.inner = untag_ptr(arg);
68160         arg_conv.is_owned = ptr_is_owned(arg);
68161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68162         arg_conv.is_owned = false;
68163         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
68164         return ret_conv;
68165 }
68166
68167 int64_t  CS_LDK_NodeId_clone(int64_t orig) {
68168         LDKNodeId orig_conv;
68169         orig_conv.inner = untag_ptr(orig);
68170         orig_conv.is_owned = ptr_is_owned(orig);
68171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68172         orig_conv.is_owned = false;
68173         LDKNodeId ret_var = NodeId_clone(&orig_conv);
68174         int64_t ret_ref = 0;
68175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68177         return ret_ref;
68178 }
68179
68180 int64_t  CS_LDK_NodeId_from_pubkey(int8_tArray pubkey) {
68181         LDKPublicKey pubkey_ref;
68182         CHECK(pubkey->arr_len == 33);
68183         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
68184         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
68185         int64_t ret_ref = 0;
68186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68188         return ret_ref;
68189 }
68190
68191 int64_t  CS_LDK_NodeId_from_slice(int8_tArray bytes) {
68192         LDKu8slice bytes_ref;
68193         bytes_ref.datalen = bytes->arr_len;
68194         bytes_ref.data = bytes->elems;
68195         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
68196         *ret_conv = NodeId_from_slice(bytes_ref);
68197         FREE(bytes);
68198         return tag_ptr(ret_conv, true);
68199 }
68200
68201 int8_tArray  CS_LDK_NodeId_as_slice(int64_t this_arg) {
68202         LDKNodeId this_arg_conv;
68203         this_arg_conv.inner = untag_ptr(this_arg);
68204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68206         this_arg_conv.is_owned = false;
68207         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
68208         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68209         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68210         return ret_arr;
68211 }
68212
68213 int8_tArray  CS_LDK_NodeId_as_array(int64_t this_arg) {
68214         LDKNodeId 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68220         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
68221         return ret_arr;
68222 }
68223
68224 int64_t  CS_LDK_NodeId_as_pubkey(int64_t this_arg) {
68225         LDKNodeId this_arg_conv;
68226         this_arg_conv.inner = untag_ptr(this_arg);
68227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68229         this_arg_conv.is_owned = false;
68230         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
68231         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
68232         return tag_ptr(ret_conv, true);
68233 }
68234
68235 int64_t  CS_LDK_NodeId_hash(int64_t o) {
68236         LDKNodeId o_conv;
68237         o_conv.inner = untag_ptr(o);
68238         o_conv.is_owned = ptr_is_owned(o);
68239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68240         o_conv.is_owned = false;
68241         int64_t ret_conv = NodeId_hash(&o_conv);
68242         return ret_conv;
68243 }
68244
68245 int8_tArray  CS_LDK_NodeId_write(int64_t obj) {
68246         LDKNodeId obj_conv;
68247         obj_conv.inner = untag_ptr(obj);
68248         obj_conv.is_owned = ptr_is_owned(obj);
68249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68250         obj_conv.is_owned = false;
68251         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
68252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68254         CVec_u8Z_free(ret_var);
68255         return ret_arr;
68256 }
68257
68258 int64_t  CS_LDK_NodeId_read(int8_tArray ser) {
68259         LDKu8slice ser_ref;
68260         ser_ref.datalen = ser->arr_len;
68261         ser_ref.data = ser->elems;
68262         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
68263         *ret_conv = NodeId_read(ser_ref);
68264         FREE(ser);
68265         return tag_ptr(ret_conv, true);
68266 }
68267
68268 void  CS_LDK_NetworkGraph_free(int64_t this_obj) {
68269         LDKNetworkGraph this_obj_conv;
68270         this_obj_conv.inner = untag_ptr(this_obj);
68271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68273         NetworkGraph_free(this_obj_conv);
68274 }
68275
68276 void  CS_LDK_ReadOnlyNetworkGraph_free(int64_t this_obj) {
68277         LDKReadOnlyNetworkGraph this_obj_conv;
68278         this_obj_conv.inner = untag_ptr(this_obj);
68279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68281         ReadOnlyNetworkGraph_free(this_obj_conv);
68282 }
68283
68284 void  CS_LDK_NetworkUpdate_free(int64_t this_ptr) {
68285         if (!ptr_is_owned(this_ptr)) return;
68286         void* this_ptr_ptr = untag_ptr(this_ptr);
68287         CHECK_ACCESS(this_ptr_ptr);
68288         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
68289         FREE(untag_ptr(this_ptr));
68290         NetworkUpdate_free(this_ptr_conv);
68291 }
68292
68293 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
68294         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
68295         *ret_copy = NetworkUpdate_clone(arg);
68296         int64_t ret_ref = tag_ptr(ret_copy, true);
68297         return ret_ref;
68298 }
68299 int64_t  CS_LDK_NetworkUpdate_clone_ptr(int64_t arg) {
68300         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
68301         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
68302         return ret_conv;
68303 }
68304
68305 int64_t  CS_LDK_NetworkUpdate_clone(int64_t orig) {
68306         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
68307         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
68308         *ret_copy = NetworkUpdate_clone(orig_conv);
68309         int64_t ret_ref = tag_ptr(ret_copy, true);
68310         return ret_ref;
68311 }
68312
68313 int64_t  CS_LDK_NetworkUpdate_channel_update_message(int64_t msg) {
68314         LDKChannelUpdate msg_conv;
68315         msg_conv.inner = untag_ptr(msg);
68316         msg_conv.is_owned = ptr_is_owned(msg);
68317         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
68318         msg_conv = ChannelUpdate_clone(&msg_conv);
68319         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
68320         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
68321         int64_t ret_ref = tag_ptr(ret_copy, true);
68322         return ret_ref;
68323 }
68324
68325 int64_t  CS_LDK_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
68326         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
68327         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
68328         int64_t ret_ref = tag_ptr(ret_copy, true);
68329         return ret_ref;
68330 }
68331
68332 int64_t  CS_LDK_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
68333         LDKPublicKey node_id_ref;
68334         CHECK(node_id->arr_len == 33);
68335         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
68336         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
68337         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
68338         int64_t ret_ref = tag_ptr(ret_copy, true);
68339         return ret_ref;
68340 }
68341
68342 jboolean  CS_LDK_NetworkUpdate_eq(int64_t a, int64_t b) {
68343         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
68344         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
68345         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
68346         return ret_conv;
68347 }
68348
68349 int8_tArray  CS_LDK_NetworkUpdate_write(int64_t obj) {
68350         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
68351         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
68352         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68353         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68354         CVec_u8Z_free(ret_var);
68355         return ret_arr;
68356 }
68357
68358 int64_t  CS_LDK_NetworkUpdate_read(int8_tArray ser) {
68359         LDKu8slice ser_ref;
68360         ser_ref.datalen = ser->arr_len;
68361         ser_ref.data = ser->elems;
68362         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
68363         *ret_conv = NetworkUpdate_read(ser_ref);
68364         FREE(ser);
68365         return tag_ptr(ret_conv, true);
68366 }
68367
68368 void  CS_LDK_P2PGossipSync_free(int64_t this_obj) {
68369         LDKP2PGossipSync this_obj_conv;
68370         this_obj_conv.inner = untag_ptr(this_obj);
68371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68373         P2PGossipSync_free(this_obj_conv);
68374 }
68375
68376 int64_t  CS_LDK_P2PGossipSync_new(int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
68377         LDKNetworkGraph network_graph_conv;
68378         network_graph_conv.inner = untag_ptr(network_graph);
68379         network_graph_conv.is_owned = ptr_is_owned(network_graph);
68380         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
68381         network_graph_conv.is_owned = false;
68382         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
68383         CHECK_ACCESS(utxo_lookup_ptr);
68384         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
68385         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
68386         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
68387                 // Manually implement clone for Java trait instances
68388                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
68389                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68390                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
68391                 }
68392         }
68393         void* logger_ptr = untag_ptr(logger);
68394         CHECK_ACCESS(logger_ptr);
68395         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
68396         if (logger_conv.free == LDKLogger_JCalls_free) {
68397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68398                 LDKLogger_JCalls_cloned(&logger_conv);
68399         }
68400         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
68401         int64_t ret_ref = 0;
68402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68404         return ret_ref;
68405 }
68406
68407 void  CS_LDK_P2PGossipSync_add_utxo_lookup(int64_t this_arg, int64_t utxo_lookup) {
68408         LDKP2PGossipSync this_arg_conv;
68409         this_arg_conv.inner = untag_ptr(this_arg);
68410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68412         this_arg_conv.is_owned = false;
68413         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
68414         CHECK_ACCESS(utxo_lookup_ptr);
68415         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
68416         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
68417         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
68418                 // Manually implement clone for Java trait instances
68419                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
68420                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
68421                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
68422                 }
68423         }
68424         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
68425 }
68426
68427 void  CS_LDK_NetworkGraph_handle_network_update(int64_t this_arg, int64_t network_update) {
68428         LDKNetworkGraph this_arg_conv;
68429         this_arg_conv.inner = untag_ptr(this_arg);
68430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68432         this_arg_conv.is_owned = false;
68433         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
68434         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
68435 }
68436
68437 int8_tArray  CS_LDK_NetworkGraph_get_chain_hash(int64_t this_arg) {
68438         LDKNetworkGraph this_arg_conv;
68439         this_arg_conv.inner = untag_ptr(this_arg);
68440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68442         this_arg_conv.is_owned = false;
68443         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68444         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
68445         return ret_arr;
68446 }
68447
68448 int64_t  CS_LDK_verify_node_announcement(int64_t msg) {
68449         LDKNodeAnnouncement msg_conv;
68450         msg_conv.inner = untag_ptr(msg);
68451         msg_conv.is_owned = ptr_is_owned(msg);
68452         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
68453         msg_conv.is_owned = false;
68454         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
68455         *ret_conv = verify_node_announcement(&msg_conv);
68456         return tag_ptr(ret_conv, true);
68457 }
68458
68459 int64_t  CS_LDK_verify_channel_announcement(int64_t msg) {
68460         LDKChannelAnnouncement msg_conv;
68461         msg_conv.inner = untag_ptr(msg);
68462         msg_conv.is_owned = ptr_is_owned(msg);
68463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
68464         msg_conv.is_owned = false;
68465         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
68466         *ret_conv = verify_channel_announcement(&msg_conv);
68467         return tag_ptr(ret_conv, true);
68468 }
68469
68470 int64_t  CS_LDK_P2PGossipSync_as_RoutingMessageHandler(int64_t this_arg) {
68471         LDKP2PGossipSync this_arg_conv;
68472         this_arg_conv.inner = untag_ptr(this_arg);
68473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68475         this_arg_conv.is_owned = false;
68476         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
68477         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
68478         return tag_ptr(ret_ret, true);
68479 }
68480
68481 int64_t  CS_LDK_P2PGossipSync_as_MessageSendEventsProvider(int64_t this_arg) {
68482         LDKP2PGossipSync this_arg_conv;
68483         this_arg_conv.inner = untag_ptr(this_arg);
68484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68486         this_arg_conv.is_owned = false;
68487         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
68488         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
68489         return tag_ptr(ret_ret, true);
68490 }
68491
68492 void  CS_LDK_ChannelUpdateInfo_free(int64_t this_obj) {
68493         LDKChannelUpdateInfo this_obj_conv;
68494         this_obj_conv.inner = untag_ptr(this_obj);
68495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68497         ChannelUpdateInfo_free(this_obj_conv);
68498 }
68499
68500 int32_t  CS_LDK_ChannelUpdateInfo_get_last_update(int64_t this_ptr) {
68501         LDKChannelUpdateInfo this_ptr_conv;
68502         this_ptr_conv.inner = untag_ptr(this_ptr);
68503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68505         this_ptr_conv.is_owned = false;
68506         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
68507         return ret_conv;
68508 }
68509
68510 void  CS_LDK_ChannelUpdateInfo_set_last_update(int64_t this_ptr, int32_t val) {
68511         LDKChannelUpdateInfo this_ptr_conv;
68512         this_ptr_conv.inner = untag_ptr(this_ptr);
68513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68515         this_ptr_conv.is_owned = false;
68516         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
68517 }
68518
68519 jboolean  CS_LDK_ChannelUpdateInfo_get_enabled(int64_t this_ptr) {
68520         LDKChannelUpdateInfo this_ptr_conv;
68521         this_ptr_conv.inner = untag_ptr(this_ptr);
68522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68524         this_ptr_conv.is_owned = false;
68525         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
68526         return ret_conv;
68527 }
68528
68529 void  CS_LDK_ChannelUpdateInfo_set_enabled(int64_t this_ptr, jboolean val) {
68530         LDKChannelUpdateInfo this_ptr_conv;
68531         this_ptr_conv.inner = untag_ptr(this_ptr);
68532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68534         this_ptr_conv.is_owned = false;
68535         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
68536 }
68537
68538 int16_t  CS_LDK_ChannelUpdateInfo_get_cltv_expiry_delta(int64_t this_ptr) {
68539         LDKChannelUpdateInfo this_ptr_conv;
68540         this_ptr_conv.inner = untag_ptr(this_ptr);
68541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68543         this_ptr_conv.is_owned = false;
68544         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
68545         return ret_conv;
68546 }
68547
68548 void  CS_LDK_ChannelUpdateInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
68549         LDKChannelUpdateInfo this_ptr_conv;
68550         this_ptr_conv.inner = untag_ptr(this_ptr);
68551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68553         this_ptr_conv.is_owned = false;
68554         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
68555 }
68556
68557 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_minimum_msat(int64_t this_ptr) {
68558         LDKChannelUpdateInfo this_ptr_conv;
68559         this_ptr_conv.inner = untag_ptr(this_ptr);
68560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68562         this_ptr_conv.is_owned = false;
68563         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
68564         return ret_conv;
68565 }
68566
68567 void  CS_LDK_ChannelUpdateInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
68568         LDKChannelUpdateInfo this_ptr_conv;
68569         this_ptr_conv.inner = untag_ptr(this_ptr);
68570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68572         this_ptr_conv.is_owned = false;
68573         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
68574 }
68575
68576 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_maximum_msat(int64_t this_ptr) {
68577         LDKChannelUpdateInfo this_ptr_conv;
68578         this_ptr_conv.inner = untag_ptr(this_ptr);
68579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68581         this_ptr_conv.is_owned = false;
68582         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
68583         return ret_conv;
68584 }
68585
68586 void  CS_LDK_ChannelUpdateInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
68587         LDKChannelUpdateInfo this_ptr_conv;
68588         this_ptr_conv.inner = untag_ptr(this_ptr);
68589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68591         this_ptr_conv.is_owned = false;
68592         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
68593 }
68594
68595 int64_t  CS_LDK_ChannelUpdateInfo_get_fees(int64_t this_ptr) {
68596         LDKChannelUpdateInfo this_ptr_conv;
68597         this_ptr_conv.inner = untag_ptr(this_ptr);
68598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68600         this_ptr_conv.is_owned = false;
68601         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
68602         int64_t ret_ref = 0;
68603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68605         return ret_ref;
68606 }
68607
68608 void  CS_LDK_ChannelUpdateInfo_set_fees(int64_t this_ptr, int64_t val) {
68609         LDKChannelUpdateInfo this_ptr_conv;
68610         this_ptr_conv.inner = untag_ptr(this_ptr);
68611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68613         this_ptr_conv.is_owned = false;
68614         LDKRoutingFees val_conv;
68615         val_conv.inner = untag_ptr(val);
68616         val_conv.is_owned = ptr_is_owned(val);
68617         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68618         val_conv = RoutingFees_clone(&val_conv);
68619         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
68620 }
68621
68622 int64_t  CS_LDK_ChannelUpdateInfo_get_last_update_message(int64_t this_ptr) {
68623         LDKChannelUpdateInfo this_ptr_conv;
68624         this_ptr_conv.inner = untag_ptr(this_ptr);
68625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68627         this_ptr_conv.is_owned = false;
68628         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
68629         int64_t ret_ref = 0;
68630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68632         return ret_ref;
68633 }
68634
68635 void  CS_LDK_ChannelUpdateInfo_set_last_update_message(int64_t this_ptr, int64_t val) {
68636         LDKChannelUpdateInfo this_ptr_conv;
68637         this_ptr_conv.inner = untag_ptr(this_ptr);
68638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68640         this_ptr_conv.is_owned = false;
68641         LDKChannelUpdate val_conv;
68642         val_conv.inner = untag_ptr(val);
68643         val_conv.is_owned = ptr_is_owned(val);
68644         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68645         val_conv = ChannelUpdate_clone(&val_conv);
68646         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
68647 }
68648
68649 int64_t  CS_LDK_ChannelUpdateInfo_new(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) {
68650         LDKRoutingFees fees_arg_conv;
68651         fees_arg_conv.inner = untag_ptr(fees_arg);
68652         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
68653         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
68654         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
68655         LDKChannelUpdate last_update_message_arg_conv;
68656         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
68657         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
68658         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
68659         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
68660         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);
68661         int64_t ret_ref = 0;
68662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68664         return ret_ref;
68665 }
68666
68667 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
68668         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
68669         int64_t ret_ref = 0;
68670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68672         return ret_ref;
68673 }
68674 int64_t  CS_LDK_ChannelUpdateInfo_clone_ptr(int64_t arg) {
68675         LDKChannelUpdateInfo arg_conv;
68676         arg_conv.inner = untag_ptr(arg);
68677         arg_conv.is_owned = ptr_is_owned(arg);
68678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68679         arg_conv.is_owned = false;
68680         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
68681         return ret_conv;
68682 }
68683
68684 int64_t  CS_LDK_ChannelUpdateInfo_clone(int64_t orig) {
68685         LDKChannelUpdateInfo orig_conv;
68686         orig_conv.inner = untag_ptr(orig);
68687         orig_conv.is_owned = ptr_is_owned(orig);
68688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68689         orig_conv.is_owned = false;
68690         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
68691         int64_t ret_ref = 0;
68692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68694         return ret_ref;
68695 }
68696
68697 jboolean  CS_LDK_ChannelUpdateInfo_eq(int64_t a, int64_t b) {
68698         LDKChannelUpdateInfo a_conv;
68699         a_conv.inner = untag_ptr(a);
68700         a_conv.is_owned = ptr_is_owned(a);
68701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68702         a_conv.is_owned = false;
68703         LDKChannelUpdateInfo b_conv;
68704         b_conv.inner = untag_ptr(b);
68705         b_conv.is_owned = ptr_is_owned(b);
68706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68707         b_conv.is_owned = false;
68708         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
68709         return ret_conv;
68710 }
68711
68712 int8_tArray  CS_LDK_ChannelUpdateInfo_write(int64_t obj) {
68713         LDKChannelUpdateInfo obj_conv;
68714         obj_conv.inner = untag_ptr(obj);
68715         obj_conv.is_owned = ptr_is_owned(obj);
68716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68717         obj_conv.is_owned = false;
68718         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
68719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68721         CVec_u8Z_free(ret_var);
68722         return ret_arr;
68723 }
68724
68725 int64_t  CS_LDK_ChannelUpdateInfo_read(int8_tArray ser) {
68726         LDKu8slice ser_ref;
68727         ser_ref.datalen = ser->arr_len;
68728         ser_ref.data = ser->elems;
68729         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
68730         *ret_conv = ChannelUpdateInfo_read(ser_ref);
68731         FREE(ser);
68732         return tag_ptr(ret_conv, true);
68733 }
68734
68735 void  CS_LDK_ChannelInfo_free(int64_t this_obj) {
68736         LDKChannelInfo this_obj_conv;
68737         this_obj_conv.inner = untag_ptr(this_obj);
68738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68740         ChannelInfo_free(this_obj_conv);
68741 }
68742
68743 int64_t  CS_LDK_ChannelInfo_get_features(int64_t this_ptr) {
68744         LDKChannelInfo this_ptr_conv;
68745         this_ptr_conv.inner = untag_ptr(this_ptr);
68746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68748         this_ptr_conv.is_owned = false;
68749         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
68750         int64_t ret_ref = 0;
68751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68753         return ret_ref;
68754 }
68755
68756 void  CS_LDK_ChannelInfo_set_features(int64_t this_ptr, int64_t val) {
68757         LDKChannelInfo this_ptr_conv;
68758         this_ptr_conv.inner = untag_ptr(this_ptr);
68759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68761         this_ptr_conv.is_owned = false;
68762         LDKChannelFeatures val_conv;
68763         val_conv.inner = untag_ptr(val);
68764         val_conv.is_owned = ptr_is_owned(val);
68765         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68766         val_conv = ChannelFeatures_clone(&val_conv);
68767         ChannelInfo_set_features(&this_ptr_conv, val_conv);
68768 }
68769
68770 int64_t  CS_LDK_ChannelInfo_get_node_one(int64_t this_ptr) {
68771         LDKChannelInfo this_ptr_conv;
68772         this_ptr_conv.inner = untag_ptr(this_ptr);
68773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68775         this_ptr_conv.is_owned = false;
68776         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
68777         int64_t ret_ref = 0;
68778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68780         return ret_ref;
68781 }
68782
68783 void  CS_LDK_ChannelInfo_set_node_one(int64_t this_ptr, int64_t val) {
68784         LDKChannelInfo this_ptr_conv;
68785         this_ptr_conv.inner = untag_ptr(this_ptr);
68786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68788         this_ptr_conv.is_owned = false;
68789         LDKNodeId val_conv;
68790         val_conv.inner = untag_ptr(val);
68791         val_conv.is_owned = ptr_is_owned(val);
68792         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68793         val_conv = NodeId_clone(&val_conv);
68794         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
68795 }
68796
68797 int64_t  CS_LDK_ChannelInfo_get_one_to_two(int64_t this_ptr) {
68798         LDKChannelInfo this_ptr_conv;
68799         this_ptr_conv.inner = untag_ptr(this_ptr);
68800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68802         this_ptr_conv.is_owned = false;
68803         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
68804         int64_t ret_ref = 0;
68805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68807         return ret_ref;
68808 }
68809
68810 void  CS_LDK_ChannelInfo_set_one_to_two(int64_t this_ptr, int64_t val) {
68811         LDKChannelInfo this_ptr_conv;
68812         this_ptr_conv.inner = untag_ptr(this_ptr);
68813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68815         this_ptr_conv.is_owned = false;
68816         LDKChannelUpdateInfo val_conv;
68817         val_conv.inner = untag_ptr(val);
68818         val_conv.is_owned = ptr_is_owned(val);
68819         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68820         val_conv = ChannelUpdateInfo_clone(&val_conv);
68821         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
68822 }
68823
68824 int64_t  CS_LDK_ChannelInfo_get_node_two(int64_t this_ptr) {
68825         LDKChannelInfo this_ptr_conv;
68826         this_ptr_conv.inner = untag_ptr(this_ptr);
68827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68829         this_ptr_conv.is_owned = false;
68830         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
68831         int64_t ret_ref = 0;
68832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68834         return ret_ref;
68835 }
68836
68837 void  CS_LDK_ChannelInfo_set_node_two(int64_t this_ptr, int64_t val) {
68838         LDKChannelInfo this_ptr_conv;
68839         this_ptr_conv.inner = untag_ptr(this_ptr);
68840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68842         this_ptr_conv.is_owned = false;
68843         LDKNodeId val_conv;
68844         val_conv.inner = untag_ptr(val);
68845         val_conv.is_owned = ptr_is_owned(val);
68846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68847         val_conv = NodeId_clone(&val_conv);
68848         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
68849 }
68850
68851 int64_t  CS_LDK_ChannelInfo_get_two_to_one(int64_t this_ptr) {
68852         LDKChannelInfo this_ptr_conv;
68853         this_ptr_conv.inner = untag_ptr(this_ptr);
68854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68856         this_ptr_conv.is_owned = false;
68857         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
68858         int64_t ret_ref = 0;
68859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68861         return ret_ref;
68862 }
68863
68864 void  CS_LDK_ChannelInfo_set_two_to_one(int64_t this_ptr, int64_t val) {
68865         LDKChannelInfo this_ptr_conv;
68866         this_ptr_conv.inner = untag_ptr(this_ptr);
68867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68869         this_ptr_conv.is_owned = false;
68870         LDKChannelUpdateInfo val_conv;
68871         val_conv.inner = untag_ptr(val);
68872         val_conv.is_owned = ptr_is_owned(val);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68874         val_conv = ChannelUpdateInfo_clone(&val_conv);
68875         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
68876 }
68877
68878 int64_t  CS_LDK_ChannelInfo_get_capacity_sats(int64_t this_ptr) {
68879         LDKChannelInfo this_ptr_conv;
68880         this_ptr_conv.inner = untag_ptr(this_ptr);
68881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68883         this_ptr_conv.is_owned = false;
68884         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68885         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
68886         int64_t ret_ref = tag_ptr(ret_copy, true);
68887         return ret_ref;
68888 }
68889
68890 void  CS_LDK_ChannelInfo_set_capacity_sats(int64_t this_ptr, int64_t val) {
68891         LDKChannelInfo this_ptr_conv;
68892         this_ptr_conv.inner = untag_ptr(this_ptr);
68893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68895         this_ptr_conv.is_owned = false;
68896         void* val_ptr = untag_ptr(val);
68897         CHECK_ACCESS(val_ptr);
68898         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68899         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68900         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
68901 }
68902
68903 int64_t  CS_LDK_ChannelInfo_get_announcement_message(int64_t this_ptr) {
68904         LDKChannelInfo this_ptr_conv;
68905         this_ptr_conv.inner = untag_ptr(this_ptr);
68906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68908         this_ptr_conv.is_owned = false;
68909         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
68910         int64_t ret_ref = 0;
68911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68913         return ret_ref;
68914 }
68915
68916 void  CS_LDK_ChannelInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
68917         LDKChannelInfo this_ptr_conv;
68918         this_ptr_conv.inner = untag_ptr(this_ptr);
68919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68921         this_ptr_conv.is_owned = false;
68922         LDKChannelAnnouncement val_conv;
68923         val_conv.inner = untag_ptr(val);
68924         val_conv.is_owned = ptr_is_owned(val);
68925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68926         val_conv = ChannelAnnouncement_clone(&val_conv);
68927         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
68928 }
68929
68930 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
68931         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
68932         int64_t ret_ref = 0;
68933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68935         return ret_ref;
68936 }
68937 int64_t  CS_LDK_ChannelInfo_clone_ptr(int64_t arg) {
68938         LDKChannelInfo arg_conv;
68939         arg_conv.inner = untag_ptr(arg);
68940         arg_conv.is_owned = ptr_is_owned(arg);
68941         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68942         arg_conv.is_owned = false;
68943         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
68944         return ret_conv;
68945 }
68946
68947 int64_t  CS_LDK_ChannelInfo_clone(int64_t orig) {
68948         LDKChannelInfo orig_conv;
68949         orig_conv.inner = untag_ptr(orig);
68950         orig_conv.is_owned = ptr_is_owned(orig);
68951         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68952         orig_conv.is_owned = false;
68953         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
68954         int64_t ret_ref = 0;
68955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68957         return ret_ref;
68958 }
68959
68960 jboolean  CS_LDK_ChannelInfo_eq(int64_t a, int64_t b) {
68961         LDKChannelInfo a_conv;
68962         a_conv.inner = untag_ptr(a);
68963         a_conv.is_owned = ptr_is_owned(a);
68964         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68965         a_conv.is_owned = false;
68966         LDKChannelInfo b_conv;
68967         b_conv.inner = untag_ptr(b);
68968         b_conv.is_owned = ptr_is_owned(b);
68969         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68970         b_conv.is_owned = false;
68971         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
68972         return ret_conv;
68973 }
68974
68975 int64_t  CS_LDK_ChannelInfo_get_directional_info(int64_t this_arg, int8_t channel_flags) {
68976         LDKChannelInfo this_arg_conv;
68977         this_arg_conv.inner = untag_ptr(this_arg);
68978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68980         this_arg_conv.is_owned = false;
68981         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
68982         int64_t ret_ref = 0;
68983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68985         return ret_ref;
68986 }
68987
68988 int8_tArray  CS_LDK_ChannelInfo_write(int64_t obj) {
68989         LDKChannelInfo obj_conv;
68990         obj_conv.inner = untag_ptr(obj);
68991         obj_conv.is_owned = ptr_is_owned(obj);
68992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68993         obj_conv.is_owned = false;
68994         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
68995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68997         CVec_u8Z_free(ret_var);
68998         return ret_arr;
68999 }
69000
69001 int64_t  CS_LDK_ChannelInfo_read(int8_tArray ser) {
69002         LDKu8slice ser_ref;
69003         ser_ref.datalen = ser->arr_len;
69004         ser_ref.data = ser->elems;
69005         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
69006         *ret_conv = ChannelInfo_read(ser_ref);
69007         FREE(ser);
69008         return tag_ptr(ret_conv, true);
69009 }
69010
69011 void  CS_LDK_DirectedChannelInfo_free(int64_t this_obj) {
69012         LDKDirectedChannelInfo this_obj_conv;
69013         this_obj_conv.inner = untag_ptr(this_obj);
69014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69016         DirectedChannelInfo_free(this_obj_conv);
69017 }
69018
69019 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
69020         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
69021         int64_t ret_ref = 0;
69022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69024         return ret_ref;
69025 }
69026 int64_t  CS_LDK_DirectedChannelInfo_clone_ptr(int64_t arg) {
69027         LDKDirectedChannelInfo arg_conv;
69028         arg_conv.inner = untag_ptr(arg);
69029         arg_conv.is_owned = ptr_is_owned(arg);
69030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69031         arg_conv.is_owned = false;
69032         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
69033         return ret_conv;
69034 }
69035
69036 int64_t  CS_LDK_DirectedChannelInfo_clone(int64_t orig) {
69037         LDKDirectedChannelInfo orig_conv;
69038         orig_conv.inner = untag_ptr(orig);
69039         orig_conv.is_owned = ptr_is_owned(orig);
69040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69041         orig_conv.is_owned = false;
69042         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
69043         int64_t ret_ref = 0;
69044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69046         return ret_ref;
69047 }
69048
69049 int64_t  CS_LDK_DirectedChannelInfo_channel(int64_t this_arg) {
69050         LDKDirectedChannelInfo 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         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
69056         int64_t ret_ref = 0;
69057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69059         return ret_ref;
69060 }
69061
69062 int64_t  CS_LDK_DirectedChannelInfo_effective_capacity(int64_t this_arg) {
69063         LDKDirectedChannelInfo this_arg_conv;
69064         this_arg_conv.inner = untag_ptr(this_arg);
69065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69067         this_arg_conv.is_owned = false;
69068         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69069         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
69070         int64_t ret_ref = tag_ptr(ret_copy, true);
69071         return ret_ref;
69072 }
69073
69074 int64_t  CS_LDK_DirectedChannelInfo_source(int64_t this_arg) {
69075         LDKDirectedChannelInfo this_arg_conv;
69076         this_arg_conv.inner = untag_ptr(this_arg);
69077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69079         this_arg_conv.is_owned = false;
69080         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
69081         int64_t ret_ref = 0;
69082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69084         return ret_ref;
69085 }
69086
69087 int64_t  CS_LDK_DirectedChannelInfo_target(int64_t this_arg) {
69088         LDKDirectedChannelInfo this_arg_conv;
69089         this_arg_conv.inner = untag_ptr(this_arg);
69090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69092         this_arg_conv.is_owned = false;
69093         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
69094         int64_t ret_ref = 0;
69095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69097         return ret_ref;
69098 }
69099
69100 void  CS_LDK_EffectiveCapacity_free(int64_t this_ptr) {
69101         if (!ptr_is_owned(this_ptr)) return;
69102         void* this_ptr_ptr = untag_ptr(this_ptr);
69103         CHECK_ACCESS(this_ptr_ptr);
69104         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
69105         FREE(untag_ptr(this_ptr));
69106         EffectiveCapacity_free(this_ptr_conv);
69107 }
69108
69109 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
69110         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69111         *ret_copy = EffectiveCapacity_clone(arg);
69112         int64_t ret_ref = tag_ptr(ret_copy, true);
69113         return ret_ref;
69114 }
69115 int64_t  CS_LDK_EffectiveCapacity_clone_ptr(int64_t arg) {
69116         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
69117         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
69118         return ret_conv;
69119 }
69120
69121 int64_t  CS_LDK_EffectiveCapacity_clone(int64_t orig) {
69122         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
69123         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69124         *ret_copy = EffectiveCapacity_clone(orig_conv);
69125         int64_t ret_ref = tag_ptr(ret_copy, true);
69126         return ret_ref;
69127 }
69128
69129 int64_t  CS_LDK_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
69130         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69131         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
69132         int64_t ret_ref = tag_ptr(ret_copy, true);
69133         return ret_ref;
69134 }
69135
69136 int64_t  CS_LDK_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
69137         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69138         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
69139         int64_t ret_ref = tag_ptr(ret_copy, true);
69140         return ret_ref;
69141 }
69142
69143 int64_t  CS_LDK_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
69144         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69145         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
69146         int64_t ret_ref = tag_ptr(ret_copy, true);
69147         return ret_ref;
69148 }
69149
69150 int64_t  CS_LDK_EffectiveCapacity_infinite() {
69151         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69152         *ret_copy = EffectiveCapacity_infinite();
69153         int64_t ret_ref = tag_ptr(ret_copy, true);
69154         return ret_ref;
69155 }
69156
69157 int64_t  CS_LDK_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
69158         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69159         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
69160         int64_t ret_ref = tag_ptr(ret_copy, true);
69161         return ret_ref;
69162 }
69163
69164 int64_t  CS_LDK_EffectiveCapacity_unknown() {
69165         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
69166         *ret_copy = EffectiveCapacity_unknown();
69167         int64_t ret_ref = tag_ptr(ret_copy, true);
69168         return ret_ref;
69169 }
69170
69171 int64_t  CS_LDK_EffectiveCapacity_as_msat(int64_t this_arg) {
69172         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
69173         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
69174         return ret_conv;
69175 }
69176
69177 void  CS_LDK_RoutingFees_free(int64_t this_obj) {
69178         LDKRoutingFees this_obj_conv;
69179         this_obj_conv.inner = untag_ptr(this_obj);
69180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69182         RoutingFees_free(this_obj_conv);
69183 }
69184
69185 int32_t  CS_LDK_RoutingFees_get_base_msat(int64_t this_ptr) {
69186         LDKRoutingFees this_ptr_conv;
69187         this_ptr_conv.inner = untag_ptr(this_ptr);
69188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69190         this_ptr_conv.is_owned = false;
69191         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
69192         return ret_conv;
69193 }
69194
69195 void  CS_LDK_RoutingFees_set_base_msat(int64_t this_ptr, int32_t val) {
69196         LDKRoutingFees this_ptr_conv;
69197         this_ptr_conv.inner = untag_ptr(this_ptr);
69198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69200         this_ptr_conv.is_owned = false;
69201         RoutingFees_set_base_msat(&this_ptr_conv, val);
69202 }
69203
69204 int32_t  CS_LDK_RoutingFees_get_proportional_millionths(int64_t this_ptr) {
69205         LDKRoutingFees this_ptr_conv;
69206         this_ptr_conv.inner = untag_ptr(this_ptr);
69207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69209         this_ptr_conv.is_owned = false;
69210         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
69211         return ret_conv;
69212 }
69213
69214 void  CS_LDK_RoutingFees_set_proportional_millionths(int64_t this_ptr, int32_t val) {
69215         LDKRoutingFees this_ptr_conv;
69216         this_ptr_conv.inner = untag_ptr(this_ptr);
69217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69219         this_ptr_conv.is_owned = false;
69220         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
69221 }
69222
69223 int64_t  CS_LDK_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
69224         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
69225         int64_t ret_ref = 0;
69226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69228         return ret_ref;
69229 }
69230
69231 jboolean  CS_LDK_RoutingFees_eq(int64_t a, int64_t b) {
69232         LDKRoutingFees a_conv;
69233         a_conv.inner = untag_ptr(a);
69234         a_conv.is_owned = ptr_is_owned(a);
69235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69236         a_conv.is_owned = false;
69237         LDKRoutingFees b_conv;
69238         b_conv.inner = untag_ptr(b);
69239         b_conv.is_owned = ptr_is_owned(b);
69240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69241         b_conv.is_owned = false;
69242         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
69243         return ret_conv;
69244 }
69245
69246 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
69247         LDKRoutingFees ret_var = RoutingFees_clone(arg);
69248         int64_t ret_ref = 0;
69249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69251         return ret_ref;
69252 }
69253 int64_t  CS_LDK_RoutingFees_clone_ptr(int64_t arg) {
69254         LDKRoutingFees arg_conv;
69255         arg_conv.inner = untag_ptr(arg);
69256         arg_conv.is_owned = ptr_is_owned(arg);
69257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69258         arg_conv.is_owned = false;
69259         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
69260         return ret_conv;
69261 }
69262
69263 int64_t  CS_LDK_RoutingFees_clone(int64_t orig) {
69264         LDKRoutingFees orig_conv;
69265         orig_conv.inner = untag_ptr(orig);
69266         orig_conv.is_owned = ptr_is_owned(orig);
69267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69268         orig_conv.is_owned = false;
69269         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
69270         int64_t ret_ref = 0;
69271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69273         return ret_ref;
69274 }
69275
69276 int64_t  CS_LDK_RoutingFees_hash(int64_t o) {
69277         LDKRoutingFees o_conv;
69278         o_conv.inner = untag_ptr(o);
69279         o_conv.is_owned = ptr_is_owned(o);
69280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69281         o_conv.is_owned = false;
69282         int64_t ret_conv = RoutingFees_hash(&o_conv);
69283         return ret_conv;
69284 }
69285
69286 int8_tArray  CS_LDK_RoutingFees_write(int64_t obj) {
69287         LDKRoutingFees obj_conv;
69288         obj_conv.inner = untag_ptr(obj);
69289         obj_conv.is_owned = ptr_is_owned(obj);
69290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69291         obj_conv.is_owned = false;
69292         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
69293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69295         CVec_u8Z_free(ret_var);
69296         return ret_arr;
69297 }
69298
69299 int64_t  CS_LDK_RoutingFees_read(int8_tArray ser) {
69300         LDKu8slice ser_ref;
69301         ser_ref.datalen = ser->arr_len;
69302         ser_ref.data = ser->elems;
69303         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
69304         *ret_conv = RoutingFees_read(ser_ref);
69305         FREE(ser);
69306         return tag_ptr(ret_conv, true);
69307 }
69308
69309 void  CS_LDK_NodeAnnouncementInfo_free(int64_t this_obj) {
69310         LDKNodeAnnouncementInfo this_obj_conv;
69311         this_obj_conv.inner = untag_ptr(this_obj);
69312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69314         NodeAnnouncementInfo_free(this_obj_conv);
69315 }
69316
69317 int64_t  CS_LDK_NodeAnnouncementInfo_get_features(int64_t this_ptr) {
69318         LDKNodeAnnouncementInfo this_ptr_conv;
69319         this_ptr_conv.inner = untag_ptr(this_ptr);
69320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69322         this_ptr_conv.is_owned = false;
69323         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
69324         int64_t ret_ref = 0;
69325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69327         return ret_ref;
69328 }
69329
69330 void  CS_LDK_NodeAnnouncementInfo_set_features(int64_t this_ptr, int64_t val) {
69331         LDKNodeAnnouncementInfo this_ptr_conv;
69332         this_ptr_conv.inner = untag_ptr(this_ptr);
69333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69335         this_ptr_conv.is_owned = false;
69336         LDKNodeFeatures val_conv;
69337         val_conv.inner = untag_ptr(val);
69338         val_conv.is_owned = ptr_is_owned(val);
69339         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69340         val_conv = NodeFeatures_clone(&val_conv);
69341         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
69342 }
69343
69344 int32_t  CS_LDK_NodeAnnouncementInfo_get_last_update(int64_t this_ptr) {
69345         LDKNodeAnnouncementInfo this_ptr_conv;
69346         this_ptr_conv.inner = untag_ptr(this_ptr);
69347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69349         this_ptr_conv.is_owned = false;
69350         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
69351         return ret_conv;
69352 }
69353
69354 void  CS_LDK_NodeAnnouncementInfo_set_last_update(int64_t this_ptr, int32_t val) {
69355         LDKNodeAnnouncementInfo this_ptr_conv;
69356         this_ptr_conv.inner = untag_ptr(this_ptr);
69357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69359         this_ptr_conv.is_owned = false;
69360         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
69361 }
69362
69363 int8_tArray  CS_LDK_NodeAnnouncementInfo_get_rgb(int64_t this_ptr) {
69364         LDKNodeAnnouncementInfo this_ptr_conv;
69365         this_ptr_conv.inner = untag_ptr(this_ptr);
69366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69368         this_ptr_conv.is_owned = false;
69369         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
69370         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
69371         return ret_arr;
69372 }
69373
69374 void  CS_LDK_NodeAnnouncementInfo_set_rgb(int64_t this_ptr, int8_tArray val) {
69375         LDKNodeAnnouncementInfo this_ptr_conv;
69376         this_ptr_conv.inner = untag_ptr(this_ptr);
69377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69379         this_ptr_conv.is_owned = false;
69380         LDKThreeBytes val_ref;
69381         CHECK(val->arr_len == 3);
69382         memcpy(val_ref.data, val->elems, 3); FREE(val);
69383         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
69384 }
69385
69386 int64_t  CS_LDK_NodeAnnouncementInfo_get_alias(int64_t this_ptr) {
69387         LDKNodeAnnouncementInfo this_ptr_conv;
69388         this_ptr_conv.inner = untag_ptr(this_ptr);
69389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69391         this_ptr_conv.is_owned = false;
69392         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
69393         int64_t ret_ref = 0;
69394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69396         return ret_ref;
69397 }
69398
69399 void  CS_LDK_NodeAnnouncementInfo_set_alias(int64_t this_ptr, int64_t val) {
69400         LDKNodeAnnouncementInfo this_ptr_conv;
69401         this_ptr_conv.inner = untag_ptr(this_ptr);
69402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69404         this_ptr_conv.is_owned = false;
69405         LDKNodeAlias val_conv;
69406         val_conv.inner = untag_ptr(val);
69407         val_conv.is_owned = ptr_is_owned(val);
69408         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69409         val_conv = NodeAlias_clone(&val_conv);
69410         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
69411 }
69412
69413 int64_t  CS_LDK_NodeAnnouncementInfo_get_announcement_message(int64_t this_ptr) {
69414         LDKNodeAnnouncementInfo this_ptr_conv;
69415         this_ptr_conv.inner = untag_ptr(this_ptr);
69416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69418         this_ptr_conv.is_owned = false;
69419         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
69420         int64_t ret_ref = 0;
69421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69423         return ret_ref;
69424 }
69425
69426 void  CS_LDK_NodeAnnouncementInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
69427         LDKNodeAnnouncementInfo this_ptr_conv;
69428         this_ptr_conv.inner = untag_ptr(this_ptr);
69429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69431         this_ptr_conv.is_owned = false;
69432         LDKNodeAnnouncement val_conv;
69433         val_conv.inner = untag_ptr(val);
69434         val_conv.is_owned = ptr_is_owned(val);
69435         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69436         val_conv = NodeAnnouncement_clone(&val_conv);
69437         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
69438 }
69439
69440 int64_t  CS_LDK_NodeAnnouncementInfo_new(int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_t announcement_message_arg) {
69441         LDKNodeFeatures features_arg_conv;
69442         features_arg_conv.inner = untag_ptr(features_arg);
69443         features_arg_conv.is_owned = ptr_is_owned(features_arg);
69444         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
69445         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
69446         LDKThreeBytes rgb_arg_ref;
69447         CHECK(rgb_arg->arr_len == 3);
69448         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
69449         LDKNodeAlias alias_arg_conv;
69450         alias_arg_conv.inner = untag_ptr(alias_arg);
69451         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
69452         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
69453         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
69454         LDKNodeAnnouncement announcement_message_arg_conv;
69455         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
69456         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
69457         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
69458         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
69459         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
69460         int64_t ret_ref = 0;
69461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69463         return ret_ref;
69464 }
69465
69466 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
69467         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
69468         int64_t ret_ref = 0;
69469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69471         return ret_ref;
69472 }
69473 int64_t  CS_LDK_NodeAnnouncementInfo_clone_ptr(int64_t arg) {
69474         LDKNodeAnnouncementInfo arg_conv;
69475         arg_conv.inner = untag_ptr(arg);
69476         arg_conv.is_owned = ptr_is_owned(arg);
69477         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69478         arg_conv.is_owned = false;
69479         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
69480         return ret_conv;
69481 }
69482
69483 int64_t  CS_LDK_NodeAnnouncementInfo_clone(int64_t orig) {
69484         LDKNodeAnnouncementInfo orig_conv;
69485         orig_conv.inner = untag_ptr(orig);
69486         orig_conv.is_owned = ptr_is_owned(orig);
69487         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69488         orig_conv.is_owned = false;
69489         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
69490         int64_t ret_ref = 0;
69491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69493         return ret_ref;
69494 }
69495
69496 jboolean  CS_LDK_NodeAnnouncementInfo_eq(int64_t a, int64_t b) {
69497         LDKNodeAnnouncementInfo a_conv;
69498         a_conv.inner = untag_ptr(a);
69499         a_conv.is_owned = ptr_is_owned(a);
69500         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69501         a_conv.is_owned = false;
69502         LDKNodeAnnouncementInfo b_conv;
69503         b_conv.inner = untag_ptr(b);
69504         b_conv.is_owned = ptr_is_owned(b);
69505         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69506         b_conv.is_owned = false;
69507         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
69508         return ret_conv;
69509 }
69510
69511 int64_tArray  CS_LDK_NodeAnnouncementInfo_addresses(int64_t this_arg) {
69512         LDKNodeAnnouncementInfo this_arg_conv;
69513         this_arg_conv.inner = untag_ptr(this_arg);
69514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69516         this_arg_conv.is_owned = false;
69517         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
69518         int64_tArray ret_arr = NULL;
69519         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69520         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69521         for (size_t p = 0; p < ret_var.datalen; p++) {
69522                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
69523                 *ret_conv_15_copy = ret_var.data[p];
69524                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
69525                 ret_arr_ptr[p] = ret_conv_15_ref;
69526         }
69527         
69528         FREE(ret_var.data);
69529         return ret_arr;
69530 }
69531
69532 int8_tArray  CS_LDK_NodeAnnouncementInfo_write(int64_t obj) {
69533         LDKNodeAnnouncementInfo obj_conv;
69534         obj_conv.inner = untag_ptr(obj);
69535         obj_conv.is_owned = ptr_is_owned(obj);
69536         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69537         obj_conv.is_owned = false;
69538         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
69539         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69540         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69541         CVec_u8Z_free(ret_var);
69542         return ret_arr;
69543 }
69544
69545 int64_t  CS_LDK_NodeAnnouncementInfo_read(int8_tArray ser) {
69546         LDKu8slice ser_ref;
69547         ser_ref.datalen = ser->arr_len;
69548         ser_ref.data = ser->elems;
69549         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
69550         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
69551         FREE(ser);
69552         return tag_ptr(ret_conv, true);
69553 }
69554
69555 void  CS_LDK_NodeAlias_free(int64_t this_obj) {
69556         LDKNodeAlias this_obj_conv;
69557         this_obj_conv.inner = untag_ptr(this_obj);
69558         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69560         NodeAlias_free(this_obj_conv);
69561 }
69562
69563 int8_tArray  CS_LDK_NodeAlias_get_a(int64_t this_ptr) {
69564         LDKNodeAlias this_ptr_conv;
69565         this_ptr_conv.inner = untag_ptr(this_ptr);
69566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69568         this_ptr_conv.is_owned = false;
69569         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69570         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
69571         return ret_arr;
69572 }
69573
69574 void  CS_LDK_NodeAlias_set_a(int64_t this_ptr, int8_tArray val) {
69575         LDKNodeAlias this_ptr_conv;
69576         this_ptr_conv.inner = untag_ptr(this_ptr);
69577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69579         this_ptr_conv.is_owned = false;
69580         LDKThirtyTwoBytes val_ref;
69581         CHECK(val->arr_len == 32);
69582         memcpy(val_ref.data, val->elems, 32); FREE(val);
69583         NodeAlias_set_a(&this_ptr_conv, val_ref);
69584 }
69585
69586 int64_t  CS_LDK_NodeAlias_new(int8_tArray a_arg) {
69587         LDKThirtyTwoBytes a_arg_ref;
69588         CHECK(a_arg->arr_len == 32);
69589         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
69590         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
69591         int64_t ret_ref = 0;
69592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69594         return ret_ref;
69595 }
69596
69597 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
69598         LDKNodeAlias ret_var = NodeAlias_clone(arg);
69599         int64_t ret_ref = 0;
69600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69602         return ret_ref;
69603 }
69604 int64_t  CS_LDK_NodeAlias_clone_ptr(int64_t arg) {
69605         LDKNodeAlias arg_conv;
69606         arg_conv.inner = untag_ptr(arg);
69607         arg_conv.is_owned = ptr_is_owned(arg);
69608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69609         arg_conv.is_owned = false;
69610         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
69611         return ret_conv;
69612 }
69613
69614 int64_t  CS_LDK_NodeAlias_clone(int64_t orig) {
69615         LDKNodeAlias orig_conv;
69616         orig_conv.inner = untag_ptr(orig);
69617         orig_conv.is_owned = ptr_is_owned(orig);
69618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69619         orig_conv.is_owned = false;
69620         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
69621         int64_t ret_ref = 0;
69622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69624         return ret_ref;
69625 }
69626
69627 int64_t  CS_LDK_NodeAlias_hash(int64_t o) {
69628         LDKNodeAlias o_conv;
69629         o_conv.inner = untag_ptr(o);
69630         o_conv.is_owned = ptr_is_owned(o);
69631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69632         o_conv.is_owned = false;
69633         int64_t ret_conv = NodeAlias_hash(&o_conv);
69634         return ret_conv;
69635 }
69636
69637 jboolean  CS_LDK_NodeAlias_eq(int64_t a, int64_t b) {
69638         LDKNodeAlias a_conv;
69639         a_conv.inner = untag_ptr(a);
69640         a_conv.is_owned = ptr_is_owned(a);
69641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69642         a_conv.is_owned = false;
69643         LDKNodeAlias b_conv;
69644         b_conv.inner = untag_ptr(b);
69645         b_conv.is_owned = ptr_is_owned(b);
69646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69647         b_conv.is_owned = false;
69648         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
69649         return ret_conv;
69650 }
69651
69652 int8_tArray  CS_LDK_NodeAlias_write(int64_t obj) {
69653         LDKNodeAlias obj_conv;
69654         obj_conv.inner = untag_ptr(obj);
69655         obj_conv.is_owned = ptr_is_owned(obj);
69656         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69657         obj_conv.is_owned = false;
69658         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
69659         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69660         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69661         CVec_u8Z_free(ret_var);
69662         return ret_arr;
69663 }
69664
69665 int64_t  CS_LDK_NodeAlias_read(int8_tArray ser) {
69666         LDKu8slice ser_ref;
69667         ser_ref.datalen = ser->arr_len;
69668         ser_ref.data = ser->elems;
69669         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
69670         *ret_conv = NodeAlias_read(ser_ref);
69671         FREE(ser);
69672         return tag_ptr(ret_conv, true);
69673 }
69674
69675 void  CS_LDK_NodeInfo_free(int64_t this_obj) {
69676         LDKNodeInfo this_obj_conv;
69677         this_obj_conv.inner = untag_ptr(this_obj);
69678         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69680         NodeInfo_free(this_obj_conv);
69681 }
69682
69683 int64_tArray  CS_LDK_NodeInfo_get_channels(int64_t this_ptr) {
69684         LDKNodeInfo this_ptr_conv;
69685         this_ptr_conv.inner = untag_ptr(this_ptr);
69686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69688         this_ptr_conv.is_owned = false;
69689         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
69690         int64_tArray ret_arr = NULL;
69691         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69692         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69693         for (size_t g = 0; g < ret_var.datalen; g++) {
69694                 int64_t ret_conv_6_conv = ret_var.data[g];
69695                 ret_arr_ptr[g] = ret_conv_6_conv;
69696         }
69697         
69698         FREE(ret_var.data);
69699         return ret_arr;
69700 }
69701
69702 void  CS_LDK_NodeInfo_set_channels(int64_t this_ptr, int64_tArray val) {
69703         LDKNodeInfo this_ptr_conv;
69704         this_ptr_conv.inner = untag_ptr(this_ptr);
69705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69707         this_ptr_conv.is_owned = false;
69708         LDKCVec_u64Z val_constr;
69709         val_constr.datalen = val->arr_len;
69710         if (val_constr.datalen > 0)
69711                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69712         else
69713                 val_constr.data = NULL;
69714         int64_t* val_vals = val->elems;
69715         for (size_t g = 0; g < val_constr.datalen; g++) {
69716                 int64_t val_conv_6 = val_vals[g];
69717                 val_constr.data[g] = val_conv_6;
69718         }
69719         FREE(val);
69720         NodeInfo_set_channels(&this_ptr_conv, val_constr);
69721 }
69722
69723 int64_t  CS_LDK_NodeInfo_get_announcement_info(int64_t this_ptr) {
69724         LDKNodeInfo this_ptr_conv;
69725         this_ptr_conv.inner = untag_ptr(this_ptr);
69726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69728         this_ptr_conv.is_owned = false;
69729         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
69730         int64_t ret_ref = 0;
69731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69733         return ret_ref;
69734 }
69735
69736 void  CS_LDK_NodeInfo_set_announcement_info(int64_t this_ptr, int64_t val) {
69737         LDKNodeInfo this_ptr_conv;
69738         this_ptr_conv.inner = untag_ptr(this_ptr);
69739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69741         this_ptr_conv.is_owned = false;
69742         LDKNodeAnnouncementInfo val_conv;
69743         val_conv.inner = untag_ptr(val);
69744         val_conv.is_owned = ptr_is_owned(val);
69745         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69746         val_conv = NodeAnnouncementInfo_clone(&val_conv);
69747         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
69748 }
69749
69750 int64_t  CS_LDK_NodeInfo_new(int64_tArray channels_arg, int64_t announcement_info_arg) {
69751         LDKCVec_u64Z channels_arg_constr;
69752         channels_arg_constr.datalen = channels_arg->arr_len;
69753         if (channels_arg_constr.datalen > 0)
69754                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69755         else
69756                 channels_arg_constr.data = NULL;
69757         int64_t* channels_arg_vals = channels_arg->elems;
69758         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
69759                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
69760                 channels_arg_constr.data[g] = channels_arg_conv_6;
69761         }
69762         FREE(channels_arg);
69763         LDKNodeAnnouncementInfo announcement_info_arg_conv;
69764         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
69765         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
69766         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
69767         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
69768         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
69769         int64_t ret_ref = 0;
69770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69772         return ret_ref;
69773 }
69774
69775 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
69776         LDKNodeInfo ret_var = NodeInfo_clone(arg);
69777         int64_t ret_ref = 0;
69778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69780         return ret_ref;
69781 }
69782 int64_t  CS_LDK_NodeInfo_clone_ptr(int64_t arg) {
69783         LDKNodeInfo arg_conv;
69784         arg_conv.inner = untag_ptr(arg);
69785         arg_conv.is_owned = ptr_is_owned(arg);
69786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69787         arg_conv.is_owned = false;
69788         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
69789         return ret_conv;
69790 }
69791
69792 int64_t  CS_LDK_NodeInfo_clone(int64_t orig) {
69793         LDKNodeInfo orig_conv;
69794         orig_conv.inner = untag_ptr(orig);
69795         orig_conv.is_owned = ptr_is_owned(orig);
69796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69797         orig_conv.is_owned = false;
69798         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
69799         int64_t ret_ref = 0;
69800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69802         return ret_ref;
69803 }
69804
69805 jboolean  CS_LDK_NodeInfo_eq(int64_t a, int64_t b) {
69806         LDKNodeInfo a_conv;
69807         a_conv.inner = untag_ptr(a);
69808         a_conv.is_owned = ptr_is_owned(a);
69809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69810         a_conv.is_owned = false;
69811         LDKNodeInfo b_conv;
69812         b_conv.inner = untag_ptr(b);
69813         b_conv.is_owned = ptr_is_owned(b);
69814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69815         b_conv.is_owned = false;
69816         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
69817         return ret_conv;
69818 }
69819
69820 jboolean  CS_LDK_NodeInfo_is_tor_only(int64_t this_arg) {
69821         LDKNodeInfo this_arg_conv;
69822         this_arg_conv.inner = untag_ptr(this_arg);
69823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69825         this_arg_conv.is_owned = false;
69826         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
69827         return ret_conv;
69828 }
69829
69830 int8_tArray  CS_LDK_NodeInfo_write(int64_t obj) {
69831         LDKNodeInfo obj_conv;
69832         obj_conv.inner = untag_ptr(obj);
69833         obj_conv.is_owned = ptr_is_owned(obj);
69834         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69835         obj_conv.is_owned = false;
69836         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
69837         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69838         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69839         CVec_u8Z_free(ret_var);
69840         return ret_arr;
69841 }
69842
69843 int64_t  CS_LDK_NodeInfo_read(int8_tArray ser) {
69844         LDKu8slice ser_ref;
69845         ser_ref.datalen = ser->arr_len;
69846         ser_ref.data = ser->elems;
69847         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
69848         *ret_conv = NodeInfo_read(ser_ref);
69849         FREE(ser);
69850         return tag_ptr(ret_conv, true);
69851 }
69852
69853 int8_tArray  CS_LDK_NetworkGraph_write(int64_t obj) {
69854         LDKNetworkGraph obj_conv;
69855         obj_conv.inner = untag_ptr(obj);
69856         obj_conv.is_owned = ptr_is_owned(obj);
69857         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69858         obj_conv.is_owned = false;
69859         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
69860         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69861         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69862         CVec_u8Z_free(ret_var);
69863         return ret_arr;
69864 }
69865
69866 int64_t  CS_LDK_NetworkGraph_read(int8_tArray ser, int64_t arg) {
69867         LDKu8slice ser_ref;
69868         ser_ref.datalen = ser->arr_len;
69869         ser_ref.data = ser->elems;
69870         void* arg_ptr = untag_ptr(arg);
69871         CHECK_ACCESS(arg_ptr);
69872         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
69873         if (arg_conv.free == LDKLogger_JCalls_free) {
69874                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69875                 LDKLogger_JCalls_cloned(&arg_conv);
69876         }
69877         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
69878         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
69879         FREE(ser);
69880         return tag_ptr(ret_conv, true);
69881 }
69882
69883 int64_t  CS_LDK_NetworkGraph_new(int32_t network, int64_t logger) {
69884         LDKNetwork network_conv = LDKNetwork_from_cs(network);
69885         void* logger_ptr = untag_ptr(logger);
69886         CHECK_ACCESS(logger_ptr);
69887         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69888         if (logger_conv.free == LDKLogger_JCalls_free) {
69889                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69890                 LDKLogger_JCalls_cloned(&logger_conv);
69891         }
69892         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
69893         int64_t ret_ref = 0;
69894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69896         return ret_ref;
69897 }
69898
69899 int64_t  CS_LDK_NetworkGraph_read_only(int64_t this_arg) {
69900         LDKNetworkGraph this_arg_conv;
69901         this_arg_conv.inner = untag_ptr(this_arg);
69902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69904         this_arg_conv.is_owned = false;
69905         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
69906         int64_t ret_ref = 0;
69907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69909         return ret_ref;
69910 }
69911
69912 int64_t  CS_LDK_NetworkGraph_get_last_rapid_gossip_sync_timestamp(int64_t this_arg) {
69913         LDKNetworkGraph this_arg_conv;
69914         this_arg_conv.inner = untag_ptr(this_arg);
69915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69917         this_arg_conv.is_owned = false;
69918         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
69919         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
69920         int64_t ret_ref = tag_ptr(ret_copy, true);
69921         return ret_ref;
69922 }
69923
69924 void  CS_LDK_NetworkGraph_set_last_rapid_gossip_sync_timestamp(int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
69925         LDKNetworkGraph this_arg_conv;
69926         this_arg_conv.inner = untag_ptr(this_arg);
69927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69929         this_arg_conv.is_owned = false;
69930         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
69931 }
69932
69933 int64_t  CS_LDK_NetworkGraph_update_node_from_announcement(int64_t this_arg, int64_t msg) {
69934         LDKNetworkGraph this_arg_conv;
69935         this_arg_conv.inner = untag_ptr(this_arg);
69936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69938         this_arg_conv.is_owned = false;
69939         LDKNodeAnnouncement msg_conv;
69940         msg_conv.inner = untag_ptr(msg);
69941         msg_conv.is_owned = ptr_is_owned(msg);
69942         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69943         msg_conv.is_owned = false;
69944         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69945         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
69946         return tag_ptr(ret_conv, true);
69947 }
69948
69949 int64_t  CS_LDK_NetworkGraph_update_node_from_unsigned_announcement(int64_t this_arg, int64_t msg) {
69950         LDKNetworkGraph this_arg_conv;
69951         this_arg_conv.inner = untag_ptr(this_arg);
69952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69954         this_arg_conv.is_owned = false;
69955         LDKUnsignedNodeAnnouncement msg_conv;
69956         msg_conv.inner = untag_ptr(msg);
69957         msg_conv.is_owned = ptr_is_owned(msg);
69958         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69959         msg_conv.is_owned = false;
69960         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69961         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
69962         return tag_ptr(ret_conv, true);
69963 }
69964
69965 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
69966         LDKNetworkGraph this_arg_conv;
69967         this_arg_conv.inner = untag_ptr(this_arg);
69968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69970         this_arg_conv.is_owned = false;
69971         LDKChannelAnnouncement msg_conv;
69972         msg_conv.inner = untag_ptr(msg);
69973         msg_conv.is_owned = ptr_is_owned(msg);
69974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69975         msg_conv.is_owned = false;
69976         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69977         CHECK_ACCESS(utxo_lookup_ptr);
69978         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69979         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69980         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69981                 // Manually implement clone for Java trait instances
69982                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69983                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69984                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69985                 }
69986         }
69987         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69988         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69989         return tag_ptr(ret_conv, true);
69990 }
69991
69992 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement_no_lookup(int64_t this_arg, int64_t msg) {
69993         LDKNetworkGraph this_arg_conv;
69994         this_arg_conv.inner = untag_ptr(this_arg);
69995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69997         this_arg_conv.is_owned = false;
69998         LDKChannelAnnouncement msg_conv;
69999         msg_conv.inner = untag_ptr(msg);
70000         msg_conv.is_owned = ptr_is_owned(msg);
70001         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70002         msg_conv.is_owned = false;
70003         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70004         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
70005         return tag_ptr(ret_conv, true);
70006 }
70007
70008 int64_t  CS_LDK_NetworkGraph_update_channel_from_unsigned_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
70009         LDKNetworkGraph this_arg_conv;
70010         this_arg_conv.inner = untag_ptr(this_arg);
70011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70013         this_arg_conv.is_owned = false;
70014         LDKUnsignedChannelAnnouncement msg_conv;
70015         msg_conv.inner = untag_ptr(msg);
70016         msg_conv.is_owned = ptr_is_owned(msg);
70017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70018         msg_conv.is_owned = false;
70019         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
70020         CHECK_ACCESS(utxo_lookup_ptr);
70021         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
70022         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
70023         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
70024                 // Manually implement clone for Java trait instances
70025                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
70026                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70027                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
70028                 }
70029         }
70030         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70031         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
70032         return tag_ptr(ret_conv, true);
70033 }
70034
70035 int64_t  CS_LDK_NetworkGraph_add_channel_from_partial_announcement(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) {
70036         LDKNetworkGraph this_arg_conv;
70037         this_arg_conv.inner = untag_ptr(this_arg);
70038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70040         this_arg_conv.is_owned = false;
70041         LDKChannelFeatures features_conv;
70042         features_conv.inner = untag_ptr(features);
70043         features_conv.is_owned = ptr_is_owned(features);
70044         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
70045         features_conv = ChannelFeatures_clone(&features_conv);
70046         LDKPublicKey node_id_1_ref;
70047         CHECK(node_id_1->arr_len == 33);
70048         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
70049         LDKPublicKey node_id_2_ref;
70050         CHECK(node_id_2->arr_len == 33);
70051         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
70052         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70053         *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);
70054         return tag_ptr(ret_conv, true);
70055 }
70056
70057 void  CS_LDK_NetworkGraph_channel_failed_permanent(int64_t this_arg, int64_t short_channel_id) {
70058         LDKNetworkGraph this_arg_conv;
70059         this_arg_conv.inner = untag_ptr(this_arg);
70060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70062         this_arg_conv.is_owned = false;
70063         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
70064 }
70065
70066 void  CS_LDK_NetworkGraph_node_failed_permanent(int64_t this_arg, int8_tArray node_id) {
70067         LDKNetworkGraph this_arg_conv;
70068         this_arg_conv.inner = untag_ptr(this_arg);
70069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70071         this_arg_conv.is_owned = false;
70072         LDKPublicKey node_id_ref;
70073         CHECK(node_id->arr_len == 33);
70074         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
70075         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
70076 }
70077
70078 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking(int64_t this_arg) {
70079         LDKNetworkGraph this_arg_conv;
70080         this_arg_conv.inner = untag_ptr(this_arg);
70081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70083         this_arg_conv.is_owned = false;
70084         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
70085 }
70086
70087 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking_with_time(int64_t this_arg, int64_t current_time_unix) {
70088         LDKNetworkGraph this_arg_conv;
70089         this_arg_conv.inner = untag_ptr(this_arg);
70090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70092         this_arg_conv.is_owned = false;
70093         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
70094 }
70095
70096 int64_t  CS_LDK_NetworkGraph_update_channel(int64_t this_arg, int64_t msg) {
70097         LDKNetworkGraph this_arg_conv;
70098         this_arg_conv.inner = untag_ptr(this_arg);
70099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70101         this_arg_conv.is_owned = false;
70102         LDKChannelUpdate msg_conv;
70103         msg_conv.inner = untag_ptr(msg);
70104         msg_conv.is_owned = ptr_is_owned(msg);
70105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70106         msg_conv.is_owned = false;
70107         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70108         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
70109         return tag_ptr(ret_conv, true);
70110 }
70111
70112 int64_t  CS_LDK_NetworkGraph_update_channel_unsigned(int64_t this_arg, int64_t msg) {
70113         LDKNetworkGraph this_arg_conv;
70114         this_arg_conv.inner = untag_ptr(this_arg);
70115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70117         this_arg_conv.is_owned = false;
70118         LDKUnsignedChannelUpdate msg_conv;
70119         msg_conv.inner = untag_ptr(msg);
70120         msg_conv.is_owned = ptr_is_owned(msg);
70121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70122         msg_conv.is_owned = false;
70123         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70124         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
70125         return tag_ptr(ret_conv, true);
70126 }
70127
70128 int64_t  CS_LDK_NetworkGraph_verify_channel_update(int64_t this_arg, int64_t msg) {
70129         LDKNetworkGraph this_arg_conv;
70130         this_arg_conv.inner = untag_ptr(this_arg);
70131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70133         this_arg_conv.is_owned = false;
70134         LDKChannelUpdate msg_conv;
70135         msg_conv.inner = untag_ptr(msg);
70136         msg_conv.is_owned = ptr_is_owned(msg);
70137         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70138         msg_conv.is_owned = false;
70139         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
70140         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
70141         return tag_ptr(ret_conv, true);
70142 }
70143
70144 int64_t  CS_LDK_ReadOnlyNetworkGraph_channel(int64_t this_arg, int64_t short_channel_id) {
70145         LDKReadOnlyNetworkGraph this_arg_conv;
70146         this_arg_conv.inner = untag_ptr(this_arg);
70147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70149         this_arg_conv.is_owned = false;
70150         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
70151         int64_t ret_ref = 0;
70152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70154         return ret_ref;
70155 }
70156
70157 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_channels(int64_t this_arg) {
70158         LDKReadOnlyNetworkGraph this_arg_conv;
70159         this_arg_conv.inner = untag_ptr(this_arg);
70160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70162         this_arg_conv.is_owned = false;
70163         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
70164         int64_tArray ret_arr = NULL;
70165         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70166         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70167         for (size_t g = 0; g < ret_var.datalen; g++) {
70168                 int64_t ret_conv_6_conv = ret_var.data[g];
70169                 ret_arr_ptr[g] = ret_conv_6_conv;
70170         }
70171         
70172         FREE(ret_var.data);
70173         return ret_arr;
70174 }
70175
70176 int64_t  CS_LDK_ReadOnlyNetworkGraph_node(int64_t this_arg, int64_t node_id) {
70177         LDKReadOnlyNetworkGraph this_arg_conv;
70178         this_arg_conv.inner = untag_ptr(this_arg);
70179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70181         this_arg_conv.is_owned = false;
70182         LDKNodeId node_id_conv;
70183         node_id_conv.inner = untag_ptr(node_id);
70184         node_id_conv.is_owned = ptr_is_owned(node_id);
70185         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
70186         node_id_conv.is_owned = false;
70187         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
70188         int64_t ret_ref = 0;
70189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70191         return ret_ref;
70192 }
70193
70194 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_nodes(int64_t this_arg) {
70195         LDKReadOnlyNetworkGraph this_arg_conv;
70196         this_arg_conv.inner = untag_ptr(this_arg);
70197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70199         this_arg_conv.is_owned = false;
70200         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
70201         int64_tArray ret_arr = NULL;
70202         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70203         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70204         for (size_t i = 0; i < ret_var.datalen; i++) {
70205                 LDKNodeId ret_conv_8_var = ret_var.data[i];
70206                 int64_t ret_conv_8_ref = 0;
70207                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
70208                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
70209                 ret_arr_ptr[i] = ret_conv_8_ref;
70210         }
70211         
70212         FREE(ret_var.data);
70213         return ret_arr;
70214 }
70215
70216 int64_t  CS_LDK_ReadOnlyNetworkGraph_get_addresses(int64_t this_arg, int8_tArray pubkey) {
70217         LDKReadOnlyNetworkGraph this_arg_conv;
70218         this_arg_conv.inner = untag_ptr(this_arg);
70219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70221         this_arg_conv.is_owned = false;
70222         LDKPublicKey pubkey_ref;
70223         CHECK(pubkey->arr_len == 33);
70224         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
70225         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
70226         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
70227         int64_t ret_ref = tag_ptr(ret_copy, true);
70228         return ret_ref;
70229 }
70230
70231 void  CS_LDK_DefaultRouter_free(int64_t this_obj) {
70232         LDKDefaultRouter this_obj_conv;
70233         this_obj_conv.inner = untag_ptr(this_obj);
70234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70236         DefaultRouter_free(this_obj_conv);
70237 }
70238
70239 int64_t  CS_LDK_DefaultRouter_new(int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
70240         LDKNetworkGraph network_graph_conv;
70241         network_graph_conv.inner = untag_ptr(network_graph);
70242         network_graph_conv.is_owned = ptr_is_owned(network_graph);
70243         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
70244         network_graph_conv.is_owned = false;
70245         void* logger_ptr = untag_ptr(logger);
70246         CHECK_ACCESS(logger_ptr);
70247         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70248         if (logger_conv.free == LDKLogger_JCalls_free) {
70249                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70250                 LDKLogger_JCalls_cloned(&logger_conv);
70251         }
70252         void* entropy_source_ptr = untag_ptr(entropy_source);
70253         CHECK_ACCESS(entropy_source_ptr);
70254         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70255         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70257                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70258         }
70259         void* scorer_ptr = untag_ptr(scorer);
70260         CHECK_ACCESS(scorer_ptr);
70261         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
70262         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
70263                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70264                 LDKLockableScore_JCalls_cloned(&scorer_conv);
70265         }
70266         LDKProbabilisticScoringFeeParameters score_params_conv;
70267         score_params_conv.inner = untag_ptr(score_params);
70268         score_params_conv.is_owned = ptr_is_owned(score_params);
70269         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
70270         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
70271         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
70272         int64_t ret_ref = 0;
70273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70275         return ret_ref;
70276 }
70277
70278 int64_t  CS_LDK_DefaultRouter_as_Router(int64_t this_arg) {
70279         LDKDefaultRouter this_arg_conv;
70280         this_arg_conv.inner = untag_ptr(this_arg);
70281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70283         this_arg_conv.is_owned = false;
70284         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
70285         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
70286         return tag_ptr(ret_ret, true);
70287 }
70288
70289 int64_t  CS_LDK_DefaultRouter_as_MessageRouter(int64_t this_arg) {
70290         LDKDefaultRouter this_arg_conv;
70291         this_arg_conv.inner = untag_ptr(this_arg);
70292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70294         this_arg_conv.is_owned = false;
70295         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
70296         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
70297         return tag_ptr(ret_ret, true);
70298 }
70299
70300 void  CS_LDK_Router_free(int64_t this_ptr) {
70301         if (!ptr_is_owned(this_ptr)) return;
70302         void* this_ptr_ptr = untag_ptr(this_ptr);
70303         CHECK_ACCESS(this_ptr_ptr);
70304         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
70305         FREE(untag_ptr(this_ptr));
70306         Router_free(this_ptr_conv);
70307 }
70308
70309 void  CS_LDK_ScorerAccountingForInFlightHtlcs_free(int64_t this_obj) {
70310         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
70311         this_obj_conv.inner = untag_ptr(this_obj);
70312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70314         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
70315 }
70316
70317 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_new(int64_t scorer, int64_t inflight_htlcs) {
70318         void* scorer_ptr = untag_ptr(scorer);
70319         CHECK_ACCESS(scorer_ptr);
70320         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
70321         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
70322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70323                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
70324         }
70325         LDKInFlightHtlcs inflight_htlcs_conv;
70326         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
70327         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
70328         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
70329         inflight_htlcs_conv.is_owned = false;
70330         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
70331         int64_t ret_ref = 0;
70332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70334         return ret_ref;
70335 }
70336
70337 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(int64_t this_arg) {
70338         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
70339         this_arg_conv.inner = untag_ptr(this_arg);
70340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70342         this_arg_conv.is_owned = false;
70343         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
70344         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
70345         return tag_ptr(ret_ret, true);
70346 }
70347
70348 void  CS_LDK_InFlightHtlcs_free(int64_t this_obj) {
70349         LDKInFlightHtlcs this_obj_conv;
70350         this_obj_conv.inner = untag_ptr(this_obj);
70351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70353         InFlightHtlcs_free(this_obj_conv);
70354 }
70355
70356 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
70357         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
70358         int64_t ret_ref = 0;
70359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70361         return ret_ref;
70362 }
70363 int64_t  CS_LDK_InFlightHtlcs_clone_ptr(int64_t arg) {
70364         LDKInFlightHtlcs arg_conv;
70365         arg_conv.inner = untag_ptr(arg);
70366         arg_conv.is_owned = ptr_is_owned(arg);
70367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70368         arg_conv.is_owned = false;
70369         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
70370         return ret_conv;
70371 }
70372
70373 int64_t  CS_LDK_InFlightHtlcs_clone(int64_t orig) {
70374         LDKInFlightHtlcs orig_conv;
70375         orig_conv.inner = untag_ptr(orig);
70376         orig_conv.is_owned = ptr_is_owned(orig);
70377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70378         orig_conv.is_owned = false;
70379         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
70380         int64_t ret_ref = 0;
70381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70383         return ret_ref;
70384 }
70385
70386 int64_t  CS_LDK_InFlightHtlcs_new() {
70387         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
70388         int64_t ret_ref = 0;
70389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70391         return ret_ref;
70392 }
70393
70394 void  CS_LDK_InFlightHtlcs_process_path(int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
70395         LDKInFlightHtlcs this_arg_conv;
70396         this_arg_conv.inner = untag_ptr(this_arg);
70397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70399         this_arg_conv.is_owned = false;
70400         LDKPath path_conv;
70401         path_conv.inner = untag_ptr(path);
70402         path_conv.is_owned = ptr_is_owned(path);
70403         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70404         path_conv.is_owned = false;
70405         LDKPublicKey payer_node_id_ref;
70406         CHECK(payer_node_id->arr_len == 33);
70407         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
70408         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
70409 }
70410
70411 void  CS_LDK_InFlightHtlcs_add_inflight_htlc(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid, int64_t used_msat) {
70412         LDKInFlightHtlcs this_arg_conv;
70413         this_arg_conv.inner = untag_ptr(this_arg);
70414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70416         this_arg_conv.is_owned = false;
70417         LDKNodeId source_conv;
70418         source_conv.inner = untag_ptr(source);
70419         source_conv.is_owned = ptr_is_owned(source);
70420         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
70421         source_conv.is_owned = false;
70422         LDKNodeId target_conv;
70423         target_conv.inner = untag_ptr(target);
70424         target_conv.is_owned = ptr_is_owned(target);
70425         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
70426         target_conv.is_owned = false;
70427         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
70428 }
70429
70430 int64_t  CS_LDK_InFlightHtlcs_used_liquidity_msat(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
70431         LDKInFlightHtlcs this_arg_conv;
70432         this_arg_conv.inner = untag_ptr(this_arg);
70433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70435         this_arg_conv.is_owned = false;
70436         LDKNodeId source_conv;
70437         source_conv.inner = untag_ptr(source);
70438         source_conv.is_owned = ptr_is_owned(source);
70439         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
70440         source_conv.is_owned = false;
70441         LDKNodeId target_conv;
70442         target_conv.inner = untag_ptr(target);
70443         target_conv.is_owned = ptr_is_owned(target);
70444         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
70445         target_conv.is_owned = false;
70446         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70447         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
70448         int64_t ret_ref = tag_ptr(ret_copy, true);
70449         return ret_ref;
70450 }
70451
70452 int8_tArray  CS_LDK_InFlightHtlcs_write(int64_t obj) {
70453         LDKInFlightHtlcs obj_conv;
70454         obj_conv.inner = untag_ptr(obj);
70455         obj_conv.is_owned = ptr_is_owned(obj);
70456         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70457         obj_conv.is_owned = false;
70458         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
70459         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70460         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70461         CVec_u8Z_free(ret_var);
70462         return ret_arr;
70463 }
70464
70465 int64_t  CS_LDK_InFlightHtlcs_read(int8_tArray ser) {
70466         LDKu8slice ser_ref;
70467         ser_ref.datalen = ser->arr_len;
70468         ser_ref.data = ser->elems;
70469         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
70470         *ret_conv = InFlightHtlcs_read(ser_ref);
70471         FREE(ser);
70472         return tag_ptr(ret_conv, true);
70473 }
70474
70475 void  CS_LDK_RouteHop_free(int64_t this_obj) {
70476         LDKRouteHop this_obj_conv;
70477         this_obj_conv.inner = untag_ptr(this_obj);
70478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70480         RouteHop_free(this_obj_conv);
70481 }
70482
70483 int8_tArray  CS_LDK_RouteHop_get_pubkey(int64_t this_ptr) {
70484         LDKRouteHop this_ptr_conv;
70485         this_ptr_conv.inner = untag_ptr(this_ptr);
70486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70488         this_ptr_conv.is_owned = false;
70489         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70490         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
70491         return ret_arr;
70492 }
70493
70494 void  CS_LDK_RouteHop_set_pubkey(int64_t this_ptr, int8_tArray val) {
70495         LDKRouteHop this_ptr_conv;
70496         this_ptr_conv.inner = untag_ptr(this_ptr);
70497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70499         this_ptr_conv.is_owned = false;
70500         LDKPublicKey val_ref;
70501         CHECK(val->arr_len == 33);
70502         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70503         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
70504 }
70505
70506 int64_t  CS_LDK_RouteHop_get_node_features(int64_t this_ptr) {
70507         LDKRouteHop this_ptr_conv;
70508         this_ptr_conv.inner = untag_ptr(this_ptr);
70509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70511         this_ptr_conv.is_owned = false;
70512         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
70513         int64_t ret_ref = 0;
70514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70516         return ret_ref;
70517 }
70518
70519 void  CS_LDK_RouteHop_set_node_features(int64_t this_ptr, int64_t val) {
70520         LDKRouteHop this_ptr_conv;
70521         this_ptr_conv.inner = untag_ptr(this_ptr);
70522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70524         this_ptr_conv.is_owned = false;
70525         LDKNodeFeatures val_conv;
70526         val_conv.inner = untag_ptr(val);
70527         val_conv.is_owned = ptr_is_owned(val);
70528         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70529         val_conv = NodeFeatures_clone(&val_conv);
70530         RouteHop_set_node_features(&this_ptr_conv, val_conv);
70531 }
70532
70533 int64_t  CS_LDK_RouteHop_get_short_channel_id(int64_t this_ptr) {
70534         LDKRouteHop this_ptr_conv;
70535         this_ptr_conv.inner = untag_ptr(this_ptr);
70536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70538         this_ptr_conv.is_owned = false;
70539         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
70540         return ret_conv;
70541 }
70542
70543 void  CS_LDK_RouteHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
70544         LDKRouteHop this_ptr_conv;
70545         this_ptr_conv.inner = untag_ptr(this_ptr);
70546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70548         this_ptr_conv.is_owned = false;
70549         RouteHop_set_short_channel_id(&this_ptr_conv, val);
70550 }
70551
70552 int64_t  CS_LDK_RouteHop_get_channel_features(int64_t this_ptr) {
70553         LDKRouteHop this_ptr_conv;
70554         this_ptr_conv.inner = untag_ptr(this_ptr);
70555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70557         this_ptr_conv.is_owned = false;
70558         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
70559         int64_t ret_ref = 0;
70560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70562         return ret_ref;
70563 }
70564
70565 void  CS_LDK_RouteHop_set_channel_features(int64_t this_ptr, int64_t val) {
70566         LDKRouteHop this_ptr_conv;
70567         this_ptr_conv.inner = untag_ptr(this_ptr);
70568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70570         this_ptr_conv.is_owned = false;
70571         LDKChannelFeatures val_conv;
70572         val_conv.inner = untag_ptr(val);
70573         val_conv.is_owned = ptr_is_owned(val);
70574         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70575         val_conv = ChannelFeatures_clone(&val_conv);
70576         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
70577 }
70578
70579 int64_t  CS_LDK_RouteHop_get_fee_msat(int64_t this_ptr) {
70580         LDKRouteHop this_ptr_conv;
70581         this_ptr_conv.inner = untag_ptr(this_ptr);
70582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70584         this_ptr_conv.is_owned = false;
70585         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
70586         return ret_conv;
70587 }
70588
70589 void  CS_LDK_RouteHop_set_fee_msat(int64_t this_ptr, int64_t val) {
70590         LDKRouteHop this_ptr_conv;
70591         this_ptr_conv.inner = untag_ptr(this_ptr);
70592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70594         this_ptr_conv.is_owned = false;
70595         RouteHop_set_fee_msat(&this_ptr_conv, val);
70596 }
70597
70598 int32_t  CS_LDK_RouteHop_get_cltv_expiry_delta(int64_t this_ptr) {
70599         LDKRouteHop this_ptr_conv;
70600         this_ptr_conv.inner = untag_ptr(this_ptr);
70601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70603         this_ptr_conv.is_owned = false;
70604         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
70605         return ret_conv;
70606 }
70607
70608 void  CS_LDK_RouteHop_set_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
70609         LDKRouteHop this_ptr_conv;
70610         this_ptr_conv.inner = untag_ptr(this_ptr);
70611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70613         this_ptr_conv.is_owned = false;
70614         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
70615 }
70616
70617 jboolean  CS_LDK_RouteHop_get_maybe_announced_channel(int64_t this_ptr) {
70618         LDKRouteHop this_ptr_conv;
70619         this_ptr_conv.inner = untag_ptr(this_ptr);
70620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70622         this_ptr_conv.is_owned = false;
70623         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
70624         return ret_conv;
70625 }
70626
70627 void  CS_LDK_RouteHop_set_maybe_announced_channel(int64_t this_ptr, jboolean val) {
70628         LDKRouteHop this_ptr_conv;
70629         this_ptr_conv.inner = untag_ptr(this_ptr);
70630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70632         this_ptr_conv.is_owned = false;
70633         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
70634 }
70635
70636 int64_t  CS_LDK_RouteHop_new(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) {
70637         LDKPublicKey pubkey_arg_ref;
70638         CHECK(pubkey_arg->arr_len == 33);
70639         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
70640         LDKNodeFeatures node_features_arg_conv;
70641         node_features_arg_conv.inner = untag_ptr(node_features_arg);
70642         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
70643         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
70644         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
70645         LDKChannelFeatures channel_features_arg_conv;
70646         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
70647         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
70648         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
70649         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
70650         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);
70651         int64_t ret_ref = 0;
70652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70654         return ret_ref;
70655 }
70656
70657 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
70658         LDKRouteHop ret_var = RouteHop_clone(arg);
70659         int64_t ret_ref = 0;
70660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70662         return ret_ref;
70663 }
70664 int64_t  CS_LDK_RouteHop_clone_ptr(int64_t arg) {
70665         LDKRouteHop arg_conv;
70666         arg_conv.inner = untag_ptr(arg);
70667         arg_conv.is_owned = ptr_is_owned(arg);
70668         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70669         arg_conv.is_owned = false;
70670         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
70671         return ret_conv;
70672 }
70673
70674 int64_t  CS_LDK_RouteHop_clone(int64_t orig) {
70675         LDKRouteHop orig_conv;
70676         orig_conv.inner = untag_ptr(orig);
70677         orig_conv.is_owned = ptr_is_owned(orig);
70678         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70679         orig_conv.is_owned = false;
70680         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
70681         int64_t ret_ref = 0;
70682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70684         return ret_ref;
70685 }
70686
70687 int64_t  CS_LDK_RouteHop_hash(int64_t o) {
70688         LDKRouteHop o_conv;
70689         o_conv.inner = untag_ptr(o);
70690         o_conv.is_owned = ptr_is_owned(o);
70691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70692         o_conv.is_owned = false;
70693         int64_t ret_conv = RouteHop_hash(&o_conv);
70694         return ret_conv;
70695 }
70696
70697 jboolean  CS_LDK_RouteHop_eq(int64_t a, int64_t b) {
70698         LDKRouteHop a_conv;
70699         a_conv.inner = untag_ptr(a);
70700         a_conv.is_owned = ptr_is_owned(a);
70701         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70702         a_conv.is_owned = false;
70703         LDKRouteHop b_conv;
70704         b_conv.inner = untag_ptr(b);
70705         b_conv.is_owned = ptr_is_owned(b);
70706         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70707         b_conv.is_owned = false;
70708         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
70709         return ret_conv;
70710 }
70711
70712 int8_tArray  CS_LDK_RouteHop_write(int64_t obj) {
70713         LDKRouteHop obj_conv;
70714         obj_conv.inner = untag_ptr(obj);
70715         obj_conv.is_owned = ptr_is_owned(obj);
70716         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70717         obj_conv.is_owned = false;
70718         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
70719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70721         CVec_u8Z_free(ret_var);
70722         return ret_arr;
70723 }
70724
70725 int64_t  CS_LDK_RouteHop_read(int8_tArray ser) {
70726         LDKu8slice ser_ref;
70727         ser_ref.datalen = ser->arr_len;
70728         ser_ref.data = ser->elems;
70729         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
70730         *ret_conv = RouteHop_read(ser_ref);
70731         FREE(ser);
70732         return tag_ptr(ret_conv, true);
70733 }
70734
70735 void  CS_LDK_BlindedTail_free(int64_t this_obj) {
70736         LDKBlindedTail this_obj_conv;
70737         this_obj_conv.inner = untag_ptr(this_obj);
70738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70740         BlindedTail_free(this_obj_conv);
70741 }
70742
70743 int64_tArray  CS_LDK_BlindedTail_get_hops(int64_t this_ptr) {
70744         LDKBlindedTail this_ptr_conv;
70745         this_ptr_conv.inner = untag_ptr(this_ptr);
70746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70748         this_ptr_conv.is_owned = false;
70749         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
70750         int64_tArray ret_arr = NULL;
70751         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70752         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70753         for (size_t m = 0; m < ret_var.datalen; m++) {
70754                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70755                 int64_t ret_conv_12_ref = 0;
70756                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70757                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70758                 ret_arr_ptr[m] = ret_conv_12_ref;
70759         }
70760         
70761         FREE(ret_var.data);
70762         return ret_arr;
70763 }
70764
70765 void  CS_LDK_BlindedTail_set_hops(int64_t this_ptr, int64_tArray val) {
70766         LDKBlindedTail this_ptr_conv;
70767         this_ptr_conv.inner = untag_ptr(this_ptr);
70768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70770         this_ptr_conv.is_owned = false;
70771         LDKCVec_BlindedHopZ val_constr;
70772         val_constr.datalen = val->arr_len;
70773         if (val_constr.datalen > 0)
70774                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70775         else
70776                 val_constr.data = NULL;
70777         int64_t* val_vals = val->elems;
70778         for (size_t m = 0; m < val_constr.datalen; m++) {
70779                 int64_t val_conv_12 = val_vals[m];
70780                 LDKBlindedHop val_conv_12_conv;
70781                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70782                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70784                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70785                 val_constr.data[m] = val_conv_12_conv;
70786         }
70787         FREE(val);
70788         BlindedTail_set_hops(&this_ptr_conv, val_constr);
70789 }
70790
70791 int8_tArray  CS_LDK_BlindedTail_get_blinding_point(int64_t this_ptr) {
70792         LDKBlindedTail this_ptr_conv;
70793         this_ptr_conv.inner = untag_ptr(this_ptr);
70794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70796         this_ptr_conv.is_owned = false;
70797         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70798         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70799         return ret_arr;
70800 }
70801
70802 void  CS_LDK_BlindedTail_set_blinding_point(int64_t this_ptr, int8_tArray val) {
70803         LDKBlindedTail this_ptr_conv;
70804         this_ptr_conv.inner = untag_ptr(this_ptr);
70805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70807         this_ptr_conv.is_owned = false;
70808         LDKPublicKey val_ref;
70809         CHECK(val->arr_len == 33);
70810         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70811         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
70812 }
70813
70814 int32_t  CS_LDK_BlindedTail_get_excess_final_cltv_expiry_delta(int64_t this_ptr) {
70815         LDKBlindedTail this_ptr_conv;
70816         this_ptr_conv.inner = untag_ptr(this_ptr);
70817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70819         this_ptr_conv.is_owned = false;
70820         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
70821         return ret_conv;
70822 }
70823
70824 void  CS_LDK_BlindedTail_set_excess_final_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
70825         LDKBlindedTail this_ptr_conv;
70826         this_ptr_conv.inner = untag_ptr(this_ptr);
70827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70829         this_ptr_conv.is_owned = false;
70830         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
70831 }
70832
70833 int64_t  CS_LDK_BlindedTail_get_final_value_msat(int64_t this_ptr) {
70834         LDKBlindedTail this_ptr_conv;
70835         this_ptr_conv.inner = untag_ptr(this_ptr);
70836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70838         this_ptr_conv.is_owned = false;
70839         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
70840         return ret_conv;
70841 }
70842
70843 void  CS_LDK_BlindedTail_set_final_value_msat(int64_t this_ptr, int64_t val) {
70844         LDKBlindedTail this_ptr_conv;
70845         this_ptr_conv.inner = untag_ptr(this_ptr);
70846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70848         this_ptr_conv.is_owned = false;
70849         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
70850 }
70851
70852 int64_t  CS_LDK_BlindedTail_new(int64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
70853         LDKCVec_BlindedHopZ hops_arg_constr;
70854         hops_arg_constr.datalen = hops_arg->arr_len;
70855         if (hops_arg_constr.datalen > 0)
70856                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70857         else
70858                 hops_arg_constr.data = NULL;
70859         int64_t* hops_arg_vals = hops_arg->elems;
70860         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
70861                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
70862                 LDKBlindedHop hops_arg_conv_12_conv;
70863                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
70864                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
70865                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
70866                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
70867                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
70868         }
70869         FREE(hops_arg);
70870         LDKPublicKey blinding_point_arg_ref;
70871         CHECK(blinding_point_arg->arr_len == 33);
70872         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70873         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
70874         int64_t ret_ref = 0;
70875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70877         return ret_ref;
70878 }
70879
70880 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
70881         LDKBlindedTail ret_var = BlindedTail_clone(arg);
70882         int64_t ret_ref = 0;
70883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70885         return ret_ref;
70886 }
70887 int64_t  CS_LDK_BlindedTail_clone_ptr(int64_t arg) {
70888         LDKBlindedTail arg_conv;
70889         arg_conv.inner = untag_ptr(arg);
70890         arg_conv.is_owned = ptr_is_owned(arg);
70891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70892         arg_conv.is_owned = false;
70893         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
70894         return ret_conv;
70895 }
70896
70897 int64_t  CS_LDK_BlindedTail_clone(int64_t orig) {
70898         LDKBlindedTail orig_conv;
70899         orig_conv.inner = untag_ptr(orig);
70900         orig_conv.is_owned = ptr_is_owned(orig);
70901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70902         orig_conv.is_owned = false;
70903         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
70904         int64_t ret_ref = 0;
70905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70907         return ret_ref;
70908 }
70909
70910 int64_t  CS_LDK_BlindedTail_hash(int64_t o) {
70911         LDKBlindedTail o_conv;
70912         o_conv.inner = untag_ptr(o);
70913         o_conv.is_owned = ptr_is_owned(o);
70914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70915         o_conv.is_owned = false;
70916         int64_t ret_conv = BlindedTail_hash(&o_conv);
70917         return ret_conv;
70918 }
70919
70920 jboolean  CS_LDK_BlindedTail_eq(int64_t a, int64_t b) {
70921         LDKBlindedTail a_conv;
70922         a_conv.inner = untag_ptr(a);
70923         a_conv.is_owned = ptr_is_owned(a);
70924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70925         a_conv.is_owned = false;
70926         LDKBlindedTail b_conv;
70927         b_conv.inner = untag_ptr(b);
70928         b_conv.is_owned = ptr_is_owned(b);
70929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70930         b_conv.is_owned = false;
70931         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
70932         return ret_conv;
70933 }
70934
70935 int8_tArray  CS_LDK_BlindedTail_write(int64_t obj) {
70936         LDKBlindedTail obj_conv;
70937         obj_conv.inner = untag_ptr(obj);
70938         obj_conv.is_owned = ptr_is_owned(obj);
70939         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70940         obj_conv.is_owned = false;
70941         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
70942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70944         CVec_u8Z_free(ret_var);
70945         return ret_arr;
70946 }
70947
70948 int64_t  CS_LDK_BlindedTail_read(int8_tArray ser) {
70949         LDKu8slice ser_ref;
70950         ser_ref.datalen = ser->arr_len;
70951         ser_ref.data = ser->elems;
70952         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
70953         *ret_conv = BlindedTail_read(ser_ref);
70954         FREE(ser);
70955         return tag_ptr(ret_conv, true);
70956 }
70957
70958 void  CS_LDK_Path_free(int64_t this_obj) {
70959         LDKPath this_obj_conv;
70960         this_obj_conv.inner = untag_ptr(this_obj);
70961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70963         Path_free(this_obj_conv);
70964 }
70965
70966 int64_tArray  CS_LDK_Path_get_hops(int64_t this_ptr) {
70967         LDKPath this_ptr_conv;
70968         this_ptr_conv.inner = untag_ptr(this_ptr);
70969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70971         this_ptr_conv.is_owned = false;
70972         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
70973         int64_tArray ret_arr = NULL;
70974         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70975         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70976         for (size_t k = 0; k < ret_var.datalen; k++) {
70977                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
70978                 int64_t ret_conv_10_ref = 0;
70979                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
70980                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
70981                 ret_arr_ptr[k] = ret_conv_10_ref;
70982         }
70983         
70984         FREE(ret_var.data);
70985         return ret_arr;
70986 }
70987
70988 void  CS_LDK_Path_set_hops(int64_t this_ptr, int64_tArray val) {
70989         LDKPath this_ptr_conv;
70990         this_ptr_conv.inner = untag_ptr(this_ptr);
70991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70993         this_ptr_conv.is_owned = false;
70994         LDKCVec_RouteHopZ val_constr;
70995         val_constr.datalen = val->arr_len;
70996         if (val_constr.datalen > 0)
70997                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70998         else
70999                 val_constr.data = NULL;
71000         int64_t* val_vals = val->elems;
71001         for (size_t k = 0; k < val_constr.datalen; k++) {
71002                 int64_t val_conv_10 = val_vals[k];
71003                 LDKRouteHop val_conv_10_conv;
71004                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
71005                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
71006                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
71007                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
71008                 val_constr.data[k] = val_conv_10_conv;
71009         }
71010         FREE(val);
71011         Path_set_hops(&this_ptr_conv, val_constr);
71012 }
71013
71014 int64_t  CS_LDK_Path_get_blinded_tail(int64_t this_ptr) {
71015         LDKPath this_ptr_conv;
71016         this_ptr_conv.inner = untag_ptr(this_ptr);
71017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71019         this_ptr_conv.is_owned = false;
71020         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
71021         int64_t ret_ref = 0;
71022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71024         return ret_ref;
71025 }
71026
71027 void  CS_LDK_Path_set_blinded_tail(int64_t this_ptr, int64_t val) {
71028         LDKPath this_ptr_conv;
71029         this_ptr_conv.inner = untag_ptr(this_ptr);
71030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71032         this_ptr_conv.is_owned = false;
71033         LDKBlindedTail val_conv;
71034         val_conv.inner = untag_ptr(val);
71035         val_conv.is_owned = ptr_is_owned(val);
71036         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71037         val_conv = BlindedTail_clone(&val_conv);
71038         Path_set_blinded_tail(&this_ptr_conv, val_conv);
71039 }
71040
71041 int64_t  CS_LDK_Path_new(int64_tArray hops_arg, int64_t blinded_tail_arg) {
71042         LDKCVec_RouteHopZ hops_arg_constr;
71043         hops_arg_constr.datalen = hops_arg->arr_len;
71044         if (hops_arg_constr.datalen > 0)
71045                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
71046         else
71047                 hops_arg_constr.data = NULL;
71048         int64_t* hops_arg_vals = hops_arg->elems;
71049         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
71050                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
71051                 LDKRouteHop hops_arg_conv_10_conv;
71052                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
71053                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
71054                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
71055                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
71056                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
71057         }
71058         FREE(hops_arg);
71059         LDKBlindedTail blinded_tail_arg_conv;
71060         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
71061         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
71062         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
71063         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
71064         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
71065         int64_t ret_ref = 0;
71066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71068         return ret_ref;
71069 }
71070
71071 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
71072         LDKPath ret_var = Path_clone(arg);
71073         int64_t ret_ref = 0;
71074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71076         return ret_ref;
71077 }
71078 int64_t  CS_LDK_Path_clone_ptr(int64_t arg) {
71079         LDKPath arg_conv;
71080         arg_conv.inner = untag_ptr(arg);
71081         arg_conv.is_owned = ptr_is_owned(arg);
71082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71083         arg_conv.is_owned = false;
71084         int64_t ret_conv = Path_clone_ptr(&arg_conv);
71085         return ret_conv;
71086 }
71087
71088 int64_t  CS_LDK_Path_clone(int64_t orig) {
71089         LDKPath orig_conv;
71090         orig_conv.inner = untag_ptr(orig);
71091         orig_conv.is_owned = ptr_is_owned(orig);
71092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71093         orig_conv.is_owned = false;
71094         LDKPath ret_var = Path_clone(&orig_conv);
71095         int64_t ret_ref = 0;
71096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71098         return ret_ref;
71099 }
71100
71101 int64_t  CS_LDK_Path_hash(int64_t o) {
71102         LDKPath o_conv;
71103         o_conv.inner = untag_ptr(o);
71104         o_conv.is_owned = ptr_is_owned(o);
71105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71106         o_conv.is_owned = false;
71107         int64_t ret_conv = Path_hash(&o_conv);
71108         return ret_conv;
71109 }
71110
71111 jboolean  CS_LDK_Path_eq(int64_t a, int64_t b) {
71112         LDKPath a_conv;
71113         a_conv.inner = untag_ptr(a);
71114         a_conv.is_owned = ptr_is_owned(a);
71115         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71116         a_conv.is_owned = false;
71117         LDKPath b_conv;
71118         b_conv.inner = untag_ptr(b);
71119         b_conv.is_owned = ptr_is_owned(b);
71120         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71121         b_conv.is_owned = false;
71122         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
71123         return ret_conv;
71124 }
71125
71126 int64_t  CS_LDK_Path_fee_msat(int64_t this_arg) {
71127         LDKPath this_arg_conv;
71128         this_arg_conv.inner = untag_ptr(this_arg);
71129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71131         this_arg_conv.is_owned = false;
71132         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
71133         return ret_conv;
71134 }
71135
71136 int64_t  CS_LDK_Path_final_value_msat(int64_t this_arg) {
71137         LDKPath this_arg_conv;
71138         this_arg_conv.inner = untag_ptr(this_arg);
71139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71141         this_arg_conv.is_owned = false;
71142         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
71143         return ret_conv;
71144 }
71145
71146 int64_t  CS_LDK_Path_final_cltv_expiry_delta(int64_t this_arg) {
71147         LDKPath this_arg_conv;
71148         this_arg_conv.inner = untag_ptr(this_arg);
71149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71151         this_arg_conv.is_owned = false;
71152         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
71153         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
71154         int64_t ret_ref = tag_ptr(ret_copy, true);
71155         return ret_ref;
71156 }
71157
71158 void  CS_LDK_Route_free(int64_t this_obj) {
71159         LDKRoute this_obj_conv;
71160         this_obj_conv.inner = untag_ptr(this_obj);
71161         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71163         Route_free(this_obj_conv);
71164 }
71165
71166 int64_tArray  CS_LDK_Route_get_paths(int64_t this_ptr) {
71167         LDKRoute this_ptr_conv;
71168         this_ptr_conv.inner = untag_ptr(this_ptr);
71169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71171         this_ptr_conv.is_owned = false;
71172         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
71173         int64_tArray ret_arr = NULL;
71174         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71175         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71176         for (size_t g = 0; g < ret_var.datalen; g++) {
71177                 LDKPath ret_conv_6_var = ret_var.data[g];
71178                 int64_t ret_conv_6_ref = 0;
71179                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
71180                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
71181                 ret_arr_ptr[g] = ret_conv_6_ref;
71182         }
71183         
71184         FREE(ret_var.data);
71185         return ret_arr;
71186 }
71187
71188 void  CS_LDK_Route_set_paths(int64_t this_ptr, int64_tArray val) {
71189         LDKRoute this_ptr_conv;
71190         this_ptr_conv.inner = untag_ptr(this_ptr);
71191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71193         this_ptr_conv.is_owned = false;
71194         LDKCVec_PathZ val_constr;
71195         val_constr.datalen = val->arr_len;
71196         if (val_constr.datalen > 0)
71197                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
71198         else
71199                 val_constr.data = NULL;
71200         int64_t* val_vals = val->elems;
71201         for (size_t g = 0; g < val_constr.datalen; g++) {
71202                 int64_t val_conv_6 = val_vals[g];
71203                 LDKPath val_conv_6_conv;
71204                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
71205                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
71206                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
71207                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
71208                 val_constr.data[g] = val_conv_6_conv;
71209         }
71210         FREE(val);
71211         Route_set_paths(&this_ptr_conv, val_constr);
71212 }
71213
71214 int64_t  CS_LDK_Route_get_route_params(int64_t this_ptr) {
71215         LDKRoute this_ptr_conv;
71216         this_ptr_conv.inner = untag_ptr(this_ptr);
71217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71219         this_ptr_conv.is_owned = false;
71220         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
71221         int64_t ret_ref = 0;
71222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71224         return ret_ref;
71225 }
71226
71227 void  CS_LDK_Route_set_route_params(int64_t this_ptr, int64_t val) {
71228         LDKRoute this_ptr_conv;
71229         this_ptr_conv.inner = untag_ptr(this_ptr);
71230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71232         this_ptr_conv.is_owned = false;
71233         LDKRouteParameters val_conv;
71234         val_conv.inner = untag_ptr(val);
71235         val_conv.is_owned = ptr_is_owned(val);
71236         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71237         val_conv = RouteParameters_clone(&val_conv);
71238         Route_set_route_params(&this_ptr_conv, val_conv);
71239 }
71240
71241 int64_t  CS_LDK_Route_new(int64_tArray paths_arg, int64_t route_params_arg) {
71242         LDKCVec_PathZ paths_arg_constr;
71243         paths_arg_constr.datalen = paths_arg->arr_len;
71244         if (paths_arg_constr.datalen > 0)
71245                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
71246         else
71247                 paths_arg_constr.data = NULL;
71248         int64_t* paths_arg_vals = paths_arg->elems;
71249         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
71250                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
71251                 LDKPath paths_arg_conv_6_conv;
71252                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
71253                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
71254                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
71255                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
71256                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
71257         }
71258         FREE(paths_arg);
71259         LDKRouteParameters route_params_arg_conv;
71260         route_params_arg_conv.inner = untag_ptr(route_params_arg);
71261         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
71262         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
71263         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
71264         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
71265         int64_t ret_ref = 0;
71266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71268         return ret_ref;
71269 }
71270
71271 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
71272         LDKRoute ret_var = Route_clone(arg);
71273         int64_t ret_ref = 0;
71274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71276         return ret_ref;
71277 }
71278 int64_t  CS_LDK_Route_clone_ptr(int64_t arg) {
71279         LDKRoute arg_conv;
71280         arg_conv.inner = untag_ptr(arg);
71281         arg_conv.is_owned = ptr_is_owned(arg);
71282         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71283         arg_conv.is_owned = false;
71284         int64_t ret_conv = Route_clone_ptr(&arg_conv);
71285         return ret_conv;
71286 }
71287
71288 int64_t  CS_LDK_Route_clone(int64_t orig) {
71289         LDKRoute orig_conv;
71290         orig_conv.inner = untag_ptr(orig);
71291         orig_conv.is_owned = ptr_is_owned(orig);
71292         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71293         orig_conv.is_owned = false;
71294         LDKRoute ret_var = Route_clone(&orig_conv);
71295         int64_t ret_ref = 0;
71296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71298         return ret_ref;
71299 }
71300
71301 int64_t  CS_LDK_Route_hash(int64_t o) {
71302         LDKRoute o_conv;
71303         o_conv.inner = untag_ptr(o);
71304         o_conv.is_owned = ptr_is_owned(o);
71305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71306         o_conv.is_owned = false;
71307         int64_t ret_conv = Route_hash(&o_conv);
71308         return ret_conv;
71309 }
71310
71311 jboolean  CS_LDK_Route_eq(int64_t a, int64_t b) {
71312         LDKRoute a_conv;
71313         a_conv.inner = untag_ptr(a);
71314         a_conv.is_owned = ptr_is_owned(a);
71315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71316         a_conv.is_owned = false;
71317         LDKRoute b_conv;
71318         b_conv.inner = untag_ptr(b);
71319         b_conv.is_owned = ptr_is_owned(b);
71320         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71321         b_conv.is_owned = false;
71322         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
71323         return ret_conv;
71324 }
71325
71326 int64_t  CS_LDK_Route_get_total_fees(int64_t this_arg) {
71327         LDKRoute this_arg_conv;
71328         this_arg_conv.inner = untag_ptr(this_arg);
71329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71331         this_arg_conv.is_owned = false;
71332         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
71333         return ret_conv;
71334 }
71335
71336 int64_t  CS_LDK_Route_get_total_amount(int64_t this_arg) {
71337         LDKRoute this_arg_conv;
71338         this_arg_conv.inner = untag_ptr(this_arg);
71339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71341         this_arg_conv.is_owned = false;
71342         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
71343         return ret_conv;
71344 }
71345
71346 int8_tArray  CS_LDK_Route_write(int64_t obj) {
71347         LDKRoute obj_conv;
71348         obj_conv.inner = untag_ptr(obj);
71349         obj_conv.is_owned = ptr_is_owned(obj);
71350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71351         obj_conv.is_owned = false;
71352         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
71353         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71354         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71355         CVec_u8Z_free(ret_var);
71356         return ret_arr;
71357 }
71358
71359 int64_t  CS_LDK_Route_read(int8_tArray ser) {
71360         LDKu8slice ser_ref;
71361         ser_ref.datalen = ser->arr_len;
71362         ser_ref.data = ser->elems;
71363         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
71364         *ret_conv = Route_read(ser_ref);
71365         FREE(ser);
71366         return tag_ptr(ret_conv, true);
71367 }
71368
71369 void  CS_LDK_RouteParameters_free(int64_t this_obj) {
71370         LDKRouteParameters this_obj_conv;
71371         this_obj_conv.inner = untag_ptr(this_obj);
71372         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71374         RouteParameters_free(this_obj_conv);
71375 }
71376
71377 int64_t  CS_LDK_RouteParameters_get_payment_params(int64_t this_ptr) {
71378         LDKRouteParameters this_ptr_conv;
71379         this_ptr_conv.inner = untag_ptr(this_ptr);
71380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71382         this_ptr_conv.is_owned = false;
71383         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
71384         int64_t ret_ref = 0;
71385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71387         return ret_ref;
71388 }
71389
71390 void  CS_LDK_RouteParameters_set_payment_params(int64_t this_ptr, int64_t val) {
71391         LDKRouteParameters this_ptr_conv;
71392         this_ptr_conv.inner = untag_ptr(this_ptr);
71393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71395         this_ptr_conv.is_owned = false;
71396         LDKPaymentParameters val_conv;
71397         val_conv.inner = untag_ptr(val);
71398         val_conv.is_owned = ptr_is_owned(val);
71399         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71400         val_conv = PaymentParameters_clone(&val_conv);
71401         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
71402 }
71403
71404 int64_t  CS_LDK_RouteParameters_get_final_value_msat(int64_t this_ptr) {
71405         LDKRouteParameters this_ptr_conv;
71406         this_ptr_conv.inner = untag_ptr(this_ptr);
71407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71409         this_ptr_conv.is_owned = false;
71410         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
71411         return ret_conv;
71412 }
71413
71414 void  CS_LDK_RouteParameters_set_final_value_msat(int64_t this_ptr, int64_t val) {
71415         LDKRouteParameters this_ptr_conv;
71416         this_ptr_conv.inner = untag_ptr(this_ptr);
71417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71419         this_ptr_conv.is_owned = false;
71420         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
71421 }
71422
71423 int64_t  CS_LDK_RouteParameters_get_max_total_routing_fee_msat(int64_t this_ptr) {
71424         LDKRouteParameters this_ptr_conv;
71425         this_ptr_conv.inner = untag_ptr(this_ptr);
71426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71428         this_ptr_conv.is_owned = false;
71429         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71430         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
71431         int64_t ret_ref = tag_ptr(ret_copy, true);
71432         return ret_ref;
71433 }
71434
71435 void  CS_LDK_RouteParameters_set_max_total_routing_fee_msat(int64_t this_ptr, int64_t val) {
71436         LDKRouteParameters this_ptr_conv;
71437         this_ptr_conv.inner = untag_ptr(this_ptr);
71438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71440         this_ptr_conv.is_owned = false;
71441         void* val_ptr = untag_ptr(val);
71442         CHECK_ACCESS(val_ptr);
71443         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71444         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71445         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
71446 }
71447
71448 int64_t  CS_LDK_RouteParameters_new(int64_t payment_params_arg, int64_t final_value_msat_arg, int64_t max_total_routing_fee_msat_arg) {
71449         LDKPaymentParameters payment_params_arg_conv;
71450         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
71451         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
71452         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
71453         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
71454         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
71455         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
71456         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
71457         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
71458         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
71459         int64_t ret_ref = 0;
71460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71462         return ret_ref;
71463 }
71464
71465 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
71466         LDKRouteParameters ret_var = RouteParameters_clone(arg);
71467         int64_t ret_ref = 0;
71468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71470         return ret_ref;
71471 }
71472 int64_t  CS_LDK_RouteParameters_clone_ptr(int64_t arg) {
71473         LDKRouteParameters arg_conv;
71474         arg_conv.inner = untag_ptr(arg);
71475         arg_conv.is_owned = ptr_is_owned(arg);
71476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71477         arg_conv.is_owned = false;
71478         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
71479         return ret_conv;
71480 }
71481
71482 int64_t  CS_LDK_RouteParameters_clone(int64_t orig) {
71483         LDKRouteParameters orig_conv;
71484         orig_conv.inner = untag_ptr(orig);
71485         orig_conv.is_owned = ptr_is_owned(orig);
71486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71487         orig_conv.is_owned = false;
71488         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
71489         int64_t ret_ref = 0;
71490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71492         return ret_ref;
71493 }
71494
71495 int64_t  CS_LDK_RouteParameters_hash(int64_t o) {
71496         LDKRouteParameters o_conv;
71497         o_conv.inner = untag_ptr(o);
71498         o_conv.is_owned = ptr_is_owned(o);
71499         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71500         o_conv.is_owned = false;
71501         int64_t ret_conv = RouteParameters_hash(&o_conv);
71502         return ret_conv;
71503 }
71504
71505 jboolean  CS_LDK_RouteParameters_eq(int64_t a, int64_t b) {
71506         LDKRouteParameters a_conv;
71507         a_conv.inner = untag_ptr(a);
71508         a_conv.is_owned = ptr_is_owned(a);
71509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71510         a_conv.is_owned = false;
71511         LDKRouteParameters b_conv;
71512         b_conv.inner = untag_ptr(b);
71513         b_conv.is_owned = ptr_is_owned(b);
71514         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71515         b_conv.is_owned = false;
71516         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
71517         return ret_conv;
71518 }
71519
71520 int64_t  CS_LDK_RouteParameters_from_payment_params_and_value(int64_t payment_params, int64_t final_value_msat) {
71521         LDKPaymentParameters payment_params_conv;
71522         payment_params_conv.inner = untag_ptr(payment_params);
71523         payment_params_conv.is_owned = ptr_is_owned(payment_params);
71524         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
71525         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
71526         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
71527         int64_t ret_ref = 0;
71528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71530         return ret_ref;
71531 }
71532
71533 int8_tArray  CS_LDK_RouteParameters_write(int64_t obj) {
71534         LDKRouteParameters obj_conv;
71535         obj_conv.inner = untag_ptr(obj);
71536         obj_conv.is_owned = ptr_is_owned(obj);
71537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71538         obj_conv.is_owned = false;
71539         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
71540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71542         CVec_u8Z_free(ret_var);
71543         return ret_arr;
71544 }
71545
71546 int64_t  CS_LDK_RouteParameters_read(int8_tArray ser) {
71547         LDKu8slice ser_ref;
71548         ser_ref.datalen = ser->arr_len;
71549         ser_ref.data = ser->elems;
71550         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
71551         *ret_conv = RouteParameters_read(ser_ref);
71552         FREE(ser);
71553         return tag_ptr(ret_conv, true);
71554 }
71555
71556 void  CS_LDK_PaymentParameters_free(int64_t this_obj) {
71557         LDKPaymentParameters this_obj_conv;
71558         this_obj_conv.inner = untag_ptr(this_obj);
71559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71561         PaymentParameters_free(this_obj_conv);
71562 }
71563
71564 int64_t  CS_LDK_PaymentParameters_get_payee(int64_t this_ptr) {
71565         LDKPaymentParameters this_ptr_conv;
71566         this_ptr_conv.inner = untag_ptr(this_ptr);
71567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71569         this_ptr_conv.is_owned = false;
71570         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71571         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
71572         int64_t ret_ref = tag_ptr(ret_copy, true);
71573         return ret_ref;
71574 }
71575
71576 void  CS_LDK_PaymentParameters_set_payee(int64_t this_ptr, int64_t val) {
71577         LDKPaymentParameters this_ptr_conv;
71578         this_ptr_conv.inner = untag_ptr(this_ptr);
71579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71581         this_ptr_conv.is_owned = false;
71582         void* val_ptr = untag_ptr(val);
71583         CHECK_ACCESS(val_ptr);
71584         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
71585         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
71586         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
71587 }
71588
71589 int64_t  CS_LDK_PaymentParameters_get_expiry_time(int64_t this_ptr) {
71590         LDKPaymentParameters this_ptr_conv;
71591         this_ptr_conv.inner = untag_ptr(this_ptr);
71592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71594         this_ptr_conv.is_owned = false;
71595         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71596         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
71597         int64_t ret_ref = tag_ptr(ret_copy, true);
71598         return ret_ref;
71599 }
71600
71601 void  CS_LDK_PaymentParameters_set_expiry_time(int64_t this_ptr, int64_t val) {
71602         LDKPaymentParameters this_ptr_conv;
71603         this_ptr_conv.inner = untag_ptr(this_ptr);
71604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71606         this_ptr_conv.is_owned = false;
71607         void* val_ptr = untag_ptr(val);
71608         CHECK_ACCESS(val_ptr);
71609         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71610         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71611         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
71612 }
71613
71614 int32_t  CS_LDK_PaymentParameters_get_max_total_cltv_expiry_delta(int64_t this_ptr) {
71615         LDKPaymentParameters this_ptr_conv;
71616         this_ptr_conv.inner = untag_ptr(this_ptr);
71617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71619         this_ptr_conv.is_owned = false;
71620         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
71621         return ret_conv;
71622 }
71623
71624 void  CS_LDK_PaymentParameters_set_max_total_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
71625         LDKPaymentParameters this_ptr_conv;
71626         this_ptr_conv.inner = untag_ptr(this_ptr);
71627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71629         this_ptr_conv.is_owned = false;
71630         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
71631 }
71632
71633 int8_t  CS_LDK_PaymentParameters_get_max_path_count(int64_t this_ptr) {
71634         LDKPaymentParameters this_ptr_conv;
71635         this_ptr_conv.inner = untag_ptr(this_ptr);
71636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71638         this_ptr_conv.is_owned = false;
71639         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
71640         return ret_conv;
71641 }
71642
71643 void  CS_LDK_PaymentParameters_set_max_path_count(int64_t this_ptr, int8_t val) {
71644         LDKPaymentParameters this_ptr_conv;
71645         this_ptr_conv.inner = untag_ptr(this_ptr);
71646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71648         this_ptr_conv.is_owned = false;
71649         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
71650 }
71651
71652 int8_t  CS_LDK_PaymentParameters_get_max_channel_saturation_power_of_half(int64_t this_ptr) {
71653         LDKPaymentParameters this_ptr_conv;
71654         this_ptr_conv.inner = untag_ptr(this_ptr);
71655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71657         this_ptr_conv.is_owned = false;
71658         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
71659         return ret_conv;
71660 }
71661
71662 void  CS_LDK_PaymentParameters_set_max_channel_saturation_power_of_half(int64_t this_ptr, int8_t val) {
71663         LDKPaymentParameters this_ptr_conv;
71664         this_ptr_conv.inner = untag_ptr(this_ptr);
71665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71667         this_ptr_conv.is_owned = false;
71668         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
71669 }
71670
71671 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_channels(int64_t this_ptr) {
71672         LDKPaymentParameters this_ptr_conv;
71673         this_ptr_conv.inner = untag_ptr(this_ptr);
71674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71676         this_ptr_conv.is_owned = false;
71677         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
71678         int64_tArray ret_arr = NULL;
71679         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71680         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71681         for (size_t g = 0; g < ret_var.datalen; g++) {
71682                 int64_t ret_conv_6_conv = ret_var.data[g];
71683                 ret_arr_ptr[g] = ret_conv_6_conv;
71684         }
71685         
71686         FREE(ret_var.data);
71687         return ret_arr;
71688 }
71689
71690 void  CS_LDK_PaymentParameters_set_previously_failed_channels(int64_t this_ptr, int64_tArray val) {
71691         LDKPaymentParameters this_ptr_conv;
71692         this_ptr_conv.inner = untag_ptr(this_ptr);
71693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71695         this_ptr_conv.is_owned = false;
71696         LDKCVec_u64Z val_constr;
71697         val_constr.datalen = val->arr_len;
71698         if (val_constr.datalen > 0)
71699                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71700         else
71701                 val_constr.data = NULL;
71702         int64_t* val_vals = val->elems;
71703         for (size_t g = 0; g < val_constr.datalen; g++) {
71704                 int64_t val_conv_6 = val_vals[g];
71705                 val_constr.data[g] = val_conv_6;
71706         }
71707         FREE(val);
71708         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
71709 }
71710
71711 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_blinded_path_idxs(int64_t this_ptr) {
71712         LDKPaymentParameters this_ptr_conv;
71713         this_ptr_conv.inner = untag_ptr(this_ptr);
71714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71716         this_ptr_conv.is_owned = false;
71717         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
71718         int64_tArray ret_arr = NULL;
71719         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71720         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71721         for (size_t g = 0; g < ret_var.datalen; g++) {
71722                 int64_t ret_conv_6_conv = ret_var.data[g];
71723                 ret_arr_ptr[g] = ret_conv_6_conv;
71724         }
71725         
71726         FREE(ret_var.data);
71727         return ret_arr;
71728 }
71729
71730 void  CS_LDK_PaymentParameters_set_previously_failed_blinded_path_idxs(int64_t this_ptr, int64_tArray val) {
71731         LDKPaymentParameters this_ptr_conv;
71732         this_ptr_conv.inner = untag_ptr(this_ptr);
71733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71735         this_ptr_conv.is_owned = false;
71736         LDKCVec_u64Z val_constr;
71737         val_constr.datalen = val->arr_len;
71738         if (val_constr.datalen > 0)
71739                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71740         else
71741                 val_constr.data = NULL;
71742         int64_t* val_vals = val->elems;
71743         for (size_t g = 0; g < val_constr.datalen; g++) {
71744                 int64_t val_conv_6 = val_vals[g];
71745                 val_constr.data[g] = val_conv_6;
71746         }
71747         FREE(val);
71748         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
71749 }
71750
71751 int64_t  CS_LDK_PaymentParameters_new(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) {
71752         void* payee_arg_ptr = untag_ptr(payee_arg);
71753         CHECK_ACCESS(payee_arg_ptr);
71754         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
71755         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
71756         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
71757         CHECK_ACCESS(expiry_time_arg_ptr);
71758         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
71759         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
71760         LDKCVec_u64Z previously_failed_channels_arg_constr;
71761         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
71762         if (previously_failed_channels_arg_constr.datalen > 0)
71763                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71764         else
71765                 previously_failed_channels_arg_constr.data = NULL;
71766         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
71767         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
71768                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
71769                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
71770         }
71771         FREE(previously_failed_channels_arg);
71772         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
71773         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
71774         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
71775                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71776         else
71777                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
71778         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
71779         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
71780                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
71781                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
71782         }
71783         FREE(previously_failed_blinded_path_idxs_arg);
71784         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);
71785         int64_t ret_ref = 0;
71786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71788         return ret_ref;
71789 }
71790
71791 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
71792         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
71793         int64_t ret_ref = 0;
71794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71796         return ret_ref;
71797 }
71798 int64_t  CS_LDK_PaymentParameters_clone_ptr(int64_t arg) {
71799         LDKPaymentParameters arg_conv;
71800         arg_conv.inner = untag_ptr(arg);
71801         arg_conv.is_owned = ptr_is_owned(arg);
71802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71803         arg_conv.is_owned = false;
71804         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
71805         return ret_conv;
71806 }
71807
71808 int64_t  CS_LDK_PaymentParameters_clone(int64_t orig) {
71809         LDKPaymentParameters orig_conv;
71810         orig_conv.inner = untag_ptr(orig);
71811         orig_conv.is_owned = ptr_is_owned(orig);
71812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71813         orig_conv.is_owned = false;
71814         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
71815         int64_t ret_ref = 0;
71816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71818         return ret_ref;
71819 }
71820
71821 int64_t  CS_LDK_PaymentParameters_hash(int64_t o) {
71822         LDKPaymentParameters o_conv;
71823         o_conv.inner = untag_ptr(o);
71824         o_conv.is_owned = ptr_is_owned(o);
71825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71826         o_conv.is_owned = false;
71827         int64_t ret_conv = PaymentParameters_hash(&o_conv);
71828         return ret_conv;
71829 }
71830
71831 jboolean  CS_LDK_PaymentParameters_eq(int64_t a, int64_t b) {
71832         LDKPaymentParameters a_conv;
71833         a_conv.inner = untag_ptr(a);
71834         a_conv.is_owned = ptr_is_owned(a);
71835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71836         a_conv.is_owned = false;
71837         LDKPaymentParameters b_conv;
71838         b_conv.inner = untag_ptr(b);
71839         b_conv.is_owned = ptr_is_owned(b);
71840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71841         b_conv.is_owned = false;
71842         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
71843         return ret_conv;
71844 }
71845
71846 int8_tArray  CS_LDK_PaymentParameters_write(int64_t obj) {
71847         LDKPaymentParameters obj_conv;
71848         obj_conv.inner = untag_ptr(obj);
71849         obj_conv.is_owned = ptr_is_owned(obj);
71850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71851         obj_conv.is_owned = false;
71852         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
71853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71855         CVec_u8Z_free(ret_var);
71856         return ret_arr;
71857 }
71858
71859 int64_t  CS_LDK_PaymentParameters_read(int8_tArray ser, int32_t arg) {
71860         LDKu8slice ser_ref;
71861         ser_ref.datalen = ser->arr_len;
71862         ser_ref.data = ser->elems;
71863         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
71864         *ret_conv = PaymentParameters_read(ser_ref, arg);
71865         FREE(ser);
71866         return tag_ptr(ret_conv, true);
71867 }
71868
71869 int64_t  CS_LDK_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
71870         LDKPublicKey payee_pubkey_ref;
71871         CHECK(payee_pubkey->arr_len == 33);
71872         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71873         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
71874         int64_t ret_ref = 0;
71875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71877         return ret_ref;
71878 }
71879
71880 int64_t  CS_LDK_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
71881         LDKPublicKey payee_pubkey_ref;
71882         CHECK(payee_pubkey->arr_len == 33);
71883         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
71884         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
71885         int64_t ret_ref = 0;
71886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71888         return ret_ref;
71889 }
71890
71891 int64_t  CS_LDK_PaymentParameters_from_bolt12_invoice(int64_t invoice) {
71892         LDKBolt12Invoice invoice_conv;
71893         invoice_conv.inner = untag_ptr(invoice);
71894         invoice_conv.is_owned = ptr_is_owned(invoice);
71895         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
71896         invoice_conv.is_owned = false;
71897         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
71898         int64_t ret_ref = 0;
71899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71901         return ret_ref;
71902 }
71903
71904 int64_t  CS_LDK_PaymentParameters_blinded(int64_tArray blinded_route_hints) {
71905         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
71906         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
71907         if (blinded_route_hints_constr.datalen > 0)
71908                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71909         else
71910                 blinded_route_hints_constr.data = NULL;
71911         int64_t* blinded_route_hints_vals = blinded_route_hints->elems;
71912         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
71913                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
71914                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
71915                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
71916                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
71917                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
71918                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
71919         }
71920         FREE(blinded_route_hints);
71921         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
71922         int64_t ret_ref = 0;
71923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71925         return ret_ref;
71926 }
71927
71928 void  CS_LDK_Payee_free(int64_t this_ptr) {
71929         if (!ptr_is_owned(this_ptr)) return;
71930         void* this_ptr_ptr = untag_ptr(this_ptr);
71931         CHECK_ACCESS(this_ptr_ptr);
71932         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
71933         FREE(untag_ptr(this_ptr));
71934         Payee_free(this_ptr_conv);
71935 }
71936
71937 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
71938         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71939         *ret_copy = Payee_clone(arg);
71940         int64_t ret_ref = tag_ptr(ret_copy, true);
71941         return ret_ref;
71942 }
71943 int64_t  CS_LDK_Payee_clone_ptr(int64_t arg) {
71944         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
71945         int64_t ret_conv = Payee_clone_ptr(arg_conv);
71946         return ret_conv;
71947 }
71948
71949 int64_t  CS_LDK_Payee_clone(int64_t orig) {
71950         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
71951         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71952         *ret_copy = Payee_clone(orig_conv);
71953         int64_t ret_ref = tag_ptr(ret_copy, true);
71954         return ret_ref;
71955 }
71956
71957 int64_t  CS_LDK_Payee_blinded(int64_tArray route_hints, int64_t features) {
71958         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
71959         route_hints_constr.datalen = route_hints->arr_len;
71960         if (route_hints_constr.datalen > 0)
71961                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71962         else
71963                 route_hints_constr.data = NULL;
71964         int64_t* route_hints_vals = route_hints->elems;
71965         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71966                 int64_t route_hints_conv_37 = route_hints_vals[l];
71967                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
71968                 CHECK_ACCESS(route_hints_conv_37_ptr);
71969                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
71970                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
71971                 route_hints_constr.data[l] = route_hints_conv_37_conv;
71972         }
71973         FREE(route_hints);
71974         LDKBolt12InvoiceFeatures features_conv;
71975         features_conv.inner = untag_ptr(features);
71976         features_conv.is_owned = ptr_is_owned(features);
71977         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71978         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
71979         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71980         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
71981         int64_t ret_ref = tag_ptr(ret_copy, true);
71982         return ret_ref;
71983 }
71984
71985 int64_t  CS_LDK_Payee_clear(int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
71986         LDKPublicKey node_id_ref;
71987         CHECK(node_id->arr_len == 33);
71988         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
71989         LDKCVec_RouteHintZ route_hints_constr;
71990         route_hints_constr.datalen = route_hints->arr_len;
71991         if (route_hints_constr.datalen > 0)
71992                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
71993         else
71994                 route_hints_constr.data = NULL;
71995         int64_t* route_hints_vals = route_hints->elems;
71996         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71997                 int64_t route_hints_conv_11 = route_hints_vals[l];
71998                 LDKRouteHint route_hints_conv_11_conv;
71999                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
72000                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
72001                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
72002                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
72003                 route_hints_constr.data[l] = route_hints_conv_11_conv;
72004         }
72005         FREE(route_hints);
72006         LDKBolt11InvoiceFeatures features_conv;
72007         features_conv.inner = untag_ptr(features);
72008         features_conv.is_owned = ptr_is_owned(features);
72009         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
72010         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
72011         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
72012         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
72013         int64_t ret_ref = tag_ptr(ret_copy, true);
72014         return ret_ref;
72015 }
72016
72017 int64_t  CS_LDK_Payee_hash(int64_t o) {
72018         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
72019         int64_t ret_conv = Payee_hash(o_conv);
72020         return ret_conv;
72021 }
72022
72023 jboolean  CS_LDK_Payee_eq(int64_t a, int64_t b) {
72024         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
72025         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
72026         jboolean ret_conv = Payee_eq(a_conv, b_conv);
72027         return ret_conv;
72028 }
72029
72030 void  CS_LDK_RouteHint_free(int64_t this_obj) {
72031         LDKRouteHint this_obj_conv;
72032         this_obj_conv.inner = untag_ptr(this_obj);
72033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72035         RouteHint_free(this_obj_conv);
72036 }
72037
72038 int64_tArray  CS_LDK_RouteHint_get_a(int64_t this_ptr) {
72039         LDKRouteHint this_ptr_conv;
72040         this_ptr_conv.inner = untag_ptr(this_ptr);
72041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72043         this_ptr_conv.is_owned = false;
72044         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
72045         int64_tArray ret_arr = NULL;
72046         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72047         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72048         for (size_t o = 0; o < ret_var.datalen; o++) {
72049                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
72050                 int64_t ret_conv_14_ref = 0;
72051                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
72052                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
72053                 ret_arr_ptr[o] = ret_conv_14_ref;
72054         }
72055         
72056         FREE(ret_var.data);
72057         return ret_arr;
72058 }
72059
72060 void  CS_LDK_RouteHint_set_a(int64_t this_ptr, int64_tArray val) {
72061         LDKRouteHint this_ptr_conv;
72062         this_ptr_conv.inner = untag_ptr(this_ptr);
72063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72065         this_ptr_conv.is_owned = false;
72066         LDKCVec_RouteHintHopZ val_constr;
72067         val_constr.datalen = val->arr_len;
72068         if (val_constr.datalen > 0)
72069                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
72070         else
72071                 val_constr.data = NULL;
72072         int64_t* val_vals = val->elems;
72073         for (size_t o = 0; o < val_constr.datalen; o++) {
72074                 int64_t val_conv_14 = val_vals[o];
72075                 LDKRouteHintHop val_conv_14_conv;
72076                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
72077                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
72078                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
72079                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
72080                 val_constr.data[o] = val_conv_14_conv;
72081         }
72082         FREE(val);
72083         RouteHint_set_a(&this_ptr_conv, val_constr);
72084 }
72085
72086 int64_t  CS_LDK_RouteHint_new(int64_tArray a_arg) {
72087         LDKCVec_RouteHintHopZ a_arg_constr;
72088         a_arg_constr.datalen = a_arg->arr_len;
72089         if (a_arg_constr.datalen > 0)
72090                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
72091         else
72092                 a_arg_constr.data = NULL;
72093         int64_t* a_arg_vals = a_arg->elems;
72094         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
72095                 int64_t a_arg_conv_14 = a_arg_vals[o];
72096                 LDKRouteHintHop a_arg_conv_14_conv;
72097                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
72098                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
72099                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
72100                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
72101                 a_arg_constr.data[o] = a_arg_conv_14_conv;
72102         }
72103         FREE(a_arg);
72104         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
72105         int64_t ret_ref = 0;
72106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72108         return ret_ref;
72109 }
72110
72111 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
72112         LDKRouteHint ret_var = RouteHint_clone(arg);
72113         int64_t ret_ref = 0;
72114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72116         return ret_ref;
72117 }
72118 int64_t  CS_LDK_RouteHint_clone_ptr(int64_t arg) {
72119         LDKRouteHint arg_conv;
72120         arg_conv.inner = untag_ptr(arg);
72121         arg_conv.is_owned = ptr_is_owned(arg);
72122         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72123         arg_conv.is_owned = false;
72124         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
72125         return ret_conv;
72126 }
72127
72128 int64_t  CS_LDK_RouteHint_clone(int64_t orig) {
72129         LDKRouteHint orig_conv;
72130         orig_conv.inner = untag_ptr(orig);
72131         orig_conv.is_owned = ptr_is_owned(orig);
72132         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72133         orig_conv.is_owned = false;
72134         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
72135         int64_t ret_ref = 0;
72136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72138         return ret_ref;
72139 }
72140
72141 int64_t  CS_LDK_RouteHint_hash(int64_t o) {
72142         LDKRouteHint o_conv;
72143         o_conv.inner = untag_ptr(o);
72144         o_conv.is_owned = ptr_is_owned(o);
72145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72146         o_conv.is_owned = false;
72147         int64_t ret_conv = RouteHint_hash(&o_conv);
72148         return ret_conv;
72149 }
72150
72151 jboolean  CS_LDK_RouteHint_eq(int64_t a, int64_t b) {
72152         LDKRouteHint a_conv;
72153         a_conv.inner = untag_ptr(a);
72154         a_conv.is_owned = ptr_is_owned(a);
72155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72156         a_conv.is_owned = false;
72157         LDKRouteHint b_conv;
72158         b_conv.inner = untag_ptr(b);
72159         b_conv.is_owned = ptr_is_owned(b);
72160         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72161         b_conv.is_owned = false;
72162         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
72163         return ret_conv;
72164 }
72165
72166 int8_tArray  CS_LDK_RouteHint_write(int64_t obj) {
72167         LDKRouteHint obj_conv;
72168         obj_conv.inner = untag_ptr(obj);
72169         obj_conv.is_owned = ptr_is_owned(obj);
72170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72171         obj_conv.is_owned = false;
72172         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
72173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72175         CVec_u8Z_free(ret_var);
72176         return ret_arr;
72177 }
72178
72179 int64_t  CS_LDK_RouteHint_read(int8_tArray ser) {
72180         LDKu8slice ser_ref;
72181         ser_ref.datalen = ser->arr_len;
72182         ser_ref.data = ser->elems;
72183         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
72184         *ret_conv = RouteHint_read(ser_ref);
72185         FREE(ser);
72186         return tag_ptr(ret_conv, true);
72187 }
72188
72189 void  CS_LDK_RouteHintHop_free(int64_t this_obj) {
72190         LDKRouteHintHop this_obj_conv;
72191         this_obj_conv.inner = untag_ptr(this_obj);
72192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72194         RouteHintHop_free(this_obj_conv);
72195 }
72196
72197 int8_tArray  CS_LDK_RouteHintHop_get_src_node_id(int64_t this_ptr) {
72198         LDKRouteHintHop this_ptr_conv;
72199         this_ptr_conv.inner = untag_ptr(this_ptr);
72200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72202         this_ptr_conv.is_owned = false;
72203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
72204         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
72205         return ret_arr;
72206 }
72207
72208 void  CS_LDK_RouteHintHop_set_src_node_id(int64_t this_ptr, int8_tArray val) {
72209         LDKRouteHintHop this_ptr_conv;
72210         this_ptr_conv.inner = untag_ptr(this_ptr);
72211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72213         this_ptr_conv.is_owned = false;
72214         LDKPublicKey val_ref;
72215         CHECK(val->arr_len == 33);
72216         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
72217         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
72218 }
72219
72220 int64_t  CS_LDK_RouteHintHop_get_short_channel_id(int64_t this_ptr) {
72221         LDKRouteHintHop this_ptr_conv;
72222         this_ptr_conv.inner = untag_ptr(this_ptr);
72223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72225         this_ptr_conv.is_owned = false;
72226         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
72227         return ret_conv;
72228 }
72229
72230 void  CS_LDK_RouteHintHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
72231         LDKRouteHintHop this_ptr_conv;
72232         this_ptr_conv.inner = untag_ptr(this_ptr);
72233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72235         this_ptr_conv.is_owned = false;
72236         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
72237 }
72238
72239 int64_t  CS_LDK_RouteHintHop_get_fees(int64_t this_ptr) {
72240         LDKRouteHintHop this_ptr_conv;
72241         this_ptr_conv.inner = untag_ptr(this_ptr);
72242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72244         this_ptr_conv.is_owned = false;
72245         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
72246         int64_t ret_ref = 0;
72247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72249         return ret_ref;
72250 }
72251
72252 void  CS_LDK_RouteHintHop_set_fees(int64_t this_ptr, int64_t val) {
72253         LDKRouteHintHop this_ptr_conv;
72254         this_ptr_conv.inner = untag_ptr(this_ptr);
72255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72257         this_ptr_conv.is_owned = false;
72258         LDKRoutingFees val_conv;
72259         val_conv.inner = untag_ptr(val);
72260         val_conv.is_owned = ptr_is_owned(val);
72261         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72262         val_conv = RoutingFees_clone(&val_conv);
72263         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
72264 }
72265
72266 int16_t  CS_LDK_RouteHintHop_get_cltv_expiry_delta(int64_t this_ptr) {
72267         LDKRouteHintHop this_ptr_conv;
72268         this_ptr_conv.inner = untag_ptr(this_ptr);
72269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72271         this_ptr_conv.is_owned = false;
72272         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
72273         return ret_conv;
72274 }
72275
72276 void  CS_LDK_RouteHintHop_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
72277         LDKRouteHintHop this_ptr_conv;
72278         this_ptr_conv.inner = untag_ptr(this_ptr);
72279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72281         this_ptr_conv.is_owned = false;
72282         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
72283 }
72284
72285 int64_t  CS_LDK_RouteHintHop_get_htlc_minimum_msat(int64_t this_ptr) {
72286         LDKRouteHintHop this_ptr_conv;
72287         this_ptr_conv.inner = untag_ptr(this_ptr);
72288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72290         this_ptr_conv.is_owned = false;
72291         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72292         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
72293         int64_t ret_ref = tag_ptr(ret_copy, true);
72294         return ret_ref;
72295 }
72296
72297 void  CS_LDK_RouteHintHop_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
72298         LDKRouteHintHop this_ptr_conv;
72299         this_ptr_conv.inner = untag_ptr(this_ptr);
72300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72302         this_ptr_conv.is_owned = false;
72303         void* val_ptr = untag_ptr(val);
72304         CHECK_ACCESS(val_ptr);
72305         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72306         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72307         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
72308 }
72309
72310 int64_t  CS_LDK_RouteHintHop_get_htlc_maximum_msat(int64_t this_ptr) {
72311         LDKRouteHintHop this_ptr_conv;
72312         this_ptr_conv.inner = untag_ptr(this_ptr);
72313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72315         this_ptr_conv.is_owned = false;
72316         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72317         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
72318         int64_t ret_ref = tag_ptr(ret_copy, true);
72319         return ret_ref;
72320 }
72321
72322 void  CS_LDK_RouteHintHop_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
72323         LDKRouteHintHop this_ptr_conv;
72324         this_ptr_conv.inner = untag_ptr(this_ptr);
72325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72327         this_ptr_conv.is_owned = false;
72328         void* val_ptr = untag_ptr(val);
72329         CHECK_ACCESS(val_ptr);
72330         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72331         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72332         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
72333 }
72334
72335 int64_t  CS_LDK_RouteHintHop_new(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) {
72336         LDKPublicKey src_node_id_arg_ref;
72337         CHECK(src_node_id_arg->arr_len == 33);
72338         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
72339         LDKRoutingFees fees_arg_conv;
72340         fees_arg_conv.inner = untag_ptr(fees_arg);
72341         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
72342         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
72343         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
72344         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
72345         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
72346         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
72347         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
72348         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
72349         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
72350         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
72351         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
72352         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);
72353         int64_t ret_ref = 0;
72354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72356         return ret_ref;
72357 }
72358
72359 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
72360         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
72361         int64_t ret_ref = 0;
72362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72364         return ret_ref;
72365 }
72366 int64_t  CS_LDK_RouteHintHop_clone_ptr(int64_t arg) {
72367         LDKRouteHintHop arg_conv;
72368         arg_conv.inner = untag_ptr(arg);
72369         arg_conv.is_owned = ptr_is_owned(arg);
72370         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72371         arg_conv.is_owned = false;
72372         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
72373         return ret_conv;
72374 }
72375
72376 int64_t  CS_LDK_RouteHintHop_clone(int64_t orig) {
72377         LDKRouteHintHop orig_conv;
72378         orig_conv.inner = untag_ptr(orig);
72379         orig_conv.is_owned = ptr_is_owned(orig);
72380         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72381         orig_conv.is_owned = false;
72382         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
72383         int64_t ret_ref = 0;
72384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72386         return ret_ref;
72387 }
72388
72389 int64_t  CS_LDK_RouteHintHop_hash(int64_t o) {
72390         LDKRouteHintHop o_conv;
72391         o_conv.inner = untag_ptr(o);
72392         o_conv.is_owned = ptr_is_owned(o);
72393         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72394         o_conv.is_owned = false;
72395         int64_t ret_conv = RouteHintHop_hash(&o_conv);
72396         return ret_conv;
72397 }
72398
72399 jboolean  CS_LDK_RouteHintHop_eq(int64_t a, int64_t b) {
72400         LDKRouteHintHop a_conv;
72401         a_conv.inner = untag_ptr(a);
72402         a_conv.is_owned = ptr_is_owned(a);
72403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72404         a_conv.is_owned = false;
72405         LDKRouteHintHop b_conv;
72406         b_conv.inner = untag_ptr(b);
72407         b_conv.is_owned = ptr_is_owned(b);
72408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72409         b_conv.is_owned = false;
72410         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
72411         return ret_conv;
72412 }
72413
72414 int8_tArray  CS_LDK_RouteHintHop_write(int64_t obj) {
72415         LDKRouteHintHop obj_conv;
72416         obj_conv.inner = untag_ptr(obj);
72417         obj_conv.is_owned = ptr_is_owned(obj);
72418         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72419         obj_conv.is_owned = false;
72420         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
72421         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72422         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72423         CVec_u8Z_free(ret_var);
72424         return ret_arr;
72425 }
72426
72427 int64_t  CS_LDK_RouteHintHop_read(int8_tArray ser) {
72428         LDKu8slice ser_ref;
72429         ser_ref.datalen = ser->arr_len;
72430         ser_ref.data = ser->elems;
72431         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
72432         *ret_conv = RouteHintHop_read(ser_ref);
72433         FREE(ser);
72434         return tag_ptr(ret_conv, true);
72435 }
72436
72437 void  CS_LDK_FirstHopCandidate_free(int64_t this_obj) {
72438         LDKFirstHopCandidate this_obj_conv;
72439         this_obj_conv.inner = untag_ptr(this_obj);
72440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72442         FirstHopCandidate_free(this_obj_conv);
72443 }
72444
72445 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
72446         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
72447         int64_t ret_ref = 0;
72448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72450         return ret_ref;
72451 }
72452 int64_t  CS_LDK_FirstHopCandidate_clone_ptr(int64_t arg) {
72453         LDKFirstHopCandidate arg_conv;
72454         arg_conv.inner = untag_ptr(arg);
72455         arg_conv.is_owned = ptr_is_owned(arg);
72456         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72457         arg_conv.is_owned = false;
72458         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
72459         return ret_conv;
72460 }
72461
72462 int64_t  CS_LDK_FirstHopCandidate_clone(int64_t orig) {
72463         LDKFirstHopCandidate orig_conv;
72464         orig_conv.inner = untag_ptr(orig);
72465         orig_conv.is_owned = ptr_is_owned(orig);
72466         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72467         orig_conv.is_owned = false;
72468         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
72469         int64_t ret_ref = 0;
72470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72472         return ret_ref;
72473 }
72474
72475 void  CS_LDK_PublicHopCandidate_free(int64_t this_obj) {
72476         LDKPublicHopCandidate this_obj_conv;
72477         this_obj_conv.inner = untag_ptr(this_obj);
72478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72480         PublicHopCandidate_free(this_obj_conv);
72481 }
72482
72483 int64_t  CS_LDK_PublicHopCandidate_get_short_channel_id(int64_t this_ptr) {
72484         LDKPublicHopCandidate this_ptr_conv;
72485         this_ptr_conv.inner = untag_ptr(this_ptr);
72486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72488         this_ptr_conv.is_owned = false;
72489         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
72490         return ret_conv;
72491 }
72492
72493 void  CS_LDK_PublicHopCandidate_set_short_channel_id(int64_t this_ptr, int64_t val) {
72494         LDKPublicHopCandidate this_ptr_conv;
72495         this_ptr_conv.inner = untag_ptr(this_ptr);
72496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72498         this_ptr_conv.is_owned = false;
72499         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
72500 }
72501
72502 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
72503         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
72504         int64_t ret_ref = 0;
72505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72507         return ret_ref;
72508 }
72509 int64_t  CS_LDK_PublicHopCandidate_clone_ptr(int64_t arg) {
72510         LDKPublicHopCandidate arg_conv;
72511         arg_conv.inner = untag_ptr(arg);
72512         arg_conv.is_owned = ptr_is_owned(arg);
72513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72514         arg_conv.is_owned = false;
72515         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
72516         return ret_conv;
72517 }
72518
72519 int64_t  CS_LDK_PublicHopCandidate_clone(int64_t orig) {
72520         LDKPublicHopCandidate orig_conv;
72521         orig_conv.inner = untag_ptr(orig);
72522         orig_conv.is_owned = ptr_is_owned(orig);
72523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72524         orig_conv.is_owned = false;
72525         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
72526         int64_t ret_ref = 0;
72527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72529         return ret_ref;
72530 }
72531
72532 void  CS_LDK_PrivateHopCandidate_free(int64_t this_obj) {
72533         LDKPrivateHopCandidate this_obj_conv;
72534         this_obj_conv.inner = untag_ptr(this_obj);
72535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72537         PrivateHopCandidate_free(this_obj_conv);
72538 }
72539
72540 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
72541         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
72542         int64_t ret_ref = 0;
72543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72545         return ret_ref;
72546 }
72547 int64_t  CS_LDK_PrivateHopCandidate_clone_ptr(int64_t arg) {
72548         LDKPrivateHopCandidate arg_conv;
72549         arg_conv.inner = untag_ptr(arg);
72550         arg_conv.is_owned = ptr_is_owned(arg);
72551         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72552         arg_conv.is_owned = false;
72553         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
72554         return ret_conv;
72555 }
72556
72557 int64_t  CS_LDK_PrivateHopCandidate_clone(int64_t orig) {
72558         LDKPrivateHopCandidate orig_conv;
72559         orig_conv.inner = untag_ptr(orig);
72560         orig_conv.is_owned = ptr_is_owned(orig);
72561         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72562         orig_conv.is_owned = false;
72563         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
72564         int64_t ret_ref = 0;
72565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72567         return ret_ref;
72568 }
72569
72570 void  CS_LDK_BlindedPathCandidate_free(int64_t this_obj) {
72571         LDKBlindedPathCandidate this_obj_conv;
72572         this_obj_conv.inner = untag_ptr(this_obj);
72573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72575         BlindedPathCandidate_free(this_obj_conv);
72576 }
72577
72578 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
72579         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
72580         int64_t ret_ref = 0;
72581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72583         return ret_ref;
72584 }
72585 int64_t  CS_LDK_BlindedPathCandidate_clone_ptr(int64_t arg) {
72586         LDKBlindedPathCandidate arg_conv;
72587         arg_conv.inner = untag_ptr(arg);
72588         arg_conv.is_owned = ptr_is_owned(arg);
72589         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72590         arg_conv.is_owned = false;
72591         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
72592         return ret_conv;
72593 }
72594
72595 int64_t  CS_LDK_BlindedPathCandidate_clone(int64_t orig) {
72596         LDKBlindedPathCandidate orig_conv;
72597         orig_conv.inner = untag_ptr(orig);
72598         orig_conv.is_owned = ptr_is_owned(orig);
72599         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72600         orig_conv.is_owned = false;
72601         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
72602         int64_t ret_ref = 0;
72603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72605         return ret_ref;
72606 }
72607
72608 void  CS_LDK_OneHopBlindedPathCandidate_free(int64_t this_obj) {
72609         LDKOneHopBlindedPathCandidate this_obj_conv;
72610         this_obj_conv.inner = untag_ptr(this_obj);
72611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72613         OneHopBlindedPathCandidate_free(this_obj_conv);
72614 }
72615
72616 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
72617         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
72618         int64_t ret_ref = 0;
72619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72621         return ret_ref;
72622 }
72623 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone_ptr(int64_t arg) {
72624         LDKOneHopBlindedPathCandidate arg_conv;
72625         arg_conv.inner = untag_ptr(arg);
72626         arg_conv.is_owned = ptr_is_owned(arg);
72627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72628         arg_conv.is_owned = false;
72629         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
72630         return ret_conv;
72631 }
72632
72633 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone(int64_t orig) {
72634         LDKOneHopBlindedPathCandidate orig_conv;
72635         orig_conv.inner = untag_ptr(orig);
72636         orig_conv.is_owned = ptr_is_owned(orig);
72637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72638         orig_conv.is_owned = false;
72639         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
72640         int64_t ret_ref = 0;
72641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72643         return ret_ref;
72644 }
72645
72646 void  CS_LDK_CandidateRouteHop_free(int64_t this_ptr) {
72647         if (!ptr_is_owned(this_ptr)) return;
72648         void* this_ptr_ptr = untag_ptr(this_ptr);
72649         CHECK_ACCESS(this_ptr_ptr);
72650         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
72651         FREE(untag_ptr(this_ptr));
72652         CandidateRouteHop_free(this_ptr_conv);
72653 }
72654
72655 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
72656         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72657         *ret_copy = CandidateRouteHop_clone(arg);
72658         int64_t ret_ref = tag_ptr(ret_copy, true);
72659         return ret_ref;
72660 }
72661 int64_t  CS_LDK_CandidateRouteHop_clone_ptr(int64_t arg) {
72662         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
72663         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
72664         return ret_conv;
72665 }
72666
72667 int64_t  CS_LDK_CandidateRouteHop_clone(int64_t orig) {
72668         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
72669         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72670         *ret_copy = CandidateRouteHop_clone(orig_conv);
72671         int64_t ret_ref = tag_ptr(ret_copy, true);
72672         return ret_ref;
72673 }
72674
72675 int64_t  CS_LDK_CandidateRouteHop_first_hop(int64_t a) {
72676         LDKFirstHopCandidate a_conv;
72677         a_conv.inner = untag_ptr(a);
72678         a_conv.is_owned = ptr_is_owned(a);
72679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72680         a_conv = FirstHopCandidate_clone(&a_conv);
72681         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72682         *ret_copy = CandidateRouteHop_first_hop(a_conv);
72683         int64_t ret_ref = tag_ptr(ret_copy, true);
72684         return ret_ref;
72685 }
72686
72687 int64_t  CS_LDK_CandidateRouteHop_public_hop(int64_t a) {
72688         LDKPublicHopCandidate a_conv;
72689         a_conv.inner = untag_ptr(a);
72690         a_conv.is_owned = ptr_is_owned(a);
72691         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72692         a_conv = PublicHopCandidate_clone(&a_conv);
72693         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72694         *ret_copy = CandidateRouteHop_public_hop(a_conv);
72695         int64_t ret_ref = tag_ptr(ret_copy, true);
72696         return ret_ref;
72697 }
72698
72699 int64_t  CS_LDK_CandidateRouteHop_private_hop(int64_t a) {
72700         LDKPrivateHopCandidate a_conv;
72701         a_conv.inner = untag_ptr(a);
72702         a_conv.is_owned = ptr_is_owned(a);
72703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72704         a_conv = PrivateHopCandidate_clone(&a_conv);
72705         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72706         *ret_copy = CandidateRouteHop_private_hop(a_conv);
72707         int64_t ret_ref = tag_ptr(ret_copy, true);
72708         return ret_ref;
72709 }
72710
72711 int64_t  CS_LDK_CandidateRouteHop_blinded(int64_t a) {
72712         LDKBlindedPathCandidate a_conv;
72713         a_conv.inner = untag_ptr(a);
72714         a_conv.is_owned = ptr_is_owned(a);
72715         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72716         a_conv = BlindedPathCandidate_clone(&a_conv);
72717         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72718         *ret_copy = CandidateRouteHop_blinded(a_conv);
72719         int64_t ret_ref = tag_ptr(ret_copy, true);
72720         return ret_ref;
72721 }
72722
72723 int64_t  CS_LDK_CandidateRouteHop_one_hop_blinded(int64_t a) {
72724         LDKOneHopBlindedPathCandidate a_conv;
72725         a_conv.inner = untag_ptr(a);
72726         a_conv.is_owned = ptr_is_owned(a);
72727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72728         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
72729         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
72730         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
72731         int64_t ret_ref = tag_ptr(ret_copy, true);
72732         return ret_ref;
72733 }
72734
72735 int64_t  CS_LDK_CandidateRouteHop_globally_unique_short_channel_id(int64_t this_arg) {
72736         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72737         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72738         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
72739         int64_t ret_ref = tag_ptr(ret_copy, true);
72740         return ret_ref;
72741 }
72742
72743 int32_t  CS_LDK_CandidateRouteHop_cltv_expiry_delta(int64_t this_arg) {
72744         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72745         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
72746         return ret_conv;
72747 }
72748
72749 int64_t  CS_LDK_CandidateRouteHop_htlc_minimum_msat(int64_t this_arg) {
72750         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72751         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
72752         return ret_conv;
72753 }
72754
72755 int64_t  CS_LDK_CandidateRouteHop_fees(int64_t this_arg) {
72756         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72757         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
72758         int64_t ret_ref = 0;
72759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72761         return ret_ref;
72762 }
72763
72764 int64_t  CS_LDK_CandidateRouteHop_source(int64_t this_arg) {
72765         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72766         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
72767         int64_t ret_ref = 0;
72768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72770         return ret_ref;
72771 }
72772
72773 int64_t  CS_LDK_CandidateRouteHop_target(int64_t this_arg) {
72774         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72775         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
72776         int64_t ret_ref = 0;
72777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72779         return ret_ref;
72780 }
72781
72782 int64_t  CS_LDK_find_route(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) {
72783         LDKPublicKey our_node_pubkey_ref;
72784         CHECK(our_node_pubkey->arr_len == 33);
72785         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72786         LDKRouteParameters route_params_conv;
72787         route_params_conv.inner = untag_ptr(route_params);
72788         route_params_conv.is_owned = ptr_is_owned(route_params);
72789         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72790         route_params_conv.is_owned = false;
72791         LDKNetworkGraph network_graph_conv;
72792         network_graph_conv.inner = untag_ptr(network_graph);
72793         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72794         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72795         network_graph_conv.is_owned = false;
72796         LDKCVec_ChannelDetailsZ first_hops_constr;
72797         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
72798         if (first_hops != NULL) {
72799                 first_hops_constr.datalen = first_hops->arr_len;
72800                 if (first_hops_constr.datalen > 0)
72801                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
72802                 else
72803                         first_hops_constr.data = NULL;
72804                 int64_t* first_hops_vals = first_hops->elems;
72805                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
72806                         int64_t first_hops_conv_16 = first_hops_vals[q];
72807                         LDKChannelDetails first_hops_conv_16_conv;
72808                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
72809                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
72810                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
72811                         first_hops_conv_16_conv.is_owned = false;
72812                         first_hops_constr.data[q] = first_hops_conv_16_conv;
72813                 }
72814                 FREE(first_hops);
72815                 first_hops_ptr = &first_hops_constr;
72816         }
72817         void* logger_ptr = untag_ptr(logger);
72818         CHECK_ACCESS(logger_ptr);
72819         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72820         if (logger_conv.free == LDKLogger_JCalls_free) {
72821                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72822                 LDKLogger_JCalls_cloned(&logger_conv);
72823         }
72824         void* scorer_ptr = untag_ptr(scorer);
72825         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
72826         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
72827         LDKProbabilisticScoringFeeParameters score_params_conv;
72828         score_params_conv.inner = untag_ptr(score_params);
72829         score_params_conv.is_owned = ptr_is_owned(score_params);
72830         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
72831         score_params_conv.is_owned = false;
72832         uint8_t random_seed_bytes_arr[32];
72833         CHECK(random_seed_bytes->arr_len == 32);
72834         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72835         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72836         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72837         *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);
72838         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
72839         return tag_ptr(ret_conv, true);
72840 }
72841
72842 int64_t  CS_LDK_build_route_from_hops(int8_tArray our_node_pubkey, ptrArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
72843         LDKPublicKey our_node_pubkey_ref;
72844         CHECK(our_node_pubkey->arr_len == 33);
72845         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
72846         LDKCVec_PublicKeyZ hops_constr;
72847         hops_constr.datalen = hops->arr_len;
72848         if (hops_constr.datalen > 0)
72849                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
72850         else
72851                 hops_constr.data = NULL;
72852         int8_tArray* hops_vals = (void*) hops->elems;
72853         for (size_t i = 0; i < hops_constr.datalen; i++) {
72854                 int8_tArray hops_conv_8 = hops_vals[i];
72855                 LDKPublicKey hops_conv_8_ref;
72856                 CHECK(hops_conv_8->arr_len == 33);
72857                 memcpy(hops_conv_8_ref.compressed_form, hops_conv_8->elems, 33); FREE(hops_conv_8);
72858                 hops_constr.data[i] = hops_conv_8_ref;
72859         }
72860         FREE(hops);
72861         LDKRouteParameters route_params_conv;
72862         route_params_conv.inner = untag_ptr(route_params);
72863         route_params_conv.is_owned = ptr_is_owned(route_params);
72864         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72865         route_params_conv.is_owned = false;
72866         LDKNetworkGraph network_graph_conv;
72867         network_graph_conv.inner = untag_ptr(network_graph);
72868         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72869         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72870         network_graph_conv.is_owned = false;
72871         void* logger_ptr = untag_ptr(logger);
72872         CHECK_ACCESS(logger_ptr);
72873         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72874         if (logger_conv.free == LDKLogger_JCalls_free) {
72875                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72876                 LDKLogger_JCalls_cloned(&logger_conv);
72877         }
72878         uint8_t random_seed_bytes_arr[32];
72879         CHECK(random_seed_bytes->arr_len == 32);
72880         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
72881         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72882         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72883         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
72884         return tag_ptr(ret_conv, true);
72885 }
72886
72887 void  CS_LDK_ScoreLookUp_free(int64_t this_ptr) {
72888         if (!ptr_is_owned(this_ptr)) return;
72889         void* this_ptr_ptr = untag_ptr(this_ptr);
72890         CHECK_ACCESS(this_ptr_ptr);
72891         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
72892         FREE(untag_ptr(this_ptr));
72893         ScoreLookUp_free(this_ptr_conv);
72894 }
72895
72896 void  CS_LDK_ScoreUpdate_free(int64_t this_ptr) {
72897         if (!ptr_is_owned(this_ptr)) return;
72898         void* this_ptr_ptr = untag_ptr(this_ptr);
72899         CHECK_ACCESS(this_ptr_ptr);
72900         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
72901         FREE(untag_ptr(this_ptr));
72902         ScoreUpdate_free(this_ptr_conv);
72903 }
72904
72905 void  CS_LDK_Score_free(int64_t this_ptr) {
72906         if (!ptr_is_owned(this_ptr)) return;
72907         void* this_ptr_ptr = untag_ptr(this_ptr);
72908         CHECK_ACCESS(this_ptr_ptr);
72909         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
72910         FREE(untag_ptr(this_ptr));
72911         Score_free(this_ptr_conv);
72912 }
72913
72914 void  CS_LDK_LockableScore_free(int64_t this_ptr) {
72915         if (!ptr_is_owned(this_ptr)) return;
72916         void* this_ptr_ptr = untag_ptr(this_ptr);
72917         CHECK_ACCESS(this_ptr_ptr);
72918         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
72919         FREE(untag_ptr(this_ptr));
72920         LockableScore_free(this_ptr_conv);
72921 }
72922
72923 void  CS_LDK_WriteableScore_free(int64_t this_ptr) {
72924         if (!ptr_is_owned(this_ptr)) return;
72925         void* this_ptr_ptr = untag_ptr(this_ptr);
72926         CHECK_ACCESS(this_ptr_ptr);
72927         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
72928         FREE(untag_ptr(this_ptr));
72929         WriteableScore_free(this_ptr_conv);
72930 }
72931
72932 void  CS_LDK_MultiThreadedLockableScore_free(int64_t this_obj) {
72933         LDKMultiThreadedLockableScore this_obj_conv;
72934         this_obj_conv.inner = untag_ptr(this_obj);
72935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72937         MultiThreadedLockableScore_free(this_obj_conv);
72938 }
72939
72940 int64_t  CS_LDK_MultiThreadedLockableScore_as_LockableScore(int64_t this_arg) {
72941         LDKMultiThreadedLockableScore this_arg_conv;
72942         this_arg_conv.inner = untag_ptr(this_arg);
72943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72945         this_arg_conv.is_owned = false;
72946         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
72947         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
72948         return tag_ptr(ret_ret, true);
72949 }
72950
72951 int8_tArray  CS_LDK_MultiThreadedLockableScore_write(int64_t obj) {
72952         LDKMultiThreadedLockableScore obj_conv;
72953         obj_conv.inner = untag_ptr(obj);
72954         obj_conv.is_owned = ptr_is_owned(obj);
72955         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72956         obj_conv.is_owned = false;
72957         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
72958         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72959         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72960         CVec_u8Z_free(ret_var);
72961         return ret_arr;
72962 }
72963
72964 int64_t  CS_LDK_MultiThreadedLockableScore_as_WriteableScore(int64_t this_arg) {
72965         LDKMultiThreadedLockableScore this_arg_conv;
72966         this_arg_conv.inner = untag_ptr(this_arg);
72967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72969         this_arg_conv.is_owned = false;
72970         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
72971         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
72972         return tag_ptr(ret_ret, true);
72973 }
72974
72975 int64_t  CS_LDK_MultiThreadedLockableScore_new(int64_t score) {
72976         void* score_ptr = untag_ptr(score);
72977         CHECK_ACCESS(score_ptr);
72978         LDKScore score_conv = *(LDKScore*)(score_ptr);
72979         if (score_conv.free == LDKScore_JCalls_free) {
72980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72981                 LDKScore_JCalls_cloned(&score_conv);
72982         }
72983         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
72984         int64_t ret_ref = 0;
72985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72987         return ret_ref;
72988 }
72989
72990 void  CS_LDK_MultiThreadedScoreLockRead_free(int64_t this_obj) {
72991         LDKMultiThreadedScoreLockRead this_obj_conv;
72992         this_obj_conv.inner = untag_ptr(this_obj);
72993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72995         MultiThreadedScoreLockRead_free(this_obj_conv);
72996 }
72997
72998 void  CS_LDK_MultiThreadedScoreLockWrite_free(int64_t this_obj) {
72999         LDKMultiThreadedScoreLockWrite this_obj_conv;
73000         this_obj_conv.inner = untag_ptr(this_obj);
73001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73003         MultiThreadedScoreLockWrite_free(this_obj_conv);
73004 }
73005
73006 int64_t  CS_LDK_MultiThreadedScoreLockRead_as_ScoreLookUp(int64_t this_arg) {
73007         LDKMultiThreadedScoreLockRead this_arg_conv;
73008         this_arg_conv.inner = untag_ptr(this_arg);
73009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73011         this_arg_conv.is_owned = false;
73012         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73013         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
73014         return tag_ptr(ret_ret, true);
73015 }
73016
73017 int8_tArray  CS_LDK_MultiThreadedScoreLockWrite_write(int64_t obj) {
73018         LDKMultiThreadedScoreLockWrite obj_conv;
73019         obj_conv.inner = untag_ptr(obj);
73020         obj_conv.is_owned = ptr_is_owned(obj);
73021         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73022         obj_conv.is_owned = false;
73023         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
73024         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73025         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73026         CVec_u8Z_free(ret_var);
73027         return ret_arr;
73028 }
73029
73030 int64_t  CS_LDK_MultiThreadedScoreLockWrite_as_ScoreUpdate(int64_t this_arg) {
73031         LDKMultiThreadedScoreLockWrite this_arg_conv;
73032         this_arg_conv.inner = untag_ptr(this_arg);
73033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73035         this_arg_conv.is_owned = false;
73036         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73037         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
73038         return tag_ptr(ret_ret, true);
73039 }
73040
73041 void  CS_LDK_ChannelUsage_free(int64_t this_obj) {
73042         LDKChannelUsage this_obj_conv;
73043         this_obj_conv.inner = untag_ptr(this_obj);
73044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73046         ChannelUsage_free(this_obj_conv);
73047 }
73048
73049 int64_t  CS_LDK_ChannelUsage_get_amount_msat(int64_t this_ptr) {
73050         LDKChannelUsage this_ptr_conv;
73051         this_ptr_conv.inner = untag_ptr(this_ptr);
73052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73054         this_ptr_conv.is_owned = false;
73055         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
73056         return ret_conv;
73057 }
73058
73059 void  CS_LDK_ChannelUsage_set_amount_msat(int64_t this_ptr, int64_t val) {
73060         LDKChannelUsage this_ptr_conv;
73061         this_ptr_conv.inner = untag_ptr(this_ptr);
73062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73064         this_ptr_conv.is_owned = false;
73065         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
73066 }
73067
73068 int64_t  CS_LDK_ChannelUsage_get_inflight_htlc_msat(int64_t this_ptr) {
73069         LDKChannelUsage this_ptr_conv;
73070         this_ptr_conv.inner = untag_ptr(this_ptr);
73071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73073         this_ptr_conv.is_owned = false;
73074         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
73075         return ret_conv;
73076 }
73077
73078 void  CS_LDK_ChannelUsage_set_inflight_htlc_msat(int64_t this_ptr, int64_t val) {
73079         LDKChannelUsage this_ptr_conv;
73080         this_ptr_conv.inner = untag_ptr(this_ptr);
73081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73083         this_ptr_conv.is_owned = false;
73084         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
73085 }
73086
73087 int64_t  CS_LDK_ChannelUsage_get_effective_capacity(int64_t this_ptr) {
73088         LDKChannelUsage this_ptr_conv;
73089         this_ptr_conv.inner = untag_ptr(this_ptr);
73090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73092         this_ptr_conv.is_owned = false;
73093         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
73094         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
73095         int64_t ret_ref = tag_ptr(ret_copy, true);
73096         return ret_ref;
73097 }
73098
73099 void  CS_LDK_ChannelUsage_set_effective_capacity(int64_t this_ptr, int64_t val) {
73100         LDKChannelUsage this_ptr_conv;
73101         this_ptr_conv.inner = untag_ptr(this_ptr);
73102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73104         this_ptr_conv.is_owned = false;
73105         void* val_ptr = untag_ptr(val);
73106         CHECK_ACCESS(val_ptr);
73107         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
73108         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
73109         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
73110 }
73111
73112 int64_t  CS_LDK_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
73113         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
73114         CHECK_ACCESS(effective_capacity_arg_ptr);
73115         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
73116         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
73117         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_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 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
73125         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
73126         int64_t ret_ref = 0;
73127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73129         return ret_ref;
73130 }
73131 int64_t  CS_LDK_ChannelUsage_clone_ptr(int64_t arg) {
73132         LDKChannelUsage arg_conv;
73133         arg_conv.inner = untag_ptr(arg);
73134         arg_conv.is_owned = ptr_is_owned(arg);
73135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73136         arg_conv.is_owned = false;
73137         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
73138         return ret_conv;
73139 }
73140
73141 int64_t  CS_LDK_ChannelUsage_clone(int64_t orig) {
73142         LDKChannelUsage orig_conv;
73143         orig_conv.inner = untag_ptr(orig);
73144         orig_conv.is_owned = ptr_is_owned(orig);
73145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73146         orig_conv.is_owned = false;
73147         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
73148         int64_t ret_ref = 0;
73149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73151         return ret_ref;
73152 }
73153
73154 void  CS_LDK_FixedPenaltyScorer_free(int64_t this_obj) {
73155         LDKFixedPenaltyScorer this_obj_conv;
73156         this_obj_conv.inner = untag_ptr(this_obj);
73157         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73159         FixedPenaltyScorer_free(this_obj_conv);
73160 }
73161
73162 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
73163         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
73164         int64_t ret_ref = 0;
73165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73167         return ret_ref;
73168 }
73169 int64_t  CS_LDK_FixedPenaltyScorer_clone_ptr(int64_t arg) {
73170         LDKFixedPenaltyScorer arg_conv;
73171         arg_conv.inner = untag_ptr(arg);
73172         arg_conv.is_owned = ptr_is_owned(arg);
73173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73174         arg_conv.is_owned = false;
73175         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
73176         return ret_conv;
73177 }
73178
73179 int64_t  CS_LDK_FixedPenaltyScorer_clone(int64_t orig) {
73180         LDKFixedPenaltyScorer orig_conv;
73181         orig_conv.inner = untag_ptr(orig);
73182         orig_conv.is_owned = ptr_is_owned(orig);
73183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73184         orig_conv.is_owned = false;
73185         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
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
73192 int64_t  CS_LDK_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
73193         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
73194         int64_t ret_ref = 0;
73195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73197         return ret_ref;
73198 }
73199
73200 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreLookUp(int64_t this_arg) {
73201         LDKFixedPenaltyScorer this_arg_conv;
73202         this_arg_conv.inner = untag_ptr(this_arg);
73203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73205         this_arg_conv.is_owned = false;
73206         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73207         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
73208         return tag_ptr(ret_ret, true);
73209 }
73210
73211 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreUpdate(int64_t this_arg) {
73212         LDKFixedPenaltyScorer this_arg_conv;
73213         this_arg_conv.inner = untag_ptr(this_arg);
73214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73216         this_arg_conv.is_owned = false;
73217         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73218         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
73219         return tag_ptr(ret_ret, true);
73220 }
73221
73222 int8_tArray  CS_LDK_FixedPenaltyScorer_write(int64_t obj) {
73223         LDKFixedPenaltyScorer obj_conv;
73224         obj_conv.inner = untag_ptr(obj);
73225         obj_conv.is_owned = ptr_is_owned(obj);
73226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73227         obj_conv.is_owned = false;
73228         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
73229         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73230         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73231         CVec_u8Z_free(ret_var);
73232         return ret_arr;
73233 }
73234
73235 int64_t  CS_LDK_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
73236         LDKu8slice ser_ref;
73237         ser_ref.datalen = ser->arr_len;
73238         ser_ref.data = ser->elems;
73239         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
73240         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
73241         FREE(ser);
73242         return tag_ptr(ret_conv, true);
73243 }
73244
73245 void  CS_LDK_ProbabilisticScorer_free(int64_t this_obj) {
73246         LDKProbabilisticScorer this_obj_conv;
73247         this_obj_conv.inner = untag_ptr(this_obj);
73248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73250         ProbabilisticScorer_free(this_obj_conv);
73251 }
73252
73253 void  CS_LDK_ProbabilisticScoringFeeParameters_free(int64_t this_obj) {
73254         LDKProbabilisticScoringFeeParameters this_obj_conv;
73255         this_obj_conv.inner = untag_ptr(this_obj);
73256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73258         ProbabilisticScoringFeeParameters_free(this_obj_conv);
73259 }
73260
73261 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_msat(int64_t this_ptr) {
73262         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73263         this_ptr_conv.inner = untag_ptr(this_ptr);
73264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73266         this_ptr_conv.is_owned = false;
73267         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
73268         return ret_conv;
73269 }
73270
73271 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_msat(int64_t this_ptr, int64_t val) {
73272         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73273         this_ptr_conv.inner = untag_ptr(this_ptr);
73274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73276         this_ptr_conv.is_owned = false;
73277         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
73278 }
73279
73280 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(int64_t this_ptr) {
73281         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73282         this_ptr_conv.inner = untag_ptr(this_ptr);
73283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73285         this_ptr_conv.is_owned = false;
73286         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
73287         return ret_conv;
73288 }
73289
73290 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
73291         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73292         this_ptr_conv.inner = untag_ptr(this_ptr);
73293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73295         this_ptr_conv.is_owned = false;
73296         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
73297 }
73298
73299 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
73300         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73301         this_ptr_conv.inner = untag_ptr(this_ptr);
73302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73304         this_ptr_conv.is_owned = false;
73305         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
73306         return ret_conv;
73307 }
73308
73309 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
73310         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73311         this_ptr_conv.inner = untag_ptr(this_ptr);
73312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73314         this_ptr_conv.is_owned = false;
73315         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
73316 }
73317
73318 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
73319         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73320         this_ptr_conv.inner = untag_ptr(this_ptr);
73321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73323         this_ptr_conv.is_owned = false;
73324         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
73325         return ret_conv;
73326 }
73327
73328 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
73329         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73330         this_ptr_conv.inner = untag_ptr(this_ptr);
73331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73333         this_ptr_conv.is_owned = false;
73334         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
73335 }
73336
73337 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
73338         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73339         this_ptr_conv.inner = untag_ptr(this_ptr);
73340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73342         this_ptr_conv.is_owned = false;
73343         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
73344         return ret_conv;
73345 }
73346
73347 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
73348         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73349         this_ptr_conv.inner = untag_ptr(this_ptr);
73350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73352         this_ptr_conv.is_owned = false;
73353         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
73354 }
73355
73356 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
73357         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73358         this_ptr_conv.inner = untag_ptr(this_ptr);
73359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73361         this_ptr_conv.is_owned = false;
73362         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
73363         return ret_conv;
73364 }
73365
73366 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
73367         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73368         this_ptr_conv.inner = untag_ptr(this_ptr);
73369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73371         this_ptr_conv.is_owned = false;
73372         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
73373 }
73374
73375 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(int64_t this_ptr) {
73376         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73377         this_ptr_conv.inner = untag_ptr(this_ptr);
73378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73380         this_ptr_conv.is_owned = false;
73381         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
73382         return ret_conv;
73383 }
73384
73385 void  CS_LDK_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(int64_t this_ptr, int64_t val) {
73386         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73387         this_ptr_conv.inner = untag_ptr(this_ptr);
73388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73390         this_ptr_conv.is_owned = false;
73391         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
73392 }
73393
73394 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(int64_t this_ptr) {
73395         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73396         this_ptr_conv.inner = untag_ptr(this_ptr);
73397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73399         this_ptr_conv.is_owned = false;
73400         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
73401         return ret_conv;
73402 }
73403
73404 void  CS_LDK_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(int64_t this_ptr, int64_t val) {
73405         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73406         this_ptr_conv.inner = untag_ptr(this_ptr);
73407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73409         this_ptr_conv.is_owned = false;
73410         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
73411 }
73412
73413 jboolean  CS_LDK_ProbabilisticScoringFeeParameters_get_linear_success_probability(int64_t this_ptr) {
73414         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73415         this_ptr_conv.inner = untag_ptr(this_ptr);
73416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73418         this_ptr_conv.is_owned = false;
73419         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
73420         return ret_conv;
73421 }
73422
73423 void  CS_LDK_ProbabilisticScoringFeeParameters_set_linear_success_probability(int64_t this_ptr, jboolean val) {
73424         LDKProbabilisticScoringFeeParameters this_ptr_conv;
73425         this_ptr_conv.inner = untag_ptr(this_ptr);
73426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73428         this_ptr_conv.is_owned = false;
73429         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
73430 }
73431
73432 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
73433         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
73434         int64_t ret_ref = 0;
73435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73437         return ret_ref;
73438 }
73439 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone_ptr(int64_t arg) {
73440         LDKProbabilisticScoringFeeParameters arg_conv;
73441         arg_conv.inner = untag_ptr(arg);
73442         arg_conv.is_owned = ptr_is_owned(arg);
73443         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73444         arg_conv.is_owned = false;
73445         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
73446         return ret_conv;
73447 }
73448
73449 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone(int64_t orig) {
73450         LDKProbabilisticScoringFeeParameters orig_conv;
73451         orig_conv.inner = untag_ptr(orig);
73452         orig_conv.is_owned = ptr_is_owned(orig);
73453         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73454         orig_conv.is_owned = false;
73455         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
73456         int64_t ret_ref = 0;
73457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73459         return ret_ref;
73460 }
73461
73462 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_default() {
73463         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
73464         int64_t ret_ref = 0;
73465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73467         return ret_ref;
73468 }
73469
73470 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned(int64_t this_arg, int64_t node_id) {
73471         LDKProbabilisticScoringFeeParameters 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         LDKNodeId node_id_conv;
73477         node_id_conv.inner = untag_ptr(node_id);
73478         node_id_conv.is_owned = ptr_is_owned(node_id);
73479         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73480         node_id_conv.is_owned = false;
73481         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
73482 }
73483
73484 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned_from_list(int64_t this_arg, int64_tArray node_ids) {
73485         LDKProbabilisticScoringFeeParameters this_arg_conv;
73486         this_arg_conv.inner = untag_ptr(this_arg);
73487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73489         this_arg_conv.is_owned = false;
73490         LDKCVec_NodeIdZ node_ids_constr;
73491         node_ids_constr.datalen = node_ids->arr_len;
73492         if (node_ids_constr.datalen > 0)
73493                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
73494         else
73495                 node_ids_constr.data = NULL;
73496         int64_t* node_ids_vals = node_ids->elems;
73497         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
73498                 int64_t node_ids_conv_8 = node_ids_vals[i];
73499                 LDKNodeId node_ids_conv_8_conv;
73500                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
73501                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
73502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
73503                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
73504                 node_ids_constr.data[i] = node_ids_conv_8_conv;
73505         }
73506         FREE(node_ids);
73507         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
73508 }
73509
73510 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_banned(int64_t this_arg, int64_t node_id) {
73511         LDKProbabilisticScoringFeeParameters this_arg_conv;
73512         this_arg_conv.inner = untag_ptr(this_arg);
73513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73515         this_arg_conv.is_owned = false;
73516         LDKNodeId node_id_conv;
73517         node_id_conv.inner = untag_ptr(node_id);
73518         node_id_conv.is_owned = ptr_is_owned(node_id);
73519         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73520         node_id_conv.is_owned = false;
73521         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
73522 }
73523
73524 void  CS_LDK_ProbabilisticScoringFeeParameters_set_manual_penalty(int64_t this_arg, int64_t node_id, int64_t penalty) {
73525         LDKProbabilisticScoringFeeParameters this_arg_conv;
73526         this_arg_conv.inner = untag_ptr(this_arg);
73527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73529         this_arg_conv.is_owned = false;
73530         LDKNodeId node_id_conv;
73531         node_id_conv.inner = untag_ptr(node_id);
73532         node_id_conv.is_owned = ptr_is_owned(node_id);
73533         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73534         node_id_conv.is_owned = false;
73535         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
73536 }
73537
73538 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_manual_penalty(int64_t this_arg, int64_t node_id) {
73539         LDKProbabilisticScoringFeeParameters this_arg_conv;
73540         this_arg_conv.inner = untag_ptr(this_arg);
73541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73543         this_arg_conv.is_owned = false;
73544         LDKNodeId node_id_conv;
73545         node_id_conv.inner = untag_ptr(node_id);
73546         node_id_conv.is_owned = ptr_is_owned(node_id);
73547         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
73548         node_id_conv.is_owned = false;
73549         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
73550 }
73551
73552 void  CS_LDK_ProbabilisticScoringFeeParameters_clear_manual_penalties(int64_t this_arg) {
73553         LDKProbabilisticScoringFeeParameters this_arg_conv;
73554         this_arg_conv.inner = untag_ptr(this_arg);
73555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73557         this_arg_conv.is_owned = false;
73558         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
73559 }
73560
73561 void  CS_LDK_ProbabilisticScoringDecayParameters_free(int64_t this_obj) {
73562         LDKProbabilisticScoringDecayParameters this_obj_conv;
73563         this_obj_conv.inner = untag_ptr(this_obj);
73564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73566         ProbabilisticScoringDecayParameters_free(this_obj_conv);
73567 }
73568
73569 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(int64_t this_ptr) {
73570         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73571         this_ptr_conv.inner = untag_ptr(this_ptr);
73572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73574         this_ptr_conv.is_owned = false;
73575         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
73576         return ret_conv;
73577 }
73578
73579 void  CS_LDK_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(int64_t this_ptr, int64_t val) {
73580         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73581         this_ptr_conv.inner = untag_ptr(this_ptr);
73582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73584         this_ptr_conv.is_owned = false;
73585         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
73586 }
73587
73588 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(int64_t this_ptr) {
73589         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73590         this_ptr_conv.inner = untag_ptr(this_ptr);
73591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73593         this_ptr_conv.is_owned = false;
73594         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
73595         return ret_conv;
73596 }
73597
73598 void  CS_LDK_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(int64_t this_ptr, int64_t val) {
73599         LDKProbabilisticScoringDecayParameters this_ptr_conv;
73600         this_ptr_conv.inner = untag_ptr(this_ptr);
73601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73603         this_ptr_conv.is_owned = false;
73604         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
73605 }
73606
73607 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_new(int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
73608         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
73609         int64_t ret_ref = 0;
73610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73612         return ret_ref;
73613 }
73614
73615 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
73616         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
73617         int64_t ret_ref = 0;
73618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73620         return ret_ref;
73621 }
73622 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone_ptr(int64_t arg) {
73623         LDKProbabilisticScoringDecayParameters arg_conv;
73624         arg_conv.inner = untag_ptr(arg);
73625         arg_conv.is_owned = ptr_is_owned(arg);
73626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73627         arg_conv.is_owned = false;
73628         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
73629         return ret_conv;
73630 }
73631
73632 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone(int64_t orig) {
73633         LDKProbabilisticScoringDecayParameters orig_conv;
73634         orig_conv.inner = untag_ptr(orig);
73635         orig_conv.is_owned = ptr_is_owned(orig);
73636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73637         orig_conv.is_owned = false;
73638         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
73639         int64_t ret_ref = 0;
73640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73642         return ret_ref;
73643 }
73644
73645 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_default() {
73646         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
73647         int64_t ret_ref = 0;
73648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73650         return ret_ref;
73651 }
73652
73653 int64_t  CS_LDK_ProbabilisticScorer_new(int64_t decay_params, int64_t network_graph, int64_t logger) {
73654         LDKProbabilisticScoringDecayParameters decay_params_conv;
73655         decay_params_conv.inner = untag_ptr(decay_params);
73656         decay_params_conv.is_owned = ptr_is_owned(decay_params);
73657         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
73658         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
73659         LDKNetworkGraph network_graph_conv;
73660         network_graph_conv.inner = untag_ptr(network_graph);
73661         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73662         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73663         network_graph_conv.is_owned = false;
73664         void* logger_ptr = untag_ptr(logger);
73665         CHECK_ACCESS(logger_ptr);
73666         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73667         if (logger_conv.free == LDKLogger_JCalls_free) {
73668                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73669                 LDKLogger_JCalls_cloned(&logger_conv);
73670         }
73671         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
73672         int64_t ret_ref = 0;
73673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73675         return ret_ref;
73676 }
73677
73678 void  CS_LDK_ProbabilisticScorer_debug_log_liquidity_stats(int64_t this_arg) {
73679         LDKProbabilisticScorer this_arg_conv;
73680         this_arg_conv.inner = untag_ptr(this_arg);
73681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73683         this_arg_conv.is_owned = false;
73684         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
73685 }
73686
73687 int64_t  CS_LDK_ProbabilisticScorer_estimated_channel_liquidity_range(int64_t this_arg, int64_t scid, int64_t target) {
73688         LDKProbabilisticScorer this_arg_conv;
73689         this_arg_conv.inner = untag_ptr(this_arg);
73690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73692         this_arg_conv.is_owned = false;
73693         LDKNodeId target_conv;
73694         target_conv.inner = untag_ptr(target);
73695         target_conv.is_owned = ptr_is_owned(target);
73696         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73697         target_conv.is_owned = false;
73698         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
73699         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
73700         int64_t ret_ref = tag_ptr(ret_copy, true);
73701         return ret_ref;
73702 }
73703
73704 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(int64_t this_arg, int64_t scid, int64_t target) {
73705         LDKProbabilisticScorer this_arg_conv;
73706         this_arg_conv.inner = untag_ptr(this_arg);
73707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73709         this_arg_conv.is_owned = false;
73710         LDKNodeId target_conv;
73711         target_conv.inner = untag_ptr(target);
73712         target_conv.is_owned = ptr_is_owned(target);
73713         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73714         target_conv.is_owned = false;
73715         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
73716         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
73717         int64_t ret_ref = tag_ptr(ret_copy, true);
73718         return ret_ref;
73719 }
73720
73721 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_payment_success_probability(int64_t this_arg, int64_t scid, int64_t target, int64_t amount_msat, int64_t params) {
73722         LDKProbabilisticScorer this_arg_conv;
73723         this_arg_conv.inner = untag_ptr(this_arg);
73724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73726         this_arg_conv.is_owned = false;
73727         LDKNodeId target_conv;
73728         target_conv.inner = untag_ptr(target);
73729         target_conv.is_owned = ptr_is_owned(target);
73730         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
73731         target_conv.is_owned = false;
73732         LDKProbabilisticScoringFeeParameters params_conv;
73733         params_conv.inner = untag_ptr(params);
73734         params_conv.is_owned = ptr_is_owned(params);
73735         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
73736         params_conv.is_owned = false;
73737         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
73738         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
73739         int64_t ret_ref = tag_ptr(ret_copy, true);
73740         return ret_ref;
73741 }
73742
73743 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreLookUp(int64_t this_arg) {
73744         LDKProbabilisticScorer this_arg_conv;
73745         this_arg_conv.inner = untag_ptr(this_arg);
73746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73748         this_arg_conv.is_owned = false;
73749         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
73750         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
73751         return tag_ptr(ret_ret, true);
73752 }
73753
73754 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreUpdate(int64_t this_arg) {
73755         LDKProbabilisticScorer this_arg_conv;
73756         this_arg_conv.inner = untag_ptr(this_arg);
73757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73759         this_arg_conv.is_owned = false;
73760         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73761         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
73762         return tag_ptr(ret_ret, true);
73763 }
73764
73765 int64_t  CS_LDK_ProbabilisticScorer_as_Score(int64_t this_arg) {
73766         LDKProbabilisticScorer this_arg_conv;
73767         this_arg_conv.inner = untag_ptr(this_arg);
73768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73770         this_arg_conv.is_owned = false;
73771         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
73772         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
73773         return tag_ptr(ret_ret, true);
73774 }
73775
73776 int8_tArray  CS_LDK_ProbabilisticScorer_write(int64_t obj) {
73777         LDKProbabilisticScorer obj_conv;
73778         obj_conv.inner = untag_ptr(obj);
73779         obj_conv.is_owned = ptr_is_owned(obj);
73780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73781         obj_conv.is_owned = false;
73782         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
73783         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73784         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73785         CVec_u8Z_free(ret_var);
73786         return ret_arr;
73787 }
73788
73789 int64_t  CS_LDK_ProbabilisticScorer_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
73790         LDKu8slice ser_ref;
73791         ser_ref.datalen = ser->arr_len;
73792         ser_ref.data = ser->elems;
73793         LDKProbabilisticScoringDecayParameters arg_a_conv;
73794         arg_a_conv.inner = untag_ptr(arg_a);
73795         arg_a_conv.is_owned = ptr_is_owned(arg_a);
73796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
73797         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
73798         LDKNetworkGraph arg_b_conv;
73799         arg_b_conv.inner = untag_ptr(arg_b);
73800         arg_b_conv.is_owned = ptr_is_owned(arg_b);
73801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
73802         arg_b_conv.is_owned = false;
73803         void* arg_c_ptr = untag_ptr(arg_c);
73804         CHECK_ACCESS(arg_c_ptr);
73805         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
73806         if (arg_c_conv.free == LDKLogger_JCalls_free) {
73807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73808                 LDKLogger_JCalls_cloned(&arg_c_conv);
73809         }
73810         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
73811         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
73812         FREE(ser);
73813         return tag_ptr(ret_conv, true);
73814 }
73815
73816 void  CS_LDK_DelayedPaymentOutputDescriptor_free(int64_t this_obj) {
73817         LDKDelayedPaymentOutputDescriptor this_obj_conv;
73818         this_obj_conv.inner = untag_ptr(this_obj);
73819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73821         DelayedPaymentOutputDescriptor_free(this_obj_conv);
73822 }
73823
73824 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
73825         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73826         this_ptr_conv.inner = untag_ptr(this_ptr);
73827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73829         this_ptr_conv.is_owned = false;
73830         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73831         int64_t ret_ref = 0;
73832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73834         return ret_ref;
73835 }
73836
73837 void  CS_LDK_DelayedPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
73838         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73839         this_ptr_conv.inner = untag_ptr(this_ptr);
73840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73842         this_ptr_conv.is_owned = false;
73843         LDKOutPoint val_conv;
73844         val_conv.inner = untag_ptr(val);
73845         val_conv.is_owned = ptr_is_owned(val);
73846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73847         val_conv = OutPoint_clone(&val_conv);
73848         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73849 }
73850
73851 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_per_commitment_point(int64_t this_ptr) {
73852         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73853         this_ptr_conv.inner = untag_ptr(this_ptr);
73854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73856         this_ptr_conv.is_owned = false;
73857         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
73858         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
73859         return ret_arr;
73860 }
73861
73862 void  CS_LDK_DelayedPaymentOutputDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
73863         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73864         this_ptr_conv.inner = untag_ptr(this_ptr);
73865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73867         this_ptr_conv.is_owned = false;
73868         LDKPublicKey val_ref;
73869         CHECK(val->arr_len == 33);
73870         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
73871         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73872 }
73873
73874 int16_t  CS_LDK_DelayedPaymentOutputDescriptor_get_to_self_delay(int64_t this_ptr) {
73875         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73876         this_ptr_conv.inner = untag_ptr(this_ptr);
73877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73879         this_ptr_conv.is_owned = false;
73880         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
73881         return ret_conv;
73882 }
73883
73884 void  CS_LDK_DelayedPaymentOutputDescriptor_set_to_self_delay(int64_t this_ptr, int16_t val) {
73885         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73886         this_ptr_conv.inner = untag_ptr(this_ptr);
73887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73889         this_ptr_conv.is_owned = false;
73890         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
73891 }
73892
73893 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_output(int64_t this_ptr) {
73894         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73895         this_ptr_conv.inner = untag_ptr(this_ptr);
73896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73898         this_ptr_conv.is_owned = false;
73899         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73900         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
73901         return tag_ptr(ret_ref, true);
73902 }
73903
73904 void  CS_LDK_DelayedPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
73905         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73906         this_ptr_conv.inner = untag_ptr(this_ptr);
73907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73909         this_ptr_conv.is_owned = false;
73910         void* val_ptr = untag_ptr(val);
73911         CHECK_ACCESS(val_ptr);
73912         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73913         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73914         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73915 }
73916
73917 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_revocation_pubkey(int64_t this_ptr) {
73918         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73919         this_ptr_conv.inner = untag_ptr(this_ptr);
73920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73922         this_ptr_conv.is_owned = false;
73923         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
73924         int64_t ret_ref = 0;
73925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73927         return ret_ref;
73928 }
73929
73930 void  CS_LDK_DelayedPaymentOutputDescriptor_set_revocation_pubkey(int64_t this_ptr, int64_t val) {
73931         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73932         this_ptr_conv.inner = untag_ptr(this_ptr);
73933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73935         this_ptr_conv.is_owned = false;
73936         LDKRevocationKey val_conv;
73937         val_conv.inner = untag_ptr(val);
73938         val_conv.is_owned = ptr_is_owned(val);
73939         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73940         val_conv = RevocationKey_clone(&val_conv);
73941         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
73942 }
73943
73944 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
73945         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73946         this_ptr_conv.inner = untag_ptr(this_ptr);
73947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73949         this_ptr_conv.is_owned = false;
73950         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
73951         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
73952         return ret_arr;
73953 }
73954
73955 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
73956         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73957         this_ptr_conv.inner = untag_ptr(this_ptr);
73958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73960         this_ptr_conv.is_owned = false;
73961         LDKThirtyTwoBytes val_ref;
73962         CHECK(val->arr_len == 32);
73963         memcpy(val_ref.data, val->elems, 32); FREE(val);
73964         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73965 }
73966
73967 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
73968         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73969         this_ptr_conv.inner = untag_ptr(this_ptr);
73970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73972         this_ptr_conv.is_owned = false;
73973         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73974         return ret_conv;
73975 }
73976
73977 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
73978         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73979         this_ptr_conv.inner = untag_ptr(this_ptr);
73980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73982         this_ptr_conv.is_owned = false;
73983         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73984 }
73985
73986 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
73987         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73988         this_ptr_conv.inner = untag_ptr(this_ptr);
73989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73991         this_ptr_conv.is_owned = false;
73992         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73993         int64_t ret_ref = 0;
73994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73996         return ret_ref;
73997 }
73998
73999 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
74000         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
74001         this_ptr_conv.inner = untag_ptr(this_ptr);
74002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74004         this_ptr_conv.is_owned = false;
74005         LDKChannelTransactionParameters val_conv;
74006         val_conv.inner = untag_ptr(val);
74007         val_conv.is_owned = ptr_is_owned(val);
74008         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74009         val_conv = ChannelTransactionParameters_clone(&val_conv);
74010         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
74011 }
74012
74013 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_new(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) {
74014         LDKOutPoint outpoint_arg_conv;
74015         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74016         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74017         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74018         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74019         LDKPublicKey per_commitment_point_arg_ref;
74020         CHECK(per_commitment_point_arg->arr_len == 33);
74021         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
74022         void* output_arg_ptr = untag_ptr(output_arg);
74023         CHECK_ACCESS(output_arg_ptr);
74024         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
74025         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
74026         LDKRevocationKey revocation_pubkey_arg_conv;
74027         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
74028         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
74029         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
74030         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
74031         LDKThirtyTwoBytes channel_keys_id_arg_ref;
74032         CHECK(channel_keys_id_arg->arr_len == 32);
74033         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
74034         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
74035         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
74036         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
74037         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
74038         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
74039         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);
74040         int64_t ret_ref = 0;
74041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74043         return ret_ref;
74044 }
74045
74046 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
74047         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
74048         int64_t ret_ref = 0;
74049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74051         return ret_ref;
74052 }
74053 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone_ptr(int64_t arg) {
74054         LDKDelayedPaymentOutputDescriptor arg_conv;
74055         arg_conv.inner = untag_ptr(arg);
74056         arg_conv.is_owned = ptr_is_owned(arg);
74057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74058         arg_conv.is_owned = false;
74059         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
74060         return ret_conv;
74061 }
74062
74063 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone(int64_t orig) {
74064         LDKDelayedPaymentOutputDescriptor orig_conv;
74065         orig_conv.inner = untag_ptr(orig);
74066         orig_conv.is_owned = ptr_is_owned(orig);
74067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74068         orig_conv.is_owned = false;
74069         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
74070         int64_t ret_ref = 0;
74071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74073         return ret_ref;
74074 }
74075
74076 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_hash(int64_t o) {
74077         LDKDelayedPaymentOutputDescriptor o_conv;
74078         o_conv.inner = untag_ptr(o);
74079         o_conv.is_owned = ptr_is_owned(o);
74080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74081         o_conv.is_owned = false;
74082         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
74083         return ret_conv;
74084 }
74085
74086 jboolean  CS_LDK_DelayedPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
74087         LDKDelayedPaymentOutputDescriptor a_conv;
74088         a_conv.inner = untag_ptr(a);
74089         a_conv.is_owned = ptr_is_owned(a);
74090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74091         a_conv.is_owned = false;
74092         LDKDelayedPaymentOutputDescriptor b_conv;
74093         b_conv.inner = untag_ptr(b);
74094         b_conv.is_owned = ptr_is_owned(b);
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74096         b_conv.is_owned = false;
74097         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
74098         return ret_conv;
74099 }
74100
74101 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_write(int64_t obj) {
74102         LDKDelayedPaymentOutputDescriptor obj_conv;
74103         obj_conv.inner = untag_ptr(obj);
74104         obj_conv.is_owned = ptr_is_owned(obj);
74105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74106         obj_conv.is_owned = false;
74107         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
74108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74110         CVec_u8Z_free(ret_var);
74111         return ret_arr;
74112 }
74113
74114 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
74115         LDKu8slice ser_ref;
74116         ser_ref.datalen = ser->arr_len;
74117         ser_ref.data = ser->elems;
74118         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
74119         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
74120         FREE(ser);
74121         return tag_ptr(ret_conv, true);
74122 }
74123
74124 void  CS_LDK_StaticPaymentOutputDescriptor_free(int64_t this_obj) {
74125         LDKStaticPaymentOutputDescriptor this_obj_conv;
74126         this_obj_conv.inner = untag_ptr(this_obj);
74127         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74129         StaticPaymentOutputDescriptor_free(this_obj_conv);
74130 }
74131
74132 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
74133         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74134         this_ptr_conv.inner = untag_ptr(this_ptr);
74135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74137         this_ptr_conv.is_owned = false;
74138         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
74139         int64_t ret_ref = 0;
74140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74142         return ret_ref;
74143 }
74144
74145 void  CS_LDK_StaticPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
74146         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74147         this_ptr_conv.inner = untag_ptr(this_ptr);
74148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74150         this_ptr_conv.is_owned = false;
74151         LDKOutPoint val_conv;
74152         val_conv.inner = untag_ptr(val);
74153         val_conv.is_owned = ptr_is_owned(val);
74154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74155         val_conv = OutPoint_clone(&val_conv);
74156         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
74157 }
74158
74159 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_output(int64_t this_ptr) {
74160         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74161         this_ptr_conv.inner = untag_ptr(this_ptr);
74162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74164         this_ptr_conv.is_owned = false;
74165         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74166         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
74167         return tag_ptr(ret_ref, true);
74168 }
74169
74170 void  CS_LDK_StaticPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
74171         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74172         this_ptr_conv.inner = untag_ptr(this_ptr);
74173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74175         this_ptr_conv.is_owned = false;
74176         void* val_ptr = untag_ptr(val);
74177         CHECK_ACCESS(val_ptr);
74178         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74179         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74180         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
74181 }
74182
74183 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
74184         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74185         this_ptr_conv.inner = untag_ptr(this_ptr);
74186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74188         this_ptr_conv.is_owned = false;
74189         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74190         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
74191         return ret_arr;
74192 }
74193
74194 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
74195         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74196         this_ptr_conv.inner = untag_ptr(this_ptr);
74197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74199         this_ptr_conv.is_owned = false;
74200         LDKThirtyTwoBytes val_ref;
74201         CHECK(val->arr_len == 32);
74202         memcpy(val_ref.data, val->elems, 32); FREE(val);
74203         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
74204 }
74205
74206 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
74207         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74208         this_ptr_conv.inner = untag_ptr(this_ptr);
74209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74211         this_ptr_conv.is_owned = false;
74212         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
74213         return ret_conv;
74214 }
74215
74216 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
74217         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74218         this_ptr_conv.inner = untag_ptr(this_ptr);
74219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74221         this_ptr_conv.is_owned = false;
74222         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
74223 }
74224
74225 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
74226         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74227         this_ptr_conv.inner = untag_ptr(this_ptr);
74228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74230         this_ptr_conv.is_owned = false;
74231         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
74232         int64_t ret_ref = 0;
74233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74235         return ret_ref;
74236 }
74237
74238 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
74239         LDKStaticPaymentOutputDescriptor this_ptr_conv;
74240         this_ptr_conv.inner = untag_ptr(this_ptr);
74241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74243         this_ptr_conv.is_owned = false;
74244         LDKChannelTransactionParameters val_conv;
74245         val_conv.inner = untag_ptr(val);
74246         val_conv.is_owned = ptr_is_owned(val);
74247         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74248         val_conv = ChannelTransactionParameters_clone(&val_conv);
74249         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
74250 }
74251
74252 int64_t  CS_LDK_StaticPaymentOutputDescriptor_new(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) {
74253         LDKOutPoint outpoint_arg_conv;
74254         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74255         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74256         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74257         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74258         void* output_arg_ptr = untag_ptr(output_arg);
74259         CHECK_ACCESS(output_arg_ptr);
74260         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
74261         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
74262         LDKThirtyTwoBytes channel_keys_id_arg_ref;
74263         CHECK(channel_keys_id_arg->arr_len == 32);
74264         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
74265         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
74266         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
74267         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
74268         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
74269         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
74270         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);
74271         int64_t ret_ref = 0;
74272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74274         return ret_ref;
74275 }
74276
74277 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
74278         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
74279         int64_t ret_ref = 0;
74280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74282         return ret_ref;
74283 }
74284 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone_ptr(int64_t arg) {
74285         LDKStaticPaymentOutputDescriptor arg_conv;
74286         arg_conv.inner = untag_ptr(arg);
74287         arg_conv.is_owned = ptr_is_owned(arg);
74288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74289         arg_conv.is_owned = false;
74290         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
74291         return ret_conv;
74292 }
74293
74294 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone(int64_t orig) {
74295         LDKStaticPaymentOutputDescriptor orig_conv;
74296         orig_conv.inner = untag_ptr(orig);
74297         orig_conv.is_owned = ptr_is_owned(orig);
74298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74299         orig_conv.is_owned = false;
74300         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
74301         int64_t ret_ref = 0;
74302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74304         return ret_ref;
74305 }
74306
74307 int64_t  CS_LDK_StaticPaymentOutputDescriptor_hash(int64_t o) {
74308         LDKStaticPaymentOutputDescriptor o_conv;
74309         o_conv.inner = untag_ptr(o);
74310         o_conv.is_owned = ptr_is_owned(o);
74311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74312         o_conv.is_owned = false;
74313         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
74314         return ret_conv;
74315 }
74316
74317 jboolean  CS_LDK_StaticPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
74318         LDKStaticPaymentOutputDescriptor a_conv;
74319         a_conv.inner = untag_ptr(a);
74320         a_conv.is_owned = ptr_is_owned(a);
74321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74322         a_conv.is_owned = false;
74323         LDKStaticPaymentOutputDescriptor b_conv;
74324         b_conv.inner = untag_ptr(b);
74325         b_conv.is_owned = ptr_is_owned(b);
74326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74327         b_conv.is_owned = false;
74328         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
74329         return ret_conv;
74330 }
74331
74332 int64_t  CS_LDK_StaticPaymentOutputDescriptor_witness_script(int64_t this_arg) {
74333         LDKStaticPaymentOutputDescriptor this_arg_conv;
74334         this_arg_conv.inner = untag_ptr(this_arg);
74335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74337         this_arg_conv.is_owned = false;
74338         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
74339         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
74340         int64_t ret_ref = tag_ptr(ret_copy, true);
74341         return ret_ref;
74342 }
74343
74344 int64_t  CS_LDK_StaticPaymentOutputDescriptor_max_witness_length(int64_t this_arg) {
74345         LDKStaticPaymentOutputDescriptor this_arg_conv;
74346         this_arg_conv.inner = untag_ptr(this_arg);
74347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74349         this_arg_conv.is_owned = false;
74350         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
74351         return ret_conv;
74352 }
74353
74354 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_write(int64_t obj) {
74355         LDKStaticPaymentOutputDescriptor obj_conv;
74356         obj_conv.inner = untag_ptr(obj);
74357         obj_conv.is_owned = ptr_is_owned(obj);
74358         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74359         obj_conv.is_owned = false;
74360         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
74361         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74362         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74363         CVec_u8Z_free(ret_var);
74364         return ret_arr;
74365 }
74366
74367 int64_t  CS_LDK_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
74368         LDKu8slice ser_ref;
74369         ser_ref.datalen = ser->arr_len;
74370         ser_ref.data = ser->elems;
74371         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
74372         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
74373         FREE(ser);
74374         return tag_ptr(ret_conv, true);
74375 }
74376
74377 void  CS_LDK_SpendableOutputDescriptor_free(int64_t this_ptr) {
74378         if (!ptr_is_owned(this_ptr)) return;
74379         void* this_ptr_ptr = untag_ptr(this_ptr);
74380         CHECK_ACCESS(this_ptr_ptr);
74381         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
74382         FREE(untag_ptr(this_ptr));
74383         SpendableOutputDescriptor_free(this_ptr_conv);
74384 }
74385
74386 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
74387         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
74388         *ret_copy = SpendableOutputDescriptor_clone(arg);
74389         int64_t ret_ref = tag_ptr(ret_copy, true);
74390         return ret_ref;
74391 }
74392 int64_t  CS_LDK_SpendableOutputDescriptor_clone_ptr(int64_t arg) {
74393         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
74394         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
74395         return ret_conv;
74396 }
74397
74398 int64_t  CS_LDK_SpendableOutputDescriptor_clone(int64_t orig) {
74399         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
74400         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
74401         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
74402         int64_t ret_ref = tag_ptr(ret_copy, true);
74403         return ret_ref;
74404 }
74405
74406 int64_t  CS_LDK_SpendableOutputDescriptor_static_output(int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
74407         LDKOutPoint outpoint_conv;
74408         outpoint_conv.inner = untag_ptr(outpoint);
74409         outpoint_conv.is_owned = ptr_is_owned(outpoint);
74410         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
74411         outpoint_conv = OutPoint_clone(&outpoint_conv);
74412         void* output_ptr = untag_ptr(output);
74413         CHECK_ACCESS(output_ptr);
74414         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
74415         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
74416         LDKThirtyTwoBytes channel_keys_id_ref;
74417         CHECK(channel_keys_id->arr_len == 32);
74418         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
74419         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
74420         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
74421         int64_t ret_ref = tag_ptr(ret_copy, true);
74422         return ret_ref;
74423 }
74424
74425 int64_t  CS_LDK_SpendableOutputDescriptor_delayed_payment_output(int64_t a) {
74426         LDKDelayedPaymentOutputDescriptor a_conv;
74427         a_conv.inner = untag_ptr(a);
74428         a_conv.is_owned = ptr_is_owned(a);
74429         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74430         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
74431         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
74432         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
74433         int64_t ret_ref = tag_ptr(ret_copy, true);
74434         return ret_ref;
74435 }
74436
74437 int64_t  CS_LDK_SpendableOutputDescriptor_static_payment_output(int64_t a) {
74438         LDKStaticPaymentOutputDescriptor a_conv;
74439         a_conv.inner = untag_ptr(a);
74440         a_conv.is_owned = ptr_is_owned(a);
74441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74442         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
74443         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
74444         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
74445         int64_t ret_ref = tag_ptr(ret_copy, true);
74446         return ret_ref;
74447 }
74448
74449 int64_t  CS_LDK_SpendableOutputDescriptor_hash(int64_t o) {
74450         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
74451         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
74452         return ret_conv;
74453 }
74454
74455 jboolean  CS_LDK_SpendableOutputDescriptor_eq(int64_t a, int64_t b) {
74456         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
74457         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
74458         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
74459         return ret_conv;
74460 }
74461
74462 int8_tArray  CS_LDK_SpendableOutputDescriptor_write(int64_t obj) {
74463         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
74464         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
74465         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74466         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74467         CVec_u8Z_free(ret_var);
74468         return ret_arr;
74469 }
74470
74471 int64_t  CS_LDK_SpendableOutputDescriptor_read(int8_tArray ser) {
74472         LDKu8slice ser_ref;
74473         ser_ref.datalen = ser->arr_len;
74474         ser_ref.data = ser->elems;
74475         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
74476         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
74477         FREE(ser);
74478         return tag_ptr(ret_conv, true);
74479 }
74480
74481 int64_t  CS_LDK_SpendableOutputDescriptor_create_spendable_outputs_psbt(int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
74482         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74483         descriptors_constr.datalen = descriptors->arr_len;
74484         if (descriptors_constr.datalen > 0)
74485                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74486         else
74487                 descriptors_constr.data = NULL;
74488         int64_t* descriptors_vals = descriptors->elems;
74489         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74490                 int64_t descriptors_conv_27 = descriptors_vals[b];
74491                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74492                 CHECK_ACCESS(descriptors_conv_27_ptr);
74493                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74494                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74495                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74496         }
74497         FREE(descriptors);
74498         LDKCVec_TxOutZ outputs_constr;
74499         outputs_constr.datalen = outputs->arr_len;
74500         if (outputs_constr.datalen > 0)
74501                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
74502         else
74503                 outputs_constr.data = NULL;
74504         int64_t* outputs_vals = outputs->elems;
74505         for (size_t h = 0; h < outputs_constr.datalen; h++) {
74506                 int64_t outputs_conv_7 = outputs_vals[h];
74507                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
74508                 CHECK_ACCESS(outputs_conv_7_ptr);
74509                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
74510                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
74511                 outputs_constr.data[h] = outputs_conv_7_conv;
74512         }
74513         FREE(outputs);
74514         LDKCVec_u8Z change_destination_script_ref;
74515         change_destination_script_ref.datalen = change_destination_script->arr_len;
74516         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
74517         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
74518         void* locktime_ptr = untag_ptr(locktime);
74519         CHECK_ACCESS(locktime_ptr);
74520         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
74521         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
74522         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
74523         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
74524         return tag_ptr(ret_conv, true);
74525 }
74526
74527 void  CS_LDK_ChannelDerivationParameters_free(int64_t this_obj) {
74528         LDKChannelDerivationParameters this_obj_conv;
74529         this_obj_conv.inner = untag_ptr(this_obj);
74530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74532         ChannelDerivationParameters_free(this_obj_conv);
74533 }
74534
74535 int64_t  CS_LDK_ChannelDerivationParameters_get_value_satoshis(int64_t this_ptr) {
74536         LDKChannelDerivationParameters this_ptr_conv;
74537         this_ptr_conv.inner = untag_ptr(this_ptr);
74538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74540         this_ptr_conv.is_owned = false;
74541         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
74542         return ret_conv;
74543 }
74544
74545 void  CS_LDK_ChannelDerivationParameters_set_value_satoshis(int64_t this_ptr, int64_t val) {
74546         LDKChannelDerivationParameters this_ptr_conv;
74547         this_ptr_conv.inner = untag_ptr(this_ptr);
74548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74550         this_ptr_conv.is_owned = false;
74551         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
74552 }
74553
74554 int8_tArray  CS_LDK_ChannelDerivationParameters_get_keys_id(int64_t this_ptr) {
74555         LDKChannelDerivationParameters this_ptr_conv;
74556         this_ptr_conv.inner = untag_ptr(this_ptr);
74557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74559         this_ptr_conv.is_owned = false;
74560         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74561         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
74562         return ret_arr;
74563 }
74564
74565 void  CS_LDK_ChannelDerivationParameters_set_keys_id(int64_t this_ptr, int8_tArray val) {
74566         LDKChannelDerivationParameters this_ptr_conv;
74567         this_ptr_conv.inner = untag_ptr(this_ptr);
74568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74570         this_ptr_conv.is_owned = false;
74571         LDKThirtyTwoBytes val_ref;
74572         CHECK(val->arr_len == 32);
74573         memcpy(val_ref.data, val->elems, 32); FREE(val);
74574         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
74575 }
74576
74577 int64_t  CS_LDK_ChannelDerivationParameters_get_transaction_parameters(int64_t this_ptr) {
74578         LDKChannelDerivationParameters this_ptr_conv;
74579         this_ptr_conv.inner = untag_ptr(this_ptr);
74580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74582         this_ptr_conv.is_owned = false;
74583         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
74584         int64_t ret_ref = 0;
74585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74587         return ret_ref;
74588 }
74589
74590 void  CS_LDK_ChannelDerivationParameters_set_transaction_parameters(int64_t this_ptr, int64_t val) {
74591         LDKChannelDerivationParameters this_ptr_conv;
74592         this_ptr_conv.inner = untag_ptr(this_ptr);
74593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74595         this_ptr_conv.is_owned = false;
74596         LDKChannelTransactionParameters val_conv;
74597         val_conv.inner = untag_ptr(val);
74598         val_conv.is_owned = ptr_is_owned(val);
74599         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74600         val_conv = ChannelTransactionParameters_clone(&val_conv);
74601         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
74602 }
74603
74604 int64_t  CS_LDK_ChannelDerivationParameters_new(int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
74605         LDKThirtyTwoBytes keys_id_arg_ref;
74606         CHECK(keys_id_arg->arr_len == 32);
74607         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
74608         LDKChannelTransactionParameters transaction_parameters_arg_conv;
74609         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
74610         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
74611         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
74612         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
74613         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
74614         int64_t ret_ref = 0;
74615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74617         return ret_ref;
74618 }
74619
74620 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
74621         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
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 int64_t  CS_LDK_ChannelDerivationParameters_clone_ptr(int64_t arg) {
74628         LDKChannelDerivationParameters arg_conv;
74629         arg_conv.inner = untag_ptr(arg);
74630         arg_conv.is_owned = ptr_is_owned(arg);
74631         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74632         arg_conv.is_owned = false;
74633         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
74634         return ret_conv;
74635 }
74636
74637 int64_t  CS_LDK_ChannelDerivationParameters_clone(int64_t orig) {
74638         LDKChannelDerivationParameters orig_conv;
74639         orig_conv.inner = untag_ptr(orig);
74640         orig_conv.is_owned = ptr_is_owned(orig);
74641         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74642         orig_conv.is_owned = false;
74643         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
74644         int64_t ret_ref = 0;
74645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74647         return ret_ref;
74648 }
74649
74650 jboolean  CS_LDK_ChannelDerivationParameters_eq(int64_t a, int64_t b) {
74651         LDKChannelDerivationParameters a_conv;
74652         a_conv.inner = untag_ptr(a);
74653         a_conv.is_owned = ptr_is_owned(a);
74654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74655         a_conv.is_owned = false;
74656         LDKChannelDerivationParameters b_conv;
74657         b_conv.inner = untag_ptr(b);
74658         b_conv.is_owned = ptr_is_owned(b);
74659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74660         b_conv.is_owned = false;
74661         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
74662         return ret_conv;
74663 }
74664
74665 int8_tArray  CS_LDK_ChannelDerivationParameters_write(int64_t obj) {
74666         LDKChannelDerivationParameters obj_conv;
74667         obj_conv.inner = untag_ptr(obj);
74668         obj_conv.is_owned = ptr_is_owned(obj);
74669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74670         obj_conv.is_owned = false;
74671         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
74672         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74673         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74674         CVec_u8Z_free(ret_var);
74675         return ret_arr;
74676 }
74677
74678 int64_t  CS_LDK_ChannelDerivationParameters_read(int8_tArray ser) {
74679         LDKu8slice ser_ref;
74680         ser_ref.datalen = ser->arr_len;
74681         ser_ref.data = ser->elems;
74682         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
74683         *ret_conv = ChannelDerivationParameters_read(ser_ref);
74684         FREE(ser);
74685         return tag_ptr(ret_conv, true);
74686 }
74687
74688 void  CS_LDK_HTLCDescriptor_free(int64_t this_obj) {
74689         LDKHTLCDescriptor this_obj_conv;
74690         this_obj_conv.inner = untag_ptr(this_obj);
74691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74693         HTLCDescriptor_free(this_obj_conv);
74694 }
74695
74696 int64_t  CS_LDK_HTLCDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
74697         LDKHTLCDescriptor this_ptr_conv;
74698         this_ptr_conv.inner = untag_ptr(this_ptr);
74699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74701         this_ptr_conv.is_owned = false;
74702         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
74703         int64_t ret_ref = 0;
74704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74706         return ret_ref;
74707 }
74708
74709 void  CS_LDK_HTLCDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
74710         LDKHTLCDescriptor this_ptr_conv;
74711         this_ptr_conv.inner = untag_ptr(this_ptr);
74712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74714         this_ptr_conv.is_owned = false;
74715         LDKChannelDerivationParameters val_conv;
74716         val_conv.inner = untag_ptr(val);
74717         val_conv.is_owned = ptr_is_owned(val);
74718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74719         val_conv = ChannelDerivationParameters_clone(&val_conv);
74720         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
74721 }
74722
74723 int8_tArray  CS_LDK_HTLCDescriptor_get_commitment_txid(int64_t this_ptr) {
74724         LDKHTLCDescriptor this_ptr_conv;
74725         this_ptr_conv.inner = untag_ptr(this_ptr);
74726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74728         this_ptr_conv.is_owned = false;
74729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
74730         memcpy(ret_arr->elems, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv), 32);
74731         return ret_arr;
74732 }
74733
74734 void  CS_LDK_HTLCDescriptor_set_commitment_txid(int64_t this_ptr, int8_tArray val) {
74735         LDKHTLCDescriptor this_ptr_conv;
74736         this_ptr_conv.inner = untag_ptr(this_ptr);
74737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74739         this_ptr_conv.is_owned = false;
74740         LDKThirtyTwoBytes val_ref;
74741         CHECK(val->arr_len == 32);
74742         memcpy(val_ref.data, val->elems, 32); FREE(val);
74743         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
74744 }
74745
74746 int64_t  CS_LDK_HTLCDescriptor_get_per_commitment_number(int64_t this_ptr) {
74747         LDKHTLCDescriptor this_ptr_conv;
74748         this_ptr_conv.inner = untag_ptr(this_ptr);
74749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74751         this_ptr_conv.is_owned = false;
74752         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
74753         return ret_conv;
74754 }
74755
74756 void  CS_LDK_HTLCDescriptor_set_per_commitment_number(int64_t this_ptr, int64_t val) {
74757         LDKHTLCDescriptor this_ptr_conv;
74758         this_ptr_conv.inner = untag_ptr(this_ptr);
74759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74761         this_ptr_conv.is_owned = false;
74762         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
74763 }
74764
74765 int8_tArray  CS_LDK_HTLCDescriptor_get_per_commitment_point(int64_t this_ptr) {
74766         LDKHTLCDescriptor this_ptr_conv;
74767         this_ptr_conv.inner = untag_ptr(this_ptr);
74768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74770         this_ptr_conv.is_owned = false;
74771         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
74772         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
74773         return ret_arr;
74774 }
74775
74776 void  CS_LDK_HTLCDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
74777         LDKHTLCDescriptor this_ptr_conv;
74778         this_ptr_conv.inner = untag_ptr(this_ptr);
74779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74781         this_ptr_conv.is_owned = false;
74782         LDKPublicKey val_ref;
74783         CHECK(val->arr_len == 33);
74784         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
74785         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
74786 }
74787
74788 int32_t  CS_LDK_HTLCDescriptor_get_feerate_per_kw(int64_t this_ptr) {
74789         LDKHTLCDescriptor this_ptr_conv;
74790         this_ptr_conv.inner = untag_ptr(this_ptr);
74791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74793         this_ptr_conv.is_owned = false;
74794         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
74795         return ret_conv;
74796 }
74797
74798 void  CS_LDK_HTLCDescriptor_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
74799         LDKHTLCDescriptor this_ptr_conv;
74800         this_ptr_conv.inner = untag_ptr(this_ptr);
74801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74803         this_ptr_conv.is_owned = false;
74804         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
74805 }
74806
74807 int64_t  CS_LDK_HTLCDescriptor_get_htlc(int64_t this_ptr) {
74808         LDKHTLCDescriptor this_ptr_conv;
74809         this_ptr_conv.inner = untag_ptr(this_ptr);
74810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74812         this_ptr_conv.is_owned = false;
74813         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
74814         int64_t ret_ref = 0;
74815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74817         return ret_ref;
74818 }
74819
74820 void  CS_LDK_HTLCDescriptor_set_htlc(int64_t this_ptr, int64_t val) {
74821         LDKHTLCDescriptor this_ptr_conv;
74822         this_ptr_conv.inner = untag_ptr(this_ptr);
74823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74825         this_ptr_conv.is_owned = false;
74826         LDKHTLCOutputInCommitment val_conv;
74827         val_conv.inner = untag_ptr(val);
74828         val_conv.is_owned = ptr_is_owned(val);
74829         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74830         val_conv = HTLCOutputInCommitment_clone(&val_conv);
74831         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
74832 }
74833
74834 int64_t  CS_LDK_HTLCDescriptor_get_preimage(int64_t this_ptr) {
74835         LDKHTLCDescriptor this_ptr_conv;
74836         this_ptr_conv.inner = untag_ptr(this_ptr);
74837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74839         this_ptr_conv.is_owned = false;
74840         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74841         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
74842         int64_t ret_ref = tag_ptr(ret_copy, true);
74843         return ret_ref;
74844 }
74845
74846 void  CS_LDK_HTLCDescriptor_set_preimage(int64_t this_ptr, int64_t val) {
74847         LDKHTLCDescriptor this_ptr_conv;
74848         this_ptr_conv.inner = untag_ptr(this_ptr);
74849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74851         this_ptr_conv.is_owned = false;
74852         void* val_ptr = untag_ptr(val);
74853         CHECK_ACCESS(val_ptr);
74854         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
74855         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
74856         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
74857 }
74858
74859 int8_tArray  CS_LDK_HTLCDescriptor_get_counterparty_sig(int64_t this_ptr) {
74860         LDKHTLCDescriptor this_ptr_conv;
74861         this_ptr_conv.inner = untag_ptr(this_ptr);
74862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74864         this_ptr_conv.is_owned = false;
74865         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
74866         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
74867         return ret_arr;
74868 }
74869
74870 void  CS_LDK_HTLCDescriptor_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
74871         LDKHTLCDescriptor this_ptr_conv;
74872         this_ptr_conv.inner = untag_ptr(this_ptr);
74873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74875         this_ptr_conv.is_owned = false;
74876         LDKECDSASignature val_ref;
74877         CHECK(val->arr_len == 64);
74878         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
74879         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
74880 }
74881
74882 int64_t  CS_LDK_HTLCDescriptor_new(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) {
74883         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
74884         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
74885         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
74886         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
74887         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
74888         LDKThirtyTwoBytes commitment_txid_arg_ref;
74889         CHECK(commitment_txid_arg->arr_len == 32);
74890         memcpy(commitment_txid_arg_ref.data, commitment_txid_arg->elems, 32); FREE(commitment_txid_arg);
74891         LDKPublicKey per_commitment_point_arg_ref;
74892         CHECK(per_commitment_point_arg->arr_len == 33);
74893         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
74894         LDKHTLCOutputInCommitment htlc_arg_conv;
74895         htlc_arg_conv.inner = untag_ptr(htlc_arg);
74896         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
74897         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
74898         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
74899         void* preimage_arg_ptr = untag_ptr(preimage_arg);
74900         CHECK_ACCESS(preimage_arg_ptr);
74901         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
74902         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
74903         LDKECDSASignature counterparty_sig_arg_ref;
74904         CHECK(counterparty_sig_arg->arr_len == 64);
74905         memcpy(counterparty_sig_arg_ref.compact_form, counterparty_sig_arg->elems, 64); FREE(counterparty_sig_arg);
74906         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);
74907         int64_t ret_ref = 0;
74908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74910         return ret_ref;
74911 }
74912
74913 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
74914         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
74915         int64_t ret_ref = 0;
74916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74918         return ret_ref;
74919 }
74920 int64_t  CS_LDK_HTLCDescriptor_clone_ptr(int64_t arg) {
74921         LDKHTLCDescriptor arg_conv;
74922         arg_conv.inner = untag_ptr(arg);
74923         arg_conv.is_owned = ptr_is_owned(arg);
74924         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74925         arg_conv.is_owned = false;
74926         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
74927         return ret_conv;
74928 }
74929
74930 int64_t  CS_LDK_HTLCDescriptor_clone(int64_t orig) {
74931         LDKHTLCDescriptor orig_conv;
74932         orig_conv.inner = untag_ptr(orig);
74933         orig_conv.is_owned = ptr_is_owned(orig);
74934         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74935         orig_conv.is_owned = false;
74936         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
74937         int64_t ret_ref = 0;
74938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74940         return ret_ref;
74941 }
74942
74943 jboolean  CS_LDK_HTLCDescriptor_eq(int64_t a, int64_t b) {
74944         LDKHTLCDescriptor a_conv;
74945         a_conv.inner = untag_ptr(a);
74946         a_conv.is_owned = ptr_is_owned(a);
74947         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74948         a_conv.is_owned = false;
74949         LDKHTLCDescriptor b_conv;
74950         b_conv.inner = untag_ptr(b);
74951         b_conv.is_owned = ptr_is_owned(b);
74952         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74953         b_conv.is_owned = false;
74954         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
74955         return ret_conv;
74956 }
74957
74958 int8_tArray  CS_LDK_HTLCDescriptor_write(int64_t obj) {
74959         LDKHTLCDescriptor 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 = HTLCDescriptor_write(&obj_conv);
74965         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74966         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74967         CVec_u8Z_free(ret_var);
74968         return ret_arr;
74969 }
74970
74971 int64_t  CS_LDK_HTLCDescriptor_read(int8_tArray ser) {
74972         LDKu8slice ser_ref;
74973         ser_ref.datalen = ser->arr_len;
74974         ser_ref.data = ser->elems;
74975         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
74976         *ret_conv = HTLCDescriptor_read(ser_ref);
74977         FREE(ser);
74978         return tag_ptr(ret_conv, true);
74979 }
74980
74981 int64_t  CS_LDK_HTLCDescriptor_outpoint(int64_t this_arg) {
74982         LDKHTLCDescriptor this_arg_conv;
74983         this_arg_conv.inner = untag_ptr(this_arg);
74984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74986         this_arg_conv.is_owned = false;
74987         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
74988         int64_t ret_ref = 0;
74989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74991         return ret_ref;
74992 }
74993
74994 int64_t  CS_LDK_HTLCDescriptor_previous_utxo(int64_t this_arg) {
74995         LDKHTLCDescriptor this_arg_conv;
74996         this_arg_conv.inner = untag_ptr(this_arg);
74997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74999         this_arg_conv.is_owned = false;
75000         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75001         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
75002         return tag_ptr(ret_ref, true);
75003 }
75004
75005 int64_t  CS_LDK_HTLCDescriptor_unsigned_tx_input(int64_t this_arg) {
75006         LDKHTLCDescriptor this_arg_conv;
75007         this_arg_conv.inner = untag_ptr(this_arg);
75008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75010         this_arg_conv.is_owned = false;
75011         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
75012         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
75013         return tag_ptr(ret_ref, true);
75014 }
75015
75016 int64_t  CS_LDK_HTLCDescriptor_tx_output(int64_t this_arg) {
75017         LDKHTLCDescriptor this_arg_conv;
75018         this_arg_conv.inner = untag_ptr(this_arg);
75019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75021         this_arg_conv.is_owned = false;
75022         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75023         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
75024         return tag_ptr(ret_ref, true);
75025 }
75026
75027 int8_tArray  CS_LDK_HTLCDescriptor_witness_script(int64_t this_arg) {
75028         LDKHTLCDescriptor this_arg_conv;
75029         this_arg_conv.inner = untag_ptr(this_arg);
75030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75032         this_arg_conv.is_owned = false;
75033         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
75034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75036         CVec_u8Z_free(ret_var);
75037         return ret_arr;
75038 }
75039
75040 int8_tArray  CS_LDK_HTLCDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
75041         LDKHTLCDescriptor this_arg_conv;
75042         this_arg_conv.inner = untag_ptr(this_arg);
75043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75045         this_arg_conv.is_owned = false;
75046         LDKECDSASignature signature_ref;
75047         CHECK(signature->arr_len == 64);
75048         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
75049         LDKu8slice witness_script_ref;
75050         witness_script_ref.datalen = witness_script->arr_len;
75051         witness_script_ref.data = witness_script->elems;
75052         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
75053         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75054         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75055         Witness_free(ret_var);
75056         FREE(witness_script);
75057         return ret_arr;
75058 }
75059
75060 int64_t  CS_LDK_HTLCDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
75061         LDKHTLCDescriptor this_arg_conv;
75062         this_arg_conv.inner = untag_ptr(this_arg);
75063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75065         this_arg_conv.is_owned = false;
75066         void* signer_provider_ptr = untag_ptr(signer_provider);
75067         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
75068         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
75069         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75070         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
75071         return tag_ptr(ret_ret, true);
75072 }
75073
75074 void  CS_LDK_ChannelSigner_free(int64_t this_ptr) {
75075         if (!ptr_is_owned(this_ptr)) return;
75076         void* this_ptr_ptr = untag_ptr(this_ptr);
75077         CHECK_ACCESS(this_ptr_ptr);
75078         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
75079         FREE(untag_ptr(this_ptr));
75080         ChannelSigner_free(this_ptr_conv);
75081 }
75082
75083 int32_t  CS_LDK_Recipient_clone(int64_t orig) {
75084         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
75085         int32_t ret_conv = LDKRecipient_to_cs(Recipient_clone(orig_conv));
75086         return ret_conv;
75087 }
75088
75089 int32_t  CS_LDK_Recipient_node() {
75090         int32_t ret_conv = LDKRecipient_to_cs(Recipient_node());
75091         return ret_conv;
75092 }
75093
75094 int32_t  CS_LDK_Recipient_phantom_node() {
75095         int32_t ret_conv = LDKRecipient_to_cs(Recipient_phantom_node());
75096         return ret_conv;
75097 }
75098
75099 void  CS_LDK_EntropySource_free(int64_t this_ptr) {
75100         if (!ptr_is_owned(this_ptr)) return;
75101         void* this_ptr_ptr = untag_ptr(this_ptr);
75102         CHECK_ACCESS(this_ptr_ptr);
75103         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
75104         FREE(untag_ptr(this_ptr));
75105         EntropySource_free(this_ptr_conv);
75106 }
75107
75108 void  CS_LDK_NodeSigner_free(int64_t this_ptr) {
75109         if (!ptr_is_owned(this_ptr)) return;
75110         void* this_ptr_ptr = untag_ptr(this_ptr);
75111         CHECK_ACCESS(this_ptr_ptr);
75112         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
75113         FREE(untag_ptr(this_ptr));
75114         NodeSigner_free(this_ptr_conv);
75115 }
75116
75117 void  CS_LDK_OutputSpender_free(int64_t this_ptr) {
75118         if (!ptr_is_owned(this_ptr)) return;
75119         void* this_ptr_ptr = untag_ptr(this_ptr);
75120         CHECK_ACCESS(this_ptr_ptr);
75121         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
75122         FREE(untag_ptr(this_ptr));
75123         OutputSpender_free(this_ptr_conv);
75124 }
75125
75126 void  CS_LDK_SignerProvider_free(int64_t this_ptr) {
75127         if (!ptr_is_owned(this_ptr)) return;
75128         void* this_ptr_ptr = untag_ptr(this_ptr);
75129         CHECK_ACCESS(this_ptr_ptr);
75130         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
75131         FREE(untag_ptr(this_ptr));
75132         SignerProvider_free(this_ptr_conv);
75133 }
75134
75135 void  CS_LDK_ChangeDestinationSource_free(int64_t this_ptr) {
75136         if (!ptr_is_owned(this_ptr)) return;
75137         void* this_ptr_ptr = untag_ptr(this_ptr);
75138         CHECK_ACCESS(this_ptr_ptr);
75139         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
75140         FREE(untag_ptr(this_ptr));
75141         ChangeDestinationSource_free(this_ptr_conv);
75142 }
75143
75144 void  CS_LDK_InMemorySigner_free(int64_t this_obj) {
75145         LDKInMemorySigner this_obj_conv;
75146         this_obj_conv.inner = untag_ptr(this_obj);
75147         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75149         InMemorySigner_free(this_obj_conv);
75150 }
75151
75152 int8_tArray  CS_LDK_InMemorySigner_get_funding_key(int64_t this_ptr) {
75153         LDKInMemorySigner this_ptr_conv;
75154         this_ptr_conv.inner = untag_ptr(this_ptr);
75155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75157         this_ptr_conv.is_owned = false;
75158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75159         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
75160         return ret_arr;
75161 }
75162
75163 void  CS_LDK_InMemorySigner_set_funding_key(int64_t this_ptr, int8_tArray val) {
75164         LDKInMemorySigner this_ptr_conv;
75165         this_ptr_conv.inner = untag_ptr(this_ptr);
75166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75168         this_ptr_conv.is_owned = false;
75169         LDKSecretKey val_ref;
75170         CHECK(val->arr_len == 32);
75171         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
75172         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
75173 }
75174
75175 int8_tArray  CS_LDK_InMemorySigner_get_revocation_base_key(int64_t this_ptr) {
75176         LDKInMemorySigner this_ptr_conv;
75177         this_ptr_conv.inner = untag_ptr(this_ptr);
75178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75180         this_ptr_conv.is_owned = false;
75181         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75182         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
75183         return ret_arr;
75184 }
75185
75186 void  CS_LDK_InMemorySigner_set_revocation_base_key(int64_t this_ptr, int8_tArray val) {
75187         LDKInMemorySigner this_ptr_conv;
75188         this_ptr_conv.inner = untag_ptr(this_ptr);
75189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75191         this_ptr_conv.is_owned = false;
75192         LDKSecretKey val_ref;
75193         CHECK(val->arr_len == 32);
75194         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
75195         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
75196 }
75197
75198 int8_tArray  CS_LDK_InMemorySigner_get_payment_key(int64_t this_ptr) {
75199         LDKInMemorySigner this_ptr_conv;
75200         this_ptr_conv.inner = untag_ptr(this_ptr);
75201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75203         this_ptr_conv.is_owned = false;
75204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75205         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
75206         return ret_arr;
75207 }
75208
75209 void  CS_LDK_InMemorySigner_set_payment_key(int64_t this_ptr, int8_tArray val) {
75210         LDKInMemorySigner this_ptr_conv;
75211         this_ptr_conv.inner = untag_ptr(this_ptr);
75212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75214         this_ptr_conv.is_owned = false;
75215         LDKSecretKey val_ref;
75216         CHECK(val->arr_len == 32);
75217         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
75218         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
75219 }
75220
75221 int8_tArray  CS_LDK_InMemorySigner_get_delayed_payment_base_key(int64_t this_ptr) {
75222         LDKInMemorySigner this_ptr_conv;
75223         this_ptr_conv.inner = untag_ptr(this_ptr);
75224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75226         this_ptr_conv.is_owned = false;
75227         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75228         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
75229         return ret_arr;
75230 }
75231
75232 void  CS_LDK_InMemorySigner_set_delayed_payment_base_key(int64_t this_ptr, int8_tArray val) {
75233         LDKInMemorySigner this_ptr_conv;
75234         this_ptr_conv.inner = untag_ptr(this_ptr);
75235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75237         this_ptr_conv.is_owned = false;
75238         LDKSecretKey val_ref;
75239         CHECK(val->arr_len == 32);
75240         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
75241         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
75242 }
75243
75244 int8_tArray  CS_LDK_InMemorySigner_get_htlc_base_key(int64_t this_ptr) {
75245         LDKInMemorySigner this_ptr_conv;
75246         this_ptr_conv.inner = untag_ptr(this_ptr);
75247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75249         this_ptr_conv.is_owned = false;
75250         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75251         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
75252         return ret_arr;
75253 }
75254
75255 void  CS_LDK_InMemorySigner_set_htlc_base_key(int64_t this_ptr, int8_tArray val) {
75256         LDKInMemorySigner this_ptr_conv;
75257         this_ptr_conv.inner = untag_ptr(this_ptr);
75258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75260         this_ptr_conv.is_owned = false;
75261         LDKSecretKey val_ref;
75262         CHECK(val->arr_len == 32);
75263         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
75264         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
75265 }
75266
75267 int8_tArray  CS_LDK_InMemorySigner_get_commitment_seed(int64_t this_ptr) {
75268         LDKInMemorySigner this_ptr_conv;
75269         this_ptr_conv.inner = untag_ptr(this_ptr);
75270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75272         this_ptr_conv.is_owned = false;
75273         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75274         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
75275         return ret_arr;
75276 }
75277
75278 void  CS_LDK_InMemorySigner_set_commitment_seed(int64_t this_ptr, int8_tArray val) {
75279         LDKInMemorySigner this_ptr_conv;
75280         this_ptr_conv.inner = untag_ptr(this_ptr);
75281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75283         this_ptr_conv.is_owned = false;
75284         LDKThirtyTwoBytes val_ref;
75285         CHECK(val->arr_len == 32);
75286         memcpy(val_ref.data, val->elems, 32); FREE(val);
75287         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
75288 }
75289
75290 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
75291         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
75292         int64_t ret_ref = 0;
75293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75295         return ret_ref;
75296 }
75297 int64_t  CS_LDK_InMemorySigner_clone_ptr(int64_t arg) {
75298         LDKInMemorySigner arg_conv;
75299         arg_conv.inner = untag_ptr(arg);
75300         arg_conv.is_owned = ptr_is_owned(arg);
75301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75302         arg_conv.is_owned = false;
75303         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
75304         return ret_conv;
75305 }
75306
75307 int64_t  CS_LDK_InMemorySigner_clone(int64_t orig) {
75308         LDKInMemorySigner orig_conv;
75309         orig_conv.inner = untag_ptr(orig);
75310         orig_conv.is_owned = ptr_is_owned(orig);
75311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75312         orig_conv.is_owned = false;
75313         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
75314         int64_t ret_ref = 0;
75315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75317         return ret_ref;
75318 }
75319
75320 int64_t  CS_LDK_InMemorySigner_new(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) {
75321         LDKSecretKey funding_key_ref;
75322         CHECK(funding_key->arr_len == 32);
75323         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
75324         LDKSecretKey revocation_base_key_ref;
75325         CHECK(revocation_base_key->arr_len == 32);
75326         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
75327         LDKSecretKey payment_key_ref;
75328         CHECK(payment_key->arr_len == 32);
75329         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
75330         LDKSecretKey delayed_payment_base_key_ref;
75331         CHECK(delayed_payment_base_key->arr_len == 32);
75332         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
75333         LDKSecretKey htlc_base_key_ref;
75334         CHECK(htlc_base_key->arr_len == 32);
75335         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
75336         LDKThirtyTwoBytes commitment_seed_ref;
75337         CHECK(commitment_seed->arr_len == 32);
75338         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
75339         LDKThirtyTwoBytes channel_keys_id_ref;
75340         CHECK(channel_keys_id->arr_len == 32);
75341         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
75342         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
75343         CHECK(rand_bytes_unique_start->arr_len == 32);
75344         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
75345         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);
75346         int64_t ret_ref = 0;
75347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75349         return ret_ref;
75350 }
75351
75352 int64_t  CS_LDK_InMemorySigner_counterparty_pubkeys(int64_t this_arg) {
75353         LDKInMemorySigner this_arg_conv;
75354         this_arg_conv.inner = untag_ptr(this_arg);
75355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75357         this_arg_conv.is_owned = false;
75358         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
75359         int64_t ret_ref = 0;
75360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75362         return ret_ref;
75363 }
75364
75365 int64_t  CS_LDK_InMemorySigner_counterparty_selected_contest_delay(int64_t this_arg) {
75366         LDKInMemorySigner this_arg_conv;
75367         this_arg_conv.inner = untag_ptr(this_arg);
75368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75370         this_arg_conv.is_owned = false;
75371         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
75372         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
75373         int64_t ret_ref = tag_ptr(ret_copy, true);
75374         return ret_ref;
75375 }
75376
75377 int64_t  CS_LDK_InMemorySigner_holder_selected_contest_delay(int64_t this_arg) {
75378         LDKInMemorySigner this_arg_conv;
75379         this_arg_conv.inner = untag_ptr(this_arg);
75380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75382         this_arg_conv.is_owned = false;
75383         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
75384         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
75385         int64_t ret_ref = tag_ptr(ret_copy, true);
75386         return ret_ref;
75387 }
75388
75389 int64_t  CS_LDK_InMemorySigner_is_outbound(int64_t this_arg) {
75390         LDKInMemorySigner this_arg_conv;
75391         this_arg_conv.inner = untag_ptr(this_arg);
75392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75394         this_arg_conv.is_owned = false;
75395         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
75396         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
75397         int64_t ret_ref = tag_ptr(ret_copy, true);
75398         return ret_ref;
75399 }
75400
75401 int64_t  CS_LDK_InMemorySigner_funding_outpoint(int64_t this_arg) {
75402         LDKInMemorySigner this_arg_conv;
75403         this_arg_conv.inner = untag_ptr(this_arg);
75404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75406         this_arg_conv.is_owned = false;
75407         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
75408         int64_t ret_ref = 0;
75409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75411         return ret_ref;
75412 }
75413
75414 int64_t  CS_LDK_InMemorySigner_get_channel_parameters(int64_t this_arg) {
75415         LDKInMemorySigner this_arg_conv;
75416         this_arg_conv.inner = untag_ptr(this_arg);
75417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75419         this_arg_conv.is_owned = false;
75420         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
75421         int64_t ret_ref = 0;
75422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75424         return ret_ref;
75425 }
75426
75427 int64_t  CS_LDK_InMemorySigner_channel_type_features(int64_t this_arg) {
75428         LDKInMemorySigner this_arg_conv;
75429         this_arg_conv.inner = untag_ptr(this_arg);
75430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75432         this_arg_conv.is_owned = false;
75433         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
75434         int64_t ret_ref = 0;
75435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75437         return ret_ref;
75438 }
75439
75440 int64_t  CS_LDK_InMemorySigner_sign_counterparty_payment_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
75441         LDKInMemorySigner this_arg_conv;
75442         this_arg_conv.inner = untag_ptr(this_arg);
75443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75445         this_arg_conv.is_owned = false;
75446         LDKTransaction spend_tx_ref;
75447         spend_tx_ref.datalen = spend_tx->arr_len;
75448         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
75449         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
75450         spend_tx_ref.data_is_owned = true;
75451         LDKStaticPaymentOutputDescriptor descriptor_conv;
75452         descriptor_conv.inner = untag_ptr(descriptor);
75453         descriptor_conv.is_owned = ptr_is_owned(descriptor);
75454         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
75455         descriptor_conv.is_owned = false;
75456         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
75457         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
75458         return tag_ptr(ret_conv, true);
75459 }
75460
75461 int64_t  CS_LDK_InMemorySigner_sign_dynamic_p2wsh_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
75462         LDKInMemorySigner this_arg_conv;
75463         this_arg_conv.inner = untag_ptr(this_arg);
75464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75466         this_arg_conv.is_owned = false;
75467         LDKTransaction spend_tx_ref;
75468         spend_tx_ref.datalen = spend_tx->arr_len;
75469         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
75470         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
75471         spend_tx_ref.data_is_owned = true;
75472         LDKDelayedPaymentOutputDescriptor descriptor_conv;
75473         descriptor_conv.inner = untag_ptr(descriptor);
75474         descriptor_conv.is_owned = ptr_is_owned(descriptor);
75475         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
75476         descriptor_conv.is_owned = false;
75477         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
75478         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
75479         return tag_ptr(ret_conv, true);
75480 }
75481
75482 int64_t  CS_LDK_InMemorySigner_as_EntropySource(int64_t this_arg) {
75483         LDKInMemorySigner this_arg_conv;
75484         this_arg_conv.inner = untag_ptr(this_arg);
75485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75487         this_arg_conv.is_owned = false;
75488         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75489         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
75490         return tag_ptr(ret_ret, true);
75491 }
75492
75493 int64_t  CS_LDK_InMemorySigner_as_ChannelSigner(int64_t this_arg) {
75494         LDKInMemorySigner this_arg_conv;
75495         this_arg_conv.inner = untag_ptr(this_arg);
75496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75498         this_arg_conv.is_owned = false;
75499         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
75500         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
75501         return tag_ptr(ret_ret, true);
75502 }
75503
75504 int64_t  CS_LDK_InMemorySigner_as_EcdsaChannelSigner(int64_t this_arg) {
75505         LDKInMemorySigner this_arg_conv;
75506         this_arg_conv.inner = untag_ptr(this_arg);
75507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75509         this_arg_conv.is_owned = false;
75510         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
75511         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
75512         return tag_ptr(ret_ret, true);
75513 }
75514
75515 int64_t  CS_LDK_InMemorySigner_as_WriteableEcdsaChannelSigner(int64_t this_arg) {
75516         LDKInMemorySigner this_arg_conv;
75517         this_arg_conv.inner = untag_ptr(this_arg);
75518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75520         this_arg_conv.is_owned = false;
75521         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75522         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
75523         return tag_ptr(ret_ret, true);
75524 }
75525
75526 int8_tArray  CS_LDK_InMemorySigner_write(int64_t obj) {
75527         LDKInMemorySigner obj_conv;
75528         obj_conv.inner = untag_ptr(obj);
75529         obj_conv.is_owned = ptr_is_owned(obj);
75530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75531         obj_conv.is_owned = false;
75532         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
75533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75535         CVec_u8Z_free(ret_var);
75536         return ret_arr;
75537 }
75538
75539 int64_t  CS_LDK_InMemorySigner_read(int8_tArray ser, int64_t arg) {
75540         LDKu8slice ser_ref;
75541         ser_ref.datalen = ser->arr_len;
75542         ser_ref.data = ser->elems;
75543         void* arg_ptr = untag_ptr(arg);
75544         CHECK_ACCESS(arg_ptr);
75545         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
75546         if (arg_conv.free == LDKEntropySource_JCalls_free) {
75547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75548                 LDKEntropySource_JCalls_cloned(&arg_conv);
75549         }
75550         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
75551         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
75552         FREE(ser);
75553         return tag_ptr(ret_conv, true);
75554 }
75555
75556 void  CS_LDK_KeysManager_free(int64_t this_obj) {
75557         LDKKeysManager this_obj_conv;
75558         this_obj_conv.inner = untag_ptr(this_obj);
75559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75561         KeysManager_free(this_obj_conv);
75562 }
75563
75564 int64_t  CS_LDK_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
75565         uint8_t seed_arr[32];
75566         CHECK(seed->arr_len == 32);
75567         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75568         uint8_t (*seed_ref)[32] = &seed_arr;
75569         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
75570         int64_t ret_ref = 0;
75571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75573         return ret_ref;
75574 }
75575
75576 int8_tArray  CS_LDK_KeysManager_get_node_secret_key(int64_t this_arg) {
75577         LDKKeysManager this_arg_conv;
75578         this_arg_conv.inner = untag_ptr(this_arg);
75579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75581         this_arg_conv.is_owned = false;
75582         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75583         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75584         return ret_arr;
75585 }
75586
75587 int64_t  CS_LDK_KeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
75588         LDKKeysManager this_arg_conv;
75589         this_arg_conv.inner = untag_ptr(this_arg);
75590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75592         this_arg_conv.is_owned = false;
75593         uint8_t params_arr[32];
75594         CHECK(params->arr_len == 32);
75595         memcpy(params_arr, params->elems, 32); FREE(params);
75596         uint8_t (*params_ref)[32] = &params_arr;
75597         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75598         int64_t ret_ref = 0;
75599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75601         return ret_ref;
75602 }
75603
75604 int64_t  CS_LDK_KeysManager_sign_spendable_outputs_psbt(int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
75605         LDKKeysManager this_arg_conv;
75606         this_arg_conv.inner = untag_ptr(this_arg);
75607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75609         this_arg_conv.is_owned = false;
75610         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
75611         descriptors_constr.datalen = descriptors->arr_len;
75612         if (descriptors_constr.datalen > 0)
75613                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
75614         else
75615                 descriptors_constr.data = NULL;
75616         int64_t* descriptors_vals = descriptors->elems;
75617         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
75618                 int64_t descriptors_conv_27 = descriptors_vals[b];
75619                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
75620                 CHECK_ACCESS(descriptors_conv_27_ptr);
75621                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
75622                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
75623                 descriptors_constr.data[b] = descriptors_conv_27_conv;
75624         }
75625         FREE(descriptors);
75626         LDKCVec_u8Z psbt_ref;
75627         psbt_ref.datalen = psbt->arr_len;
75628         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
75629         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
75630         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
75631         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
75632         return tag_ptr(ret_conv, true);
75633 }
75634
75635 int64_t  CS_LDK_KeysManager_as_EntropySource(int64_t this_arg) {
75636         LDKKeysManager this_arg_conv;
75637         this_arg_conv.inner = untag_ptr(this_arg);
75638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75640         this_arg_conv.is_owned = false;
75641         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75642         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
75643         return tag_ptr(ret_ret, true);
75644 }
75645
75646 int64_t  CS_LDK_KeysManager_as_NodeSigner(int64_t this_arg) {
75647         LDKKeysManager this_arg_conv;
75648         this_arg_conv.inner = untag_ptr(this_arg);
75649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75651         this_arg_conv.is_owned = false;
75652         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75653         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
75654         return tag_ptr(ret_ret, true);
75655 }
75656
75657 int64_t  CS_LDK_KeysManager_as_OutputSpender(int64_t this_arg) {
75658         LDKKeysManager this_arg_conv;
75659         this_arg_conv.inner = untag_ptr(this_arg);
75660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75662         this_arg_conv.is_owned = false;
75663         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75664         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
75665         return tag_ptr(ret_ret, true);
75666 }
75667
75668 int64_t  CS_LDK_KeysManager_as_SignerProvider(int64_t this_arg) {
75669         LDKKeysManager this_arg_conv;
75670         this_arg_conv.inner = untag_ptr(this_arg);
75671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75673         this_arg_conv.is_owned = false;
75674         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75675         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
75676         return tag_ptr(ret_ret, true);
75677 }
75678
75679 void  CS_LDK_PhantomKeysManager_free(int64_t this_obj) {
75680         LDKPhantomKeysManager this_obj_conv;
75681         this_obj_conv.inner = untag_ptr(this_obj);
75682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75684         PhantomKeysManager_free(this_obj_conv);
75685 }
75686
75687 int64_t  CS_LDK_PhantomKeysManager_as_EntropySource(int64_t this_arg) {
75688         LDKPhantomKeysManager this_arg_conv;
75689         this_arg_conv.inner = untag_ptr(this_arg);
75690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75692         this_arg_conv.is_owned = false;
75693         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75694         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
75695         return tag_ptr(ret_ret, true);
75696 }
75697
75698 int64_t  CS_LDK_PhantomKeysManager_as_NodeSigner(int64_t this_arg) {
75699         LDKPhantomKeysManager this_arg_conv;
75700         this_arg_conv.inner = untag_ptr(this_arg);
75701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75703         this_arg_conv.is_owned = false;
75704         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
75705         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
75706         return tag_ptr(ret_ret, true);
75707 }
75708
75709 int64_t  CS_LDK_PhantomKeysManager_as_OutputSpender(int64_t this_arg) {
75710         LDKPhantomKeysManager this_arg_conv;
75711         this_arg_conv.inner = untag_ptr(this_arg);
75712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75714         this_arg_conv.is_owned = false;
75715         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
75716         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
75717         return tag_ptr(ret_ret, true);
75718 }
75719
75720 int64_t  CS_LDK_PhantomKeysManager_as_SignerProvider(int64_t this_arg) {
75721         LDKPhantomKeysManager this_arg_conv;
75722         this_arg_conv.inner = untag_ptr(this_arg);
75723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75725         this_arg_conv.is_owned = false;
75726         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
75727         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
75728         return tag_ptr(ret_ret, true);
75729 }
75730
75731 int64_t  CS_LDK_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
75732         uint8_t seed_arr[32];
75733         CHECK(seed->arr_len == 32);
75734         memcpy(seed_arr, seed->elems, 32); FREE(seed);
75735         uint8_t (*seed_ref)[32] = &seed_arr;
75736         uint8_t cross_node_seed_arr[32];
75737         CHECK(cross_node_seed->arr_len == 32);
75738         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
75739         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
75740         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
75741         int64_t ret_ref = 0;
75742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75744         return ret_ref;
75745 }
75746
75747 int64_t  CS_LDK_PhantomKeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
75748         LDKPhantomKeysManager this_arg_conv;
75749         this_arg_conv.inner = untag_ptr(this_arg);
75750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75752         this_arg_conv.is_owned = false;
75753         uint8_t params_arr[32];
75754         CHECK(params->arr_len == 32);
75755         memcpy(params_arr, params->elems, 32); FREE(params);
75756         uint8_t (*params_ref)[32] = &params_arr;
75757         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
75758         int64_t ret_ref = 0;
75759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75761         return ret_ref;
75762 }
75763
75764 int8_tArray  CS_LDK_PhantomKeysManager_get_node_secret_key(int64_t this_arg) {
75765         LDKPhantomKeysManager this_arg_conv;
75766         this_arg_conv.inner = untag_ptr(this_arg);
75767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75769         this_arg_conv.is_owned = false;
75770         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75771         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
75772         return ret_arr;
75773 }
75774
75775 int8_tArray  CS_LDK_PhantomKeysManager_get_phantom_node_secret_key(int64_t this_arg) {
75776         LDKPhantomKeysManager this_arg_conv;
75777         this_arg_conv.inner = untag_ptr(this_arg);
75778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75780         this_arg_conv.is_owned = false;
75781         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75782         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
75783         return ret_arr;
75784 }
75785
75786 void  CS_LDK_RandomBytes_free(int64_t this_obj) {
75787         LDKRandomBytes this_obj_conv;
75788         this_obj_conv.inner = untag_ptr(this_obj);
75789         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75791         RandomBytes_free(this_obj_conv);
75792 }
75793
75794 int64_t  CS_LDK_RandomBytes_new(int8_tArray seed) {
75795         LDKThirtyTwoBytes seed_ref;
75796         CHECK(seed->arr_len == 32);
75797         memcpy(seed_ref.data, seed->elems, 32); FREE(seed);
75798         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
75799         int64_t ret_ref = 0;
75800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75802         return ret_ref;
75803 }
75804
75805 int64_t  CS_LDK_RandomBytes_as_EntropySource(int64_t this_arg) {
75806         LDKRandomBytes this_arg_conv;
75807         this_arg_conv.inner = untag_ptr(this_arg);
75808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75810         this_arg_conv.is_owned = false;
75811         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
75812         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
75813         return tag_ptr(ret_ret, true);
75814 }
75815
75816 void  CS_LDK_EcdsaChannelSigner_free(int64_t this_ptr) {
75817         if (!ptr_is_owned(this_ptr)) return;
75818         void* this_ptr_ptr = untag_ptr(this_ptr);
75819         CHECK_ACCESS(this_ptr_ptr);
75820         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
75821         FREE(untag_ptr(this_ptr));
75822         EcdsaChannelSigner_free(this_ptr_conv);
75823 }
75824
75825 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
75826         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75827         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
75828         return tag_ptr(ret_ret, true);
75829 }
75830 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone_ptr(int64_t arg) {
75831         void* arg_ptr = untag_ptr(arg);
75832         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
75833         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
75834         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
75835         return ret_conv;
75836 }
75837
75838 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone(int64_t orig) {
75839         void* orig_ptr = untag_ptr(orig);
75840         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
75841         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
75842         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75843         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
75844         return tag_ptr(ret_ret, true);
75845 }
75846
75847 void  CS_LDK_WriteableEcdsaChannelSigner_free(int64_t this_ptr) {
75848         if (!ptr_is_owned(this_ptr)) return;
75849         void* this_ptr_ptr = untag_ptr(this_ptr);
75850         CHECK_ACCESS(this_ptr_ptr);
75851         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
75852         FREE(untag_ptr(this_ptr));
75853         WriteableEcdsaChannelSigner_free(this_ptr_conv);
75854 }
75855
75856 void  CS_LDK_OnionMessenger_free(int64_t this_obj) {
75857         LDKOnionMessenger this_obj_conv;
75858         this_obj_conv.inner = untag_ptr(this_obj);
75859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75861         OnionMessenger_free(this_obj_conv);
75862 }
75863
75864 void  CS_LDK_MessageRouter_free(int64_t this_ptr) {
75865         if (!ptr_is_owned(this_ptr)) return;
75866         void* this_ptr_ptr = untag_ptr(this_ptr);
75867         CHECK_ACCESS(this_ptr_ptr);
75868         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
75869         FREE(untag_ptr(this_ptr));
75870         MessageRouter_free(this_ptr_conv);
75871 }
75872
75873 void  CS_LDK_DefaultMessageRouter_free(int64_t this_obj) {
75874         LDKDefaultMessageRouter this_obj_conv;
75875         this_obj_conv.inner = untag_ptr(this_obj);
75876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75878         DefaultMessageRouter_free(this_obj_conv);
75879 }
75880
75881 int64_t  CS_LDK_DefaultMessageRouter_new(int64_t network_graph, int64_t entropy_source) {
75882         LDKNetworkGraph network_graph_conv;
75883         network_graph_conv.inner = untag_ptr(network_graph);
75884         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75885         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75886         network_graph_conv.is_owned = false;
75887         void* entropy_source_ptr = untag_ptr(entropy_source);
75888         CHECK_ACCESS(entropy_source_ptr);
75889         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75890         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75892                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75893         }
75894         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
75895         int64_t ret_ref = 0;
75896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75898         return ret_ref;
75899 }
75900
75901 int64_t  CS_LDK_DefaultMessageRouter_as_MessageRouter(int64_t this_arg) {
75902         LDKDefaultMessageRouter this_arg_conv;
75903         this_arg_conv.inner = untag_ptr(this_arg);
75904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75906         this_arg_conv.is_owned = false;
75907         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75908         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
75909         return tag_ptr(ret_ret, true);
75910 }
75911
75912 void  CS_LDK_OnionMessagePath_free(int64_t this_obj) {
75913         LDKOnionMessagePath this_obj_conv;
75914         this_obj_conv.inner = untag_ptr(this_obj);
75915         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75917         OnionMessagePath_free(this_obj_conv);
75918 }
75919
75920 ptrArray  CS_LDK_OnionMessagePath_get_intermediate_nodes(int64_t this_ptr) {
75921         LDKOnionMessagePath this_ptr_conv;
75922         this_ptr_conv.inner = untag_ptr(this_ptr);
75923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75925         this_ptr_conv.is_owned = false;
75926         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
75927         ptrArray ret_arr = NULL;
75928         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
75929         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
75930         for (size_t i = 0; i < ret_var.datalen; i++) {
75931                 int8_tArray ret_conv_8_arr = init_int8_tArray(33, __LINE__);
75932                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compressed_form, 33);
75933                 ret_arr_ptr[i] = ret_conv_8_arr;
75934         }
75935         
75936         FREE(ret_var.data);
75937         return ret_arr;
75938 }
75939
75940 void  CS_LDK_OnionMessagePath_set_intermediate_nodes(int64_t this_ptr, ptrArray val) {
75941         LDKOnionMessagePath this_ptr_conv;
75942         this_ptr_conv.inner = untag_ptr(this_ptr);
75943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75945         this_ptr_conv.is_owned = false;
75946         LDKCVec_PublicKeyZ val_constr;
75947         val_constr.datalen = val->arr_len;
75948         if (val_constr.datalen > 0)
75949                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75950         else
75951                 val_constr.data = NULL;
75952         int8_tArray* val_vals = (void*) val->elems;
75953         for (size_t i = 0; i < val_constr.datalen; i++) {
75954                 int8_tArray val_conv_8 = val_vals[i];
75955                 LDKPublicKey val_conv_8_ref;
75956                 CHECK(val_conv_8->arr_len == 33);
75957                 memcpy(val_conv_8_ref.compressed_form, val_conv_8->elems, 33); FREE(val_conv_8);
75958                 val_constr.data[i] = val_conv_8_ref;
75959         }
75960         FREE(val);
75961         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
75962 }
75963
75964 int64_t  CS_LDK_OnionMessagePath_get_destination(int64_t this_ptr) {
75965         LDKOnionMessagePath this_ptr_conv;
75966         this_ptr_conv.inner = untag_ptr(this_ptr);
75967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75969         this_ptr_conv.is_owned = false;
75970         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75971         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
75972         int64_t ret_ref = tag_ptr(ret_copy, true);
75973         return ret_ref;
75974 }
75975
75976 void  CS_LDK_OnionMessagePath_set_destination(int64_t this_ptr, int64_t val) {
75977         LDKOnionMessagePath this_ptr_conv;
75978         this_ptr_conv.inner = untag_ptr(this_ptr);
75979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75981         this_ptr_conv.is_owned = false;
75982         void* val_ptr = untag_ptr(val);
75983         CHECK_ACCESS(val_ptr);
75984         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
75985         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
75986         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
75987 }
75988
75989 int64_t  CS_LDK_OnionMessagePath_get_first_node_addresses(int64_t this_ptr) {
75990         LDKOnionMessagePath this_ptr_conv;
75991         this_ptr_conv.inner = untag_ptr(this_ptr);
75992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75994         this_ptr_conv.is_owned = false;
75995         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75996         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
75997         int64_t ret_ref = tag_ptr(ret_copy, true);
75998         return ret_ref;
75999 }
76000
76001 void  CS_LDK_OnionMessagePath_set_first_node_addresses(int64_t this_ptr, int64_t val) {
76002         LDKOnionMessagePath this_ptr_conv;
76003         this_ptr_conv.inner = untag_ptr(this_ptr);
76004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76006         this_ptr_conv.is_owned = false;
76007         void* val_ptr = untag_ptr(val);
76008         CHECK_ACCESS(val_ptr);
76009         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
76010         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
76011         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
76012 }
76013
76014 int64_t  CS_LDK_OnionMessagePath_new(ptrArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
76015         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
76016         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
76017         if (intermediate_nodes_arg_constr.datalen > 0)
76018                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76019         else
76020                 intermediate_nodes_arg_constr.data = NULL;
76021         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
76022         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
76023                 int8_tArray intermediate_nodes_arg_conv_8 = intermediate_nodes_arg_vals[i];
76024                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
76025                 CHECK(intermediate_nodes_arg_conv_8->arr_len == 33);
76026                 memcpy(intermediate_nodes_arg_conv_8_ref.compressed_form, intermediate_nodes_arg_conv_8->elems, 33); FREE(intermediate_nodes_arg_conv_8);
76027                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
76028         }
76029         FREE(intermediate_nodes_arg);
76030         void* destination_arg_ptr = untag_ptr(destination_arg);
76031         CHECK_ACCESS(destination_arg_ptr);
76032         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
76033         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
76034         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
76035         CHECK_ACCESS(first_node_addresses_arg_ptr);
76036         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
76037         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
76038         int64_t ret_ref = 0;
76039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76041         return ret_ref;
76042 }
76043
76044 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
76045         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
76046         int64_t ret_ref = 0;
76047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76049         return ret_ref;
76050 }
76051 int64_t  CS_LDK_OnionMessagePath_clone_ptr(int64_t arg) {
76052         LDKOnionMessagePath arg_conv;
76053         arg_conv.inner = untag_ptr(arg);
76054         arg_conv.is_owned = ptr_is_owned(arg);
76055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76056         arg_conv.is_owned = false;
76057         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
76058         return ret_conv;
76059 }
76060
76061 int64_t  CS_LDK_OnionMessagePath_clone(int64_t orig) {
76062         LDKOnionMessagePath orig_conv;
76063         orig_conv.inner = untag_ptr(orig);
76064         orig_conv.is_owned = ptr_is_owned(orig);
76065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76066         orig_conv.is_owned = false;
76067         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
76068         int64_t ret_ref = 0;
76069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76071         return ret_ref;
76072 }
76073
76074 int8_tArray  CS_LDK_OnionMessagePath_first_node(int64_t this_arg) {
76075         LDKOnionMessagePath this_arg_conv;
76076         this_arg_conv.inner = untag_ptr(this_arg);
76077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76079         this_arg_conv.is_owned = false;
76080         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76081         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
76082         return ret_arr;
76083 }
76084
76085 void  CS_LDK_Destination_free(int64_t this_ptr) {
76086         if (!ptr_is_owned(this_ptr)) return;
76087         void* this_ptr_ptr = untag_ptr(this_ptr);
76088         CHECK_ACCESS(this_ptr_ptr);
76089         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
76090         FREE(untag_ptr(this_ptr));
76091         Destination_free(this_ptr_conv);
76092 }
76093
76094 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
76095         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
76096         *ret_copy = Destination_clone(arg);
76097         int64_t ret_ref = tag_ptr(ret_copy, true);
76098         return ret_ref;
76099 }
76100 int64_t  CS_LDK_Destination_clone_ptr(int64_t arg) {
76101         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
76102         int64_t ret_conv = Destination_clone_ptr(arg_conv);
76103         return ret_conv;
76104 }
76105
76106 int64_t  CS_LDK_Destination_clone(int64_t orig) {
76107         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
76108         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
76109         *ret_copy = Destination_clone(orig_conv);
76110         int64_t ret_ref = tag_ptr(ret_copy, true);
76111         return ret_ref;
76112 }
76113
76114 int64_t  CS_LDK_Destination_node(int8_tArray a) {
76115         LDKPublicKey a_ref;
76116         CHECK(a->arr_len == 33);
76117         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76118         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
76119         *ret_copy = Destination_node(a_ref);
76120         int64_t ret_ref = tag_ptr(ret_copy, true);
76121         return ret_ref;
76122 }
76123
76124 int64_t  CS_LDK_Destination_blinded_path(int64_t a) {
76125         LDKBlindedPath a_conv;
76126         a_conv.inner = untag_ptr(a);
76127         a_conv.is_owned = ptr_is_owned(a);
76128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76129         a_conv = BlindedPath_clone(&a_conv);
76130         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
76131         *ret_copy = Destination_blinded_path(a_conv);
76132         int64_t ret_ref = tag_ptr(ret_copy, true);
76133         return ret_ref;
76134 }
76135
76136 int64_t  CS_LDK_Destination_hash(int64_t o) {
76137         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
76138         int64_t ret_conv = Destination_hash(o_conv);
76139         return ret_conv;
76140 }
76141
76142 jboolean  CS_LDK_Destination_eq(int64_t a, int64_t b) {
76143         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
76144         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
76145         jboolean ret_conv = Destination_eq(a_conv, b_conv);
76146         return ret_conv;
76147 }
76148
76149 void  CS_LDK_Destination_resolve(int64_t this_arg, int64_t network_graph) {
76150         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
76151         LDKReadOnlyNetworkGraph network_graph_conv;
76152         network_graph_conv.inner = untag_ptr(network_graph);
76153         network_graph_conv.is_owned = ptr_is_owned(network_graph);
76154         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
76155         network_graph_conv.is_owned = false;
76156         Destination_resolve(this_arg_conv, &network_graph_conv);
76157 }
76158
76159 void  CS_LDK_SendSuccess_free(int64_t this_ptr) {
76160         if (!ptr_is_owned(this_ptr)) return;
76161         void* this_ptr_ptr = untag_ptr(this_ptr);
76162         CHECK_ACCESS(this_ptr_ptr);
76163         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
76164         FREE(untag_ptr(this_ptr));
76165         SendSuccess_free(this_ptr_conv);
76166 }
76167
76168 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
76169         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
76170         *ret_copy = SendSuccess_clone(arg);
76171         int64_t ret_ref = tag_ptr(ret_copy, true);
76172         return ret_ref;
76173 }
76174 int64_t  CS_LDK_SendSuccess_clone_ptr(int64_t arg) {
76175         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
76176         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
76177         return ret_conv;
76178 }
76179
76180 int64_t  CS_LDK_SendSuccess_clone(int64_t orig) {
76181         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
76182         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
76183         *ret_copy = SendSuccess_clone(orig_conv);
76184         int64_t ret_ref = tag_ptr(ret_copy, true);
76185         return ret_ref;
76186 }
76187
76188 int64_t  CS_LDK_SendSuccess_buffered() {
76189         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
76190         *ret_copy = SendSuccess_buffered();
76191         int64_t ret_ref = tag_ptr(ret_copy, true);
76192         return ret_ref;
76193 }
76194
76195 int64_t  CS_LDK_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
76196         LDKPublicKey a_ref;
76197         CHECK(a->arr_len == 33);
76198         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76199         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
76200         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
76201         int64_t ret_ref = tag_ptr(ret_copy, true);
76202         return ret_ref;
76203 }
76204
76205 int64_t  CS_LDK_SendSuccess_hash(int64_t o) {
76206         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
76207         int64_t ret_conv = SendSuccess_hash(o_conv);
76208         return ret_conv;
76209 }
76210
76211 jboolean  CS_LDK_SendSuccess_eq(int64_t a, int64_t b) {
76212         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
76213         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
76214         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
76215         return ret_conv;
76216 }
76217
76218 void  CS_LDK_SendError_free(int64_t this_ptr) {
76219         if (!ptr_is_owned(this_ptr)) return;
76220         void* this_ptr_ptr = untag_ptr(this_ptr);
76221         CHECK_ACCESS(this_ptr_ptr);
76222         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
76223         FREE(untag_ptr(this_ptr));
76224         SendError_free(this_ptr_conv);
76225 }
76226
76227 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
76228         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76229         *ret_copy = SendError_clone(arg);
76230         int64_t ret_ref = tag_ptr(ret_copy, true);
76231         return ret_ref;
76232 }
76233 int64_t  CS_LDK_SendError_clone_ptr(int64_t arg) {
76234         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
76235         int64_t ret_conv = SendError_clone_ptr(arg_conv);
76236         return ret_conv;
76237 }
76238
76239 int64_t  CS_LDK_SendError_clone(int64_t orig) {
76240         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
76241         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76242         *ret_copy = SendError_clone(orig_conv);
76243         int64_t ret_ref = tag_ptr(ret_copy, true);
76244         return ret_ref;
76245 }
76246
76247 int64_t  CS_LDK_SendError_secp256k1(int32_t a) {
76248         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
76249         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76250         *ret_copy = SendError_secp256k1(a_conv);
76251         int64_t ret_ref = tag_ptr(ret_copy, true);
76252         return ret_ref;
76253 }
76254
76255 int64_t  CS_LDK_SendError_too_big_packet() {
76256         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76257         *ret_copy = SendError_too_big_packet();
76258         int64_t ret_ref = tag_ptr(ret_copy, true);
76259         return ret_ref;
76260 }
76261
76262 int64_t  CS_LDK_SendError_too_few_blinded_hops() {
76263         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76264         *ret_copy = SendError_too_few_blinded_hops();
76265         int64_t ret_ref = tag_ptr(ret_copy, true);
76266         return ret_ref;
76267 }
76268
76269 int64_t  CS_LDK_SendError_invalid_first_hop(int8_tArray a) {
76270         LDKPublicKey a_ref;
76271         CHECK(a->arr_len == 33);
76272         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
76273         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76274         *ret_copy = SendError_invalid_first_hop(a_ref);
76275         int64_t ret_ref = tag_ptr(ret_copy, true);
76276         return ret_ref;
76277 }
76278
76279 int64_t  CS_LDK_SendError_path_not_found() {
76280         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76281         *ret_copy = SendError_path_not_found();
76282         int64_t ret_ref = tag_ptr(ret_copy, true);
76283         return ret_ref;
76284 }
76285
76286 int64_t  CS_LDK_SendError_invalid_message() {
76287         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76288         *ret_copy = SendError_invalid_message();
76289         int64_t ret_ref = tag_ptr(ret_copy, true);
76290         return ret_ref;
76291 }
76292
76293 int64_t  CS_LDK_SendError_buffer_full() {
76294         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76295         *ret_copy = SendError_buffer_full();
76296         int64_t ret_ref = tag_ptr(ret_copy, true);
76297         return ret_ref;
76298 }
76299
76300 int64_t  CS_LDK_SendError_get_node_id_failed() {
76301         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76302         *ret_copy = SendError_get_node_id_failed();
76303         int64_t ret_ref = tag_ptr(ret_copy, true);
76304         return ret_ref;
76305 }
76306
76307 int64_t  CS_LDK_SendError_unresolved_introduction_node() {
76308         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76309         *ret_copy = SendError_unresolved_introduction_node();
76310         int64_t ret_ref = tag_ptr(ret_copy, true);
76311         return ret_ref;
76312 }
76313
76314 int64_t  CS_LDK_SendError_blinded_path_advance_failed() {
76315         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
76316         *ret_copy = SendError_blinded_path_advance_failed();
76317         int64_t ret_ref = tag_ptr(ret_copy, true);
76318         return ret_ref;
76319 }
76320
76321 int64_t  CS_LDK_SendError_hash(int64_t o) {
76322         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
76323         int64_t ret_conv = SendError_hash(o_conv);
76324         return ret_conv;
76325 }
76326
76327 jboolean  CS_LDK_SendError_eq(int64_t a, int64_t b) {
76328         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
76329         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
76330         jboolean ret_conv = SendError_eq(a_conv, b_conv);
76331         return ret_conv;
76332 }
76333
76334 void  CS_LDK_CustomOnionMessageHandler_free(int64_t this_ptr) {
76335         if (!ptr_is_owned(this_ptr)) return;
76336         void* this_ptr_ptr = untag_ptr(this_ptr);
76337         CHECK_ACCESS(this_ptr_ptr);
76338         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
76339         FREE(untag_ptr(this_ptr));
76340         CustomOnionMessageHandler_free(this_ptr_conv);
76341 }
76342
76343 void  CS_LDK_PeeledOnion_free(int64_t this_ptr) {
76344         if (!ptr_is_owned(this_ptr)) return;
76345         void* this_ptr_ptr = untag_ptr(this_ptr);
76346         CHECK_ACCESS(this_ptr_ptr);
76347         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
76348         FREE(untag_ptr(this_ptr));
76349         PeeledOnion_free(this_ptr_conv);
76350 }
76351
76352 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
76353         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
76354         *ret_copy = PeeledOnion_clone(arg);
76355         int64_t ret_ref = tag_ptr(ret_copy, true);
76356         return ret_ref;
76357 }
76358 int64_t  CS_LDK_PeeledOnion_clone_ptr(int64_t arg) {
76359         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
76360         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
76361         return ret_conv;
76362 }
76363
76364 int64_t  CS_LDK_PeeledOnion_clone(int64_t orig) {
76365         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
76366         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
76367         *ret_copy = PeeledOnion_clone(orig_conv);
76368         int64_t ret_ref = tag_ptr(ret_copy, true);
76369         return ret_ref;
76370 }
76371
76372 int64_t  CS_LDK_PeeledOnion_forward(int64_t a, int64_t b) {
76373         void* a_ptr = untag_ptr(a);
76374         CHECK_ACCESS(a_ptr);
76375         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
76376         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
76377         LDKOnionMessage b_conv;
76378         b_conv.inner = untag_ptr(b);
76379         b_conv.is_owned = ptr_is_owned(b);
76380         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76381         b_conv = OnionMessage_clone(&b_conv);
76382         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
76383         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
76384         int64_t ret_ref = tag_ptr(ret_copy, true);
76385         return ret_ref;
76386 }
76387
76388 int64_t  CS_LDK_PeeledOnion_receive(int64_t a, int8_tArray b, int64_t c) {
76389         void* a_ptr = untag_ptr(a);
76390         CHECK_ACCESS(a_ptr);
76391         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
76392         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
76393         LDKThirtyTwoBytes b_ref;
76394         CHECK(b->arr_len == 32);
76395         memcpy(b_ref.data, b->elems, 32); FREE(b);
76396         LDKBlindedPath c_conv;
76397         c_conv.inner = untag_ptr(c);
76398         c_conv.is_owned = ptr_is_owned(c);
76399         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
76400         c_conv = BlindedPath_clone(&c_conv);
76401         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
76402         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
76403         int64_t ret_ref = tag_ptr(ret_copy, true);
76404         return ret_ref;
76405 }
76406
76407 int64_t  CS_LDK_create_onion_message_resolving_destination(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) {
76408         void* entropy_source_ptr = untag_ptr(entropy_source);
76409         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76410         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76411         void* node_signer_ptr = untag_ptr(node_signer);
76412         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
76413         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
76414         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
76415         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
76416         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
76417         LDKReadOnlyNetworkGraph network_graph_conv;
76418         network_graph_conv.inner = untag_ptr(network_graph);
76419         network_graph_conv.is_owned = ptr_is_owned(network_graph);
76420         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
76421         network_graph_conv.is_owned = false;
76422         LDKOnionMessagePath path_conv;
76423         path_conv.inner = untag_ptr(path);
76424         path_conv.is_owned = ptr_is_owned(path);
76425         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
76426         path_conv = OnionMessagePath_clone(&path_conv);
76427         void* contents_ptr = untag_ptr(contents);
76428         CHECK_ACCESS(contents_ptr);
76429         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
76430         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
76431                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76432                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
76433         }
76434         LDKBlindedPath reply_path_conv;
76435         reply_path_conv.inner = untag_ptr(reply_path);
76436         reply_path_conv.is_owned = ptr_is_owned(reply_path);
76437         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
76438         reply_path_conv = BlindedPath_clone(&reply_path_conv);
76439         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
76440         *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);
76441         return tag_ptr(ret_conv, true);
76442 }
76443
76444 int64_t  CS_LDK_create_onion_message(int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t path, int64_t contents, int64_t reply_path) {
76445         void* entropy_source_ptr = untag_ptr(entropy_source);
76446         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76447         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76448         void* node_signer_ptr = untag_ptr(node_signer);
76449         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
76450         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
76451         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
76452         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
76453         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
76454         LDKOnionMessagePath path_conv;
76455         path_conv.inner = untag_ptr(path);
76456         path_conv.is_owned = ptr_is_owned(path);
76457         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
76458         path_conv = OnionMessagePath_clone(&path_conv);
76459         void* contents_ptr = untag_ptr(contents);
76460         CHECK_ACCESS(contents_ptr);
76461         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
76462         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
76463                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76464                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
76465         }
76466         LDKBlindedPath reply_path_conv;
76467         reply_path_conv.inner = untag_ptr(reply_path);
76468         reply_path_conv.is_owned = ptr_is_owned(reply_path);
76469         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
76470         reply_path_conv = BlindedPath_clone(&reply_path_conv);
76471         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
76472         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
76473         return tag_ptr(ret_conv, true);
76474 }
76475
76476 int64_t  CS_LDK_peel_onion_message(int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
76477         LDKOnionMessage msg_conv;
76478         msg_conv.inner = untag_ptr(msg);
76479         msg_conv.is_owned = ptr_is_owned(msg);
76480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
76481         msg_conv.is_owned = false;
76482         void* node_signer_ptr = untag_ptr(node_signer);
76483         CHECK_ACCESS(node_signer_ptr);
76484         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76485         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76487                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76488         }
76489         void* logger_ptr = untag_ptr(logger);
76490         CHECK_ACCESS(logger_ptr);
76491         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76492         if (logger_conv.free == LDKLogger_JCalls_free) {
76493                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76494                 LDKLogger_JCalls_cloned(&logger_conv);
76495         }
76496         void* custom_handler_ptr = untag_ptr(custom_handler);
76497         CHECK_ACCESS(custom_handler_ptr);
76498         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
76499         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
76500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76501                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
76502         }
76503         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
76504         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
76505         return tag_ptr(ret_conv, true);
76506 }
76507
76508 int64_t  CS_LDK_OnionMessenger_new(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) {
76509         void* entropy_source_ptr = untag_ptr(entropy_source);
76510         CHECK_ACCESS(entropy_source_ptr);
76511         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76512         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76513                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76514                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76515         }
76516         void* node_signer_ptr = untag_ptr(node_signer);
76517         CHECK_ACCESS(node_signer_ptr);
76518         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76519         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76520                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76521                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76522         }
76523         void* logger_ptr = untag_ptr(logger);
76524         CHECK_ACCESS(logger_ptr);
76525         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76526         if (logger_conv.free == LDKLogger_JCalls_free) {
76527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76528                 LDKLogger_JCalls_cloned(&logger_conv);
76529         }
76530         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
76531         CHECK_ACCESS(node_id_lookup_ptr);
76532         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
76533         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
76534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76535                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
76536         }
76537         void* message_router_ptr = untag_ptr(message_router);
76538         CHECK_ACCESS(message_router_ptr);
76539         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
76540         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
76541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76542                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
76543         }
76544         void* offers_handler_ptr = untag_ptr(offers_handler);
76545         CHECK_ACCESS(offers_handler_ptr);
76546         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
76547         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
76548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76549                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
76550         }
76551         void* custom_handler_ptr = untag_ptr(custom_handler);
76552         CHECK_ACCESS(custom_handler_ptr);
76553         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
76554         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
76555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76556                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
76557         }
76558         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);
76559         int64_t ret_ref = 0;
76560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76562         return ret_ref;
76563 }
76564
76565 int64_t  CS_LDK_OnionMessenger_send_onion_message(int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
76566         LDKOnionMessenger this_arg_conv;
76567         this_arg_conv.inner = untag_ptr(this_arg);
76568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76570         this_arg_conv.is_owned = false;
76571         void* contents_ptr = untag_ptr(contents);
76572         CHECK_ACCESS(contents_ptr);
76573         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
76574         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
76575                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76576                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
76577         }
76578         void* destination_ptr = untag_ptr(destination);
76579         CHECK_ACCESS(destination_ptr);
76580         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
76581         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
76582         LDKBlindedPath reply_path_conv;
76583         reply_path_conv.inner = untag_ptr(reply_path);
76584         reply_path_conv.is_owned = ptr_is_owned(reply_path);
76585         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
76586         reply_path_conv = BlindedPath_clone(&reply_path_conv);
76587         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
76588         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
76589         return tag_ptr(ret_conv, true);
76590 }
76591
76592 int64_t  CS_LDK_OnionMessenger_as_OnionMessageHandler(int64_t this_arg) {
76593         LDKOnionMessenger this_arg_conv;
76594         this_arg_conv.inner = untag_ptr(this_arg);
76595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76597         this_arg_conv.is_owned = false;
76598         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
76599         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
76600         return tag_ptr(ret_ret, true);
76601 }
76602
76603 void  CS_LDK_OffersMessageHandler_free(int64_t this_ptr) {
76604         if (!ptr_is_owned(this_ptr)) return;
76605         void* this_ptr_ptr = untag_ptr(this_ptr);
76606         CHECK_ACCESS(this_ptr_ptr);
76607         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
76608         FREE(untag_ptr(this_ptr));
76609         OffersMessageHandler_free(this_ptr_conv);
76610 }
76611
76612 void  CS_LDK_OffersMessage_free(int64_t this_ptr) {
76613         if (!ptr_is_owned(this_ptr)) return;
76614         void* this_ptr_ptr = untag_ptr(this_ptr);
76615         CHECK_ACCESS(this_ptr_ptr);
76616         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
76617         FREE(untag_ptr(this_ptr));
76618         OffersMessage_free(this_ptr_conv);
76619 }
76620
76621 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
76622         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76623         *ret_copy = OffersMessage_clone(arg);
76624         int64_t ret_ref = tag_ptr(ret_copy, true);
76625         return ret_ref;
76626 }
76627 int64_t  CS_LDK_OffersMessage_clone_ptr(int64_t arg) {
76628         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
76629         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
76630         return ret_conv;
76631 }
76632
76633 int64_t  CS_LDK_OffersMessage_clone(int64_t orig) {
76634         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
76635         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76636         *ret_copy = OffersMessage_clone(orig_conv);
76637         int64_t ret_ref = tag_ptr(ret_copy, true);
76638         return ret_ref;
76639 }
76640
76641 int64_t  CS_LDK_OffersMessage_invoice_request(int64_t a) {
76642         LDKInvoiceRequest a_conv;
76643         a_conv.inner = untag_ptr(a);
76644         a_conv.is_owned = ptr_is_owned(a);
76645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76646         a_conv = InvoiceRequest_clone(&a_conv);
76647         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76648         *ret_copy = OffersMessage_invoice_request(a_conv);
76649         int64_t ret_ref = tag_ptr(ret_copy, true);
76650         return ret_ref;
76651 }
76652
76653 int64_t  CS_LDK_OffersMessage_invoice(int64_t a) {
76654         LDKBolt12Invoice a_conv;
76655         a_conv.inner = untag_ptr(a);
76656         a_conv.is_owned = ptr_is_owned(a);
76657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76658         a_conv = Bolt12Invoice_clone(&a_conv);
76659         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76660         *ret_copy = OffersMessage_invoice(a_conv);
76661         int64_t ret_ref = tag_ptr(ret_copy, true);
76662         return ret_ref;
76663 }
76664
76665 int64_t  CS_LDK_OffersMessage_invoice_error(int64_t a) {
76666         LDKInvoiceError a_conv;
76667         a_conv.inner = untag_ptr(a);
76668         a_conv.is_owned = ptr_is_owned(a);
76669         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76670         a_conv = InvoiceError_clone(&a_conv);
76671         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
76672         *ret_copy = OffersMessage_invoice_error(a_conv);
76673         int64_t ret_ref = tag_ptr(ret_copy, true);
76674         return ret_ref;
76675 }
76676
76677 jboolean  CS_LDK_OffersMessage_is_known_type(int64_t tlv_type) {
76678         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
76679         return ret_conv;
76680 }
76681
76682 int64_t  CS_LDK_OffersMessage_as_OnionMessageContents(int64_t this_arg) {
76683         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
76684         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76685         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
76686         return tag_ptr(ret_ret, true);
76687 }
76688
76689 int8_tArray  CS_LDK_OffersMessage_write(int64_t obj) {
76690         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
76691         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
76692         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76693         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76694         CVec_u8Z_free(ret_var);
76695         return ret_arr;
76696 }
76697
76698 int64_t  CS_LDK_OffersMessage_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
76699         LDKu8slice ser_ref;
76700         ser_ref.datalen = ser->arr_len;
76701         ser_ref.data = ser->elems;
76702         void* arg_b_ptr = untag_ptr(arg_b);
76703         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
76704         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
76705         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
76706         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
76707         FREE(ser);
76708         return tag_ptr(ret_conv, true);
76709 }
76710
76711 void  CS_LDK_Packet_free(int64_t this_obj) {
76712         LDKPacket this_obj_conv;
76713         this_obj_conv.inner = untag_ptr(this_obj);
76714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76716         Packet_free(this_obj_conv);
76717 }
76718
76719 int8_t  CS_LDK_Packet_get_version(int64_t this_ptr) {
76720         LDKPacket this_ptr_conv;
76721         this_ptr_conv.inner = untag_ptr(this_ptr);
76722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76724         this_ptr_conv.is_owned = false;
76725         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
76726         return ret_conv;
76727 }
76728
76729 void  CS_LDK_Packet_set_version(int64_t this_ptr, int8_t val) {
76730         LDKPacket this_ptr_conv;
76731         this_ptr_conv.inner = untag_ptr(this_ptr);
76732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76734         this_ptr_conv.is_owned = false;
76735         Packet_set_version(&this_ptr_conv, val);
76736 }
76737
76738 int8_tArray  CS_LDK_Packet_get_public_key(int64_t this_ptr) {
76739         LDKPacket this_ptr_conv;
76740         this_ptr_conv.inner = untag_ptr(this_ptr);
76741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76743         this_ptr_conv.is_owned = false;
76744         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76745         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
76746         return ret_arr;
76747 }
76748
76749 void  CS_LDK_Packet_set_public_key(int64_t this_ptr, int8_tArray val) {
76750         LDKPacket this_ptr_conv;
76751         this_ptr_conv.inner = untag_ptr(this_ptr);
76752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76754         this_ptr_conv.is_owned = false;
76755         LDKPublicKey val_ref;
76756         CHECK(val->arr_len == 33);
76757         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76758         Packet_set_public_key(&this_ptr_conv, val_ref);
76759 }
76760
76761 int8_tArray  CS_LDK_Packet_get_hop_data(int64_t this_ptr) {
76762         LDKPacket this_ptr_conv;
76763         this_ptr_conv.inner = untag_ptr(this_ptr);
76764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76766         this_ptr_conv.is_owned = false;
76767         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
76768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76770         CVec_u8Z_free(ret_var);
76771         return ret_arr;
76772 }
76773
76774 void  CS_LDK_Packet_set_hop_data(int64_t this_ptr, int8_tArray val) {
76775         LDKPacket this_ptr_conv;
76776         this_ptr_conv.inner = untag_ptr(this_ptr);
76777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76779         this_ptr_conv.is_owned = false;
76780         LDKCVec_u8Z val_ref;
76781         val_ref.datalen = val->arr_len;
76782         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76783         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
76784         Packet_set_hop_data(&this_ptr_conv, val_ref);
76785 }
76786
76787 int8_tArray  CS_LDK_Packet_get_hmac(int64_t this_ptr) {
76788         LDKPacket this_ptr_conv;
76789         this_ptr_conv.inner = untag_ptr(this_ptr);
76790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76792         this_ptr_conv.is_owned = false;
76793         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76794         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
76795         return ret_arr;
76796 }
76797
76798 void  CS_LDK_Packet_set_hmac(int64_t this_ptr, int8_tArray val) {
76799         LDKPacket this_ptr_conv;
76800         this_ptr_conv.inner = untag_ptr(this_ptr);
76801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76803         this_ptr_conv.is_owned = false;
76804         LDKThirtyTwoBytes val_ref;
76805         CHECK(val->arr_len == 32);
76806         memcpy(val_ref.data, val->elems, 32); FREE(val);
76807         Packet_set_hmac(&this_ptr_conv, val_ref);
76808 }
76809
76810 int64_t  CS_LDK_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
76811         LDKPublicKey public_key_arg_ref;
76812         CHECK(public_key_arg->arr_len == 33);
76813         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
76814         LDKCVec_u8Z hop_data_arg_ref;
76815         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
76816         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76817         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
76818         LDKThirtyTwoBytes hmac_arg_ref;
76819         CHECK(hmac_arg->arr_len == 32);
76820         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
76821         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
76822         int64_t ret_ref = 0;
76823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76825         return ret_ref;
76826 }
76827
76828 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
76829         LDKPacket ret_var = Packet_clone(arg);
76830         int64_t ret_ref = 0;
76831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76833         return ret_ref;
76834 }
76835 int64_t  CS_LDK_Packet_clone_ptr(int64_t arg) {
76836         LDKPacket arg_conv;
76837         arg_conv.inner = untag_ptr(arg);
76838         arg_conv.is_owned = ptr_is_owned(arg);
76839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76840         arg_conv.is_owned = false;
76841         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
76842         return ret_conv;
76843 }
76844
76845 int64_t  CS_LDK_Packet_clone(int64_t orig) {
76846         LDKPacket orig_conv;
76847         orig_conv.inner = untag_ptr(orig);
76848         orig_conv.is_owned = ptr_is_owned(orig);
76849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76850         orig_conv.is_owned = false;
76851         LDKPacket ret_var = Packet_clone(&orig_conv);
76852         int64_t ret_ref = 0;
76853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76855         return ret_ref;
76856 }
76857
76858 int64_t  CS_LDK_Packet_hash(int64_t o) {
76859         LDKPacket o_conv;
76860         o_conv.inner = untag_ptr(o);
76861         o_conv.is_owned = ptr_is_owned(o);
76862         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76863         o_conv.is_owned = false;
76864         int64_t ret_conv = Packet_hash(&o_conv);
76865         return ret_conv;
76866 }
76867
76868 jboolean  CS_LDK_Packet_eq(int64_t a, int64_t b) {
76869         LDKPacket a_conv;
76870         a_conv.inner = untag_ptr(a);
76871         a_conv.is_owned = ptr_is_owned(a);
76872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76873         a_conv.is_owned = false;
76874         LDKPacket b_conv;
76875         b_conv.inner = untag_ptr(b);
76876         b_conv.is_owned = ptr_is_owned(b);
76877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76878         b_conv.is_owned = false;
76879         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
76880         return ret_conv;
76881 }
76882
76883 int8_tArray  CS_LDK_Packet_write(int64_t obj) {
76884         LDKPacket obj_conv;
76885         obj_conv.inner = untag_ptr(obj);
76886         obj_conv.is_owned = ptr_is_owned(obj);
76887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76888         obj_conv.is_owned = false;
76889         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
76890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76892         CVec_u8Z_free(ret_var);
76893         return ret_arr;
76894 }
76895
76896 void  CS_LDK_ParsedOnionMessageContents_free(int64_t this_ptr) {
76897         if (!ptr_is_owned(this_ptr)) return;
76898         void* this_ptr_ptr = untag_ptr(this_ptr);
76899         CHECK_ACCESS(this_ptr_ptr);
76900         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
76901         FREE(untag_ptr(this_ptr));
76902         ParsedOnionMessageContents_free(this_ptr_conv);
76903 }
76904
76905 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
76906         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76907         *ret_copy = ParsedOnionMessageContents_clone(arg);
76908         int64_t ret_ref = tag_ptr(ret_copy, true);
76909         return ret_ref;
76910 }
76911 int64_t  CS_LDK_ParsedOnionMessageContents_clone_ptr(int64_t arg) {
76912         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
76913         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
76914         return ret_conv;
76915 }
76916
76917 int64_t  CS_LDK_ParsedOnionMessageContents_clone(int64_t orig) {
76918         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
76919         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76920         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
76921         int64_t ret_ref = tag_ptr(ret_copy, true);
76922         return ret_ref;
76923 }
76924
76925 int64_t  CS_LDK_ParsedOnionMessageContents_offers(int64_t a) {
76926         void* a_ptr = untag_ptr(a);
76927         CHECK_ACCESS(a_ptr);
76928         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
76929         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
76930         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76931         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
76932         int64_t ret_ref = tag_ptr(ret_copy, true);
76933         return ret_ref;
76934 }
76935
76936 int64_t  CS_LDK_ParsedOnionMessageContents_custom(int64_t a) {
76937         void* a_ptr = untag_ptr(a);
76938         CHECK_ACCESS(a_ptr);
76939         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
76940         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
76941                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76942                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
76943         }
76944         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76945         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
76946         int64_t ret_ref = tag_ptr(ret_copy, true);
76947         return ret_ref;
76948 }
76949
76950 int64_t  CS_LDK_ParsedOnionMessageContents_as_OnionMessageContents(int64_t this_arg) {
76951         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
76952         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76953         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
76954         return tag_ptr(ret_ret, true);
76955 }
76956
76957 int8_tArray  CS_LDK_ParsedOnionMessageContents_write(int64_t obj) {
76958         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
76959         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
76960         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76961         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76962         CVec_u8Z_free(ret_var);
76963         return ret_arr;
76964 }
76965
76966 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
76967         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76968         *ret_ret = OnionMessageContents_clone(arg);
76969         return tag_ptr(ret_ret, true);
76970 }
76971 int64_t  CS_LDK_OnionMessageContents_clone_ptr(int64_t arg) {
76972         void* arg_ptr = untag_ptr(arg);
76973         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76974         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
76975         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
76976         return ret_conv;
76977 }
76978
76979 int64_t  CS_LDK_OnionMessageContents_clone(int64_t orig) {
76980         void* orig_ptr = untag_ptr(orig);
76981         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76982         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
76983         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76984         *ret_ret = OnionMessageContents_clone(orig_conv);
76985         return tag_ptr(ret_ret, true);
76986 }
76987
76988 void  CS_LDK_OnionMessageContents_free(int64_t this_ptr) {
76989         if (!ptr_is_owned(this_ptr)) return;
76990         void* this_ptr_ptr = untag_ptr(this_ptr);
76991         CHECK_ACCESS(this_ptr_ptr);
76992         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
76993         FREE(untag_ptr(this_ptr));
76994         OnionMessageContents_free(this_ptr_conv);
76995 }
76996
76997 void  CS_LDK_NextMessageHop_free(int64_t this_ptr) {
76998         if (!ptr_is_owned(this_ptr)) return;
76999         void* this_ptr_ptr = untag_ptr(this_ptr);
77000         CHECK_ACCESS(this_ptr_ptr);
77001         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
77002         FREE(untag_ptr(this_ptr));
77003         NextMessageHop_free(this_ptr_conv);
77004 }
77005
77006 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
77007         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77008         *ret_copy = NextMessageHop_clone(arg);
77009         int64_t ret_ref = tag_ptr(ret_copy, true);
77010         return ret_ref;
77011 }
77012 int64_t  CS_LDK_NextMessageHop_clone_ptr(int64_t arg) {
77013         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
77014         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
77015         return ret_conv;
77016 }
77017
77018 int64_t  CS_LDK_NextMessageHop_clone(int64_t orig) {
77019         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
77020         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77021         *ret_copy = NextMessageHop_clone(orig_conv);
77022         int64_t ret_ref = tag_ptr(ret_copy, true);
77023         return ret_ref;
77024 }
77025
77026 int64_t  CS_LDK_NextMessageHop_node_id(int8_tArray a) {
77027         LDKPublicKey a_ref;
77028         CHECK(a->arr_len == 33);
77029         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77030         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77031         *ret_copy = NextMessageHop_node_id(a_ref);
77032         int64_t ret_ref = tag_ptr(ret_copy, true);
77033         return ret_ref;
77034 }
77035
77036 int64_t  CS_LDK_NextMessageHop_short_channel_id(int64_t a) {
77037         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
77038         *ret_copy = NextMessageHop_short_channel_id(a);
77039         int64_t ret_ref = tag_ptr(ret_copy, true);
77040         return ret_ref;
77041 }
77042
77043 int64_t  CS_LDK_NextMessageHop_hash(int64_t o) {
77044         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
77045         int64_t ret_conv = NextMessageHop_hash(o_conv);
77046         return ret_conv;
77047 }
77048
77049 jboolean  CS_LDK_NextMessageHop_eq(int64_t a, int64_t b) {
77050         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
77051         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
77052         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
77053         return ret_conv;
77054 }
77055
77056 void  CS_LDK_BlindedPath_free(int64_t this_obj) {
77057         LDKBlindedPath this_obj_conv;
77058         this_obj_conv.inner = untag_ptr(this_obj);
77059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77061         BlindedPath_free(this_obj_conv);
77062 }
77063
77064 int64_t  CS_LDK_BlindedPath_get_introduction_node(int64_t this_ptr) {
77065         LDKBlindedPath this_ptr_conv;
77066         this_ptr_conv.inner = untag_ptr(this_ptr);
77067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77069         this_ptr_conv.is_owned = false;
77070         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
77071         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
77072         int64_t ret_ref = tag_ptr(ret_copy, true);
77073         return ret_ref;
77074 }
77075
77076 void  CS_LDK_BlindedPath_set_introduction_node(int64_t this_ptr, int64_t val) {
77077         LDKBlindedPath this_ptr_conv;
77078         this_ptr_conv.inner = untag_ptr(this_ptr);
77079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77081         this_ptr_conv.is_owned = false;
77082         void* val_ptr = untag_ptr(val);
77083         CHECK_ACCESS(val_ptr);
77084         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
77085         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
77086         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
77087 }
77088
77089 int8_tArray  CS_LDK_BlindedPath_get_blinding_point(int64_t this_ptr) {
77090         LDKBlindedPath this_ptr_conv;
77091         this_ptr_conv.inner = untag_ptr(this_ptr);
77092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77094         this_ptr_conv.is_owned = false;
77095         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77096         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
77097         return ret_arr;
77098 }
77099
77100 void  CS_LDK_BlindedPath_set_blinding_point(int64_t this_ptr, int8_tArray val) {
77101         LDKBlindedPath this_ptr_conv;
77102         this_ptr_conv.inner = untag_ptr(this_ptr);
77103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77105         this_ptr_conv.is_owned = false;
77106         LDKPublicKey val_ref;
77107         CHECK(val->arr_len == 33);
77108         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77109         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
77110 }
77111
77112 int64_tArray  CS_LDK_BlindedPath_get_blinded_hops(int64_t this_ptr) {
77113         LDKBlindedPath this_ptr_conv;
77114         this_ptr_conv.inner = untag_ptr(this_ptr);
77115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77117         this_ptr_conv.is_owned = false;
77118         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
77119         int64_tArray ret_arr = NULL;
77120         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
77121         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
77122         for (size_t m = 0; m < ret_var.datalen; m++) {
77123                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
77124                 int64_t ret_conv_12_ref = 0;
77125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
77126                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
77127                 ret_arr_ptr[m] = ret_conv_12_ref;
77128         }
77129         
77130         FREE(ret_var.data);
77131         return ret_arr;
77132 }
77133
77134 void  CS_LDK_BlindedPath_set_blinded_hops(int64_t this_ptr, int64_tArray val) {
77135         LDKBlindedPath this_ptr_conv;
77136         this_ptr_conv.inner = untag_ptr(this_ptr);
77137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77139         this_ptr_conv.is_owned = false;
77140         LDKCVec_BlindedHopZ val_constr;
77141         val_constr.datalen = val->arr_len;
77142         if (val_constr.datalen > 0)
77143                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
77144         else
77145                 val_constr.data = NULL;
77146         int64_t* val_vals = val->elems;
77147         for (size_t m = 0; m < val_constr.datalen; m++) {
77148                 int64_t val_conv_12 = val_vals[m];
77149                 LDKBlindedHop val_conv_12_conv;
77150                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
77151                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
77152                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
77153                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
77154                 val_constr.data[m] = val_conv_12_conv;
77155         }
77156         FREE(val);
77157         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
77158 }
77159
77160 int64_t  CS_LDK_BlindedPath_new(int64_t introduction_node_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
77161         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
77162         CHECK_ACCESS(introduction_node_arg_ptr);
77163         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
77164         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
77165         LDKPublicKey blinding_point_arg_ref;
77166         CHECK(blinding_point_arg->arr_len == 33);
77167         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
77168         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
77169         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
77170         if (blinded_hops_arg_constr.datalen > 0)
77171                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
77172         else
77173                 blinded_hops_arg_constr.data = NULL;
77174         int64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
77175         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
77176                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
77177                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
77178                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
77179                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
77180                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
77181                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
77182                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
77183         }
77184         FREE(blinded_hops_arg);
77185         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
77186         int64_t ret_ref = 0;
77187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77189         return ret_ref;
77190 }
77191
77192 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
77193         LDKBlindedPath ret_var = BlindedPath_clone(arg);
77194         int64_t ret_ref = 0;
77195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77197         return ret_ref;
77198 }
77199 int64_t  CS_LDK_BlindedPath_clone_ptr(int64_t arg) {
77200         LDKBlindedPath arg_conv;
77201         arg_conv.inner = untag_ptr(arg);
77202         arg_conv.is_owned = ptr_is_owned(arg);
77203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77204         arg_conv.is_owned = false;
77205         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
77206         return ret_conv;
77207 }
77208
77209 int64_t  CS_LDK_BlindedPath_clone(int64_t orig) {
77210         LDKBlindedPath orig_conv;
77211         orig_conv.inner = untag_ptr(orig);
77212         orig_conv.is_owned = ptr_is_owned(orig);
77213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77214         orig_conv.is_owned = false;
77215         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
77216         int64_t ret_ref = 0;
77217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77219         return ret_ref;
77220 }
77221
77222 int64_t  CS_LDK_BlindedPath_hash(int64_t o) {
77223         LDKBlindedPath o_conv;
77224         o_conv.inner = untag_ptr(o);
77225         o_conv.is_owned = ptr_is_owned(o);
77226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77227         o_conv.is_owned = false;
77228         int64_t ret_conv = BlindedPath_hash(&o_conv);
77229         return ret_conv;
77230 }
77231
77232 jboolean  CS_LDK_BlindedPath_eq(int64_t a, int64_t b) {
77233         LDKBlindedPath a_conv;
77234         a_conv.inner = untag_ptr(a);
77235         a_conv.is_owned = ptr_is_owned(a);
77236         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77237         a_conv.is_owned = false;
77238         LDKBlindedPath b_conv;
77239         b_conv.inner = untag_ptr(b);
77240         b_conv.is_owned = ptr_is_owned(b);
77241         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77242         b_conv.is_owned = false;
77243         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
77244         return ret_conv;
77245 }
77246
77247 void  CS_LDK_IntroductionNode_free(int64_t this_ptr) {
77248         if (!ptr_is_owned(this_ptr)) return;
77249         void* this_ptr_ptr = untag_ptr(this_ptr);
77250         CHECK_ACCESS(this_ptr_ptr);
77251         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
77252         FREE(untag_ptr(this_ptr));
77253         IntroductionNode_free(this_ptr_conv);
77254 }
77255
77256 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
77257         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
77258         *ret_copy = IntroductionNode_clone(arg);
77259         int64_t ret_ref = tag_ptr(ret_copy, true);
77260         return ret_ref;
77261 }
77262 int64_t  CS_LDK_IntroductionNode_clone_ptr(int64_t arg) {
77263         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
77264         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
77265         return ret_conv;
77266 }
77267
77268 int64_t  CS_LDK_IntroductionNode_clone(int64_t orig) {
77269         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
77270         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
77271         *ret_copy = IntroductionNode_clone(orig_conv);
77272         int64_t ret_ref = tag_ptr(ret_copy, true);
77273         return ret_ref;
77274 }
77275
77276 int64_t  CS_LDK_IntroductionNode_node_id(int8_tArray a) {
77277         LDKPublicKey a_ref;
77278         CHECK(a->arr_len == 33);
77279         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77280         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
77281         *ret_copy = IntroductionNode_node_id(a_ref);
77282         int64_t ret_ref = tag_ptr(ret_copy, true);
77283         return ret_ref;
77284 }
77285
77286 int64_t  CS_LDK_IntroductionNode_directed_short_channel_id(int32_t a, int64_t b) {
77287         LDKDirection a_conv = LDKDirection_from_cs(a);
77288         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
77289         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
77290         int64_t ret_ref = tag_ptr(ret_copy, true);
77291         return ret_ref;
77292 }
77293
77294 int64_t  CS_LDK_IntroductionNode_hash(int64_t o) {
77295         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
77296         int64_t ret_conv = IntroductionNode_hash(o_conv);
77297         return ret_conv;
77298 }
77299
77300 jboolean  CS_LDK_IntroductionNode_eq(int64_t a, int64_t b) {
77301         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
77302         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
77303         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
77304         return ret_conv;
77305 }
77306
77307 int32_t  CS_LDK_Direction_clone(int64_t orig) {
77308         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
77309         int32_t ret_conv = LDKDirection_to_cs(Direction_clone(orig_conv));
77310         return ret_conv;
77311 }
77312
77313 int32_t  CS_LDK_Direction_node_one() {
77314         int32_t ret_conv = LDKDirection_to_cs(Direction_node_one());
77315         return ret_conv;
77316 }
77317
77318 int32_t  CS_LDK_Direction_node_two() {
77319         int32_t ret_conv = LDKDirection_to_cs(Direction_node_two());
77320         return ret_conv;
77321 }
77322
77323 int64_t  CS_LDK_Direction_hash(int64_t o) {
77324         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
77325         int64_t ret_conv = Direction_hash(o_conv);
77326         return ret_conv;
77327 }
77328
77329 jboolean  CS_LDK_Direction_eq(int64_t a, int64_t b) {
77330         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
77331         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
77332         jboolean ret_conv = Direction_eq(a_conv, b_conv);
77333         return ret_conv;
77334 }
77335
77336 void  CS_LDK_NodeIdLookUp_free(int64_t this_ptr) {
77337         if (!ptr_is_owned(this_ptr)) return;
77338         void* this_ptr_ptr = untag_ptr(this_ptr);
77339         CHECK_ACCESS(this_ptr_ptr);
77340         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
77341         FREE(untag_ptr(this_ptr));
77342         NodeIdLookUp_free(this_ptr_conv);
77343 }
77344
77345 void  CS_LDK_EmptyNodeIdLookUp_free(int64_t this_obj) {
77346         LDKEmptyNodeIdLookUp this_obj_conv;
77347         this_obj_conv.inner = untag_ptr(this_obj);
77348         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77350         EmptyNodeIdLookUp_free(this_obj_conv);
77351 }
77352
77353 int64_t  CS_LDK_EmptyNodeIdLookUp_new() {
77354         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
77355         int64_t ret_ref = 0;
77356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77358         return ret_ref;
77359 }
77360
77361 int64_t  CS_LDK_EmptyNodeIdLookUp_as_NodeIdLookUp(int64_t this_arg) {
77362         LDKEmptyNodeIdLookUp this_arg_conv;
77363         this_arg_conv.inner = untag_ptr(this_arg);
77364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77366         this_arg_conv.is_owned = false;
77367         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
77368         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
77369         return tag_ptr(ret_ret, true);
77370 }
77371
77372 void  CS_LDK_BlindedHop_free(int64_t this_obj) {
77373         LDKBlindedHop this_obj_conv;
77374         this_obj_conv.inner = untag_ptr(this_obj);
77375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77377         BlindedHop_free(this_obj_conv);
77378 }
77379
77380 int8_tArray  CS_LDK_BlindedHop_get_blinded_node_id(int64_t this_ptr) {
77381         LDKBlindedHop this_ptr_conv;
77382         this_ptr_conv.inner = untag_ptr(this_ptr);
77383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77385         this_ptr_conv.is_owned = false;
77386         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77387         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
77388         return ret_arr;
77389 }
77390
77391 void  CS_LDK_BlindedHop_set_blinded_node_id(int64_t this_ptr, int8_tArray val) {
77392         LDKBlindedHop this_ptr_conv;
77393         this_ptr_conv.inner = untag_ptr(this_ptr);
77394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77396         this_ptr_conv.is_owned = false;
77397         LDKPublicKey val_ref;
77398         CHECK(val->arr_len == 33);
77399         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77400         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
77401 }
77402
77403 int8_tArray  CS_LDK_BlindedHop_get_encrypted_payload(int64_t this_ptr) {
77404         LDKBlindedHop this_ptr_conv;
77405         this_ptr_conv.inner = untag_ptr(this_ptr);
77406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77408         this_ptr_conv.is_owned = false;
77409         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
77410         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77411         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77412         CVec_u8Z_free(ret_var);
77413         return ret_arr;
77414 }
77415
77416 void  CS_LDK_BlindedHop_set_encrypted_payload(int64_t this_ptr, int8_tArray val) {
77417         LDKBlindedHop this_ptr_conv;
77418         this_ptr_conv.inner = untag_ptr(this_ptr);
77419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77421         this_ptr_conv.is_owned = false;
77422         LDKCVec_u8Z val_ref;
77423         val_ref.datalen = val->arr_len;
77424         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
77425         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
77426         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
77427 }
77428
77429 int64_t  CS_LDK_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
77430         LDKPublicKey blinded_node_id_arg_ref;
77431         CHECK(blinded_node_id_arg->arr_len == 33);
77432         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
77433         LDKCVec_u8Z encrypted_payload_arg_ref;
77434         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
77435         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
77436         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
77437         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
77438         int64_t ret_ref = 0;
77439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77441         return ret_ref;
77442 }
77443
77444 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
77445         LDKBlindedHop ret_var = BlindedHop_clone(arg);
77446         int64_t ret_ref = 0;
77447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77449         return ret_ref;
77450 }
77451 int64_t  CS_LDK_BlindedHop_clone_ptr(int64_t arg) {
77452         LDKBlindedHop arg_conv;
77453         arg_conv.inner = untag_ptr(arg);
77454         arg_conv.is_owned = ptr_is_owned(arg);
77455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77456         arg_conv.is_owned = false;
77457         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
77458         return ret_conv;
77459 }
77460
77461 int64_t  CS_LDK_BlindedHop_clone(int64_t orig) {
77462         LDKBlindedHop orig_conv;
77463         orig_conv.inner = untag_ptr(orig);
77464         orig_conv.is_owned = ptr_is_owned(orig);
77465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77466         orig_conv.is_owned = false;
77467         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
77468         int64_t ret_ref = 0;
77469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77471         return ret_ref;
77472 }
77473
77474 int64_t  CS_LDK_BlindedHop_hash(int64_t o) {
77475         LDKBlindedHop o_conv;
77476         o_conv.inner = untag_ptr(o);
77477         o_conv.is_owned = ptr_is_owned(o);
77478         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77479         o_conv.is_owned = false;
77480         int64_t ret_conv = BlindedHop_hash(&o_conv);
77481         return ret_conv;
77482 }
77483
77484 jboolean  CS_LDK_BlindedHop_eq(int64_t a, int64_t b) {
77485         LDKBlindedHop a_conv;
77486         a_conv.inner = untag_ptr(a);
77487         a_conv.is_owned = ptr_is_owned(a);
77488         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77489         a_conv.is_owned = false;
77490         LDKBlindedHop b_conv;
77491         b_conv.inner = untag_ptr(b);
77492         b_conv.is_owned = ptr_is_owned(b);
77493         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77494         b_conv.is_owned = false;
77495         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
77496         return ret_conv;
77497 }
77498
77499 int64_t  CS_LDK_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, int64_t entropy_source) {
77500         LDKPublicKey recipient_node_id_ref;
77501         CHECK(recipient_node_id->arr_len == 33);
77502         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
77503         void* entropy_source_ptr = untag_ptr(entropy_source);
77504         CHECK_ACCESS(entropy_source_ptr);
77505         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77506         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77508                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77509         }
77510         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
77511         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
77512         return tag_ptr(ret_conv, true);
77513 }
77514
77515 int64_t  CS_LDK_BlindedPath_new_for_message(ptrArray node_pks, int64_t entropy_source) {
77516         LDKCVec_PublicKeyZ node_pks_constr;
77517         node_pks_constr.datalen = node_pks->arr_len;
77518         if (node_pks_constr.datalen > 0)
77519                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
77520         else
77521                 node_pks_constr.data = NULL;
77522         int8_tArray* node_pks_vals = (void*) node_pks->elems;
77523         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
77524                 int8_tArray node_pks_conv_8 = node_pks_vals[i];
77525                 LDKPublicKey node_pks_conv_8_ref;
77526                 CHECK(node_pks_conv_8->arr_len == 33);
77527                 memcpy(node_pks_conv_8_ref.compressed_form, node_pks_conv_8->elems, 33); FREE(node_pks_conv_8);
77528                 node_pks_constr.data[i] = node_pks_conv_8_ref;
77529         }
77530         FREE(node_pks);
77531         void* entropy_source_ptr = untag_ptr(entropy_source);
77532         CHECK_ACCESS(entropy_source_ptr);
77533         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77534         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77535                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77536                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77537         }
77538         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
77539         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
77540         return tag_ptr(ret_conv, true);
77541 }
77542
77543 int64_t  CS_LDK_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, int64_t payee_tlvs, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
77544         LDKPublicKey payee_node_id_ref;
77545         CHECK(payee_node_id->arr_len == 33);
77546         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
77547         LDKReceiveTlvs payee_tlvs_conv;
77548         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77549         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77550         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77551         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77552         void* entropy_source_ptr = untag_ptr(entropy_source);
77553         CHECK_ACCESS(entropy_source_ptr);
77554         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77555         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77556                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77557                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77558         }
77559         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77560         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
77561         return tag_ptr(ret_conv, true);
77562 }
77563
77564 int64_t  CS_LDK_BlindedPath_new_for_payment(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) {
77565         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
77566         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
77567         if (intermediate_nodes_constr.datalen > 0)
77568                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
77569         else
77570                 intermediate_nodes_constr.data = NULL;
77571         int64_t* intermediate_nodes_vals = intermediate_nodes->elems;
77572         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
77573                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
77574                 LDKForwardNode intermediate_nodes_conv_13_conv;
77575                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
77576                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
77577                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
77578                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
77579                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
77580         }
77581         FREE(intermediate_nodes);
77582         LDKPublicKey payee_node_id_ref;
77583         CHECK(payee_node_id->arr_len == 33);
77584         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
77585         LDKReceiveTlvs payee_tlvs_conv;
77586         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
77587         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
77588         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
77589         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
77590         void* entropy_source_ptr = untag_ptr(entropy_source);
77591         CHECK_ACCESS(entropy_source_ptr);
77592         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77593         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77594                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77595                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77596         }
77597         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
77598         *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);
77599         return tag_ptr(ret_conv, true);
77600 }
77601
77602 int64_t  CS_LDK_BlindedPath_public_introduction_node_id(int64_t this_arg, int64_t network_graph) {
77603         LDKBlindedPath this_arg_conv;
77604         this_arg_conv.inner = untag_ptr(this_arg);
77605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77607         this_arg_conv.is_owned = false;
77608         LDKReadOnlyNetworkGraph network_graph_conv;
77609         network_graph_conv.inner = untag_ptr(network_graph);
77610         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77611         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77612         network_graph_conv.is_owned = false;
77613         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
77614         int64_t ret_ref = 0;
77615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77617         return ret_ref;
77618 }
77619
77620 int8_tArray  CS_LDK_BlindedPath_write(int64_t obj) {
77621         LDKBlindedPath obj_conv;
77622         obj_conv.inner = untag_ptr(obj);
77623         obj_conv.is_owned = ptr_is_owned(obj);
77624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77625         obj_conv.is_owned = false;
77626         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
77627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77629         CVec_u8Z_free(ret_var);
77630         return ret_arr;
77631 }
77632
77633 int64_t  CS_LDK_BlindedPath_read(int8_tArray ser) {
77634         LDKu8slice ser_ref;
77635         ser_ref.datalen = ser->arr_len;
77636         ser_ref.data = ser->elems;
77637         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
77638         *ret_conv = BlindedPath_read(ser_ref);
77639         FREE(ser);
77640         return tag_ptr(ret_conv, true);
77641 }
77642
77643 int8_tArray  CS_LDK_BlindedHop_write(int64_t obj) {
77644         LDKBlindedHop obj_conv;
77645         obj_conv.inner = untag_ptr(obj);
77646         obj_conv.is_owned = ptr_is_owned(obj);
77647         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77648         obj_conv.is_owned = false;
77649         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
77650         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77651         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77652         CVec_u8Z_free(ret_var);
77653         return ret_arr;
77654 }
77655
77656 int64_t  CS_LDK_BlindedHop_read(int8_tArray ser) {
77657         LDKu8slice ser_ref;
77658         ser_ref.datalen = ser->arr_len;
77659         ser_ref.data = ser->elems;
77660         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
77661         *ret_conv = BlindedHop_read(ser_ref);
77662         FREE(ser);
77663         return tag_ptr(ret_conv, true);
77664 }
77665
77666 void  CS_LDK_ForwardNode_free(int64_t this_obj) {
77667         LDKForwardNode this_obj_conv;
77668         this_obj_conv.inner = untag_ptr(this_obj);
77669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77671         ForwardNode_free(this_obj_conv);
77672 }
77673
77674 int64_t  CS_LDK_ForwardNode_get_tlvs(int64_t this_ptr) {
77675         LDKForwardNode this_ptr_conv;
77676         this_ptr_conv.inner = untag_ptr(this_ptr);
77677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77679         this_ptr_conv.is_owned = false;
77680         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
77681         int64_t ret_ref = 0;
77682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77684         return ret_ref;
77685 }
77686
77687 void  CS_LDK_ForwardNode_set_tlvs(int64_t this_ptr, int64_t val) {
77688         LDKForwardNode this_ptr_conv;
77689         this_ptr_conv.inner = untag_ptr(this_ptr);
77690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77692         this_ptr_conv.is_owned = false;
77693         LDKForwardTlvs val_conv;
77694         val_conv.inner = untag_ptr(val);
77695         val_conv.is_owned = ptr_is_owned(val);
77696         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77697         val_conv = ForwardTlvs_clone(&val_conv);
77698         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
77699 }
77700
77701 int8_tArray  CS_LDK_ForwardNode_get_node_id(int64_t this_ptr) {
77702         LDKForwardNode this_ptr_conv;
77703         this_ptr_conv.inner = untag_ptr(this_ptr);
77704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77706         this_ptr_conv.is_owned = false;
77707         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77708         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
77709         return ret_arr;
77710 }
77711
77712 void  CS_LDK_ForwardNode_set_node_id(int64_t this_ptr, int8_tArray val) {
77713         LDKForwardNode this_ptr_conv;
77714         this_ptr_conv.inner = untag_ptr(this_ptr);
77715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77717         this_ptr_conv.is_owned = false;
77718         LDKPublicKey val_ref;
77719         CHECK(val->arr_len == 33);
77720         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
77721         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
77722 }
77723
77724 int64_t  CS_LDK_ForwardNode_get_htlc_maximum_msat(int64_t this_ptr) {
77725         LDKForwardNode this_ptr_conv;
77726         this_ptr_conv.inner = untag_ptr(this_ptr);
77727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77729         this_ptr_conv.is_owned = false;
77730         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
77731         return ret_conv;
77732 }
77733
77734 void  CS_LDK_ForwardNode_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
77735         LDKForwardNode this_ptr_conv;
77736         this_ptr_conv.inner = untag_ptr(this_ptr);
77737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77739         this_ptr_conv.is_owned = false;
77740         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
77741 }
77742
77743 int64_t  CS_LDK_ForwardNode_new(int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
77744         LDKForwardTlvs tlvs_arg_conv;
77745         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
77746         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
77747         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
77748         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
77749         LDKPublicKey node_id_arg_ref;
77750         CHECK(node_id_arg->arr_len == 33);
77751         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
77752         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
77753         int64_t ret_ref = 0;
77754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77756         return ret_ref;
77757 }
77758
77759 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
77760         LDKForwardNode ret_var = ForwardNode_clone(arg);
77761         int64_t ret_ref = 0;
77762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77764         return ret_ref;
77765 }
77766 int64_t  CS_LDK_ForwardNode_clone_ptr(int64_t arg) {
77767         LDKForwardNode arg_conv;
77768         arg_conv.inner = untag_ptr(arg);
77769         arg_conv.is_owned = ptr_is_owned(arg);
77770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77771         arg_conv.is_owned = false;
77772         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
77773         return ret_conv;
77774 }
77775
77776 int64_t  CS_LDK_ForwardNode_clone(int64_t orig) {
77777         LDKForwardNode orig_conv;
77778         orig_conv.inner = untag_ptr(orig);
77779         orig_conv.is_owned = ptr_is_owned(orig);
77780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77781         orig_conv.is_owned = false;
77782         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
77783         int64_t ret_ref = 0;
77784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77786         return ret_ref;
77787 }
77788
77789 void  CS_LDK_ForwardTlvs_free(int64_t this_obj) {
77790         LDKForwardTlvs this_obj_conv;
77791         this_obj_conv.inner = untag_ptr(this_obj);
77792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77794         ForwardTlvs_free(this_obj_conv);
77795 }
77796
77797 int64_t  CS_LDK_ForwardTlvs_get_short_channel_id(int64_t this_ptr) {
77798         LDKForwardTlvs this_ptr_conv;
77799         this_ptr_conv.inner = untag_ptr(this_ptr);
77800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77802         this_ptr_conv.is_owned = false;
77803         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
77804         return ret_conv;
77805 }
77806
77807 void  CS_LDK_ForwardTlvs_set_short_channel_id(int64_t this_ptr, int64_t val) {
77808         LDKForwardTlvs this_ptr_conv;
77809         this_ptr_conv.inner = untag_ptr(this_ptr);
77810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77812         this_ptr_conv.is_owned = false;
77813         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
77814 }
77815
77816 int64_t  CS_LDK_ForwardTlvs_get_payment_relay(int64_t this_ptr) {
77817         LDKForwardTlvs this_ptr_conv;
77818         this_ptr_conv.inner = untag_ptr(this_ptr);
77819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77821         this_ptr_conv.is_owned = false;
77822         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
77823         int64_t ret_ref = 0;
77824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77826         return ret_ref;
77827 }
77828
77829 void  CS_LDK_ForwardTlvs_set_payment_relay(int64_t this_ptr, int64_t val) {
77830         LDKForwardTlvs this_ptr_conv;
77831         this_ptr_conv.inner = untag_ptr(this_ptr);
77832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77834         this_ptr_conv.is_owned = false;
77835         LDKPaymentRelay val_conv;
77836         val_conv.inner = untag_ptr(val);
77837         val_conv.is_owned = ptr_is_owned(val);
77838         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77839         val_conv = PaymentRelay_clone(&val_conv);
77840         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
77841 }
77842
77843 int64_t  CS_LDK_ForwardTlvs_get_payment_constraints(int64_t this_ptr) {
77844         LDKForwardTlvs this_ptr_conv;
77845         this_ptr_conv.inner = untag_ptr(this_ptr);
77846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77848         this_ptr_conv.is_owned = false;
77849         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
77850         int64_t ret_ref = 0;
77851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77853         return ret_ref;
77854 }
77855
77856 void  CS_LDK_ForwardTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
77857         LDKForwardTlvs this_ptr_conv;
77858         this_ptr_conv.inner = untag_ptr(this_ptr);
77859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77861         this_ptr_conv.is_owned = false;
77862         LDKPaymentConstraints val_conv;
77863         val_conv.inner = untag_ptr(val);
77864         val_conv.is_owned = ptr_is_owned(val);
77865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77866         val_conv = PaymentConstraints_clone(&val_conv);
77867         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
77868 }
77869
77870 int64_t  CS_LDK_ForwardTlvs_get_features(int64_t this_ptr) {
77871         LDKForwardTlvs this_ptr_conv;
77872         this_ptr_conv.inner = untag_ptr(this_ptr);
77873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77875         this_ptr_conv.is_owned = false;
77876         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
77877         int64_t ret_ref = 0;
77878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77880         return ret_ref;
77881 }
77882
77883 void  CS_LDK_ForwardTlvs_set_features(int64_t this_ptr, int64_t val) {
77884         LDKForwardTlvs this_ptr_conv;
77885         this_ptr_conv.inner = untag_ptr(this_ptr);
77886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77888         this_ptr_conv.is_owned = false;
77889         LDKBlindedHopFeatures val_conv;
77890         val_conv.inner = untag_ptr(val);
77891         val_conv.is_owned = ptr_is_owned(val);
77892         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77893         val_conv = BlindedHopFeatures_clone(&val_conv);
77894         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
77895 }
77896
77897 int64_t  CS_LDK_ForwardTlvs_new(int64_t short_channel_id_arg, int64_t payment_relay_arg, int64_t payment_constraints_arg, int64_t features_arg) {
77898         LDKPaymentRelay payment_relay_arg_conv;
77899         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
77900         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
77901         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
77902         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
77903         LDKPaymentConstraints payment_constraints_arg_conv;
77904         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
77905         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
77906         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
77907         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
77908         LDKBlindedHopFeatures features_arg_conv;
77909         features_arg_conv.inner = untag_ptr(features_arg);
77910         features_arg_conv.is_owned = ptr_is_owned(features_arg);
77911         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
77912         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
77913         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
77914         int64_t ret_ref = 0;
77915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77917         return ret_ref;
77918 }
77919
77920 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
77921         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
77922         int64_t ret_ref = 0;
77923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77925         return ret_ref;
77926 }
77927 int64_t  CS_LDK_ForwardTlvs_clone_ptr(int64_t arg) {
77928         LDKForwardTlvs arg_conv;
77929         arg_conv.inner = untag_ptr(arg);
77930         arg_conv.is_owned = ptr_is_owned(arg);
77931         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77932         arg_conv.is_owned = false;
77933         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
77934         return ret_conv;
77935 }
77936
77937 int64_t  CS_LDK_ForwardTlvs_clone(int64_t orig) {
77938         LDKForwardTlvs orig_conv;
77939         orig_conv.inner = untag_ptr(orig);
77940         orig_conv.is_owned = ptr_is_owned(orig);
77941         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77942         orig_conv.is_owned = false;
77943         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
77944         int64_t ret_ref = 0;
77945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77947         return ret_ref;
77948 }
77949
77950 void  CS_LDK_ReceiveTlvs_free(int64_t this_obj) {
77951         LDKReceiveTlvs this_obj_conv;
77952         this_obj_conv.inner = untag_ptr(this_obj);
77953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77955         ReceiveTlvs_free(this_obj_conv);
77956 }
77957
77958 int8_tArray  CS_LDK_ReceiveTlvs_get_payment_secret(int64_t this_ptr) {
77959         LDKReceiveTlvs this_ptr_conv;
77960         this_ptr_conv.inner = untag_ptr(this_ptr);
77961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77963         this_ptr_conv.is_owned = false;
77964         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77965         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
77966         return ret_arr;
77967 }
77968
77969 void  CS_LDK_ReceiveTlvs_set_payment_secret(int64_t this_ptr, int8_tArray val) {
77970         LDKReceiveTlvs this_ptr_conv;
77971         this_ptr_conv.inner = untag_ptr(this_ptr);
77972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77974         this_ptr_conv.is_owned = false;
77975         LDKThirtyTwoBytes val_ref;
77976         CHECK(val->arr_len == 32);
77977         memcpy(val_ref.data, val->elems, 32); FREE(val);
77978         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
77979 }
77980
77981 int64_t  CS_LDK_ReceiveTlvs_get_payment_constraints(int64_t this_ptr) {
77982         LDKReceiveTlvs this_ptr_conv;
77983         this_ptr_conv.inner = untag_ptr(this_ptr);
77984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77986         this_ptr_conv.is_owned = false;
77987         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
77988         int64_t ret_ref = 0;
77989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77991         return ret_ref;
77992 }
77993
77994 void  CS_LDK_ReceiveTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
77995         LDKReceiveTlvs this_ptr_conv;
77996         this_ptr_conv.inner = untag_ptr(this_ptr);
77997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77999         this_ptr_conv.is_owned = false;
78000         LDKPaymentConstraints val_conv;
78001         val_conv.inner = untag_ptr(val);
78002         val_conv.is_owned = ptr_is_owned(val);
78003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78004         val_conv = PaymentConstraints_clone(&val_conv);
78005         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
78006 }
78007
78008 int64_t  CS_LDK_ReceiveTlvs_get_payment_context(int64_t this_ptr) {
78009         LDKReceiveTlvs this_ptr_conv;
78010         this_ptr_conv.inner = untag_ptr(this_ptr);
78011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78013         this_ptr_conv.is_owned = false;
78014         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78015         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
78016         int64_t ret_ref = tag_ptr(ret_copy, true);
78017         return ret_ref;
78018 }
78019
78020 void  CS_LDK_ReceiveTlvs_set_payment_context(int64_t this_ptr, int64_t val) {
78021         LDKReceiveTlvs this_ptr_conv;
78022         this_ptr_conv.inner = untag_ptr(this_ptr);
78023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78025         this_ptr_conv.is_owned = false;
78026         void* val_ptr = untag_ptr(val);
78027         CHECK_ACCESS(val_ptr);
78028         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
78029         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
78030         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
78031 }
78032
78033 int64_t  CS_LDK_ReceiveTlvs_new(int8_tArray payment_secret_arg, int64_t payment_constraints_arg, int64_t payment_context_arg) {
78034         LDKThirtyTwoBytes payment_secret_arg_ref;
78035         CHECK(payment_secret_arg->arr_len == 32);
78036         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
78037         LDKPaymentConstraints payment_constraints_arg_conv;
78038         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
78039         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
78040         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
78041         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
78042         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
78043         CHECK_ACCESS(payment_context_arg_ptr);
78044         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
78045         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
78046         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
78047         int64_t ret_ref = 0;
78048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78050         return ret_ref;
78051 }
78052
78053 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
78054         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
78055         int64_t ret_ref = 0;
78056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78058         return ret_ref;
78059 }
78060 int64_t  CS_LDK_ReceiveTlvs_clone_ptr(int64_t arg) {
78061         LDKReceiveTlvs arg_conv;
78062         arg_conv.inner = untag_ptr(arg);
78063         arg_conv.is_owned = ptr_is_owned(arg);
78064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78065         arg_conv.is_owned = false;
78066         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
78067         return ret_conv;
78068 }
78069
78070 int64_t  CS_LDK_ReceiveTlvs_clone(int64_t orig) {
78071         LDKReceiveTlvs orig_conv;
78072         orig_conv.inner = untag_ptr(orig);
78073         orig_conv.is_owned = ptr_is_owned(orig);
78074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78075         orig_conv.is_owned = false;
78076         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
78077         int64_t ret_ref = 0;
78078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78080         return ret_ref;
78081 }
78082
78083 void  CS_LDK_PaymentRelay_free(int64_t this_obj) {
78084         LDKPaymentRelay this_obj_conv;
78085         this_obj_conv.inner = untag_ptr(this_obj);
78086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78088         PaymentRelay_free(this_obj_conv);
78089 }
78090
78091 int16_t  CS_LDK_PaymentRelay_get_cltv_expiry_delta(int64_t this_ptr) {
78092         LDKPaymentRelay this_ptr_conv;
78093         this_ptr_conv.inner = untag_ptr(this_ptr);
78094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78096         this_ptr_conv.is_owned = false;
78097         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
78098         return ret_conv;
78099 }
78100
78101 void  CS_LDK_PaymentRelay_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
78102         LDKPaymentRelay this_ptr_conv;
78103         this_ptr_conv.inner = untag_ptr(this_ptr);
78104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78106         this_ptr_conv.is_owned = false;
78107         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
78108 }
78109
78110 int32_t  CS_LDK_PaymentRelay_get_fee_proportional_millionths(int64_t this_ptr) {
78111         LDKPaymentRelay this_ptr_conv;
78112         this_ptr_conv.inner = untag_ptr(this_ptr);
78113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78115         this_ptr_conv.is_owned = false;
78116         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
78117         return ret_conv;
78118 }
78119
78120 void  CS_LDK_PaymentRelay_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
78121         LDKPaymentRelay this_ptr_conv;
78122         this_ptr_conv.inner = untag_ptr(this_ptr);
78123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78125         this_ptr_conv.is_owned = false;
78126         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
78127 }
78128
78129 int32_t  CS_LDK_PaymentRelay_get_fee_base_msat(int64_t this_ptr) {
78130         LDKPaymentRelay this_ptr_conv;
78131         this_ptr_conv.inner = untag_ptr(this_ptr);
78132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78134         this_ptr_conv.is_owned = false;
78135         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
78136         return ret_conv;
78137 }
78138
78139 void  CS_LDK_PaymentRelay_set_fee_base_msat(int64_t this_ptr, int32_t val) {
78140         LDKPaymentRelay this_ptr_conv;
78141         this_ptr_conv.inner = untag_ptr(this_ptr);
78142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78144         this_ptr_conv.is_owned = false;
78145         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
78146 }
78147
78148 int64_t  CS_LDK_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
78149         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
78150         int64_t ret_ref = 0;
78151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78153         return ret_ref;
78154 }
78155
78156 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
78157         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
78158         int64_t ret_ref = 0;
78159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78161         return ret_ref;
78162 }
78163 int64_t  CS_LDK_PaymentRelay_clone_ptr(int64_t arg) {
78164         LDKPaymentRelay arg_conv;
78165         arg_conv.inner = untag_ptr(arg);
78166         arg_conv.is_owned = ptr_is_owned(arg);
78167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78168         arg_conv.is_owned = false;
78169         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
78170         return ret_conv;
78171 }
78172
78173 int64_t  CS_LDK_PaymentRelay_clone(int64_t orig) {
78174         LDKPaymentRelay orig_conv;
78175         orig_conv.inner = untag_ptr(orig);
78176         orig_conv.is_owned = ptr_is_owned(orig);
78177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78178         orig_conv.is_owned = false;
78179         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
78180         int64_t ret_ref = 0;
78181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78183         return ret_ref;
78184 }
78185
78186 void  CS_LDK_PaymentConstraints_free(int64_t this_obj) {
78187         LDKPaymentConstraints this_obj_conv;
78188         this_obj_conv.inner = untag_ptr(this_obj);
78189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78191         PaymentConstraints_free(this_obj_conv);
78192 }
78193
78194 int32_t  CS_LDK_PaymentConstraints_get_max_cltv_expiry(int64_t this_ptr) {
78195         LDKPaymentConstraints this_ptr_conv;
78196         this_ptr_conv.inner = untag_ptr(this_ptr);
78197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78199         this_ptr_conv.is_owned = false;
78200         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
78201         return ret_conv;
78202 }
78203
78204 void  CS_LDK_PaymentConstraints_set_max_cltv_expiry(int64_t this_ptr, int32_t val) {
78205         LDKPaymentConstraints this_ptr_conv;
78206         this_ptr_conv.inner = untag_ptr(this_ptr);
78207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78209         this_ptr_conv.is_owned = false;
78210         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
78211 }
78212
78213 int64_t  CS_LDK_PaymentConstraints_get_htlc_minimum_msat(int64_t this_ptr) {
78214         LDKPaymentConstraints this_ptr_conv;
78215         this_ptr_conv.inner = untag_ptr(this_ptr);
78216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78218         this_ptr_conv.is_owned = false;
78219         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
78220         return ret_conv;
78221 }
78222
78223 void  CS_LDK_PaymentConstraints_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
78224         LDKPaymentConstraints this_ptr_conv;
78225         this_ptr_conv.inner = untag_ptr(this_ptr);
78226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78228         this_ptr_conv.is_owned = false;
78229         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
78230 }
78231
78232 int64_t  CS_LDK_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
78233         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
78234         int64_t ret_ref = 0;
78235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78237         return ret_ref;
78238 }
78239
78240 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
78241         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
78242         int64_t ret_ref = 0;
78243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78245         return ret_ref;
78246 }
78247 int64_t  CS_LDK_PaymentConstraints_clone_ptr(int64_t arg) {
78248         LDKPaymentConstraints arg_conv;
78249         arg_conv.inner = untag_ptr(arg);
78250         arg_conv.is_owned = ptr_is_owned(arg);
78251         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78252         arg_conv.is_owned = false;
78253         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
78254         return ret_conv;
78255 }
78256
78257 int64_t  CS_LDK_PaymentConstraints_clone(int64_t orig) {
78258         LDKPaymentConstraints orig_conv;
78259         orig_conv.inner = untag_ptr(orig);
78260         orig_conv.is_owned = ptr_is_owned(orig);
78261         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78262         orig_conv.is_owned = false;
78263         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
78264         int64_t ret_ref = 0;
78265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78267         return ret_ref;
78268 }
78269
78270 void  CS_LDK_PaymentContext_free(int64_t this_ptr) {
78271         if (!ptr_is_owned(this_ptr)) return;
78272         void* this_ptr_ptr = untag_ptr(this_ptr);
78273         CHECK_ACCESS(this_ptr_ptr);
78274         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
78275         FREE(untag_ptr(this_ptr));
78276         PaymentContext_free(this_ptr_conv);
78277 }
78278
78279 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
78280         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78281         *ret_copy = PaymentContext_clone(arg);
78282         int64_t ret_ref = tag_ptr(ret_copy, true);
78283         return ret_ref;
78284 }
78285 int64_t  CS_LDK_PaymentContext_clone_ptr(int64_t arg) {
78286         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
78287         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
78288         return ret_conv;
78289 }
78290
78291 int64_t  CS_LDK_PaymentContext_clone(int64_t orig) {
78292         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
78293         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78294         *ret_copy = PaymentContext_clone(orig_conv);
78295         int64_t ret_ref = tag_ptr(ret_copy, true);
78296         return ret_ref;
78297 }
78298
78299 int64_t  CS_LDK_PaymentContext_unknown(int64_t a) {
78300         LDKUnknownPaymentContext a_conv;
78301         a_conv.inner = untag_ptr(a);
78302         a_conv.is_owned = ptr_is_owned(a);
78303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78304         a_conv = UnknownPaymentContext_clone(&a_conv);
78305         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78306         *ret_copy = PaymentContext_unknown(a_conv);
78307         int64_t ret_ref = tag_ptr(ret_copy, true);
78308         return ret_ref;
78309 }
78310
78311 int64_t  CS_LDK_PaymentContext_bolt12_offer(int64_t a) {
78312         LDKBolt12OfferContext a_conv;
78313         a_conv.inner = untag_ptr(a);
78314         a_conv.is_owned = ptr_is_owned(a);
78315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78316         a_conv = Bolt12OfferContext_clone(&a_conv);
78317         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78318         *ret_copy = PaymentContext_bolt12_offer(a_conv);
78319         int64_t ret_ref = tag_ptr(ret_copy, true);
78320         return ret_ref;
78321 }
78322
78323 int64_t  CS_LDK_PaymentContext_bolt12_refund(int64_t a) {
78324         LDKBolt12RefundContext a_conv;
78325         a_conv.inner = untag_ptr(a);
78326         a_conv.is_owned = ptr_is_owned(a);
78327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78328         a_conv = Bolt12RefundContext_clone(&a_conv);
78329         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
78330         *ret_copy = PaymentContext_bolt12_refund(a_conv);
78331         int64_t ret_ref = tag_ptr(ret_copy, true);
78332         return ret_ref;
78333 }
78334
78335 jboolean  CS_LDK_PaymentContext_eq(int64_t a, int64_t b) {
78336         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
78337         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
78338         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
78339         return ret_conv;
78340 }
78341
78342 void  CS_LDK_UnknownPaymentContext_free(int64_t this_obj) {
78343         LDKUnknownPaymentContext this_obj_conv;
78344         this_obj_conv.inner = untag_ptr(this_obj);
78345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78347         UnknownPaymentContext_free(this_obj_conv);
78348 }
78349
78350 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
78351         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
78352         int64_t ret_ref = 0;
78353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78355         return ret_ref;
78356 }
78357 int64_t  CS_LDK_UnknownPaymentContext_clone_ptr(int64_t arg) {
78358         LDKUnknownPaymentContext arg_conv;
78359         arg_conv.inner = untag_ptr(arg);
78360         arg_conv.is_owned = ptr_is_owned(arg);
78361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78362         arg_conv.is_owned = false;
78363         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
78364         return ret_conv;
78365 }
78366
78367 int64_t  CS_LDK_UnknownPaymentContext_clone(int64_t orig) {
78368         LDKUnknownPaymentContext orig_conv;
78369         orig_conv.inner = untag_ptr(orig);
78370         orig_conv.is_owned = ptr_is_owned(orig);
78371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78372         orig_conv.is_owned = false;
78373         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
78374         int64_t ret_ref = 0;
78375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78377         return ret_ref;
78378 }
78379
78380 jboolean  CS_LDK_UnknownPaymentContext_eq(int64_t a, int64_t b) {
78381         LDKUnknownPaymentContext a_conv;
78382         a_conv.inner = untag_ptr(a);
78383         a_conv.is_owned = ptr_is_owned(a);
78384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78385         a_conv.is_owned = false;
78386         LDKUnknownPaymentContext b_conv;
78387         b_conv.inner = untag_ptr(b);
78388         b_conv.is_owned = ptr_is_owned(b);
78389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78390         b_conv.is_owned = false;
78391         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
78392         return ret_conv;
78393 }
78394
78395 void  CS_LDK_Bolt12OfferContext_free(int64_t this_obj) {
78396         LDKBolt12OfferContext this_obj_conv;
78397         this_obj_conv.inner = untag_ptr(this_obj);
78398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78400         Bolt12OfferContext_free(this_obj_conv);
78401 }
78402
78403 int64_t  CS_LDK_Bolt12OfferContext_get_offer_id(int64_t this_ptr) {
78404         LDKBolt12OfferContext this_ptr_conv;
78405         this_ptr_conv.inner = untag_ptr(this_ptr);
78406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78408         this_ptr_conv.is_owned = false;
78409         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
78410         int64_t ret_ref = 0;
78411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78413         return ret_ref;
78414 }
78415
78416 void  CS_LDK_Bolt12OfferContext_set_offer_id(int64_t this_ptr, int64_t val) {
78417         LDKBolt12OfferContext this_ptr_conv;
78418         this_ptr_conv.inner = untag_ptr(this_ptr);
78419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78421         this_ptr_conv.is_owned = false;
78422         LDKOfferId val_conv;
78423         val_conv.inner = untag_ptr(val);
78424         val_conv.is_owned = ptr_is_owned(val);
78425         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78426         val_conv = OfferId_clone(&val_conv);
78427         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
78428 }
78429
78430 int64_t  CS_LDK_Bolt12OfferContext_get_invoice_request(int64_t this_ptr) {
78431         LDKBolt12OfferContext this_ptr_conv;
78432         this_ptr_conv.inner = untag_ptr(this_ptr);
78433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78435         this_ptr_conv.is_owned = false;
78436         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
78437         int64_t ret_ref = 0;
78438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78440         return ret_ref;
78441 }
78442
78443 void  CS_LDK_Bolt12OfferContext_set_invoice_request(int64_t this_ptr, int64_t val) {
78444         LDKBolt12OfferContext this_ptr_conv;
78445         this_ptr_conv.inner = untag_ptr(this_ptr);
78446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78448         this_ptr_conv.is_owned = false;
78449         LDKInvoiceRequestFields val_conv;
78450         val_conv.inner = untag_ptr(val);
78451         val_conv.is_owned = ptr_is_owned(val);
78452         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78453         val_conv = InvoiceRequestFields_clone(&val_conv);
78454         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
78455 }
78456
78457 int64_t  CS_LDK_Bolt12OfferContext_new(int64_t offer_id_arg, int64_t invoice_request_arg) {
78458         LDKOfferId offer_id_arg_conv;
78459         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
78460         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
78461         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
78462         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
78463         LDKInvoiceRequestFields invoice_request_arg_conv;
78464         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
78465         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
78466         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
78467         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
78468         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
78469         int64_t ret_ref = 0;
78470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78472         return ret_ref;
78473 }
78474
78475 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
78476         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
78477         int64_t ret_ref = 0;
78478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78480         return ret_ref;
78481 }
78482 int64_t  CS_LDK_Bolt12OfferContext_clone_ptr(int64_t arg) {
78483         LDKBolt12OfferContext arg_conv;
78484         arg_conv.inner = untag_ptr(arg);
78485         arg_conv.is_owned = ptr_is_owned(arg);
78486         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78487         arg_conv.is_owned = false;
78488         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
78489         return ret_conv;
78490 }
78491
78492 int64_t  CS_LDK_Bolt12OfferContext_clone(int64_t orig) {
78493         LDKBolt12OfferContext orig_conv;
78494         orig_conv.inner = untag_ptr(orig);
78495         orig_conv.is_owned = ptr_is_owned(orig);
78496         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78497         orig_conv.is_owned = false;
78498         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
78499         int64_t ret_ref = 0;
78500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78502         return ret_ref;
78503 }
78504
78505 jboolean  CS_LDK_Bolt12OfferContext_eq(int64_t a, int64_t b) {
78506         LDKBolt12OfferContext a_conv;
78507         a_conv.inner = untag_ptr(a);
78508         a_conv.is_owned = ptr_is_owned(a);
78509         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78510         a_conv.is_owned = false;
78511         LDKBolt12OfferContext b_conv;
78512         b_conv.inner = untag_ptr(b);
78513         b_conv.is_owned = ptr_is_owned(b);
78514         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78515         b_conv.is_owned = false;
78516         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
78517         return ret_conv;
78518 }
78519
78520 void  CS_LDK_Bolt12RefundContext_free(int64_t this_obj) {
78521         LDKBolt12RefundContext this_obj_conv;
78522         this_obj_conv.inner = untag_ptr(this_obj);
78523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78525         Bolt12RefundContext_free(this_obj_conv);
78526 }
78527
78528 int64_t  CS_LDK_Bolt12RefundContext_new() {
78529         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
78530         int64_t ret_ref = 0;
78531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78533         return ret_ref;
78534 }
78535
78536 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
78537         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
78538         int64_t ret_ref = 0;
78539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78541         return ret_ref;
78542 }
78543 int64_t  CS_LDK_Bolt12RefundContext_clone_ptr(int64_t arg) {
78544         LDKBolt12RefundContext arg_conv;
78545         arg_conv.inner = untag_ptr(arg);
78546         arg_conv.is_owned = ptr_is_owned(arg);
78547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78548         arg_conv.is_owned = false;
78549         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
78550         return ret_conv;
78551 }
78552
78553 int64_t  CS_LDK_Bolt12RefundContext_clone(int64_t orig) {
78554         LDKBolt12RefundContext orig_conv;
78555         orig_conv.inner = untag_ptr(orig);
78556         orig_conv.is_owned = ptr_is_owned(orig);
78557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78558         orig_conv.is_owned = false;
78559         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
78560         int64_t ret_ref = 0;
78561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78563         return ret_ref;
78564 }
78565
78566 jboolean  CS_LDK_Bolt12RefundContext_eq(int64_t a, int64_t b) {
78567         LDKBolt12RefundContext a_conv;
78568         a_conv.inner = untag_ptr(a);
78569         a_conv.is_owned = ptr_is_owned(a);
78570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78571         a_conv.is_owned = false;
78572         LDKBolt12RefundContext b_conv;
78573         b_conv.inner = untag_ptr(b);
78574         b_conv.is_owned = ptr_is_owned(b);
78575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78576         b_conv.is_owned = false;
78577         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
78578         return ret_conv;
78579 }
78580
78581 int8_tArray  CS_LDK_ForwardTlvs_write(int64_t obj) {
78582         LDKForwardTlvs obj_conv;
78583         obj_conv.inner = untag_ptr(obj);
78584         obj_conv.is_owned = ptr_is_owned(obj);
78585         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78586         obj_conv.is_owned = false;
78587         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
78588         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78589         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78590         CVec_u8Z_free(ret_var);
78591         return ret_arr;
78592 }
78593
78594 int8_tArray  CS_LDK_ReceiveTlvs_write(int64_t obj) {
78595         LDKReceiveTlvs obj_conv;
78596         obj_conv.inner = untag_ptr(obj);
78597         obj_conv.is_owned = ptr_is_owned(obj);
78598         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78599         obj_conv.is_owned = false;
78600         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
78601         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78602         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78603         CVec_u8Z_free(ret_var);
78604         return ret_arr;
78605 }
78606
78607 int8_tArray  CS_LDK_PaymentRelay_write(int64_t obj) {
78608         LDKPaymentRelay obj_conv;
78609         obj_conv.inner = untag_ptr(obj);
78610         obj_conv.is_owned = ptr_is_owned(obj);
78611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78612         obj_conv.is_owned = false;
78613         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
78614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78616         CVec_u8Z_free(ret_var);
78617         return ret_arr;
78618 }
78619
78620 int64_t  CS_LDK_PaymentRelay_read(int8_tArray ser) {
78621         LDKu8slice ser_ref;
78622         ser_ref.datalen = ser->arr_len;
78623         ser_ref.data = ser->elems;
78624         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
78625         *ret_conv = PaymentRelay_read(ser_ref);
78626         FREE(ser);
78627         return tag_ptr(ret_conv, true);
78628 }
78629
78630 int8_tArray  CS_LDK_PaymentConstraints_write(int64_t obj) {
78631         LDKPaymentConstraints obj_conv;
78632         obj_conv.inner = untag_ptr(obj);
78633         obj_conv.is_owned = ptr_is_owned(obj);
78634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78635         obj_conv.is_owned = false;
78636         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
78637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78639         CVec_u8Z_free(ret_var);
78640         return ret_arr;
78641 }
78642
78643 int64_t  CS_LDK_PaymentConstraints_read(int8_tArray ser) {
78644         LDKu8slice ser_ref;
78645         ser_ref.datalen = ser->arr_len;
78646         ser_ref.data = ser->elems;
78647         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
78648         *ret_conv = PaymentConstraints_read(ser_ref);
78649         FREE(ser);
78650         return tag_ptr(ret_conv, true);
78651 }
78652
78653 int8_tArray  CS_LDK_PaymentContext_write(int64_t obj) {
78654         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
78655         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
78656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78658         CVec_u8Z_free(ret_var);
78659         return ret_arr;
78660 }
78661
78662 int64_t  CS_LDK_PaymentContext_read(int8_tArray ser) {
78663         LDKu8slice ser_ref;
78664         ser_ref.datalen = ser->arr_len;
78665         ser_ref.data = ser->elems;
78666         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
78667         *ret_conv = PaymentContext_read(ser_ref);
78668         FREE(ser);
78669         return tag_ptr(ret_conv, true);
78670 }
78671
78672 int8_tArray  CS_LDK_UnknownPaymentContext_write(int64_t obj) {
78673         LDKUnknownPaymentContext obj_conv;
78674         obj_conv.inner = untag_ptr(obj);
78675         obj_conv.is_owned = ptr_is_owned(obj);
78676         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78677         obj_conv.is_owned = false;
78678         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
78679         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78680         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78681         CVec_u8Z_free(ret_var);
78682         return ret_arr;
78683 }
78684
78685 int64_t  CS_LDK_UnknownPaymentContext_read(int8_tArray ser) {
78686         LDKu8slice ser_ref;
78687         ser_ref.datalen = ser->arr_len;
78688         ser_ref.data = ser->elems;
78689         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
78690         *ret_conv = UnknownPaymentContext_read(ser_ref);
78691         FREE(ser);
78692         return tag_ptr(ret_conv, true);
78693 }
78694
78695 int8_tArray  CS_LDK_Bolt12OfferContext_write(int64_t obj) {
78696         LDKBolt12OfferContext obj_conv;
78697         obj_conv.inner = untag_ptr(obj);
78698         obj_conv.is_owned = ptr_is_owned(obj);
78699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78700         obj_conv.is_owned = false;
78701         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
78702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78704         CVec_u8Z_free(ret_var);
78705         return ret_arr;
78706 }
78707
78708 int64_t  CS_LDK_Bolt12OfferContext_read(int8_tArray ser) {
78709         LDKu8slice ser_ref;
78710         ser_ref.datalen = ser->arr_len;
78711         ser_ref.data = ser->elems;
78712         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
78713         *ret_conv = Bolt12OfferContext_read(ser_ref);
78714         FREE(ser);
78715         return tag_ptr(ret_conv, true);
78716 }
78717
78718 int8_tArray  CS_LDK_Bolt12RefundContext_write(int64_t obj) {
78719         LDKBolt12RefundContext obj_conv;
78720         obj_conv.inner = untag_ptr(obj);
78721         obj_conv.is_owned = ptr_is_owned(obj);
78722         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78723         obj_conv.is_owned = false;
78724         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
78725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78727         CVec_u8Z_free(ret_var);
78728         return ret_arr;
78729 }
78730
78731 int64_t  CS_LDK_Bolt12RefundContext_read(int8_tArray ser) {
78732         LDKu8slice ser_ref;
78733         ser_ref.datalen = ser->arr_len;
78734         ser_ref.data = ser->elems;
78735         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
78736         *ret_conv = Bolt12RefundContext_read(ser_ref);
78737         FREE(ser);
78738         return tag_ptr(ret_conv, true);
78739 }
78740
78741 void  CS_LDK_PaymentPurpose_free(int64_t this_ptr) {
78742         if (!ptr_is_owned(this_ptr)) return;
78743         void* this_ptr_ptr = untag_ptr(this_ptr);
78744         CHECK_ACCESS(this_ptr_ptr);
78745         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
78746         FREE(untag_ptr(this_ptr));
78747         PaymentPurpose_free(this_ptr_conv);
78748 }
78749
78750 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
78751         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78752         *ret_copy = PaymentPurpose_clone(arg);
78753         int64_t ret_ref = tag_ptr(ret_copy, true);
78754         return ret_ref;
78755 }
78756 int64_t  CS_LDK_PaymentPurpose_clone_ptr(int64_t arg) {
78757         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
78758         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
78759         return ret_conv;
78760 }
78761
78762 int64_t  CS_LDK_PaymentPurpose_clone(int64_t orig) {
78763         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
78764         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78765         *ret_copy = PaymentPurpose_clone(orig_conv);
78766         int64_t ret_ref = tag_ptr(ret_copy, true);
78767         return ret_ref;
78768 }
78769
78770 int64_t  CS_LDK_PaymentPurpose_bolt11_invoice_payment(int64_t payment_preimage, int8_tArray payment_secret) {
78771         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78772         CHECK_ACCESS(payment_preimage_ptr);
78773         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78774         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78775         LDKThirtyTwoBytes payment_secret_ref;
78776         CHECK(payment_secret->arr_len == 32);
78777         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78778         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78779         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
78780         int64_t ret_ref = tag_ptr(ret_copy, true);
78781         return ret_ref;
78782 }
78783
78784 int64_t  CS_LDK_PaymentPurpose_bolt12_offer_payment(int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
78785         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78786         CHECK_ACCESS(payment_preimage_ptr);
78787         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78788         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78789         LDKThirtyTwoBytes payment_secret_ref;
78790         CHECK(payment_secret->arr_len == 32);
78791         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78792         LDKBolt12OfferContext payment_context_conv;
78793         payment_context_conv.inner = untag_ptr(payment_context);
78794         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78795         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78796         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
78797         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78798         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78799         int64_t ret_ref = tag_ptr(ret_copy, true);
78800         return ret_ref;
78801 }
78802
78803 int64_t  CS_LDK_PaymentPurpose_bolt12_refund_payment(int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
78804         void* payment_preimage_ptr = untag_ptr(payment_preimage);
78805         CHECK_ACCESS(payment_preimage_ptr);
78806         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
78807         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
78808         LDKThirtyTwoBytes payment_secret_ref;
78809         CHECK(payment_secret->arr_len == 32);
78810         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
78811         LDKBolt12RefundContext payment_context_conv;
78812         payment_context_conv.inner = untag_ptr(payment_context);
78813         payment_context_conv.is_owned = ptr_is_owned(payment_context);
78814         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
78815         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
78816         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78817         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
78818         int64_t ret_ref = tag_ptr(ret_copy, true);
78819         return ret_ref;
78820 }
78821
78822 int64_t  CS_LDK_PaymentPurpose_spontaneous_payment(int8_tArray a) {
78823         LDKThirtyTwoBytes a_ref;
78824         CHECK(a->arr_len == 32);
78825         memcpy(a_ref.data, a->elems, 32); FREE(a);
78826         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
78827         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
78828         int64_t ret_ref = tag_ptr(ret_copy, true);
78829         return ret_ref;
78830 }
78831
78832 jboolean  CS_LDK_PaymentPurpose_eq(int64_t a, int64_t b) {
78833         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
78834         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
78835         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
78836         return ret_conv;
78837 }
78838
78839 int64_t  CS_LDK_PaymentPurpose_preimage(int64_t this_arg) {
78840         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
78841         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
78842         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
78843         int64_t ret_ref = tag_ptr(ret_copy, true);
78844         return ret_ref;
78845 }
78846
78847 int8_tArray  CS_LDK_PaymentPurpose_write(int64_t obj) {
78848         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
78849         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
78850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78852         CVec_u8Z_free(ret_var);
78853         return ret_arr;
78854 }
78855
78856 int64_t  CS_LDK_PaymentPurpose_read(int8_tArray ser) {
78857         LDKu8slice ser_ref;
78858         ser_ref.datalen = ser->arr_len;
78859         ser_ref.data = ser->elems;
78860         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
78861         *ret_conv = PaymentPurpose_read(ser_ref);
78862         FREE(ser);
78863         return tag_ptr(ret_conv, true);
78864 }
78865
78866 void  CS_LDK_ClaimedHTLC_free(int64_t this_obj) {
78867         LDKClaimedHTLC this_obj_conv;
78868         this_obj_conv.inner = untag_ptr(this_obj);
78869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78871         ClaimedHTLC_free(this_obj_conv);
78872 }
78873
78874 int64_t  CS_LDK_ClaimedHTLC_get_channel_id(int64_t this_ptr) {
78875         LDKClaimedHTLC this_ptr_conv;
78876         this_ptr_conv.inner = untag_ptr(this_ptr);
78877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78879         this_ptr_conv.is_owned = false;
78880         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
78881         int64_t ret_ref = 0;
78882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78884         return ret_ref;
78885 }
78886
78887 void  CS_LDK_ClaimedHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
78888         LDKClaimedHTLC this_ptr_conv;
78889         this_ptr_conv.inner = untag_ptr(this_ptr);
78890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78892         this_ptr_conv.is_owned = false;
78893         LDKChannelId val_conv;
78894         val_conv.inner = untag_ptr(val);
78895         val_conv.is_owned = ptr_is_owned(val);
78896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78897         val_conv = ChannelId_clone(&val_conv);
78898         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
78899 }
78900
78901 int8_tArray  CS_LDK_ClaimedHTLC_get_user_channel_id(int64_t this_ptr) {
78902         LDKClaimedHTLC this_ptr_conv;
78903         this_ptr_conv.inner = untag_ptr(this_ptr);
78904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78906         this_ptr_conv.is_owned = false;
78907         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
78908         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
78909         return ret_arr;
78910 }
78911
78912 void  CS_LDK_ClaimedHTLC_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
78913         LDKClaimedHTLC this_ptr_conv;
78914         this_ptr_conv.inner = untag_ptr(this_ptr);
78915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78917         this_ptr_conv.is_owned = false;
78918         LDKU128 val_ref;
78919         CHECK(val->arr_len == 16);
78920         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
78921         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
78922 }
78923
78924 int32_t  CS_LDK_ClaimedHTLC_get_cltv_expiry(int64_t this_ptr) {
78925         LDKClaimedHTLC this_ptr_conv;
78926         this_ptr_conv.inner = untag_ptr(this_ptr);
78927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78929         this_ptr_conv.is_owned = false;
78930         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
78931         return ret_conv;
78932 }
78933
78934 void  CS_LDK_ClaimedHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
78935         LDKClaimedHTLC this_ptr_conv;
78936         this_ptr_conv.inner = untag_ptr(this_ptr);
78937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78939         this_ptr_conv.is_owned = false;
78940         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
78941 }
78942
78943 int64_t  CS_LDK_ClaimedHTLC_get_value_msat(int64_t this_ptr) {
78944         LDKClaimedHTLC this_ptr_conv;
78945         this_ptr_conv.inner = untag_ptr(this_ptr);
78946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78948         this_ptr_conv.is_owned = false;
78949         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
78950         return ret_conv;
78951 }
78952
78953 void  CS_LDK_ClaimedHTLC_set_value_msat(int64_t this_ptr, int64_t val) {
78954         LDKClaimedHTLC this_ptr_conv;
78955         this_ptr_conv.inner = untag_ptr(this_ptr);
78956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78958         this_ptr_conv.is_owned = false;
78959         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
78960 }
78961
78962 int64_t  CS_LDK_ClaimedHTLC_get_counterparty_skimmed_fee_msat(int64_t this_ptr) {
78963         LDKClaimedHTLC this_ptr_conv;
78964         this_ptr_conv.inner = untag_ptr(this_ptr);
78965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78967         this_ptr_conv.is_owned = false;
78968         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
78969         return ret_conv;
78970 }
78971
78972 void  CS_LDK_ClaimedHTLC_set_counterparty_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
78973         LDKClaimedHTLC this_ptr_conv;
78974         this_ptr_conv.inner = untag_ptr(this_ptr);
78975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78977         this_ptr_conv.is_owned = false;
78978         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
78979 }
78980
78981 int64_t  CS_LDK_ClaimedHTLC_new(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) {
78982         LDKChannelId channel_id_arg_conv;
78983         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
78984         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
78985         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
78986         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
78987         LDKU128 user_channel_id_arg_ref;
78988         CHECK(user_channel_id_arg->arr_len == 16);
78989         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
78990         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);
78991         int64_t ret_ref = 0;
78992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78994         return ret_ref;
78995 }
78996
78997 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
78998         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
78999         int64_t ret_ref = 0;
79000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79002         return ret_ref;
79003 }
79004 int64_t  CS_LDK_ClaimedHTLC_clone_ptr(int64_t arg) {
79005         LDKClaimedHTLC arg_conv;
79006         arg_conv.inner = untag_ptr(arg);
79007         arg_conv.is_owned = ptr_is_owned(arg);
79008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79009         arg_conv.is_owned = false;
79010         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
79011         return ret_conv;
79012 }
79013
79014 int64_t  CS_LDK_ClaimedHTLC_clone(int64_t orig) {
79015         LDKClaimedHTLC orig_conv;
79016         orig_conv.inner = untag_ptr(orig);
79017         orig_conv.is_owned = ptr_is_owned(orig);
79018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79019         orig_conv.is_owned = false;
79020         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
79021         int64_t ret_ref = 0;
79022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79024         return ret_ref;
79025 }
79026
79027 jboolean  CS_LDK_ClaimedHTLC_eq(int64_t a, int64_t b) {
79028         LDKClaimedHTLC a_conv;
79029         a_conv.inner = untag_ptr(a);
79030         a_conv.is_owned = ptr_is_owned(a);
79031         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79032         a_conv.is_owned = false;
79033         LDKClaimedHTLC b_conv;
79034         b_conv.inner = untag_ptr(b);
79035         b_conv.is_owned = ptr_is_owned(b);
79036         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79037         b_conv.is_owned = false;
79038         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
79039         return ret_conv;
79040 }
79041
79042 int8_tArray  CS_LDK_ClaimedHTLC_write(int64_t obj) {
79043         LDKClaimedHTLC obj_conv;
79044         obj_conv.inner = untag_ptr(obj);
79045         obj_conv.is_owned = ptr_is_owned(obj);
79046         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79047         obj_conv.is_owned = false;
79048         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
79049         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79050         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79051         CVec_u8Z_free(ret_var);
79052         return ret_arr;
79053 }
79054
79055 int64_t  CS_LDK_ClaimedHTLC_read(int8_tArray ser) {
79056         LDKu8slice ser_ref;
79057         ser_ref.datalen = ser->arr_len;
79058         ser_ref.data = ser->elems;
79059         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
79060         *ret_conv = ClaimedHTLC_read(ser_ref);
79061         FREE(ser);
79062         return tag_ptr(ret_conv, true);
79063 }
79064
79065 void  CS_LDK_PathFailure_free(int64_t this_ptr) {
79066         if (!ptr_is_owned(this_ptr)) return;
79067         void* this_ptr_ptr = untag_ptr(this_ptr);
79068         CHECK_ACCESS(this_ptr_ptr);
79069         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
79070         FREE(untag_ptr(this_ptr));
79071         PathFailure_free(this_ptr_conv);
79072 }
79073
79074 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
79075         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
79076         *ret_copy = PathFailure_clone(arg);
79077         int64_t ret_ref = tag_ptr(ret_copy, true);
79078         return ret_ref;
79079 }
79080 int64_t  CS_LDK_PathFailure_clone_ptr(int64_t arg) {
79081         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
79082         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
79083         return ret_conv;
79084 }
79085
79086 int64_t  CS_LDK_PathFailure_clone(int64_t orig) {
79087         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
79088         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
79089         *ret_copy = PathFailure_clone(orig_conv);
79090         int64_t ret_ref = tag_ptr(ret_copy, true);
79091         return ret_ref;
79092 }
79093
79094 int64_t  CS_LDK_PathFailure_initial_send(int64_t err) {
79095         void* err_ptr = untag_ptr(err);
79096         CHECK_ACCESS(err_ptr);
79097         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
79098         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
79099         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
79100         *ret_copy = PathFailure_initial_send(err_conv);
79101         int64_t ret_ref = tag_ptr(ret_copy, true);
79102         return ret_ref;
79103 }
79104
79105 int64_t  CS_LDK_PathFailure_on_path(int64_t network_update) {
79106         void* network_update_ptr = untag_ptr(network_update);
79107         CHECK_ACCESS(network_update_ptr);
79108         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
79109         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
79110         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
79111         *ret_copy = PathFailure_on_path(network_update_conv);
79112         int64_t ret_ref = tag_ptr(ret_copy, true);
79113         return ret_ref;
79114 }
79115
79116 jboolean  CS_LDK_PathFailure_eq(int64_t a, int64_t b) {
79117         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
79118         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
79119         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
79120         return ret_conv;
79121 }
79122
79123 int8_tArray  CS_LDK_PathFailure_write(int64_t obj) {
79124         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
79125         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
79126         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79127         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79128         CVec_u8Z_free(ret_var);
79129         return ret_arr;
79130 }
79131
79132 int64_t  CS_LDK_PathFailure_read(int8_tArray ser) {
79133         LDKu8slice ser_ref;
79134         ser_ref.datalen = ser->arr_len;
79135         ser_ref.data = ser->elems;
79136         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
79137         *ret_conv = PathFailure_read(ser_ref);
79138         FREE(ser);
79139         return tag_ptr(ret_conv, true);
79140 }
79141
79142 void  CS_LDK_ClosureReason_free(int64_t this_ptr) {
79143         if (!ptr_is_owned(this_ptr)) return;
79144         void* this_ptr_ptr = untag_ptr(this_ptr);
79145         CHECK_ACCESS(this_ptr_ptr);
79146         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
79147         FREE(untag_ptr(this_ptr));
79148         ClosureReason_free(this_ptr_conv);
79149 }
79150
79151 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
79152         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79153         *ret_copy = ClosureReason_clone(arg);
79154         int64_t ret_ref = tag_ptr(ret_copy, true);
79155         return ret_ref;
79156 }
79157 int64_t  CS_LDK_ClosureReason_clone_ptr(int64_t arg) {
79158         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
79159         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
79160         return ret_conv;
79161 }
79162
79163 int64_t  CS_LDK_ClosureReason_clone(int64_t orig) {
79164         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
79165         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79166         *ret_copy = ClosureReason_clone(orig_conv);
79167         int64_t ret_ref = tag_ptr(ret_copy, true);
79168         return ret_ref;
79169 }
79170
79171 int64_t  CS_LDK_ClosureReason_counterparty_force_closed(int64_t peer_msg) {
79172         LDKUntrustedString peer_msg_conv;
79173         peer_msg_conv.inner = untag_ptr(peer_msg);
79174         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
79175         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
79176         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
79177         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79178         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
79179         int64_t ret_ref = tag_ptr(ret_copy, true);
79180         return ret_ref;
79181 }
79182
79183 int64_t  CS_LDK_ClosureReason_holder_force_closed() {
79184         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79185         *ret_copy = ClosureReason_holder_force_closed();
79186         int64_t ret_ref = tag_ptr(ret_copy, true);
79187         return ret_ref;
79188 }
79189
79190 int64_t  CS_LDK_ClosureReason_legacy_cooperative_closure() {
79191         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79192         *ret_copy = ClosureReason_legacy_cooperative_closure();
79193         int64_t ret_ref = tag_ptr(ret_copy, true);
79194         return ret_ref;
79195 }
79196
79197 int64_t  CS_LDK_ClosureReason_counterparty_initiated_cooperative_closure() {
79198         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79199         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
79200         int64_t ret_ref = tag_ptr(ret_copy, true);
79201         return ret_ref;
79202 }
79203
79204 int64_t  CS_LDK_ClosureReason_locally_initiated_cooperative_closure() {
79205         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79206         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
79207         int64_t ret_ref = tag_ptr(ret_copy, true);
79208         return ret_ref;
79209 }
79210
79211 int64_t  CS_LDK_ClosureReason_commitment_tx_confirmed() {
79212         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79213         *ret_copy = ClosureReason_commitment_tx_confirmed();
79214         int64_t ret_ref = tag_ptr(ret_copy, true);
79215         return ret_ref;
79216 }
79217
79218 int64_t  CS_LDK_ClosureReason_funding_timed_out() {
79219         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79220         *ret_copy = ClosureReason_funding_timed_out();
79221         int64_t ret_ref = tag_ptr(ret_copy, true);
79222         return ret_ref;
79223 }
79224
79225 int64_t  CS_LDK_ClosureReason_processing_error(jstring err) {
79226         LDKStr err_conv = str_ref_to_owned_c(err);
79227         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79228         *ret_copy = ClosureReason_processing_error(err_conv);
79229         int64_t ret_ref = tag_ptr(ret_copy, true);
79230         return ret_ref;
79231 }
79232
79233 int64_t  CS_LDK_ClosureReason_disconnected_peer() {
79234         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79235         *ret_copy = ClosureReason_disconnected_peer();
79236         int64_t ret_ref = tag_ptr(ret_copy, true);
79237         return ret_ref;
79238 }
79239
79240 int64_t  CS_LDK_ClosureReason_outdated_channel_manager() {
79241         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79242         *ret_copy = ClosureReason_outdated_channel_manager();
79243         int64_t ret_ref = tag_ptr(ret_copy, true);
79244         return ret_ref;
79245 }
79246
79247 int64_t  CS_LDK_ClosureReason_counterparty_coop_closed_unfunded_channel() {
79248         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79249         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
79250         int64_t ret_ref = tag_ptr(ret_copy, true);
79251         return ret_ref;
79252 }
79253
79254 int64_t  CS_LDK_ClosureReason_funding_batch_closure() {
79255         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79256         *ret_copy = ClosureReason_funding_batch_closure();
79257         int64_t ret_ref = tag_ptr(ret_copy, true);
79258         return ret_ref;
79259 }
79260
79261 int64_t  CS_LDK_ClosureReason_htlcs_timed_out() {
79262         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
79263         *ret_copy = ClosureReason_htlcs_timed_out();
79264         int64_t ret_ref = tag_ptr(ret_copy, true);
79265         return ret_ref;
79266 }
79267
79268 jboolean  CS_LDK_ClosureReason_eq(int64_t a, int64_t b) {
79269         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
79270         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
79271         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
79272         return ret_conv;
79273 }
79274
79275 int8_tArray  CS_LDK_ClosureReason_write(int64_t obj) {
79276         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
79277         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
79278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79280         CVec_u8Z_free(ret_var);
79281         return ret_arr;
79282 }
79283
79284 int64_t  CS_LDK_ClosureReason_read(int8_tArray ser) {
79285         LDKu8slice ser_ref;
79286         ser_ref.datalen = ser->arr_len;
79287         ser_ref.data = ser->elems;
79288         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
79289         *ret_conv = ClosureReason_read(ser_ref);
79290         FREE(ser);
79291         return tag_ptr(ret_conv, true);
79292 }
79293
79294 void  CS_LDK_HTLCDestination_free(int64_t this_ptr) {
79295         if (!ptr_is_owned(this_ptr)) return;
79296         void* this_ptr_ptr = untag_ptr(this_ptr);
79297         CHECK_ACCESS(this_ptr_ptr);
79298         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
79299         FREE(untag_ptr(this_ptr));
79300         HTLCDestination_free(this_ptr_conv);
79301 }
79302
79303 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
79304         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79305         *ret_copy = HTLCDestination_clone(arg);
79306         int64_t ret_ref = tag_ptr(ret_copy, true);
79307         return ret_ref;
79308 }
79309 int64_t  CS_LDK_HTLCDestination_clone_ptr(int64_t arg) {
79310         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
79311         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
79312         return ret_conv;
79313 }
79314
79315 int64_t  CS_LDK_HTLCDestination_clone(int64_t orig) {
79316         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
79317         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79318         *ret_copy = HTLCDestination_clone(orig_conv);
79319         int64_t ret_ref = tag_ptr(ret_copy, true);
79320         return ret_ref;
79321 }
79322
79323 int64_t  CS_LDK_HTLCDestination_next_hop_channel(int8_tArray node_id, int64_t channel_id) {
79324         LDKPublicKey node_id_ref;
79325         CHECK(node_id->arr_len == 33);
79326         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79327         LDKChannelId channel_id_conv;
79328         channel_id_conv.inner = untag_ptr(channel_id);
79329         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79330         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79331         channel_id_conv = ChannelId_clone(&channel_id_conv);
79332         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79333         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
79334         int64_t ret_ref = tag_ptr(ret_copy, true);
79335         return ret_ref;
79336 }
79337
79338 int64_t  CS_LDK_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
79339         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79340         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
79341         int64_t ret_ref = tag_ptr(ret_copy, true);
79342         return ret_ref;
79343 }
79344
79345 int64_t  CS_LDK_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
79346         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79347         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
79348         int64_t ret_ref = tag_ptr(ret_copy, true);
79349         return ret_ref;
79350 }
79351
79352 int64_t  CS_LDK_HTLCDestination_invalid_onion() {
79353         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79354         *ret_copy = HTLCDestination_invalid_onion();
79355         int64_t ret_ref = tag_ptr(ret_copy, true);
79356         return ret_ref;
79357 }
79358
79359 int64_t  CS_LDK_HTLCDestination_failed_payment(int8_tArray payment_hash) {
79360         LDKThirtyTwoBytes payment_hash_ref;
79361         CHECK(payment_hash->arr_len == 32);
79362         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79363         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
79364         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
79365         int64_t ret_ref = tag_ptr(ret_copy, true);
79366         return ret_ref;
79367 }
79368
79369 jboolean  CS_LDK_HTLCDestination_eq(int64_t a, int64_t b) {
79370         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
79371         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
79372         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
79373         return ret_conv;
79374 }
79375
79376 int8_tArray  CS_LDK_HTLCDestination_write(int64_t obj) {
79377         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
79378         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
79379         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79380         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79381         CVec_u8Z_free(ret_var);
79382         return ret_arr;
79383 }
79384
79385 int64_t  CS_LDK_HTLCDestination_read(int8_tArray ser) {
79386         LDKu8slice ser_ref;
79387         ser_ref.datalen = ser->arr_len;
79388         ser_ref.data = ser->elems;
79389         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
79390         *ret_conv = HTLCDestination_read(ser_ref);
79391         FREE(ser);
79392         return tag_ptr(ret_conv, true);
79393 }
79394
79395 int32_t  CS_LDK_PaymentFailureReason_clone(int64_t orig) {
79396         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
79397         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_clone(orig_conv));
79398         return ret_conv;
79399 }
79400
79401 int32_t  CS_LDK_PaymentFailureReason_recipient_rejected() {
79402         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_recipient_rejected());
79403         return ret_conv;
79404 }
79405
79406 int32_t  CS_LDK_PaymentFailureReason_user_abandoned() {
79407         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_user_abandoned());
79408         return ret_conv;
79409 }
79410
79411 int32_t  CS_LDK_PaymentFailureReason_retries_exhausted() {
79412         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_retries_exhausted());
79413         return ret_conv;
79414 }
79415
79416 int32_t  CS_LDK_PaymentFailureReason_payment_expired() {
79417         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_payment_expired());
79418         return ret_conv;
79419 }
79420
79421 int32_t  CS_LDK_PaymentFailureReason_route_not_found() {
79422         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_route_not_found());
79423         return ret_conv;
79424 }
79425
79426 int32_t  CS_LDK_PaymentFailureReason_unexpected_error() {
79427         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_unexpected_error());
79428         return ret_conv;
79429 }
79430
79431 jboolean  CS_LDK_PaymentFailureReason_eq(int64_t a, int64_t b) {
79432         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
79433         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
79434         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
79435         return ret_conv;
79436 }
79437
79438 int8_tArray  CS_LDK_PaymentFailureReason_write(int64_t obj) {
79439         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
79440         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
79441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79443         CVec_u8Z_free(ret_var);
79444         return ret_arr;
79445 }
79446
79447 int64_t  CS_LDK_PaymentFailureReason_read(int8_tArray ser) {
79448         LDKu8slice ser_ref;
79449         ser_ref.datalen = ser->arr_len;
79450         ser_ref.data = ser->elems;
79451         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
79452         *ret_conv = PaymentFailureReason_read(ser_ref);
79453         FREE(ser);
79454         return tag_ptr(ret_conv, true);
79455 }
79456
79457 void  CS_LDK_Event_free(int64_t this_ptr) {
79458         if (!ptr_is_owned(this_ptr)) return;
79459         void* this_ptr_ptr = untag_ptr(this_ptr);
79460         CHECK_ACCESS(this_ptr_ptr);
79461         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
79462         FREE(untag_ptr(this_ptr));
79463         Event_free(this_ptr_conv);
79464 }
79465
79466 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
79467         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79468         *ret_copy = Event_clone(arg);
79469         int64_t ret_ref = tag_ptr(ret_copy, true);
79470         return ret_ref;
79471 }
79472 int64_t  CS_LDK_Event_clone_ptr(int64_t arg) {
79473         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
79474         int64_t ret_conv = Event_clone_ptr(arg_conv);
79475         return ret_conv;
79476 }
79477
79478 int64_t  CS_LDK_Event_clone(int64_t orig) {
79479         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
79480         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79481         *ret_copy = Event_clone(orig_conv);
79482         int64_t ret_ref = tag_ptr(ret_copy, true);
79483         return ret_ref;
79484 }
79485
79486 int64_t  CS_LDK_Event_funding_generation_ready(int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
79487         LDKChannelId temporary_channel_id_conv;
79488         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
79489         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
79490         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
79491         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
79492         LDKPublicKey counterparty_node_id_ref;
79493         CHECK(counterparty_node_id->arr_len == 33);
79494         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79495         LDKCVec_u8Z output_script_ref;
79496         output_script_ref.datalen = output_script->arr_len;
79497         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
79498         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
79499         LDKU128 user_channel_id_ref;
79500         CHECK(user_channel_id->arr_len == 16);
79501         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79502         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79503         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
79504         int64_t ret_ref = tag_ptr(ret_copy, true);
79505         return ret_ref;
79506 }
79507
79508 int64_t  CS_LDK_Event_payment_claimable(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) {
79509         LDKPublicKey receiver_node_id_ref;
79510         CHECK(receiver_node_id->arr_len == 33);
79511         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
79512         LDKThirtyTwoBytes payment_hash_ref;
79513         CHECK(payment_hash->arr_len == 32);
79514         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79515         LDKRecipientOnionFields onion_fields_conv;
79516         onion_fields_conv.inner = untag_ptr(onion_fields);
79517         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
79518         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
79519         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
79520         void* purpose_ptr = untag_ptr(purpose);
79521         CHECK_ACCESS(purpose_ptr);
79522         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
79523         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
79524         LDKChannelId via_channel_id_conv;
79525         via_channel_id_conv.inner = untag_ptr(via_channel_id);
79526         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
79527         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
79528         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
79529         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
79530         CHECK_ACCESS(via_user_channel_id_ptr);
79531         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
79532         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
79533         void* claim_deadline_ptr = untag_ptr(claim_deadline);
79534         CHECK_ACCESS(claim_deadline_ptr);
79535         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
79536         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
79537         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79538         *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);
79539         int64_t ret_ref = tag_ptr(ret_copy, true);
79540         return ret_ref;
79541 }
79542
79543 int64_t  CS_LDK_Event_payment_claimed(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) {
79544         LDKPublicKey receiver_node_id_ref;
79545         CHECK(receiver_node_id->arr_len == 33);
79546         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
79547         LDKThirtyTwoBytes payment_hash_ref;
79548         CHECK(payment_hash->arr_len == 32);
79549         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79550         void* purpose_ptr = untag_ptr(purpose);
79551         CHECK_ACCESS(purpose_ptr);
79552         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
79553         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
79554         LDKCVec_ClaimedHTLCZ htlcs_constr;
79555         htlcs_constr.datalen = htlcs->arr_len;
79556         if (htlcs_constr.datalen > 0)
79557                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
79558         else
79559                 htlcs_constr.data = NULL;
79560         int64_t* htlcs_vals = htlcs->elems;
79561         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
79562                 int64_t htlcs_conv_13 = htlcs_vals[n];
79563                 LDKClaimedHTLC htlcs_conv_13_conv;
79564                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
79565                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
79566                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
79567                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
79568                 htlcs_constr.data[n] = htlcs_conv_13_conv;
79569         }
79570         FREE(htlcs);
79571         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
79572         CHECK_ACCESS(sender_intended_total_msat_ptr);
79573         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
79574         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
79575         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79576         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
79577         int64_t ret_ref = tag_ptr(ret_copy, true);
79578         return ret_ref;
79579 }
79580
79581 int64_t  CS_LDK_Event_connection_needed(int8_tArray node_id, int64_tArray addresses) {
79582         LDKPublicKey node_id_ref;
79583         CHECK(node_id->arr_len == 33);
79584         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
79585         LDKCVec_SocketAddressZ addresses_constr;
79586         addresses_constr.datalen = addresses->arr_len;
79587         if (addresses_constr.datalen > 0)
79588                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
79589         else
79590                 addresses_constr.data = NULL;
79591         int64_t* addresses_vals = addresses->elems;
79592         for (size_t p = 0; p < addresses_constr.datalen; p++) {
79593                 int64_t addresses_conv_15 = addresses_vals[p];
79594                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
79595                 CHECK_ACCESS(addresses_conv_15_ptr);
79596                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
79597                 addresses_constr.data[p] = addresses_conv_15_conv;
79598         }
79599         FREE(addresses);
79600         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79601         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
79602         int64_t ret_ref = tag_ptr(ret_copy, true);
79603         return ret_ref;
79604 }
79605
79606 int64_t  CS_LDK_Event_invoice_request_failed(int8_tArray payment_id) {
79607         LDKThirtyTwoBytes payment_id_ref;
79608         CHECK(payment_id->arr_len == 32);
79609         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79610         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79611         *ret_copy = Event_invoice_request_failed(payment_id_ref);
79612         int64_t ret_ref = tag_ptr(ret_copy, true);
79613         return ret_ref;
79614 }
79615
79616 int64_t  CS_LDK_Event_payment_sent(int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
79617         void* payment_id_ptr = untag_ptr(payment_id);
79618         CHECK_ACCESS(payment_id_ptr);
79619         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79620         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79621         LDKThirtyTwoBytes payment_preimage_ref;
79622         CHECK(payment_preimage->arr_len == 32);
79623         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
79624         LDKThirtyTwoBytes payment_hash_ref;
79625         CHECK(payment_hash->arr_len == 32);
79626         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79627         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
79628         CHECK_ACCESS(fee_paid_msat_ptr);
79629         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
79630         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
79631         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79632         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
79633         int64_t ret_ref = tag_ptr(ret_copy, true);
79634         return ret_ref;
79635 }
79636
79637 int64_t  CS_LDK_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
79638         LDKThirtyTwoBytes payment_id_ref;
79639         CHECK(payment_id->arr_len == 32);
79640         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79641         LDKThirtyTwoBytes payment_hash_ref;
79642         CHECK(payment_hash->arr_len == 32);
79643         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79644         void* reason_ptr = untag_ptr(reason);
79645         CHECK_ACCESS(reason_ptr);
79646         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
79647         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
79648         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79649         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
79650         int64_t ret_ref = tag_ptr(ret_copy, true);
79651         return ret_ref;
79652 }
79653
79654 int64_t  CS_LDK_Event_payment_path_successful(int8_tArray payment_id, int64_t payment_hash, int64_t path) {
79655         LDKThirtyTwoBytes payment_id_ref;
79656         CHECK(payment_id->arr_len == 32);
79657         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79658         void* payment_hash_ptr = untag_ptr(payment_hash);
79659         CHECK_ACCESS(payment_hash_ptr);
79660         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
79661         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
79662         LDKPath path_conv;
79663         path_conv.inner = untag_ptr(path);
79664         path_conv.is_owned = ptr_is_owned(path);
79665         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79666         path_conv = Path_clone(&path_conv);
79667         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79668         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
79669         int64_t ret_ref = tag_ptr(ret_copy, true);
79670         return ret_ref;
79671 }
79672
79673 int64_t  CS_LDK_Event_payment_path_failed(int64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_t path, int64_t short_channel_id) {
79674         void* payment_id_ptr = untag_ptr(payment_id);
79675         CHECK_ACCESS(payment_id_ptr);
79676         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
79677         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
79678         LDKThirtyTwoBytes payment_hash_ref;
79679         CHECK(payment_hash->arr_len == 32);
79680         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79681         void* failure_ptr = untag_ptr(failure);
79682         CHECK_ACCESS(failure_ptr);
79683         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
79684         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
79685         LDKPath path_conv;
79686         path_conv.inner = untag_ptr(path);
79687         path_conv.is_owned = ptr_is_owned(path);
79688         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79689         path_conv = Path_clone(&path_conv);
79690         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79691         CHECK_ACCESS(short_channel_id_ptr);
79692         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79693         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79694         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79695         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
79696         int64_t ret_ref = tag_ptr(ret_copy, true);
79697         return ret_ref;
79698 }
79699
79700 int64_t  CS_LDK_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
79701         LDKThirtyTwoBytes payment_id_ref;
79702         CHECK(payment_id->arr_len == 32);
79703         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79704         LDKThirtyTwoBytes payment_hash_ref;
79705         CHECK(payment_hash->arr_len == 32);
79706         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79707         LDKPath path_conv;
79708         path_conv.inner = untag_ptr(path);
79709         path_conv.is_owned = ptr_is_owned(path);
79710         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79711         path_conv = Path_clone(&path_conv);
79712         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79713         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
79714         int64_t ret_ref = tag_ptr(ret_copy, true);
79715         return ret_ref;
79716 }
79717
79718 int64_t  CS_LDK_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
79719         LDKThirtyTwoBytes payment_id_ref;
79720         CHECK(payment_id->arr_len == 32);
79721         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
79722         LDKThirtyTwoBytes payment_hash_ref;
79723         CHECK(payment_hash->arr_len == 32);
79724         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79725         LDKPath path_conv;
79726         path_conv.inner = untag_ptr(path);
79727         path_conv.is_owned = ptr_is_owned(path);
79728         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
79729         path_conv = Path_clone(&path_conv);
79730         void* short_channel_id_ptr = untag_ptr(short_channel_id);
79731         CHECK_ACCESS(short_channel_id_ptr);
79732         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
79733         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
79734         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79735         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
79736         int64_t ret_ref = tag_ptr(ret_copy, true);
79737         return ret_ref;
79738 }
79739
79740 int64_t  CS_LDK_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
79741         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79742         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
79743         int64_t ret_ref = tag_ptr(ret_copy, true);
79744         return ret_ref;
79745 }
79746
79747 int64_t  CS_LDK_Event_htlcintercepted(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) {
79748         LDKThirtyTwoBytes intercept_id_ref;
79749         CHECK(intercept_id->arr_len == 32);
79750         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
79751         LDKThirtyTwoBytes payment_hash_ref;
79752         CHECK(payment_hash->arr_len == 32);
79753         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
79754         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79755         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
79756         int64_t ret_ref = tag_ptr(ret_copy, true);
79757         return ret_ref;
79758 }
79759
79760 int64_t  CS_LDK_Event_spendable_outputs(int64_tArray outputs, int64_t channel_id) {
79761         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
79762         outputs_constr.datalen = outputs->arr_len;
79763         if (outputs_constr.datalen > 0)
79764                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
79765         else
79766                 outputs_constr.data = NULL;
79767         int64_t* outputs_vals = outputs->elems;
79768         for (size_t b = 0; b < outputs_constr.datalen; b++) {
79769                 int64_t outputs_conv_27 = outputs_vals[b];
79770                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
79771                 CHECK_ACCESS(outputs_conv_27_ptr);
79772                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
79773                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
79774                 outputs_constr.data[b] = outputs_conv_27_conv;
79775         }
79776         FREE(outputs);
79777         LDKChannelId channel_id_conv;
79778         channel_id_conv.inner = untag_ptr(channel_id);
79779         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79780         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79781         channel_id_conv = ChannelId_clone(&channel_id_conv);
79782         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79783         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
79784         int64_t ret_ref = tag_ptr(ret_copy, true);
79785         return ret_ref;
79786 }
79787
79788 int64_t  CS_LDK_Event_payment_forwarded(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) {
79789         LDKChannelId prev_channel_id_conv;
79790         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79791         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79792         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79793         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79794         LDKChannelId next_channel_id_conv;
79795         next_channel_id_conv.inner = untag_ptr(next_channel_id);
79796         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
79797         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
79798         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
79799         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
79800         CHECK_ACCESS(prev_user_channel_id_ptr);
79801         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
79802         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
79803         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
79804         CHECK_ACCESS(next_user_channel_id_ptr);
79805         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
79806         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
79807         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
79808         CHECK_ACCESS(total_fee_earned_msat_ptr);
79809         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
79810         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
79811         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
79812         CHECK_ACCESS(skimmed_fee_msat_ptr);
79813         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
79814         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
79815         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
79816         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
79817         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
79818         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
79819         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79820         *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);
79821         int64_t ret_ref = tag_ptr(ret_copy, true);
79822         return ret_ref;
79823 }
79824
79825 int64_t  CS_LDK_Event_channel_pending(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) {
79826         LDKChannelId channel_id_conv;
79827         channel_id_conv.inner = untag_ptr(channel_id);
79828         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79829         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79830         channel_id_conv = ChannelId_clone(&channel_id_conv);
79831         LDKU128 user_channel_id_ref;
79832         CHECK(user_channel_id->arr_len == 16);
79833         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79834         LDKChannelId former_temporary_channel_id_conv;
79835         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
79836         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
79837         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
79838         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
79839         LDKPublicKey counterparty_node_id_ref;
79840         CHECK(counterparty_node_id->arr_len == 33);
79841         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79842         LDKOutPoint funding_txo_conv;
79843         funding_txo_conv.inner = untag_ptr(funding_txo);
79844         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
79845         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
79846         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
79847         LDKChannelTypeFeatures channel_type_conv;
79848         channel_type_conv.inner = untag_ptr(channel_type);
79849         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79850         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79851         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79852         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79853         *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);
79854         int64_t ret_ref = tag_ptr(ret_copy, true);
79855         return ret_ref;
79856 }
79857
79858 int64_t  CS_LDK_Event_channel_ready(int64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
79859         LDKChannelId channel_id_conv;
79860         channel_id_conv.inner = untag_ptr(channel_id);
79861         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79862         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79863         channel_id_conv = ChannelId_clone(&channel_id_conv);
79864         LDKU128 user_channel_id_ref;
79865         CHECK(user_channel_id->arr_len == 16);
79866         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79867         LDKPublicKey counterparty_node_id_ref;
79868         CHECK(counterparty_node_id->arr_len == 33);
79869         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79870         LDKChannelTypeFeatures channel_type_conv;
79871         channel_type_conv.inner = untag_ptr(channel_type);
79872         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79873         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79874         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79875         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79876         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
79877         int64_t ret_ref = tag_ptr(ret_copy, true);
79878         return ret_ref;
79879 }
79880
79881 int64_t  CS_LDK_Event_channel_closed(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) {
79882         LDKChannelId channel_id_conv;
79883         channel_id_conv.inner = untag_ptr(channel_id);
79884         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79885         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79886         channel_id_conv = ChannelId_clone(&channel_id_conv);
79887         LDKU128 user_channel_id_ref;
79888         CHECK(user_channel_id->arr_len == 16);
79889         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
79890         void* reason_ptr = untag_ptr(reason);
79891         CHECK_ACCESS(reason_ptr);
79892         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
79893         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
79894         LDKPublicKey counterparty_node_id_ref;
79895         CHECK(counterparty_node_id->arr_len == 33);
79896         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79897         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
79898         CHECK_ACCESS(channel_capacity_sats_ptr);
79899         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
79900         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
79901         LDKOutPoint channel_funding_txo_conv;
79902         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
79903         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
79904         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
79905         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
79906         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79907         *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);
79908         int64_t ret_ref = tag_ptr(ret_copy, true);
79909         return ret_ref;
79910 }
79911
79912 int64_t  CS_LDK_Event_discard_funding(int64_t channel_id, int8_tArray transaction) {
79913         LDKChannelId channel_id_conv;
79914         channel_id_conv.inner = untag_ptr(channel_id);
79915         channel_id_conv.is_owned = ptr_is_owned(channel_id);
79916         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
79917         channel_id_conv = ChannelId_clone(&channel_id_conv);
79918         LDKTransaction transaction_ref;
79919         transaction_ref.datalen = transaction->arr_len;
79920         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
79921         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
79922         transaction_ref.data_is_owned = true;
79923         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79924         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
79925         int64_t ret_ref = tag_ptr(ret_copy, true);
79926         return ret_ref;
79927 }
79928
79929 int64_t  CS_LDK_Event_open_channel_request(int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
79930         LDKChannelId temporary_channel_id_conv;
79931         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
79932         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
79933         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
79934         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
79935         LDKPublicKey counterparty_node_id_ref;
79936         CHECK(counterparty_node_id->arr_len == 33);
79937         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
79938         LDKChannelTypeFeatures channel_type_conv;
79939         channel_type_conv.inner = untag_ptr(channel_type);
79940         channel_type_conv.is_owned = ptr_is_owned(channel_type);
79941         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
79942         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
79943         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79944         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
79945         int64_t ret_ref = tag_ptr(ret_copy, true);
79946         return ret_ref;
79947 }
79948
79949 int64_t  CS_LDK_Event_htlchandling_failed(int64_t prev_channel_id, int64_t failed_next_destination) {
79950         LDKChannelId prev_channel_id_conv;
79951         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
79952         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
79953         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
79954         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
79955         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
79956         CHECK_ACCESS(failed_next_destination_ptr);
79957         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
79958         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
79959         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79960         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
79961         int64_t ret_ref = tag_ptr(ret_copy, true);
79962         return ret_ref;
79963 }
79964
79965 int64_t  CS_LDK_Event_bump_transaction(int64_t a) {
79966         void* a_ptr = untag_ptr(a);
79967         CHECK_ACCESS(a_ptr);
79968         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
79969         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
79970         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
79971         *ret_copy = Event_bump_transaction(a_conv);
79972         int64_t ret_ref = tag_ptr(ret_copy, true);
79973         return ret_ref;
79974 }
79975
79976 jboolean  CS_LDK_Event_eq(int64_t a, int64_t b) {
79977         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
79978         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
79979         jboolean ret_conv = Event_eq(a_conv, b_conv);
79980         return ret_conv;
79981 }
79982
79983 int8_tArray  CS_LDK_Event_write(int64_t obj) {
79984         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
79985         LDKCVec_u8Z ret_var = Event_write(obj_conv);
79986         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79987         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79988         CVec_u8Z_free(ret_var);
79989         return ret_arr;
79990 }
79991
79992 int64_t  CS_LDK_Event_read(int8_tArray ser) {
79993         LDKu8slice ser_ref;
79994         ser_ref.datalen = ser->arr_len;
79995         ser_ref.data = ser->elems;
79996         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
79997         *ret_conv = Event_read(ser_ref);
79998         FREE(ser);
79999         return tag_ptr(ret_conv, true);
80000 }
80001
80002 void  CS_LDK_MessageSendEvent_free(int64_t this_ptr) {
80003         if (!ptr_is_owned(this_ptr)) return;
80004         void* this_ptr_ptr = untag_ptr(this_ptr);
80005         CHECK_ACCESS(this_ptr_ptr);
80006         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
80007         FREE(untag_ptr(this_ptr));
80008         MessageSendEvent_free(this_ptr_conv);
80009 }
80010
80011 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
80012         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80013         *ret_copy = MessageSendEvent_clone(arg);
80014         int64_t ret_ref = tag_ptr(ret_copy, true);
80015         return ret_ref;
80016 }
80017 int64_t  CS_LDK_MessageSendEvent_clone_ptr(int64_t arg) {
80018         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
80019         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
80020         return ret_conv;
80021 }
80022
80023 int64_t  CS_LDK_MessageSendEvent_clone(int64_t orig) {
80024         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
80025         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80026         *ret_copy = MessageSendEvent_clone(orig_conv);
80027         int64_t ret_ref = tag_ptr(ret_copy, true);
80028         return ret_ref;
80029 }
80030
80031 int64_t  CS_LDK_MessageSendEvent_send_accept_channel(int8_tArray node_id, int64_t msg) {
80032         LDKPublicKey node_id_ref;
80033         CHECK(node_id->arr_len == 33);
80034         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80035         LDKAcceptChannel msg_conv;
80036         msg_conv.inner = untag_ptr(msg);
80037         msg_conv.is_owned = ptr_is_owned(msg);
80038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80039         msg_conv = AcceptChannel_clone(&msg_conv);
80040         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80041         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
80042         int64_t ret_ref = tag_ptr(ret_copy, true);
80043         return ret_ref;
80044 }
80045
80046 int64_t  CS_LDK_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, int64_t msg) {
80047         LDKPublicKey node_id_ref;
80048         CHECK(node_id->arr_len == 33);
80049         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80050         LDKAcceptChannelV2 msg_conv;
80051         msg_conv.inner = untag_ptr(msg);
80052         msg_conv.is_owned = ptr_is_owned(msg);
80053         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80054         msg_conv = AcceptChannelV2_clone(&msg_conv);
80055         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80056         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
80057         int64_t ret_ref = tag_ptr(ret_copy, true);
80058         return ret_ref;
80059 }
80060
80061 int64_t  CS_LDK_MessageSendEvent_send_open_channel(int8_tArray node_id, int64_t msg) {
80062         LDKPublicKey node_id_ref;
80063         CHECK(node_id->arr_len == 33);
80064         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80065         LDKOpenChannel msg_conv;
80066         msg_conv.inner = untag_ptr(msg);
80067         msg_conv.is_owned = ptr_is_owned(msg);
80068         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80069         msg_conv = OpenChannel_clone(&msg_conv);
80070         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80071         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
80072         int64_t ret_ref = tag_ptr(ret_copy, true);
80073         return ret_ref;
80074 }
80075
80076 int64_t  CS_LDK_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, int64_t msg) {
80077         LDKPublicKey node_id_ref;
80078         CHECK(node_id->arr_len == 33);
80079         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80080         LDKOpenChannelV2 msg_conv;
80081         msg_conv.inner = untag_ptr(msg);
80082         msg_conv.is_owned = ptr_is_owned(msg);
80083         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80084         msg_conv = OpenChannelV2_clone(&msg_conv);
80085         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80086         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
80087         int64_t ret_ref = tag_ptr(ret_copy, true);
80088         return ret_ref;
80089 }
80090
80091 int64_t  CS_LDK_MessageSendEvent_send_funding_created(int8_tArray node_id, int64_t msg) {
80092         LDKPublicKey node_id_ref;
80093         CHECK(node_id->arr_len == 33);
80094         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80095         LDKFundingCreated msg_conv;
80096         msg_conv.inner = untag_ptr(msg);
80097         msg_conv.is_owned = ptr_is_owned(msg);
80098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80099         msg_conv = FundingCreated_clone(&msg_conv);
80100         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80101         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
80102         int64_t ret_ref = tag_ptr(ret_copy, true);
80103         return ret_ref;
80104 }
80105
80106 int64_t  CS_LDK_MessageSendEvent_send_funding_signed(int8_tArray node_id, int64_t msg) {
80107         LDKPublicKey node_id_ref;
80108         CHECK(node_id->arr_len == 33);
80109         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80110         LDKFundingSigned msg_conv;
80111         msg_conv.inner = untag_ptr(msg);
80112         msg_conv.is_owned = ptr_is_owned(msg);
80113         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80114         msg_conv = FundingSigned_clone(&msg_conv);
80115         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80116         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
80117         int64_t ret_ref = tag_ptr(ret_copy, true);
80118         return ret_ref;
80119 }
80120
80121 int64_t  CS_LDK_MessageSendEvent_send_stfu(int8_tArray node_id, int64_t msg) {
80122         LDKPublicKey node_id_ref;
80123         CHECK(node_id->arr_len == 33);
80124         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80125         LDKStfu msg_conv;
80126         msg_conv.inner = untag_ptr(msg);
80127         msg_conv.is_owned = ptr_is_owned(msg);
80128         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80129         msg_conv = Stfu_clone(&msg_conv);
80130         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80131         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
80132         int64_t ret_ref = tag_ptr(ret_copy, true);
80133         return ret_ref;
80134 }
80135
80136 int64_t  CS_LDK_MessageSendEvent_send_splice(int8_tArray node_id, int64_t msg) {
80137         LDKPublicKey node_id_ref;
80138         CHECK(node_id->arr_len == 33);
80139         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80140         LDKSplice msg_conv;
80141         msg_conv.inner = untag_ptr(msg);
80142         msg_conv.is_owned = ptr_is_owned(msg);
80143         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80144         msg_conv = Splice_clone(&msg_conv);
80145         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80146         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
80147         int64_t ret_ref = tag_ptr(ret_copy, true);
80148         return ret_ref;
80149 }
80150
80151 int64_t  CS_LDK_MessageSendEvent_send_splice_ack(int8_tArray node_id, int64_t msg) {
80152         LDKPublicKey node_id_ref;
80153         CHECK(node_id->arr_len == 33);
80154         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80155         LDKSpliceAck msg_conv;
80156         msg_conv.inner = untag_ptr(msg);
80157         msg_conv.is_owned = ptr_is_owned(msg);
80158         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80159         msg_conv = SpliceAck_clone(&msg_conv);
80160         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80161         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
80162         int64_t ret_ref = tag_ptr(ret_copy, true);
80163         return ret_ref;
80164 }
80165
80166 int64_t  CS_LDK_MessageSendEvent_send_splice_locked(int8_tArray node_id, int64_t msg) {
80167         LDKPublicKey node_id_ref;
80168         CHECK(node_id->arr_len == 33);
80169         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80170         LDKSpliceLocked msg_conv;
80171         msg_conv.inner = untag_ptr(msg);
80172         msg_conv.is_owned = ptr_is_owned(msg);
80173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80174         msg_conv = SpliceLocked_clone(&msg_conv);
80175         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80176         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
80177         int64_t ret_ref = tag_ptr(ret_copy, true);
80178         return ret_ref;
80179 }
80180
80181 int64_t  CS_LDK_MessageSendEvent_send_tx_add_input(int8_tArray node_id, int64_t msg) {
80182         LDKPublicKey node_id_ref;
80183         CHECK(node_id->arr_len == 33);
80184         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80185         LDKTxAddInput msg_conv;
80186         msg_conv.inner = untag_ptr(msg);
80187         msg_conv.is_owned = ptr_is_owned(msg);
80188         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80189         msg_conv = TxAddInput_clone(&msg_conv);
80190         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80191         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
80192         int64_t ret_ref = tag_ptr(ret_copy, true);
80193         return ret_ref;
80194 }
80195
80196 int64_t  CS_LDK_MessageSendEvent_send_tx_add_output(int8_tArray node_id, int64_t msg) {
80197         LDKPublicKey node_id_ref;
80198         CHECK(node_id->arr_len == 33);
80199         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80200         LDKTxAddOutput msg_conv;
80201         msg_conv.inner = untag_ptr(msg);
80202         msg_conv.is_owned = ptr_is_owned(msg);
80203         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80204         msg_conv = TxAddOutput_clone(&msg_conv);
80205         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80206         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
80207         int64_t ret_ref = tag_ptr(ret_copy, true);
80208         return ret_ref;
80209 }
80210
80211 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, int64_t msg) {
80212         LDKPublicKey node_id_ref;
80213         CHECK(node_id->arr_len == 33);
80214         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80215         LDKTxRemoveInput msg_conv;
80216         msg_conv.inner = untag_ptr(msg);
80217         msg_conv.is_owned = ptr_is_owned(msg);
80218         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80219         msg_conv = TxRemoveInput_clone(&msg_conv);
80220         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80221         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
80222         int64_t ret_ref = tag_ptr(ret_copy, true);
80223         return ret_ref;
80224 }
80225
80226 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, int64_t msg) {
80227         LDKPublicKey node_id_ref;
80228         CHECK(node_id->arr_len == 33);
80229         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80230         LDKTxRemoveOutput msg_conv;
80231         msg_conv.inner = untag_ptr(msg);
80232         msg_conv.is_owned = ptr_is_owned(msg);
80233         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80234         msg_conv = TxRemoveOutput_clone(&msg_conv);
80235         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80236         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
80237         int64_t ret_ref = tag_ptr(ret_copy, true);
80238         return ret_ref;
80239 }
80240
80241 int64_t  CS_LDK_MessageSendEvent_send_tx_complete(int8_tArray node_id, int64_t msg) {
80242         LDKPublicKey node_id_ref;
80243         CHECK(node_id->arr_len == 33);
80244         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80245         LDKTxComplete msg_conv;
80246         msg_conv.inner = untag_ptr(msg);
80247         msg_conv.is_owned = ptr_is_owned(msg);
80248         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80249         msg_conv = TxComplete_clone(&msg_conv);
80250         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80251         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
80252         int64_t ret_ref = tag_ptr(ret_copy, true);
80253         return ret_ref;
80254 }
80255
80256 int64_t  CS_LDK_MessageSendEvent_send_tx_signatures(int8_tArray node_id, int64_t msg) {
80257         LDKPublicKey node_id_ref;
80258         CHECK(node_id->arr_len == 33);
80259         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80260         LDKTxSignatures msg_conv;
80261         msg_conv.inner = untag_ptr(msg);
80262         msg_conv.is_owned = ptr_is_owned(msg);
80263         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80264         msg_conv = TxSignatures_clone(&msg_conv);
80265         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80266         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
80267         int64_t ret_ref = tag_ptr(ret_copy, true);
80268         return ret_ref;
80269 }
80270
80271 int64_t  CS_LDK_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, int64_t msg) {
80272         LDKPublicKey node_id_ref;
80273         CHECK(node_id->arr_len == 33);
80274         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80275         LDKTxInitRbf msg_conv;
80276         msg_conv.inner = untag_ptr(msg);
80277         msg_conv.is_owned = ptr_is_owned(msg);
80278         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80279         msg_conv = TxInitRbf_clone(&msg_conv);
80280         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80281         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
80282         int64_t ret_ref = tag_ptr(ret_copy, true);
80283         return ret_ref;
80284 }
80285
80286 int64_t  CS_LDK_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, int64_t msg) {
80287         LDKPublicKey node_id_ref;
80288         CHECK(node_id->arr_len == 33);
80289         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80290         LDKTxAckRbf msg_conv;
80291         msg_conv.inner = untag_ptr(msg);
80292         msg_conv.is_owned = ptr_is_owned(msg);
80293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80294         msg_conv = TxAckRbf_clone(&msg_conv);
80295         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80296         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
80297         int64_t ret_ref = tag_ptr(ret_copy, true);
80298         return ret_ref;
80299 }
80300
80301 int64_t  CS_LDK_MessageSendEvent_send_tx_abort(int8_tArray node_id, int64_t msg) {
80302         LDKPublicKey node_id_ref;
80303         CHECK(node_id->arr_len == 33);
80304         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80305         LDKTxAbort msg_conv;
80306         msg_conv.inner = untag_ptr(msg);
80307         msg_conv.is_owned = ptr_is_owned(msg);
80308         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80309         msg_conv = TxAbort_clone(&msg_conv);
80310         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80311         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
80312         int64_t ret_ref = tag_ptr(ret_copy, true);
80313         return ret_ref;
80314 }
80315
80316 int64_t  CS_LDK_MessageSendEvent_send_channel_ready(int8_tArray node_id, int64_t msg) {
80317         LDKPublicKey node_id_ref;
80318         CHECK(node_id->arr_len == 33);
80319         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80320         LDKChannelReady msg_conv;
80321         msg_conv.inner = untag_ptr(msg);
80322         msg_conv.is_owned = ptr_is_owned(msg);
80323         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80324         msg_conv = ChannelReady_clone(&msg_conv);
80325         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80326         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
80327         int64_t ret_ref = tag_ptr(ret_copy, true);
80328         return ret_ref;
80329 }
80330
80331 int64_t  CS_LDK_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, int64_t msg) {
80332         LDKPublicKey node_id_ref;
80333         CHECK(node_id->arr_len == 33);
80334         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80335         LDKAnnouncementSignatures msg_conv;
80336         msg_conv.inner = untag_ptr(msg);
80337         msg_conv.is_owned = ptr_is_owned(msg);
80338         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80339         msg_conv = AnnouncementSignatures_clone(&msg_conv);
80340         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80341         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
80342         int64_t ret_ref = tag_ptr(ret_copy, true);
80343         return ret_ref;
80344 }
80345
80346 int64_t  CS_LDK_MessageSendEvent_update_htlcs(int8_tArray node_id, int64_t updates) {
80347         LDKPublicKey node_id_ref;
80348         CHECK(node_id->arr_len == 33);
80349         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80350         LDKCommitmentUpdate updates_conv;
80351         updates_conv.inner = untag_ptr(updates);
80352         updates_conv.is_owned = ptr_is_owned(updates);
80353         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
80354         updates_conv = CommitmentUpdate_clone(&updates_conv);
80355         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80356         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
80357         int64_t ret_ref = tag_ptr(ret_copy, true);
80358         return ret_ref;
80359 }
80360
80361 int64_t  CS_LDK_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, int64_t msg) {
80362         LDKPublicKey node_id_ref;
80363         CHECK(node_id->arr_len == 33);
80364         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80365         LDKRevokeAndACK msg_conv;
80366         msg_conv.inner = untag_ptr(msg);
80367         msg_conv.is_owned = ptr_is_owned(msg);
80368         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80369         msg_conv = RevokeAndACK_clone(&msg_conv);
80370         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80371         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
80372         int64_t ret_ref = tag_ptr(ret_copy, true);
80373         return ret_ref;
80374 }
80375
80376 int64_t  CS_LDK_MessageSendEvent_send_closing_signed(int8_tArray node_id, int64_t msg) {
80377         LDKPublicKey node_id_ref;
80378         CHECK(node_id->arr_len == 33);
80379         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80380         LDKClosingSigned msg_conv;
80381         msg_conv.inner = untag_ptr(msg);
80382         msg_conv.is_owned = ptr_is_owned(msg);
80383         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80384         msg_conv = ClosingSigned_clone(&msg_conv);
80385         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80386         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
80387         int64_t ret_ref = tag_ptr(ret_copy, true);
80388         return ret_ref;
80389 }
80390
80391 int64_t  CS_LDK_MessageSendEvent_send_shutdown(int8_tArray node_id, int64_t msg) {
80392         LDKPublicKey node_id_ref;
80393         CHECK(node_id->arr_len == 33);
80394         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80395         LDKShutdown msg_conv;
80396         msg_conv.inner = untag_ptr(msg);
80397         msg_conv.is_owned = ptr_is_owned(msg);
80398         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80399         msg_conv = Shutdown_clone(&msg_conv);
80400         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80401         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
80402         int64_t ret_ref = tag_ptr(ret_copy, true);
80403         return ret_ref;
80404 }
80405
80406 int64_t  CS_LDK_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, int64_t msg) {
80407         LDKPublicKey node_id_ref;
80408         CHECK(node_id->arr_len == 33);
80409         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80410         LDKChannelReestablish msg_conv;
80411         msg_conv.inner = untag_ptr(msg);
80412         msg_conv.is_owned = ptr_is_owned(msg);
80413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80414         msg_conv = ChannelReestablish_clone(&msg_conv);
80415         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80416         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
80417         int64_t ret_ref = tag_ptr(ret_copy, true);
80418         return ret_ref;
80419 }
80420
80421 int64_t  CS_LDK_MessageSendEvent_send_channel_announcement(int8_tArray node_id, int64_t msg, int64_t update_msg) {
80422         LDKPublicKey node_id_ref;
80423         CHECK(node_id->arr_len == 33);
80424         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80425         LDKChannelAnnouncement msg_conv;
80426         msg_conv.inner = untag_ptr(msg);
80427         msg_conv.is_owned = ptr_is_owned(msg);
80428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80429         msg_conv = ChannelAnnouncement_clone(&msg_conv);
80430         LDKChannelUpdate update_msg_conv;
80431         update_msg_conv.inner = untag_ptr(update_msg);
80432         update_msg_conv.is_owned = ptr_is_owned(update_msg);
80433         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
80434         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
80435         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80436         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
80437         int64_t ret_ref = tag_ptr(ret_copy, true);
80438         return ret_ref;
80439 }
80440
80441 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_announcement(int64_t msg, int64_t update_msg) {
80442         LDKChannelAnnouncement msg_conv;
80443         msg_conv.inner = untag_ptr(msg);
80444         msg_conv.is_owned = ptr_is_owned(msg);
80445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80446         msg_conv = ChannelAnnouncement_clone(&msg_conv);
80447         LDKChannelUpdate update_msg_conv;
80448         update_msg_conv.inner = untag_ptr(update_msg);
80449         update_msg_conv.is_owned = ptr_is_owned(update_msg);
80450         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
80451         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
80452         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80453         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
80454         int64_t ret_ref = tag_ptr(ret_copy, true);
80455         return ret_ref;
80456 }
80457
80458 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_update(int64_t msg) {
80459         LDKChannelUpdate msg_conv;
80460         msg_conv.inner = untag_ptr(msg);
80461         msg_conv.is_owned = ptr_is_owned(msg);
80462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80463         msg_conv = ChannelUpdate_clone(&msg_conv);
80464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80465         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
80466         int64_t ret_ref = tag_ptr(ret_copy, true);
80467         return ret_ref;
80468 }
80469
80470 int64_t  CS_LDK_MessageSendEvent_broadcast_node_announcement(int64_t msg) {
80471         LDKNodeAnnouncement msg_conv;
80472         msg_conv.inner = untag_ptr(msg);
80473         msg_conv.is_owned = ptr_is_owned(msg);
80474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80475         msg_conv = NodeAnnouncement_clone(&msg_conv);
80476         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80477         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
80478         int64_t ret_ref = tag_ptr(ret_copy, true);
80479         return ret_ref;
80480 }
80481
80482 int64_t  CS_LDK_MessageSendEvent_send_channel_update(int8_tArray node_id, int64_t msg) {
80483         LDKPublicKey node_id_ref;
80484         CHECK(node_id->arr_len == 33);
80485         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80486         LDKChannelUpdate msg_conv;
80487         msg_conv.inner = untag_ptr(msg);
80488         msg_conv.is_owned = ptr_is_owned(msg);
80489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80490         msg_conv = ChannelUpdate_clone(&msg_conv);
80491         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80492         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
80493         int64_t ret_ref = tag_ptr(ret_copy, true);
80494         return ret_ref;
80495 }
80496
80497 int64_t  CS_LDK_MessageSendEvent_handle_error(int8_tArray node_id, int64_t action) {
80498         LDKPublicKey node_id_ref;
80499         CHECK(node_id->arr_len == 33);
80500         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80501         void* action_ptr = untag_ptr(action);
80502         CHECK_ACCESS(action_ptr);
80503         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
80504         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
80505         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80506         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
80507         int64_t ret_ref = tag_ptr(ret_copy, true);
80508         return ret_ref;
80509 }
80510
80511 int64_t  CS_LDK_MessageSendEvent_send_channel_range_query(int8_tArray node_id, int64_t msg) {
80512         LDKPublicKey node_id_ref;
80513         CHECK(node_id->arr_len == 33);
80514         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80515         LDKQueryChannelRange msg_conv;
80516         msg_conv.inner = untag_ptr(msg);
80517         msg_conv.is_owned = ptr_is_owned(msg);
80518         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80519         msg_conv = QueryChannelRange_clone(&msg_conv);
80520         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80521         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
80522         int64_t ret_ref = tag_ptr(ret_copy, true);
80523         return ret_ref;
80524 }
80525
80526 int64_t  CS_LDK_MessageSendEvent_send_short_ids_query(int8_tArray node_id, int64_t msg) {
80527         LDKPublicKey node_id_ref;
80528         CHECK(node_id->arr_len == 33);
80529         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80530         LDKQueryShortChannelIds msg_conv;
80531         msg_conv.inner = untag_ptr(msg);
80532         msg_conv.is_owned = ptr_is_owned(msg);
80533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80534         msg_conv = QueryShortChannelIds_clone(&msg_conv);
80535         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80536         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
80537         int64_t ret_ref = tag_ptr(ret_copy, true);
80538         return ret_ref;
80539 }
80540
80541 int64_t  CS_LDK_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, int64_t msg) {
80542         LDKPublicKey node_id_ref;
80543         CHECK(node_id->arr_len == 33);
80544         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80545         LDKReplyChannelRange msg_conv;
80546         msg_conv.inner = untag_ptr(msg);
80547         msg_conv.is_owned = ptr_is_owned(msg);
80548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80549         msg_conv = ReplyChannelRange_clone(&msg_conv);
80550         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80551         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
80552         int64_t ret_ref = tag_ptr(ret_copy, true);
80553         return ret_ref;
80554 }
80555
80556 int64_t  CS_LDK_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, int64_t msg) {
80557         LDKPublicKey node_id_ref;
80558         CHECK(node_id->arr_len == 33);
80559         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80560         LDKGossipTimestampFilter msg_conv;
80561         msg_conv.inner = untag_ptr(msg);
80562         msg_conv.is_owned = ptr_is_owned(msg);
80563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
80564         msg_conv = GossipTimestampFilter_clone(&msg_conv);
80565         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
80566         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
80567         int64_t ret_ref = tag_ptr(ret_copy, true);
80568         return ret_ref;
80569 }
80570
80571 void  CS_LDK_MessageSendEventsProvider_free(int64_t this_ptr) {
80572         if (!ptr_is_owned(this_ptr)) return;
80573         void* this_ptr_ptr = untag_ptr(this_ptr);
80574         CHECK_ACCESS(this_ptr_ptr);
80575         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
80576         FREE(untag_ptr(this_ptr));
80577         MessageSendEventsProvider_free(this_ptr_conv);
80578 }
80579
80580 void  CS_LDK_EventsProvider_free(int64_t this_ptr) {
80581         if (!ptr_is_owned(this_ptr)) return;
80582         void* this_ptr_ptr = untag_ptr(this_ptr);
80583         CHECK_ACCESS(this_ptr_ptr);
80584         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
80585         FREE(untag_ptr(this_ptr));
80586         EventsProvider_free(this_ptr_conv);
80587 }
80588
80589 void  CS_LDK_EventHandler_free(int64_t this_ptr) {
80590         if (!ptr_is_owned(this_ptr)) return;
80591         void* this_ptr_ptr = untag_ptr(this_ptr);
80592         CHECK_ACCESS(this_ptr_ptr);
80593         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
80594         FREE(untag_ptr(this_ptr));
80595         EventHandler_free(this_ptr_conv);
80596 }
80597
80598 void  CS_LDK_AnchorDescriptor_free(int64_t this_obj) {
80599         LDKAnchorDescriptor this_obj_conv;
80600         this_obj_conv.inner = untag_ptr(this_obj);
80601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80603         AnchorDescriptor_free(this_obj_conv);
80604 }
80605
80606 int64_t  CS_LDK_AnchorDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
80607         LDKAnchorDescriptor this_ptr_conv;
80608         this_ptr_conv.inner = untag_ptr(this_ptr);
80609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80611         this_ptr_conv.is_owned = false;
80612         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
80613         int64_t ret_ref = 0;
80614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80616         return ret_ref;
80617 }
80618
80619 void  CS_LDK_AnchorDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
80620         LDKAnchorDescriptor this_ptr_conv;
80621         this_ptr_conv.inner = untag_ptr(this_ptr);
80622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80624         this_ptr_conv.is_owned = false;
80625         LDKChannelDerivationParameters val_conv;
80626         val_conv.inner = untag_ptr(val);
80627         val_conv.is_owned = ptr_is_owned(val);
80628         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80629         val_conv = ChannelDerivationParameters_clone(&val_conv);
80630         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
80631 }
80632
80633 int64_t  CS_LDK_AnchorDescriptor_get_outpoint(int64_t this_ptr) {
80634         LDKAnchorDescriptor this_ptr_conv;
80635         this_ptr_conv.inner = untag_ptr(this_ptr);
80636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80638         this_ptr_conv.is_owned = false;
80639         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
80640         int64_t ret_ref = 0;
80641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80643         return ret_ref;
80644 }
80645
80646 void  CS_LDK_AnchorDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
80647         LDKAnchorDescriptor this_ptr_conv;
80648         this_ptr_conv.inner = untag_ptr(this_ptr);
80649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80651         this_ptr_conv.is_owned = false;
80652         LDKOutPoint val_conv;
80653         val_conv.inner = untag_ptr(val);
80654         val_conv.is_owned = ptr_is_owned(val);
80655         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80656         val_conv = OutPoint_clone(&val_conv);
80657         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
80658 }
80659
80660 int64_t  CS_LDK_AnchorDescriptor_new(int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
80661         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
80662         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
80663         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
80664         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
80665         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
80666         LDKOutPoint outpoint_arg_conv;
80667         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80668         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80669         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80670         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80671         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
80672         int64_t ret_ref = 0;
80673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80675         return ret_ref;
80676 }
80677
80678 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
80679         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
80680         int64_t ret_ref = 0;
80681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80683         return ret_ref;
80684 }
80685 int64_t  CS_LDK_AnchorDescriptor_clone_ptr(int64_t arg) {
80686         LDKAnchorDescriptor arg_conv;
80687         arg_conv.inner = untag_ptr(arg);
80688         arg_conv.is_owned = ptr_is_owned(arg);
80689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80690         arg_conv.is_owned = false;
80691         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
80692         return ret_conv;
80693 }
80694
80695 int64_t  CS_LDK_AnchorDescriptor_clone(int64_t orig) {
80696         LDKAnchorDescriptor orig_conv;
80697         orig_conv.inner = untag_ptr(orig);
80698         orig_conv.is_owned = ptr_is_owned(orig);
80699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80700         orig_conv.is_owned = false;
80701         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
80702         int64_t ret_ref = 0;
80703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80705         return ret_ref;
80706 }
80707
80708 jboolean  CS_LDK_AnchorDescriptor_eq(int64_t a, int64_t b) {
80709         LDKAnchorDescriptor a_conv;
80710         a_conv.inner = untag_ptr(a);
80711         a_conv.is_owned = ptr_is_owned(a);
80712         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80713         a_conv.is_owned = false;
80714         LDKAnchorDescriptor b_conv;
80715         b_conv.inner = untag_ptr(b);
80716         b_conv.is_owned = ptr_is_owned(b);
80717         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80718         b_conv.is_owned = false;
80719         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
80720         return ret_conv;
80721 }
80722
80723 int64_t  CS_LDK_AnchorDescriptor_previous_utxo(int64_t this_arg) {
80724         LDKAnchorDescriptor this_arg_conv;
80725         this_arg_conv.inner = untag_ptr(this_arg);
80726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80728         this_arg_conv.is_owned = false;
80729         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80730         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
80731         return tag_ptr(ret_ref, true);
80732 }
80733
80734 int64_t  CS_LDK_AnchorDescriptor_unsigned_tx_input(int64_t this_arg) {
80735         LDKAnchorDescriptor this_arg_conv;
80736         this_arg_conv.inner = untag_ptr(this_arg);
80737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80739         this_arg_conv.is_owned = false;
80740         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
80741         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
80742         return tag_ptr(ret_ref, true);
80743 }
80744
80745 int8_tArray  CS_LDK_AnchorDescriptor_witness_script(int64_t this_arg) {
80746         LDKAnchorDescriptor this_arg_conv;
80747         this_arg_conv.inner = untag_ptr(this_arg);
80748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80750         this_arg_conv.is_owned = false;
80751         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
80752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80754         CVec_u8Z_free(ret_var);
80755         return ret_arr;
80756 }
80757
80758 int8_tArray  CS_LDK_AnchorDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature) {
80759         LDKAnchorDescriptor this_arg_conv;
80760         this_arg_conv.inner = untag_ptr(this_arg);
80761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80763         this_arg_conv.is_owned = false;
80764         LDKECDSASignature signature_ref;
80765         CHECK(signature->arr_len == 64);
80766         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
80767         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
80768         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80769         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80770         Witness_free(ret_var);
80771         return ret_arr;
80772 }
80773
80774 int64_t  CS_LDK_AnchorDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
80775         LDKAnchorDescriptor this_arg_conv;
80776         this_arg_conv.inner = untag_ptr(this_arg);
80777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80779         this_arg_conv.is_owned = false;
80780         void* signer_provider_ptr = untag_ptr(signer_provider);
80781         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
80782         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
80783         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
80784         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
80785         return tag_ptr(ret_ret, true);
80786 }
80787
80788 void  CS_LDK_BumpTransactionEvent_free(int64_t this_ptr) {
80789         if (!ptr_is_owned(this_ptr)) return;
80790         void* this_ptr_ptr = untag_ptr(this_ptr);
80791         CHECK_ACCESS(this_ptr_ptr);
80792         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
80793         FREE(untag_ptr(this_ptr));
80794         BumpTransactionEvent_free(this_ptr_conv);
80795 }
80796
80797 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
80798         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80799         *ret_copy = BumpTransactionEvent_clone(arg);
80800         int64_t ret_ref = tag_ptr(ret_copy, true);
80801         return ret_ref;
80802 }
80803 int64_t  CS_LDK_BumpTransactionEvent_clone_ptr(int64_t arg) {
80804         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
80805         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
80806         return ret_conv;
80807 }
80808
80809 int64_t  CS_LDK_BumpTransactionEvent_clone(int64_t orig) {
80810         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
80811         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80812         *ret_copy = BumpTransactionEvent_clone(orig_conv);
80813         int64_t ret_ref = tag_ptr(ret_copy, true);
80814         return ret_ref;
80815 }
80816
80817 int64_t  CS_LDK_BumpTransactionEvent_channel_close(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) {
80818         LDKChannelId channel_id_conv;
80819         channel_id_conv.inner = untag_ptr(channel_id);
80820         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80822         channel_id_conv = ChannelId_clone(&channel_id_conv);
80823         LDKPublicKey counterparty_node_id_ref;
80824         CHECK(counterparty_node_id->arr_len == 33);
80825         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80826         LDKThirtyTwoBytes claim_id_ref;
80827         CHECK(claim_id->arr_len == 32);
80828         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80829         LDKTransaction commitment_tx_ref;
80830         commitment_tx_ref.datalen = commitment_tx->arr_len;
80831         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
80832         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
80833         commitment_tx_ref.data_is_owned = true;
80834         LDKAnchorDescriptor anchor_descriptor_conv;
80835         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
80836         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
80837         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
80838         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
80839         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
80840         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
80841         if (pending_htlcs_constr.datalen > 0)
80842                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
80843         else
80844                 pending_htlcs_constr.data = NULL;
80845         int64_t* pending_htlcs_vals = pending_htlcs->elems;
80846         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
80847                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
80848                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
80849                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
80850                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
80851                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
80852                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
80853                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
80854         }
80855         FREE(pending_htlcs);
80856         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80857         *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);
80858         int64_t ret_ref = tag_ptr(ret_copy, true);
80859         return ret_ref;
80860 }
80861
80862 int64_t  CS_LDK_BumpTransactionEvent_htlcresolution(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) {
80863         LDKChannelId channel_id_conv;
80864         channel_id_conv.inner = untag_ptr(channel_id);
80865         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80866         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80867         channel_id_conv = ChannelId_clone(&channel_id_conv);
80868         LDKPublicKey counterparty_node_id_ref;
80869         CHECK(counterparty_node_id->arr_len == 33);
80870         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80871         LDKThirtyTwoBytes claim_id_ref;
80872         CHECK(claim_id->arr_len == 32);
80873         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
80874         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
80875         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
80876         if (htlc_descriptors_constr.datalen > 0)
80877                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
80878         else
80879                 htlc_descriptors_constr.data = NULL;
80880         int64_t* htlc_descriptors_vals = htlc_descriptors->elems;
80881         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
80882                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
80883                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
80884                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
80885                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
80886                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
80887                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
80888                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
80889         }
80890         FREE(htlc_descriptors);
80891         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
80892         *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);
80893         int64_t ret_ref = tag_ptr(ret_copy, true);
80894         return ret_ref;
80895 }
80896
80897 jboolean  CS_LDK_BumpTransactionEvent_eq(int64_t a, int64_t b) {
80898         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
80899         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
80900         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
80901         return ret_conv;
80902 }
80903
80904 void  CS_LDK_Input_free(int64_t this_obj) {
80905         LDKInput this_obj_conv;
80906         this_obj_conv.inner = untag_ptr(this_obj);
80907         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80909         Input_free(this_obj_conv);
80910 }
80911
80912 int64_t  CS_LDK_Input_get_outpoint(int64_t this_ptr) {
80913         LDKInput this_ptr_conv;
80914         this_ptr_conv.inner = untag_ptr(this_ptr);
80915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80917         this_ptr_conv.is_owned = false;
80918         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
80919         int64_t ret_ref = 0;
80920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80922         return ret_ref;
80923 }
80924
80925 void  CS_LDK_Input_set_outpoint(int64_t this_ptr, int64_t val) {
80926         LDKInput this_ptr_conv;
80927         this_ptr_conv.inner = untag_ptr(this_ptr);
80928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80930         this_ptr_conv.is_owned = false;
80931         LDKOutPoint val_conv;
80932         val_conv.inner = untag_ptr(val);
80933         val_conv.is_owned = ptr_is_owned(val);
80934         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80935         val_conv = OutPoint_clone(&val_conv);
80936         Input_set_outpoint(&this_ptr_conv, val_conv);
80937 }
80938
80939 int64_t  CS_LDK_Input_get_previous_utxo(int64_t this_ptr) {
80940         LDKInput this_ptr_conv;
80941         this_ptr_conv.inner = untag_ptr(this_ptr);
80942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80944         this_ptr_conv.is_owned = false;
80945         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80946         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
80947         return tag_ptr(ret_ref, true);
80948 }
80949
80950 void  CS_LDK_Input_set_previous_utxo(int64_t this_ptr, int64_t val) {
80951         LDKInput this_ptr_conv;
80952         this_ptr_conv.inner = untag_ptr(this_ptr);
80953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80955         this_ptr_conv.is_owned = false;
80956         void* val_ptr = untag_ptr(val);
80957         CHECK_ACCESS(val_ptr);
80958         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
80959         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
80960         Input_set_previous_utxo(&this_ptr_conv, val_conv);
80961 }
80962
80963 int64_t  CS_LDK_Input_get_satisfaction_weight(int64_t this_ptr) {
80964         LDKInput this_ptr_conv;
80965         this_ptr_conv.inner = untag_ptr(this_ptr);
80966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80968         this_ptr_conv.is_owned = false;
80969         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
80970         return ret_conv;
80971 }
80972
80973 void  CS_LDK_Input_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
80974         LDKInput this_ptr_conv;
80975         this_ptr_conv.inner = untag_ptr(this_ptr);
80976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80978         this_ptr_conv.is_owned = false;
80979         Input_set_satisfaction_weight(&this_ptr_conv, val);
80980 }
80981
80982 int64_t  CS_LDK_Input_new(int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
80983         LDKOutPoint outpoint_arg_conv;
80984         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
80985         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
80986         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
80987         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
80988         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
80989         CHECK_ACCESS(previous_utxo_arg_ptr);
80990         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
80991         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
80992         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
80993         int64_t ret_ref = 0;
80994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80996         return ret_ref;
80997 }
80998
80999 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
81000         LDKInput ret_var = Input_clone(arg);
81001         int64_t ret_ref = 0;
81002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81004         return ret_ref;
81005 }
81006 int64_t  CS_LDK_Input_clone_ptr(int64_t arg) {
81007         LDKInput arg_conv;
81008         arg_conv.inner = untag_ptr(arg);
81009         arg_conv.is_owned = ptr_is_owned(arg);
81010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81011         arg_conv.is_owned = false;
81012         int64_t ret_conv = Input_clone_ptr(&arg_conv);
81013         return ret_conv;
81014 }
81015
81016 int64_t  CS_LDK_Input_clone(int64_t orig) {
81017         LDKInput orig_conv;
81018         orig_conv.inner = untag_ptr(orig);
81019         orig_conv.is_owned = ptr_is_owned(orig);
81020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81021         orig_conv.is_owned = false;
81022         LDKInput ret_var = Input_clone(&orig_conv);
81023         int64_t ret_ref = 0;
81024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81026         return ret_ref;
81027 }
81028
81029 int64_t  CS_LDK_Input_hash(int64_t o) {
81030         LDKInput o_conv;
81031         o_conv.inner = untag_ptr(o);
81032         o_conv.is_owned = ptr_is_owned(o);
81033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81034         o_conv.is_owned = false;
81035         int64_t ret_conv = Input_hash(&o_conv);
81036         return ret_conv;
81037 }
81038
81039 jboolean  CS_LDK_Input_eq(int64_t a, int64_t b) {
81040         LDKInput a_conv;
81041         a_conv.inner = untag_ptr(a);
81042         a_conv.is_owned = ptr_is_owned(a);
81043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81044         a_conv.is_owned = false;
81045         LDKInput b_conv;
81046         b_conv.inner = untag_ptr(b);
81047         b_conv.is_owned = ptr_is_owned(b);
81048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81049         b_conv.is_owned = false;
81050         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
81051         return ret_conv;
81052 }
81053
81054 void  CS_LDK_Utxo_free(int64_t this_obj) {
81055         LDKUtxo this_obj_conv;
81056         this_obj_conv.inner = untag_ptr(this_obj);
81057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81059         Utxo_free(this_obj_conv);
81060 }
81061
81062 int64_t  CS_LDK_Utxo_get_outpoint(int64_t this_ptr) {
81063         LDKUtxo this_ptr_conv;
81064         this_ptr_conv.inner = untag_ptr(this_ptr);
81065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81067         this_ptr_conv.is_owned = false;
81068         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
81069         int64_t ret_ref = 0;
81070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81072         return ret_ref;
81073 }
81074
81075 void  CS_LDK_Utxo_set_outpoint(int64_t this_ptr, int64_t val) {
81076         LDKUtxo this_ptr_conv;
81077         this_ptr_conv.inner = untag_ptr(this_ptr);
81078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81080         this_ptr_conv.is_owned = false;
81081         LDKOutPoint val_conv;
81082         val_conv.inner = untag_ptr(val);
81083         val_conv.is_owned = ptr_is_owned(val);
81084         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
81085         val_conv = OutPoint_clone(&val_conv);
81086         Utxo_set_outpoint(&this_ptr_conv, val_conv);
81087 }
81088
81089 int64_t  CS_LDK_Utxo_get_output(int64_t this_ptr) {
81090         LDKUtxo this_ptr_conv;
81091         this_ptr_conv.inner = untag_ptr(this_ptr);
81092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81094         this_ptr_conv.is_owned = false;
81095         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
81096         *ret_ref = Utxo_get_output(&this_ptr_conv);
81097         return tag_ptr(ret_ref, true);
81098 }
81099
81100 void  CS_LDK_Utxo_set_output(int64_t this_ptr, int64_t val) {
81101         LDKUtxo this_ptr_conv;
81102         this_ptr_conv.inner = untag_ptr(this_ptr);
81103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81105         this_ptr_conv.is_owned = false;
81106         void* val_ptr = untag_ptr(val);
81107         CHECK_ACCESS(val_ptr);
81108         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
81109         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
81110         Utxo_set_output(&this_ptr_conv, val_conv);
81111 }
81112
81113 int64_t  CS_LDK_Utxo_get_satisfaction_weight(int64_t this_ptr) {
81114         LDKUtxo this_ptr_conv;
81115         this_ptr_conv.inner = untag_ptr(this_ptr);
81116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81118         this_ptr_conv.is_owned = false;
81119         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
81120         return ret_conv;
81121 }
81122
81123 void  CS_LDK_Utxo_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
81124         LDKUtxo this_ptr_conv;
81125         this_ptr_conv.inner = untag_ptr(this_ptr);
81126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81128         this_ptr_conv.is_owned = false;
81129         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
81130 }
81131
81132 int64_t  CS_LDK_Utxo_new(int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
81133         LDKOutPoint outpoint_arg_conv;
81134         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
81135         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
81136         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
81137         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
81138         void* output_arg_ptr = untag_ptr(output_arg);
81139         CHECK_ACCESS(output_arg_ptr);
81140         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
81141         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
81142         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
81143         int64_t ret_ref = 0;
81144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81146         return ret_ref;
81147 }
81148
81149 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
81150         LDKUtxo ret_var = Utxo_clone(arg);
81151         int64_t ret_ref = 0;
81152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81154         return ret_ref;
81155 }
81156 int64_t  CS_LDK_Utxo_clone_ptr(int64_t arg) {
81157         LDKUtxo arg_conv;
81158         arg_conv.inner = untag_ptr(arg);
81159         arg_conv.is_owned = ptr_is_owned(arg);
81160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81161         arg_conv.is_owned = false;
81162         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
81163         return ret_conv;
81164 }
81165
81166 int64_t  CS_LDK_Utxo_clone(int64_t orig) {
81167         LDKUtxo orig_conv;
81168         orig_conv.inner = untag_ptr(orig);
81169         orig_conv.is_owned = ptr_is_owned(orig);
81170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81171         orig_conv.is_owned = false;
81172         LDKUtxo ret_var = Utxo_clone(&orig_conv);
81173         int64_t ret_ref = 0;
81174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81176         return ret_ref;
81177 }
81178
81179 int64_t  CS_LDK_Utxo_hash(int64_t o) {
81180         LDKUtxo o_conv;
81181         o_conv.inner = untag_ptr(o);
81182         o_conv.is_owned = ptr_is_owned(o);
81183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81184         o_conv.is_owned = false;
81185         int64_t ret_conv = Utxo_hash(&o_conv);
81186         return ret_conv;
81187 }
81188
81189 jboolean  CS_LDK_Utxo_eq(int64_t a, int64_t b) {
81190         LDKUtxo a_conv;
81191         a_conv.inner = untag_ptr(a);
81192         a_conv.is_owned = ptr_is_owned(a);
81193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81194         a_conv.is_owned = false;
81195         LDKUtxo b_conv;
81196         b_conv.inner = untag_ptr(b);
81197         b_conv.is_owned = ptr_is_owned(b);
81198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81199         b_conv.is_owned = false;
81200         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
81201         return ret_conv;
81202 }
81203
81204 int64_t  CS_LDK_Utxo_new_p2pkh(int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
81205         LDKOutPoint outpoint_conv;
81206         outpoint_conv.inner = untag_ptr(outpoint);
81207         outpoint_conv.is_owned = ptr_is_owned(outpoint);
81208         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
81209         outpoint_conv = OutPoint_clone(&outpoint_conv);
81210         uint8_t pubkey_hash_arr[20];
81211         CHECK(pubkey_hash->arr_len == 20);
81212         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
81213         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
81214         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
81215         int64_t ret_ref = 0;
81216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81218         return ret_ref;
81219 }
81220
81221 void  CS_LDK_CoinSelection_free(int64_t this_obj) {
81222         LDKCoinSelection this_obj_conv;
81223         this_obj_conv.inner = untag_ptr(this_obj);
81224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81226         CoinSelection_free(this_obj_conv);
81227 }
81228
81229 int64_tArray  CS_LDK_CoinSelection_get_confirmed_utxos(int64_t this_ptr) {
81230         LDKCoinSelection this_ptr_conv;
81231         this_ptr_conv.inner = untag_ptr(this_ptr);
81232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81234         this_ptr_conv.is_owned = false;
81235         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
81236         int64_tArray ret_arr = NULL;
81237         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
81238         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
81239         for (size_t g = 0; g < ret_var.datalen; g++) {
81240                 LDKUtxo ret_conv_6_var = ret_var.data[g];
81241                 int64_t ret_conv_6_ref = 0;
81242                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
81243                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
81244                 ret_arr_ptr[g] = ret_conv_6_ref;
81245         }
81246         
81247         FREE(ret_var.data);
81248         return ret_arr;
81249 }
81250
81251 void  CS_LDK_CoinSelection_set_confirmed_utxos(int64_t this_ptr, int64_tArray val) {
81252         LDKCoinSelection 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         LDKCVec_UtxoZ val_constr;
81258         val_constr.datalen = val->arr_len;
81259         if (val_constr.datalen > 0)
81260                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
81261         else
81262                 val_constr.data = NULL;
81263         int64_t* val_vals = val->elems;
81264         for (size_t g = 0; g < val_constr.datalen; g++) {
81265                 int64_t val_conv_6 = val_vals[g];
81266                 LDKUtxo val_conv_6_conv;
81267                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
81268                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
81269                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
81270                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
81271                 val_constr.data[g] = val_conv_6_conv;
81272         }
81273         FREE(val);
81274         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
81275 }
81276
81277 int64_t  CS_LDK_CoinSelection_get_change_output(int64_t this_ptr) {
81278         LDKCoinSelection this_ptr_conv;
81279         this_ptr_conv.inner = untag_ptr(this_ptr);
81280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81282         this_ptr_conv.is_owned = false;
81283         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
81284         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
81285         int64_t ret_ref = tag_ptr(ret_copy, true);
81286         return ret_ref;
81287 }
81288
81289 void  CS_LDK_CoinSelection_set_change_output(int64_t this_ptr, int64_t val) {
81290         LDKCoinSelection this_ptr_conv;
81291         this_ptr_conv.inner = untag_ptr(this_ptr);
81292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81294         this_ptr_conv.is_owned = false;
81295         void* val_ptr = untag_ptr(val);
81296         CHECK_ACCESS(val_ptr);
81297         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
81298         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
81299         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
81300 }
81301
81302 int64_t  CS_LDK_CoinSelection_new(int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
81303         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
81304         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
81305         if (confirmed_utxos_arg_constr.datalen > 0)
81306                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
81307         else
81308                 confirmed_utxos_arg_constr.data = NULL;
81309         int64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
81310         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
81311                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
81312                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
81313                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
81314                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
81315                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
81316                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
81317                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
81318         }
81319         FREE(confirmed_utxos_arg);
81320         void* change_output_arg_ptr = untag_ptr(change_output_arg);
81321         CHECK_ACCESS(change_output_arg_ptr);
81322         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
81323         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
81324         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
81325         int64_t ret_ref = 0;
81326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81328         return ret_ref;
81329 }
81330
81331 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
81332         LDKCoinSelection ret_var = CoinSelection_clone(arg);
81333         int64_t ret_ref = 0;
81334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81336         return ret_ref;
81337 }
81338 int64_t  CS_LDK_CoinSelection_clone_ptr(int64_t arg) {
81339         LDKCoinSelection arg_conv;
81340         arg_conv.inner = untag_ptr(arg);
81341         arg_conv.is_owned = ptr_is_owned(arg);
81342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81343         arg_conv.is_owned = false;
81344         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
81345         return ret_conv;
81346 }
81347
81348 int64_t  CS_LDK_CoinSelection_clone(int64_t orig) {
81349         LDKCoinSelection orig_conv;
81350         orig_conv.inner = untag_ptr(orig);
81351         orig_conv.is_owned = ptr_is_owned(orig);
81352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81353         orig_conv.is_owned = false;
81354         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
81355         int64_t ret_ref = 0;
81356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81358         return ret_ref;
81359 }
81360
81361 void  CS_LDK_CoinSelectionSource_free(int64_t this_ptr) {
81362         if (!ptr_is_owned(this_ptr)) return;
81363         void* this_ptr_ptr = untag_ptr(this_ptr);
81364         CHECK_ACCESS(this_ptr_ptr);
81365         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
81366         FREE(untag_ptr(this_ptr));
81367         CoinSelectionSource_free(this_ptr_conv);
81368 }
81369
81370 void  CS_LDK_WalletSource_free(int64_t this_ptr) {
81371         if (!ptr_is_owned(this_ptr)) return;
81372         void* this_ptr_ptr = untag_ptr(this_ptr);
81373         CHECK_ACCESS(this_ptr_ptr);
81374         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
81375         FREE(untag_ptr(this_ptr));
81376         WalletSource_free(this_ptr_conv);
81377 }
81378
81379 void  CS_LDK_Wallet_free(int64_t this_obj) {
81380         LDKWallet this_obj_conv;
81381         this_obj_conv.inner = untag_ptr(this_obj);
81382         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81384         Wallet_free(this_obj_conv);
81385 }
81386
81387 int64_t  CS_LDK_Wallet_new(int64_t source, int64_t logger) {
81388         void* source_ptr = untag_ptr(source);
81389         CHECK_ACCESS(source_ptr);
81390         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
81391         if (source_conv.free == LDKWalletSource_JCalls_free) {
81392                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81393                 LDKWalletSource_JCalls_cloned(&source_conv);
81394         }
81395         void* logger_ptr = untag_ptr(logger);
81396         CHECK_ACCESS(logger_ptr);
81397         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
81398         if (logger_conv.free == LDKLogger_JCalls_free) {
81399                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81400                 LDKLogger_JCalls_cloned(&logger_conv);
81401         }
81402         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
81403         int64_t ret_ref = 0;
81404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81406         return ret_ref;
81407 }
81408
81409 int64_t  CS_LDK_Wallet_as_CoinSelectionSource(int64_t this_arg) {
81410         LDKWallet this_arg_conv;
81411         this_arg_conv.inner = untag_ptr(this_arg);
81412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81414         this_arg_conv.is_owned = false;
81415         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
81416         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
81417         return tag_ptr(ret_ret, true);
81418 }
81419
81420 void  CS_LDK_BumpTransactionEventHandler_free(int64_t this_obj) {
81421         LDKBumpTransactionEventHandler this_obj_conv;
81422         this_obj_conv.inner = untag_ptr(this_obj);
81423         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81425         BumpTransactionEventHandler_free(this_obj_conv);
81426 }
81427
81428 int64_t  CS_LDK_BumpTransactionEventHandler_new(int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
81429         void* broadcaster_ptr = untag_ptr(broadcaster);
81430         CHECK_ACCESS(broadcaster_ptr);
81431         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
81432         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
81433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81434                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
81435         }
81436         void* utxo_source_ptr = untag_ptr(utxo_source);
81437         CHECK_ACCESS(utxo_source_ptr);
81438         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
81439         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
81440                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81441                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
81442         }
81443         void* signer_provider_ptr = untag_ptr(signer_provider);
81444         CHECK_ACCESS(signer_provider_ptr);
81445         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
81446         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
81447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81448                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
81449         }
81450         void* logger_ptr = untag_ptr(logger);
81451         CHECK_ACCESS(logger_ptr);
81452         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
81453         if (logger_conv.free == LDKLogger_JCalls_free) {
81454                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81455                 LDKLogger_JCalls_cloned(&logger_conv);
81456         }
81457         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
81458         int64_t ret_ref = 0;
81459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81461         return ret_ref;
81462 }
81463
81464 void  CS_LDK_BumpTransactionEventHandler_handle_event(int64_t this_arg, int64_t event) {
81465         LDKBumpTransactionEventHandler this_arg_conv;
81466         this_arg_conv.inner = untag_ptr(this_arg);
81467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81469         this_arg_conv.is_owned = false;
81470         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
81471         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
81472 }
81473
81474 void  CS_LDK_FilesystemStore_free(int64_t this_obj) {
81475         LDKFilesystemStore this_obj_conv;
81476         this_obj_conv.inner = untag_ptr(this_obj);
81477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81479         FilesystemStore_free(this_obj_conv);
81480 }
81481
81482 int64_t  CS_LDK_FilesystemStore_new(jstring data_dir) {
81483         LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
81484         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
81485         int64_t ret_ref = 0;
81486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81488         return ret_ref;
81489 }
81490
81491 jstring  CS_LDK_FilesystemStore_get_data_dir(int64_t this_arg) {
81492         LDKFilesystemStore this_arg_conv;
81493         this_arg_conv.inner = untag_ptr(this_arg);
81494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81496         this_arg_conv.is_owned = false;
81497         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
81498         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
81499         Str_free(ret_str);
81500         return ret_conv;
81501 }
81502
81503 int64_t  CS_LDK_FilesystemStore_as_KVStore(int64_t this_arg) {
81504         LDKFilesystemStore this_arg_conv;
81505         this_arg_conv.inner = untag_ptr(this_arg);
81506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81508         this_arg_conv.is_owned = false;
81509         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
81510         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
81511         return tag_ptr(ret_ret, true);
81512 }
81513
81514 void  CS_LDK_BackgroundProcessor_free(int64_t this_obj) {
81515         LDKBackgroundProcessor this_obj_conv;
81516         this_obj_conv.inner = untag_ptr(this_obj);
81517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81519         BackgroundProcessor_free(this_obj_conv);
81520 }
81521
81522 void  CS_LDK_GossipSync_free(int64_t this_ptr) {
81523         if (!ptr_is_owned(this_ptr)) return;
81524         void* this_ptr_ptr = untag_ptr(this_ptr);
81525         CHECK_ACCESS(this_ptr_ptr);
81526         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
81527         FREE(untag_ptr(this_ptr));
81528         GossipSync_free(this_ptr_conv);
81529 }
81530
81531 int64_t  CS_LDK_GossipSync_p2_p(int64_t a) {
81532         LDKP2PGossipSync a_conv;
81533         a_conv.inner = untag_ptr(a);
81534         a_conv.is_owned = ptr_is_owned(a);
81535         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81536         a_conv.is_owned = false;
81537         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
81538         *ret_copy = GossipSync_p2_p(&a_conv);
81539         int64_t ret_ref = tag_ptr(ret_copy, true);
81540         return ret_ref;
81541 }
81542
81543 int64_t  CS_LDK_GossipSync_rapid(int64_t a) {
81544         LDKRapidGossipSync a_conv;
81545         a_conv.inner = untag_ptr(a);
81546         a_conv.is_owned = ptr_is_owned(a);
81547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81548         a_conv.is_owned = false;
81549         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
81550         *ret_copy = GossipSync_rapid(&a_conv);
81551         int64_t ret_ref = tag_ptr(ret_copy, true);
81552         return ret_ref;
81553 }
81554
81555 int64_t  CS_LDK_GossipSync_none() {
81556         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
81557         *ret_copy = GossipSync_none();
81558         int64_t ret_ref = tag_ptr(ret_copy, true);
81559         return ret_ref;
81560 }
81561
81562 int64_t  CS_LDK_BackgroundProcessor_start(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) {
81563         void* persister_ptr = untag_ptr(persister);
81564         CHECK_ACCESS(persister_ptr);
81565         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
81566         if (persister_conv.free == LDKPersister_JCalls_free) {
81567                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81568                 LDKPersister_JCalls_cloned(&persister_conv);
81569         }
81570         void* event_handler_ptr = untag_ptr(event_handler);
81571         CHECK_ACCESS(event_handler_ptr);
81572         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
81573         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
81574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81575                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
81576         }
81577         LDKChainMonitor chain_monitor_conv;
81578         chain_monitor_conv.inner = untag_ptr(chain_monitor);
81579         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
81580         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
81581         chain_monitor_conv.is_owned = false;
81582         LDKChannelManager channel_manager_conv;
81583         channel_manager_conv.inner = untag_ptr(channel_manager);
81584         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
81585         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
81586         channel_manager_conv.is_owned = false;
81587         void* gossip_sync_ptr = untag_ptr(gossip_sync);
81588         CHECK_ACCESS(gossip_sync_ptr);
81589         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
81590         // WARNING: we may need a move here but no clone is available for LDKGossipSync
81591         LDKPeerManager peer_manager_conv;
81592         peer_manager_conv.inner = untag_ptr(peer_manager);
81593         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
81594         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
81595         peer_manager_conv.is_owned = false;
81596         void* logger_ptr = untag_ptr(logger);
81597         CHECK_ACCESS(logger_ptr);
81598         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
81599         if (logger_conv.free == LDKLogger_JCalls_free) {
81600                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81601                 LDKLogger_JCalls_cloned(&logger_conv);
81602         }
81603         void* scorer_ptr = untag_ptr(scorer);
81604         CHECK_ACCESS(scorer_ptr);
81605         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
81606         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
81607         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
81608                 // Manually implement clone for Java trait instances
81609                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
81610                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81611                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
81612                 }
81613         }
81614         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);
81615         int64_t ret_ref = 0;
81616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81618         return ret_ref;
81619 }
81620
81621 int64_t  CS_LDK_BackgroundProcessor_join(int64_t this_arg) {
81622         LDKBackgroundProcessor this_arg_conv;
81623         this_arg_conv.inner = untag_ptr(this_arg);
81624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81626         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
81627         
81628         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
81629         *ret_conv = BackgroundProcessor_join(this_arg_conv);
81630         return tag_ptr(ret_conv, true);
81631 }
81632
81633 int64_t  CS_LDK_BackgroundProcessor_stop(int64_t this_arg) {
81634         LDKBackgroundProcessor this_arg_conv;
81635         this_arg_conv.inner = untag_ptr(this_arg);
81636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81638         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
81639         
81640         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
81641         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
81642         return tag_ptr(ret_conv, true);
81643 }
81644
81645 void  CS_LDK_Bolt11ParseError_free(int64_t this_ptr) {
81646         if (!ptr_is_owned(this_ptr)) return;
81647         void* this_ptr_ptr = untag_ptr(this_ptr);
81648         CHECK_ACCESS(this_ptr_ptr);
81649         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
81650         FREE(untag_ptr(this_ptr));
81651         Bolt11ParseError_free(this_ptr_conv);
81652 }
81653
81654 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
81655         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81656         *ret_copy = Bolt11ParseError_clone(arg);
81657         int64_t ret_ref = tag_ptr(ret_copy, true);
81658         return ret_ref;
81659 }
81660 int64_t  CS_LDK_Bolt11ParseError_clone_ptr(int64_t arg) {
81661         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
81662         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
81663         return ret_conv;
81664 }
81665
81666 int64_t  CS_LDK_Bolt11ParseError_clone(int64_t orig) {
81667         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
81668         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81669         *ret_copy = Bolt11ParseError_clone(orig_conv);
81670         int64_t ret_ref = tag_ptr(ret_copy, true);
81671         return ret_ref;
81672 }
81673
81674 int64_t  CS_LDK_Bolt11ParseError_bech32_error(int64_t a) {
81675         void* a_ptr = untag_ptr(a);
81676         CHECK_ACCESS(a_ptr);
81677         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
81678         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
81679         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81680         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
81681         int64_t ret_ref = tag_ptr(ret_copy, true);
81682         return ret_ref;
81683 }
81684
81685 int64_t  CS_LDK_Bolt11ParseError_parse_amount_error(int32_t a) {
81686         
81687         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81688         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
81689         int64_t ret_ref = tag_ptr(ret_copy, true);
81690         return ret_ref;
81691 }
81692
81693 int64_t  CS_LDK_Bolt11ParseError_malformed_signature(int32_t a) {
81694         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
81695         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81696         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
81697         int64_t ret_ref = tag_ptr(ret_copy, true);
81698         return ret_ref;
81699 }
81700
81701 int64_t  CS_LDK_Bolt11ParseError_bad_prefix() {
81702         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81703         *ret_copy = Bolt11ParseError_bad_prefix();
81704         int64_t ret_ref = tag_ptr(ret_copy, true);
81705         return ret_ref;
81706 }
81707
81708 int64_t  CS_LDK_Bolt11ParseError_unknown_currency() {
81709         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81710         *ret_copy = Bolt11ParseError_unknown_currency();
81711         int64_t ret_ref = tag_ptr(ret_copy, true);
81712         return ret_ref;
81713 }
81714
81715 int64_t  CS_LDK_Bolt11ParseError_unknown_si_prefix() {
81716         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81717         *ret_copy = Bolt11ParseError_unknown_si_prefix();
81718         int64_t ret_ref = tag_ptr(ret_copy, true);
81719         return ret_ref;
81720 }
81721
81722 int64_t  CS_LDK_Bolt11ParseError_malformed_hrp() {
81723         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81724         *ret_copy = Bolt11ParseError_malformed_hrp();
81725         int64_t ret_ref = tag_ptr(ret_copy, true);
81726         return ret_ref;
81727 }
81728
81729 int64_t  CS_LDK_Bolt11ParseError_too_short_data_part() {
81730         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81731         *ret_copy = Bolt11ParseError_too_short_data_part();
81732         int64_t ret_ref = tag_ptr(ret_copy, true);
81733         return ret_ref;
81734 }
81735
81736 int64_t  CS_LDK_Bolt11ParseError_unexpected_end_of_tagged_fields() {
81737         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81738         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
81739         int64_t ret_ref = tag_ptr(ret_copy, true);
81740         return ret_ref;
81741 }
81742
81743 int64_t  CS_LDK_Bolt11ParseError_description_decode_error(int32_t a) {
81744         
81745         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81746         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
81747         int64_t ret_ref = tag_ptr(ret_copy, true);
81748         return ret_ref;
81749 }
81750
81751 int64_t  CS_LDK_Bolt11ParseError_padding_error() {
81752         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81753         *ret_copy = Bolt11ParseError_padding_error();
81754         int64_t ret_ref = tag_ptr(ret_copy, true);
81755         return ret_ref;
81756 }
81757
81758 int64_t  CS_LDK_Bolt11ParseError_integer_overflow_error() {
81759         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81760         *ret_copy = Bolt11ParseError_integer_overflow_error();
81761         int64_t ret_ref = tag_ptr(ret_copy, true);
81762         return ret_ref;
81763 }
81764
81765 int64_t  CS_LDK_Bolt11ParseError_invalid_seg_wit_program_length() {
81766         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81767         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
81768         int64_t ret_ref = tag_ptr(ret_copy, true);
81769         return ret_ref;
81770 }
81771
81772 int64_t  CS_LDK_Bolt11ParseError_invalid_pub_key_hash_length() {
81773         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81774         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
81775         int64_t ret_ref = tag_ptr(ret_copy, true);
81776         return ret_ref;
81777 }
81778
81779 int64_t  CS_LDK_Bolt11ParseError_invalid_script_hash_length() {
81780         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81781         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
81782         int64_t ret_ref = tag_ptr(ret_copy, true);
81783         return ret_ref;
81784 }
81785
81786 int64_t  CS_LDK_Bolt11ParseError_invalid_recovery_id() {
81787         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81788         *ret_copy = Bolt11ParseError_invalid_recovery_id();
81789         int64_t ret_ref = tag_ptr(ret_copy, true);
81790         return ret_ref;
81791 }
81792
81793 int64_t  CS_LDK_Bolt11ParseError_invalid_slice_length(jstring a) {
81794         LDKStr a_conv = str_ref_to_owned_c(a);
81795         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81796         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
81797         int64_t ret_ref = tag_ptr(ret_copy, true);
81798         return ret_ref;
81799 }
81800
81801 int64_t  CS_LDK_Bolt11ParseError_skip() {
81802         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
81803         *ret_copy = Bolt11ParseError_skip();
81804         int64_t ret_ref = tag_ptr(ret_copy, true);
81805         return ret_ref;
81806 }
81807
81808 jboolean  CS_LDK_Bolt11ParseError_eq(int64_t a, int64_t b) {
81809         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
81810         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
81811         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
81812         return ret_conv;
81813 }
81814
81815 void  CS_LDK_ParseOrSemanticError_free(int64_t this_ptr) {
81816         if (!ptr_is_owned(this_ptr)) return;
81817         void* this_ptr_ptr = untag_ptr(this_ptr);
81818         CHECK_ACCESS(this_ptr_ptr);
81819         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
81820         FREE(untag_ptr(this_ptr));
81821         ParseOrSemanticError_free(this_ptr_conv);
81822 }
81823
81824 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
81825         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81826         *ret_copy = ParseOrSemanticError_clone(arg);
81827         int64_t ret_ref = tag_ptr(ret_copy, true);
81828         return ret_ref;
81829 }
81830 int64_t  CS_LDK_ParseOrSemanticError_clone_ptr(int64_t arg) {
81831         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
81832         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
81833         return ret_conv;
81834 }
81835
81836 int64_t  CS_LDK_ParseOrSemanticError_clone(int64_t orig) {
81837         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
81838         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81839         *ret_copy = ParseOrSemanticError_clone(orig_conv);
81840         int64_t ret_ref = tag_ptr(ret_copy, true);
81841         return ret_ref;
81842 }
81843
81844 int64_t  CS_LDK_ParseOrSemanticError_parse_error(int64_t a) {
81845         void* a_ptr = untag_ptr(a);
81846         CHECK_ACCESS(a_ptr);
81847         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
81848         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
81849         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81850         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
81851         int64_t ret_ref = tag_ptr(ret_copy, true);
81852         return ret_ref;
81853 }
81854
81855 int64_t  CS_LDK_ParseOrSemanticError_semantic_error(int32_t a) {
81856         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_cs(a);
81857         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
81858         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
81859         int64_t ret_ref = tag_ptr(ret_copy, true);
81860         return ret_ref;
81861 }
81862
81863 jboolean  CS_LDK_ParseOrSemanticError_eq(int64_t a, int64_t b) {
81864         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
81865         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
81866         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
81867         return ret_conv;
81868 }
81869
81870 void  CS_LDK_Bolt11Invoice_free(int64_t this_obj) {
81871         LDKBolt11Invoice this_obj_conv;
81872         this_obj_conv.inner = untag_ptr(this_obj);
81873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81875         Bolt11Invoice_free(this_obj_conv);
81876 }
81877
81878 jboolean  CS_LDK_Bolt11Invoice_eq(int64_t a, int64_t b) {
81879         LDKBolt11Invoice a_conv;
81880         a_conv.inner = untag_ptr(a);
81881         a_conv.is_owned = ptr_is_owned(a);
81882         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81883         a_conv.is_owned = false;
81884         LDKBolt11Invoice b_conv;
81885         b_conv.inner = untag_ptr(b);
81886         b_conv.is_owned = ptr_is_owned(b);
81887         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81888         b_conv.is_owned = false;
81889         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
81890         return ret_conv;
81891 }
81892
81893 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
81894         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
81895         int64_t ret_ref = 0;
81896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81898         return ret_ref;
81899 }
81900 int64_t  CS_LDK_Bolt11Invoice_clone_ptr(int64_t arg) {
81901         LDKBolt11Invoice arg_conv;
81902         arg_conv.inner = untag_ptr(arg);
81903         arg_conv.is_owned = ptr_is_owned(arg);
81904         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81905         arg_conv.is_owned = false;
81906         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
81907         return ret_conv;
81908 }
81909
81910 int64_t  CS_LDK_Bolt11Invoice_clone(int64_t orig) {
81911         LDKBolt11Invoice orig_conv;
81912         orig_conv.inner = untag_ptr(orig);
81913         orig_conv.is_owned = ptr_is_owned(orig);
81914         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81915         orig_conv.is_owned = false;
81916         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
81917         int64_t ret_ref = 0;
81918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81920         return ret_ref;
81921 }
81922
81923 int64_t  CS_LDK_Bolt11Invoice_hash(int64_t o) {
81924         LDKBolt11Invoice o_conv;
81925         o_conv.inner = untag_ptr(o);
81926         o_conv.is_owned = ptr_is_owned(o);
81927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81928         o_conv.is_owned = false;
81929         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
81930         return ret_conv;
81931 }
81932
81933 void  CS_LDK_SignedRawBolt11Invoice_free(int64_t this_obj) {
81934         LDKSignedRawBolt11Invoice this_obj_conv;
81935         this_obj_conv.inner = untag_ptr(this_obj);
81936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81938         SignedRawBolt11Invoice_free(this_obj_conv);
81939 }
81940
81941 jboolean  CS_LDK_SignedRawBolt11Invoice_eq(int64_t a, int64_t b) {
81942         LDKSignedRawBolt11Invoice a_conv;
81943         a_conv.inner = untag_ptr(a);
81944         a_conv.is_owned = ptr_is_owned(a);
81945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81946         a_conv.is_owned = false;
81947         LDKSignedRawBolt11Invoice b_conv;
81948         b_conv.inner = untag_ptr(b);
81949         b_conv.is_owned = ptr_is_owned(b);
81950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81951         b_conv.is_owned = false;
81952         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
81953         return ret_conv;
81954 }
81955
81956 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
81957         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
81958         int64_t ret_ref = 0;
81959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81961         return ret_ref;
81962 }
81963 int64_t  CS_LDK_SignedRawBolt11Invoice_clone_ptr(int64_t arg) {
81964         LDKSignedRawBolt11Invoice arg_conv;
81965         arg_conv.inner = untag_ptr(arg);
81966         arg_conv.is_owned = ptr_is_owned(arg);
81967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81968         arg_conv.is_owned = false;
81969         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
81970         return ret_conv;
81971 }
81972
81973 int64_t  CS_LDK_SignedRawBolt11Invoice_clone(int64_t orig) {
81974         LDKSignedRawBolt11Invoice orig_conv;
81975         orig_conv.inner = untag_ptr(orig);
81976         orig_conv.is_owned = ptr_is_owned(orig);
81977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81978         orig_conv.is_owned = false;
81979         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
81980         int64_t ret_ref = 0;
81981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81983         return ret_ref;
81984 }
81985
81986 int64_t  CS_LDK_SignedRawBolt11Invoice_hash(int64_t o) {
81987         LDKSignedRawBolt11Invoice o_conv;
81988         o_conv.inner = untag_ptr(o);
81989         o_conv.is_owned = ptr_is_owned(o);
81990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81991         o_conv.is_owned = false;
81992         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
81993         return ret_conv;
81994 }
81995
81996 void  CS_LDK_RawBolt11Invoice_free(int64_t this_obj) {
81997         LDKRawBolt11Invoice this_obj_conv;
81998         this_obj_conv.inner = untag_ptr(this_obj);
81999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82001         RawBolt11Invoice_free(this_obj_conv);
82002 }
82003
82004 int64_t  CS_LDK_RawBolt11Invoice_get_data(int64_t this_ptr) {
82005         LDKRawBolt11Invoice this_ptr_conv;
82006         this_ptr_conv.inner = untag_ptr(this_ptr);
82007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82009         this_ptr_conv.is_owned = false;
82010         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
82011         int64_t ret_ref = 0;
82012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82014         return ret_ref;
82015 }
82016
82017 void  CS_LDK_RawBolt11Invoice_set_data(int64_t this_ptr, int64_t val) {
82018         LDKRawBolt11Invoice this_ptr_conv;
82019         this_ptr_conv.inner = untag_ptr(this_ptr);
82020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82022         this_ptr_conv.is_owned = false;
82023         LDKRawDataPart val_conv;
82024         val_conv.inner = untag_ptr(val);
82025         val_conv.is_owned = ptr_is_owned(val);
82026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82027         val_conv = RawDataPart_clone(&val_conv);
82028         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
82029 }
82030
82031 jboolean  CS_LDK_RawBolt11Invoice_eq(int64_t a, int64_t b) {
82032         LDKRawBolt11Invoice a_conv;
82033         a_conv.inner = untag_ptr(a);
82034         a_conv.is_owned = ptr_is_owned(a);
82035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82036         a_conv.is_owned = false;
82037         LDKRawBolt11Invoice b_conv;
82038         b_conv.inner = untag_ptr(b);
82039         b_conv.is_owned = ptr_is_owned(b);
82040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82041         b_conv.is_owned = false;
82042         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
82043         return ret_conv;
82044 }
82045
82046 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
82047         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
82048         int64_t ret_ref = 0;
82049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82051         return ret_ref;
82052 }
82053 int64_t  CS_LDK_RawBolt11Invoice_clone_ptr(int64_t arg) {
82054         LDKRawBolt11Invoice arg_conv;
82055         arg_conv.inner = untag_ptr(arg);
82056         arg_conv.is_owned = ptr_is_owned(arg);
82057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82058         arg_conv.is_owned = false;
82059         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
82060         return ret_conv;
82061 }
82062
82063 int64_t  CS_LDK_RawBolt11Invoice_clone(int64_t orig) {
82064         LDKRawBolt11Invoice orig_conv;
82065         orig_conv.inner = untag_ptr(orig);
82066         orig_conv.is_owned = ptr_is_owned(orig);
82067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82068         orig_conv.is_owned = false;
82069         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
82070         int64_t ret_ref = 0;
82071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82073         return ret_ref;
82074 }
82075
82076 int64_t  CS_LDK_RawBolt11Invoice_hash(int64_t o) {
82077         LDKRawBolt11Invoice o_conv;
82078         o_conv.inner = untag_ptr(o);
82079         o_conv.is_owned = ptr_is_owned(o);
82080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82081         o_conv.is_owned = false;
82082         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
82083         return ret_conv;
82084 }
82085
82086 void  CS_LDK_RawDataPart_free(int64_t this_obj) {
82087         LDKRawDataPart this_obj_conv;
82088         this_obj_conv.inner = untag_ptr(this_obj);
82089         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82091         RawDataPart_free(this_obj_conv);
82092 }
82093
82094 int64_t  CS_LDK_RawDataPart_get_timestamp(int64_t this_ptr) {
82095         LDKRawDataPart this_ptr_conv;
82096         this_ptr_conv.inner = untag_ptr(this_ptr);
82097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82099         this_ptr_conv.is_owned = false;
82100         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
82101         int64_t ret_ref = 0;
82102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82104         return ret_ref;
82105 }
82106
82107 void  CS_LDK_RawDataPart_set_timestamp(int64_t this_ptr, int64_t val) {
82108         LDKRawDataPart this_ptr_conv;
82109         this_ptr_conv.inner = untag_ptr(this_ptr);
82110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82112         this_ptr_conv.is_owned = false;
82113         LDKPositiveTimestamp val_conv;
82114         val_conv.inner = untag_ptr(val);
82115         val_conv.is_owned = ptr_is_owned(val);
82116         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82117         val_conv = PositiveTimestamp_clone(&val_conv);
82118         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
82119 }
82120
82121 jboolean  CS_LDK_RawDataPart_eq(int64_t a, int64_t b) {
82122         LDKRawDataPart a_conv;
82123         a_conv.inner = untag_ptr(a);
82124         a_conv.is_owned = ptr_is_owned(a);
82125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82126         a_conv.is_owned = false;
82127         LDKRawDataPart b_conv;
82128         b_conv.inner = untag_ptr(b);
82129         b_conv.is_owned = ptr_is_owned(b);
82130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82131         b_conv.is_owned = false;
82132         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
82133         return ret_conv;
82134 }
82135
82136 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
82137         LDKRawDataPart ret_var = RawDataPart_clone(arg);
82138         int64_t ret_ref = 0;
82139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82141         return ret_ref;
82142 }
82143 int64_t  CS_LDK_RawDataPart_clone_ptr(int64_t arg) {
82144         LDKRawDataPart arg_conv;
82145         arg_conv.inner = untag_ptr(arg);
82146         arg_conv.is_owned = ptr_is_owned(arg);
82147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82148         arg_conv.is_owned = false;
82149         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
82150         return ret_conv;
82151 }
82152
82153 int64_t  CS_LDK_RawDataPart_clone(int64_t orig) {
82154         LDKRawDataPart orig_conv;
82155         orig_conv.inner = untag_ptr(orig);
82156         orig_conv.is_owned = ptr_is_owned(orig);
82157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82158         orig_conv.is_owned = false;
82159         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
82160         int64_t ret_ref = 0;
82161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82163         return ret_ref;
82164 }
82165
82166 int64_t  CS_LDK_RawDataPart_hash(int64_t o) {
82167         LDKRawDataPart o_conv;
82168         o_conv.inner = untag_ptr(o);
82169         o_conv.is_owned = ptr_is_owned(o);
82170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82171         o_conv.is_owned = false;
82172         int64_t ret_conv = RawDataPart_hash(&o_conv);
82173         return ret_conv;
82174 }
82175
82176 void  CS_LDK_PositiveTimestamp_free(int64_t this_obj) {
82177         LDKPositiveTimestamp this_obj_conv;
82178         this_obj_conv.inner = untag_ptr(this_obj);
82179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82181         PositiveTimestamp_free(this_obj_conv);
82182 }
82183
82184 jboolean  CS_LDK_PositiveTimestamp_eq(int64_t a, int64_t b) {
82185         LDKPositiveTimestamp a_conv;
82186         a_conv.inner = untag_ptr(a);
82187         a_conv.is_owned = ptr_is_owned(a);
82188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82189         a_conv.is_owned = false;
82190         LDKPositiveTimestamp b_conv;
82191         b_conv.inner = untag_ptr(b);
82192         b_conv.is_owned = ptr_is_owned(b);
82193         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82194         b_conv.is_owned = false;
82195         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
82196         return ret_conv;
82197 }
82198
82199 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
82200         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
82201         int64_t ret_ref = 0;
82202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82204         return ret_ref;
82205 }
82206 int64_t  CS_LDK_PositiveTimestamp_clone_ptr(int64_t arg) {
82207         LDKPositiveTimestamp arg_conv;
82208         arg_conv.inner = untag_ptr(arg);
82209         arg_conv.is_owned = ptr_is_owned(arg);
82210         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82211         arg_conv.is_owned = false;
82212         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
82213         return ret_conv;
82214 }
82215
82216 int64_t  CS_LDK_PositiveTimestamp_clone(int64_t orig) {
82217         LDKPositiveTimestamp orig_conv;
82218         orig_conv.inner = untag_ptr(orig);
82219         orig_conv.is_owned = ptr_is_owned(orig);
82220         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82221         orig_conv.is_owned = false;
82222         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
82223         int64_t ret_ref = 0;
82224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82226         return ret_ref;
82227 }
82228
82229 int64_t  CS_LDK_PositiveTimestamp_hash(int64_t o) {
82230         LDKPositiveTimestamp o_conv;
82231         o_conv.inner = untag_ptr(o);
82232         o_conv.is_owned = ptr_is_owned(o);
82233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82234         o_conv.is_owned = false;
82235         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
82236         return ret_conv;
82237 }
82238
82239 int32_t  CS_LDK_SiPrefix_clone(int64_t orig) {
82240         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
82241         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_clone(orig_conv));
82242         return ret_conv;
82243 }
82244
82245 int32_t  CS_LDK_SiPrefix_milli() {
82246         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_milli());
82247         return ret_conv;
82248 }
82249
82250 int32_t  CS_LDK_SiPrefix_micro() {
82251         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_micro());
82252         return ret_conv;
82253 }
82254
82255 int32_t  CS_LDK_SiPrefix_nano() {
82256         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_nano());
82257         return ret_conv;
82258 }
82259
82260 int32_t  CS_LDK_SiPrefix_pico() {
82261         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_pico());
82262         return ret_conv;
82263 }
82264
82265 jboolean  CS_LDK_SiPrefix_eq(int64_t a, int64_t b) {
82266         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
82267         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
82268         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
82269         return ret_conv;
82270 }
82271
82272 int64_t  CS_LDK_SiPrefix_hash(int64_t o) {
82273         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
82274         int64_t ret_conv = SiPrefix_hash(o_conv);
82275         return ret_conv;
82276 }
82277
82278 int64_t  CS_LDK_SiPrefix_multiplier(int64_t this_arg) {
82279         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
82280         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
82281         return ret_conv;
82282 }
82283
82284 int32_t  CS_LDK_Currency_clone(int64_t orig) {
82285         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
82286         int32_t ret_conv = LDKCurrency_to_cs(Currency_clone(orig_conv));
82287         return ret_conv;
82288 }
82289
82290 int32_t  CS_LDK_Currency_bitcoin() {
82291         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin());
82292         return ret_conv;
82293 }
82294
82295 int32_t  CS_LDK_Currency_bitcoin_testnet() {
82296         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin_testnet());
82297         return ret_conv;
82298 }
82299
82300 int32_t  CS_LDK_Currency_regtest() {
82301         int32_t ret_conv = LDKCurrency_to_cs(Currency_regtest());
82302         return ret_conv;
82303 }
82304
82305 int32_t  CS_LDK_Currency_simnet() {
82306         int32_t ret_conv = LDKCurrency_to_cs(Currency_simnet());
82307         return ret_conv;
82308 }
82309
82310 int32_t  CS_LDK_Currency_signet() {
82311         int32_t ret_conv = LDKCurrency_to_cs(Currency_signet());
82312         return ret_conv;
82313 }
82314
82315 int64_t  CS_LDK_Currency_hash(int64_t o) {
82316         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
82317         int64_t ret_conv = Currency_hash(o_conv);
82318         return ret_conv;
82319 }
82320
82321 jboolean  CS_LDK_Currency_eq(int64_t a, int64_t b) {
82322         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
82323         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
82324         jboolean ret_conv = Currency_eq(a_conv, b_conv);
82325         return ret_conv;
82326 }
82327
82328 void  CS_LDK_Sha256_free(int64_t this_obj) {
82329         LDKSha256 this_obj_conv;
82330         this_obj_conv.inner = untag_ptr(this_obj);
82331         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82333         Sha256_free(this_obj_conv);
82334 }
82335
82336 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
82337         LDKSha256 ret_var = Sha256_clone(arg);
82338         int64_t ret_ref = 0;
82339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82341         return ret_ref;
82342 }
82343 int64_t  CS_LDK_Sha256_clone_ptr(int64_t arg) {
82344         LDKSha256 arg_conv;
82345         arg_conv.inner = untag_ptr(arg);
82346         arg_conv.is_owned = ptr_is_owned(arg);
82347         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82348         arg_conv.is_owned = false;
82349         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
82350         return ret_conv;
82351 }
82352
82353 int64_t  CS_LDK_Sha256_clone(int64_t orig) {
82354         LDKSha256 orig_conv;
82355         orig_conv.inner = untag_ptr(orig);
82356         orig_conv.is_owned = ptr_is_owned(orig);
82357         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82358         orig_conv.is_owned = false;
82359         LDKSha256 ret_var = Sha256_clone(&orig_conv);
82360         int64_t ret_ref = 0;
82361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82363         return ret_ref;
82364 }
82365
82366 int64_t  CS_LDK_Sha256_hash(int64_t o) {
82367         LDKSha256 o_conv;
82368         o_conv.inner = untag_ptr(o);
82369         o_conv.is_owned = ptr_is_owned(o);
82370         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82371         o_conv.is_owned = false;
82372         int64_t ret_conv = Sha256_hash(&o_conv);
82373         return ret_conv;
82374 }
82375
82376 jboolean  CS_LDK_Sha256_eq(int64_t a, int64_t b) {
82377         LDKSha256 a_conv;
82378         a_conv.inner = untag_ptr(a);
82379         a_conv.is_owned = ptr_is_owned(a);
82380         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82381         a_conv.is_owned = false;
82382         LDKSha256 b_conv;
82383         b_conv.inner = untag_ptr(b);
82384         b_conv.is_owned = ptr_is_owned(b);
82385         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82386         b_conv.is_owned = false;
82387         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
82388         return ret_conv;
82389 }
82390
82391 int64_t  CS_LDK_Sha256_from_bytes(int8_tArray bytes) {
82392         uint8_t bytes_arr[32];
82393         CHECK(bytes->arr_len == 32);
82394         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
82395         uint8_t (*bytes_ref)[32] = &bytes_arr;
82396         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
82397         int64_t ret_ref = 0;
82398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82400         return ret_ref;
82401 }
82402
82403 void  CS_LDK_Description_free(int64_t this_obj) {
82404         LDKDescription this_obj_conv;
82405         this_obj_conv.inner = untag_ptr(this_obj);
82406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82408         Description_free(this_obj_conv);
82409 }
82410
82411 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
82412         LDKDescription ret_var = Description_clone(arg);
82413         int64_t ret_ref = 0;
82414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82416         return ret_ref;
82417 }
82418 int64_t  CS_LDK_Description_clone_ptr(int64_t arg) {
82419         LDKDescription arg_conv;
82420         arg_conv.inner = untag_ptr(arg);
82421         arg_conv.is_owned = ptr_is_owned(arg);
82422         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82423         arg_conv.is_owned = false;
82424         int64_t ret_conv = Description_clone_ptr(&arg_conv);
82425         return ret_conv;
82426 }
82427
82428 int64_t  CS_LDK_Description_clone(int64_t orig) {
82429         LDKDescription orig_conv;
82430         orig_conv.inner = untag_ptr(orig);
82431         orig_conv.is_owned = ptr_is_owned(orig);
82432         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82433         orig_conv.is_owned = false;
82434         LDKDescription ret_var = Description_clone(&orig_conv);
82435         int64_t ret_ref = 0;
82436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82438         return ret_ref;
82439 }
82440
82441 int64_t  CS_LDK_Description_hash(int64_t o) {
82442         LDKDescription o_conv;
82443         o_conv.inner = untag_ptr(o);
82444         o_conv.is_owned = ptr_is_owned(o);
82445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82446         o_conv.is_owned = false;
82447         int64_t ret_conv = Description_hash(&o_conv);
82448         return ret_conv;
82449 }
82450
82451 jboolean  CS_LDK_Description_eq(int64_t a, int64_t b) {
82452         LDKDescription a_conv;
82453         a_conv.inner = untag_ptr(a);
82454         a_conv.is_owned = ptr_is_owned(a);
82455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82456         a_conv.is_owned = false;
82457         LDKDescription b_conv;
82458         b_conv.inner = untag_ptr(b);
82459         b_conv.is_owned = ptr_is_owned(b);
82460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82461         b_conv.is_owned = false;
82462         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
82463         return ret_conv;
82464 }
82465
82466 void  CS_LDK_PayeePubKey_free(int64_t this_obj) {
82467         LDKPayeePubKey this_obj_conv;
82468         this_obj_conv.inner = untag_ptr(this_obj);
82469         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82471         PayeePubKey_free(this_obj_conv);
82472 }
82473
82474 int8_tArray  CS_LDK_PayeePubKey_get_a(int64_t this_ptr) {
82475         LDKPayeePubKey this_ptr_conv;
82476         this_ptr_conv.inner = untag_ptr(this_ptr);
82477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82479         this_ptr_conv.is_owned = false;
82480         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
82481         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
82482         return ret_arr;
82483 }
82484
82485 void  CS_LDK_PayeePubKey_set_a(int64_t this_ptr, int8_tArray val) {
82486         LDKPayeePubKey this_ptr_conv;
82487         this_ptr_conv.inner = untag_ptr(this_ptr);
82488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82490         this_ptr_conv.is_owned = false;
82491         LDKPublicKey val_ref;
82492         CHECK(val->arr_len == 33);
82493         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
82494         PayeePubKey_set_a(&this_ptr_conv, val_ref);
82495 }
82496
82497 int64_t  CS_LDK_PayeePubKey_new(int8_tArray a_arg) {
82498         LDKPublicKey a_arg_ref;
82499         CHECK(a_arg->arr_len == 33);
82500         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
82501         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
82502         int64_t ret_ref = 0;
82503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82505         return ret_ref;
82506 }
82507
82508 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
82509         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
82510         int64_t ret_ref = 0;
82511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82513         return ret_ref;
82514 }
82515 int64_t  CS_LDK_PayeePubKey_clone_ptr(int64_t arg) {
82516         LDKPayeePubKey arg_conv;
82517         arg_conv.inner = untag_ptr(arg);
82518         arg_conv.is_owned = ptr_is_owned(arg);
82519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82520         arg_conv.is_owned = false;
82521         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
82522         return ret_conv;
82523 }
82524
82525 int64_t  CS_LDK_PayeePubKey_clone(int64_t orig) {
82526         LDKPayeePubKey orig_conv;
82527         orig_conv.inner = untag_ptr(orig);
82528         orig_conv.is_owned = ptr_is_owned(orig);
82529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82530         orig_conv.is_owned = false;
82531         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
82532         int64_t ret_ref = 0;
82533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82535         return ret_ref;
82536 }
82537
82538 int64_t  CS_LDK_PayeePubKey_hash(int64_t o) {
82539         LDKPayeePubKey o_conv;
82540         o_conv.inner = untag_ptr(o);
82541         o_conv.is_owned = ptr_is_owned(o);
82542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82543         o_conv.is_owned = false;
82544         int64_t ret_conv = PayeePubKey_hash(&o_conv);
82545         return ret_conv;
82546 }
82547
82548 jboolean  CS_LDK_PayeePubKey_eq(int64_t a, int64_t b) {
82549         LDKPayeePubKey a_conv;
82550         a_conv.inner = untag_ptr(a);
82551         a_conv.is_owned = ptr_is_owned(a);
82552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82553         a_conv.is_owned = false;
82554         LDKPayeePubKey b_conv;
82555         b_conv.inner = untag_ptr(b);
82556         b_conv.is_owned = ptr_is_owned(b);
82557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82558         b_conv.is_owned = false;
82559         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
82560         return ret_conv;
82561 }
82562
82563 void  CS_LDK_ExpiryTime_free(int64_t this_obj) {
82564         LDKExpiryTime this_obj_conv;
82565         this_obj_conv.inner = untag_ptr(this_obj);
82566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82568         ExpiryTime_free(this_obj_conv);
82569 }
82570
82571 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
82572         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
82573         int64_t ret_ref = 0;
82574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82576         return ret_ref;
82577 }
82578 int64_t  CS_LDK_ExpiryTime_clone_ptr(int64_t arg) {
82579         LDKExpiryTime arg_conv;
82580         arg_conv.inner = untag_ptr(arg);
82581         arg_conv.is_owned = ptr_is_owned(arg);
82582         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82583         arg_conv.is_owned = false;
82584         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
82585         return ret_conv;
82586 }
82587
82588 int64_t  CS_LDK_ExpiryTime_clone(int64_t orig) {
82589         LDKExpiryTime orig_conv;
82590         orig_conv.inner = untag_ptr(orig);
82591         orig_conv.is_owned = ptr_is_owned(orig);
82592         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82593         orig_conv.is_owned = false;
82594         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
82595         int64_t ret_ref = 0;
82596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82598         return ret_ref;
82599 }
82600
82601 int64_t  CS_LDK_ExpiryTime_hash(int64_t o) {
82602         LDKExpiryTime o_conv;
82603         o_conv.inner = untag_ptr(o);
82604         o_conv.is_owned = ptr_is_owned(o);
82605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82606         o_conv.is_owned = false;
82607         int64_t ret_conv = ExpiryTime_hash(&o_conv);
82608         return ret_conv;
82609 }
82610
82611 jboolean  CS_LDK_ExpiryTime_eq(int64_t a, int64_t b) {
82612         LDKExpiryTime a_conv;
82613         a_conv.inner = untag_ptr(a);
82614         a_conv.is_owned = ptr_is_owned(a);
82615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82616         a_conv.is_owned = false;
82617         LDKExpiryTime b_conv;
82618         b_conv.inner = untag_ptr(b);
82619         b_conv.is_owned = ptr_is_owned(b);
82620         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82621         b_conv.is_owned = false;
82622         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
82623         return ret_conv;
82624 }
82625
82626 void  CS_LDK_MinFinalCltvExpiryDelta_free(int64_t this_obj) {
82627         LDKMinFinalCltvExpiryDelta this_obj_conv;
82628         this_obj_conv.inner = untag_ptr(this_obj);
82629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82631         MinFinalCltvExpiryDelta_free(this_obj_conv);
82632 }
82633
82634 int64_t  CS_LDK_MinFinalCltvExpiryDelta_get_a(int64_t this_ptr) {
82635         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82636         this_ptr_conv.inner = untag_ptr(this_ptr);
82637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82639         this_ptr_conv.is_owned = false;
82640         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
82641         return ret_conv;
82642 }
82643
82644 void  CS_LDK_MinFinalCltvExpiryDelta_set_a(int64_t this_ptr, int64_t val) {
82645         LDKMinFinalCltvExpiryDelta this_ptr_conv;
82646         this_ptr_conv.inner = untag_ptr(this_ptr);
82647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82649         this_ptr_conv.is_owned = false;
82650         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
82651 }
82652
82653 int64_t  CS_LDK_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
82654         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
82655         int64_t ret_ref = 0;
82656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82658         return ret_ref;
82659 }
82660
82661 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
82662         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
82663         int64_t ret_ref = 0;
82664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82666         return ret_ref;
82667 }
82668 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone_ptr(int64_t arg) {
82669         LDKMinFinalCltvExpiryDelta arg_conv;
82670         arg_conv.inner = untag_ptr(arg);
82671         arg_conv.is_owned = ptr_is_owned(arg);
82672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82673         arg_conv.is_owned = false;
82674         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
82675         return ret_conv;
82676 }
82677
82678 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone(int64_t orig) {
82679         LDKMinFinalCltvExpiryDelta orig_conv;
82680         orig_conv.inner = untag_ptr(orig);
82681         orig_conv.is_owned = ptr_is_owned(orig);
82682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82683         orig_conv.is_owned = false;
82684         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
82685         int64_t ret_ref = 0;
82686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82688         return ret_ref;
82689 }
82690
82691 int64_t  CS_LDK_MinFinalCltvExpiryDelta_hash(int64_t o) {
82692         LDKMinFinalCltvExpiryDelta o_conv;
82693         o_conv.inner = untag_ptr(o);
82694         o_conv.is_owned = ptr_is_owned(o);
82695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82696         o_conv.is_owned = false;
82697         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
82698         return ret_conv;
82699 }
82700
82701 jboolean  CS_LDK_MinFinalCltvExpiryDelta_eq(int64_t a, int64_t b) {
82702         LDKMinFinalCltvExpiryDelta a_conv;
82703         a_conv.inner = untag_ptr(a);
82704         a_conv.is_owned = ptr_is_owned(a);
82705         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82706         a_conv.is_owned = false;
82707         LDKMinFinalCltvExpiryDelta b_conv;
82708         b_conv.inner = untag_ptr(b);
82709         b_conv.is_owned = ptr_is_owned(b);
82710         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82711         b_conv.is_owned = false;
82712         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
82713         return ret_conv;
82714 }
82715
82716 void  CS_LDK_Fallback_free(int64_t this_ptr) {
82717         if (!ptr_is_owned(this_ptr)) return;
82718         void* this_ptr_ptr = untag_ptr(this_ptr);
82719         CHECK_ACCESS(this_ptr_ptr);
82720         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
82721         FREE(untag_ptr(this_ptr));
82722         Fallback_free(this_ptr_conv);
82723 }
82724
82725 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
82726         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82727         *ret_copy = Fallback_clone(arg);
82728         int64_t ret_ref = tag_ptr(ret_copy, true);
82729         return ret_ref;
82730 }
82731 int64_t  CS_LDK_Fallback_clone_ptr(int64_t arg) {
82732         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
82733         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
82734         return ret_conv;
82735 }
82736
82737 int64_t  CS_LDK_Fallback_clone(int64_t orig) {
82738         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
82739         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82740         *ret_copy = Fallback_clone(orig_conv);
82741         int64_t ret_ref = tag_ptr(ret_copy, true);
82742         return ret_ref;
82743 }
82744
82745 int64_t  CS_LDK_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
82746         
82747         LDKCVec_u8Z program_ref;
82748         program_ref.datalen = program->arr_len;
82749         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
82750         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
82751         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82752         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
82753         int64_t ret_ref = tag_ptr(ret_copy, true);
82754         return ret_ref;
82755 }
82756
82757 int64_t  CS_LDK_Fallback_pub_key_hash(int8_tArray a) {
82758         LDKTwentyBytes a_ref;
82759         CHECK(a->arr_len == 20);
82760         memcpy(a_ref.data, a->elems, 20); FREE(a);
82761         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82762         *ret_copy = Fallback_pub_key_hash(a_ref);
82763         int64_t ret_ref = tag_ptr(ret_copy, true);
82764         return ret_ref;
82765 }
82766
82767 int64_t  CS_LDK_Fallback_script_hash(int8_tArray a) {
82768         LDKTwentyBytes a_ref;
82769         CHECK(a->arr_len == 20);
82770         memcpy(a_ref.data, a->elems, 20); FREE(a);
82771         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
82772         *ret_copy = Fallback_script_hash(a_ref);
82773         int64_t ret_ref = tag_ptr(ret_copy, true);
82774         return ret_ref;
82775 }
82776
82777 int64_t  CS_LDK_Fallback_hash(int64_t o) {
82778         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
82779         int64_t ret_conv = Fallback_hash(o_conv);
82780         return ret_conv;
82781 }
82782
82783 jboolean  CS_LDK_Fallback_eq(int64_t a, int64_t b) {
82784         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
82785         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
82786         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
82787         return ret_conv;
82788 }
82789
82790 void  CS_LDK_Bolt11InvoiceSignature_free(int64_t this_obj) {
82791         LDKBolt11InvoiceSignature this_obj_conv;
82792         this_obj_conv.inner = untag_ptr(this_obj);
82793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82795         Bolt11InvoiceSignature_free(this_obj_conv);
82796 }
82797
82798 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
82799         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
82800         int64_t ret_ref = 0;
82801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82803         return ret_ref;
82804 }
82805 int64_t  CS_LDK_Bolt11InvoiceSignature_clone_ptr(int64_t arg) {
82806         LDKBolt11InvoiceSignature arg_conv;
82807         arg_conv.inner = untag_ptr(arg);
82808         arg_conv.is_owned = ptr_is_owned(arg);
82809         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82810         arg_conv.is_owned = false;
82811         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
82812         return ret_conv;
82813 }
82814
82815 int64_t  CS_LDK_Bolt11InvoiceSignature_clone(int64_t orig) {
82816         LDKBolt11InvoiceSignature orig_conv;
82817         orig_conv.inner = untag_ptr(orig);
82818         orig_conv.is_owned = ptr_is_owned(orig);
82819         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82820         orig_conv.is_owned = false;
82821         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
82822         int64_t ret_ref = 0;
82823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82825         return ret_ref;
82826 }
82827
82828 int64_t  CS_LDK_Bolt11InvoiceSignature_hash(int64_t o) {
82829         LDKBolt11InvoiceSignature o_conv;
82830         o_conv.inner = untag_ptr(o);
82831         o_conv.is_owned = ptr_is_owned(o);
82832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82833         o_conv.is_owned = false;
82834         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
82835         return ret_conv;
82836 }
82837
82838 jboolean  CS_LDK_Bolt11InvoiceSignature_eq(int64_t a, int64_t b) {
82839         LDKBolt11InvoiceSignature a_conv;
82840         a_conv.inner = untag_ptr(a);
82841         a_conv.is_owned = ptr_is_owned(a);
82842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82843         a_conv.is_owned = false;
82844         LDKBolt11InvoiceSignature b_conv;
82845         b_conv.inner = untag_ptr(b);
82846         b_conv.is_owned = ptr_is_owned(b);
82847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82848         b_conv.is_owned = false;
82849         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
82850         return ret_conv;
82851 }
82852
82853 void  CS_LDK_PrivateRoute_free(int64_t this_obj) {
82854         LDKPrivateRoute this_obj_conv;
82855         this_obj_conv.inner = untag_ptr(this_obj);
82856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82858         PrivateRoute_free(this_obj_conv);
82859 }
82860
82861 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
82862         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
82863         int64_t ret_ref = 0;
82864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82866         return ret_ref;
82867 }
82868 int64_t  CS_LDK_PrivateRoute_clone_ptr(int64_t arg) {
82869         LDKPrivateRoute arg_conv;
82870         arg_conv.inner = untag_ptr(arg);
82871         arg_conv.is_owned = ptr_is_owned(arg);
82872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82873         arg_conv.is_owned = false;
82874         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
82875         return ret_conv;
82876 }
82877
82878 int64_t  CS_LDK_PrivateRoute_clone(int64_t orig) {
82879         LDKPrivateRoute orig_conv;
82880         orig_conv.inner = untag_ptr(orig);
82881         orig_conv.is_owned = ptr_is_owned(orig);
82882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82883         orig_conv.is_owned = false;
82884         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
82885         int64_t ret_ref = 0;
82886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82888         return ret_ref;
82889 }
82890
82891 int64_t  CS_LDK_PrivateRoute_hash(int64_t o) {
82892         LDKPrivateRoute o_conv;
82893         o_conv.inner = untag_ptr(o);
82894         o_conv.is_owned = ptr_is_owned(o);
82895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82896         o_conv.is_owned = false;
82897         int64_t ret_conv = PrivateRoute_hash(&o_conv);
82898         return ret_conv;
82899 }
82900
82901 jboolean  CS_LDK_PrivateRoute_eq(int64_t a, int64_t b) {
82902         LDKPrivateRoute a_conv;
82903         a_conv.inner = untag_ptr(a);
82904         a_conv.is_owned = ptr_is_owned(a);
82905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82906         a_conv.is_owned = false;
82907         LDKPrivateRoute b_conv;
82908         b_conv.inner = untag_ptr(b);
82909         b_conv.is_owned = ptr_is_owned(b);
82910         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82911         b_conv.is_owned = false;
82912         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
82913         return ret_conv;
82914 }
82915
82916 int64_t  CS_LDK_SignedRawBolt11Invoice_into_parts(int64_t this_arg) {
82917         LDKSignedRawBolt11Invoice this_arg_conv;
82918         this_arg_conv.inner = untag_ptr(this_arg);
82919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82921         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
82922         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
82923         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
82924         return tag_ptr(ret_conv, true);
82925 }
82926
82927 int64_t  CS_LDK_SignedRawBolt11Invoice_raw_invoice(int64_t this_arg) {
82928         LDKSignedRawBolt11Invoice this_arg_conv;
82929         this_arg_conv.inner = untag_ptr(this_arg);
82930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82932         this_arg_conv.is_owned = false;
82933         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
82934         int64_t ret_ref = 0;
82935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82937         return ret_ref;
82938 }
82939
82940 int8_tArray  CS_LDK_SignedRawBolt11Invoice_signable_hash(int64_t this_arg) {
82941         LDKSignedRawBolt11Invoice this_arg_conv;
82942         this_arg_conv.inner = untag_ptr(this_arg);
82943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82945         this_arg_conv.is_owned = false;
82946         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82947         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
82948         return ret_arr;
82949 }
82950
82951 int64_t  CS_LDK_SignedRawBolt11Invoice_signature(int64_t this_arg) {
82952         LDKSignedRawBolt11Invoice this_arg_conv;
82953         this_arg_conv.inner = untag_ptr(this_arg);
82954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82956         this_arg_conv.is_owned = false;
82957         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
82958         int64_t ret_ref = 0;
82959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82961         return ret_ref;
82962 }
82963
82964 int64_t  CS_LDK_SignedRawBolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
82965         LDKSignedRawBolt11Invoice this_arg_conv;
82966         this_arg_conv.inner = untag_ptr(this_arg);
82967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82969         this_arg_conv.is_owned = false;
82970         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
82971         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
82972         return tag_ptr(ret_conv, true);
82973 }
82974
82975 jboolean  CS_LDK_SignedRawBolt11Invoice_check_signature(int64_t this_arg) {
82976         LDKSignedRawBolt11Invoice this_arg_conv;
82977         this_arg_conv.inner = untag_ptr(this_arg);
82978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82980         this_arg_conv.is_owned = false;
82981         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
82982         return ret_conv;
82983 }
82984
82985 int8_tArray  CS_LDK_RawBolt11Invoice_signable_hash(int64_t this_arg) {
82986         LDKRawBolt11Invoice this_arg_conv;
82987         this_arg_conv.inner = untag_ptr(this_arg);
82988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82990         this_arg_conv.is_owned = false;
82991         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
82992         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
82993         return ret_arr;
82994 }
82995
82996 int64_t  CS_LDK_RawBolt11Invoice_payment_hash(int64_t this_arg) {
82997         LDKRawBolt11Invoice this_arg_conv;
82998         this_arg_conv.inner = untag_ptr(this_arg);
82999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83001         this_arg_conv.is_owned = false;
83002         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
83003         int64_t ret_ref = 0;
83004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83006         return ret_ref;
83007 }
83008
83009 int64_t  CS_LDK_RawBolt11Invoice_description(int64_t this_arg) {
83010         LDKRawBolt11Invoice this_arg_conv;
83011         this_arg_conv.inner = untag_ptr(this_arg);
83012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83014         this_arg_conv.is_owned = false;
83015         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
83016         int64_t ret_ref = 0;
83017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83019         return ret_ref;
83020 }
83021
83022 int64_t  CS_LDK_RawBolt11Invoice_payee_pub_key(int64_t this_arg) {
83023         LDKRawBolt11Invoice this_arg_conv;
83024         this_arg_conv.inner = untag_ptr(this_arg);
83025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83027         this_arg_conv.is_owned = false;
83028         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
83029         int64_t ret_ref = 0;
83030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83032         return ret_ref;
83033 }
83034
83035 int64_t  CS_LDK_RawBolt11Invoice_description_hash(int64_t this_arg) {
83036         LDKRawBolt11Invoice this_arg_conv;
83037         this_arg_conv.inner = untag_ptr(this_arg);
83038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83040         this_arg_conv.is_owned = false;
83041         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
83042         int64_t ret_ref = 0;
83043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83045         return ret_ref;
83046 }
83047
83048 int64_t  CS_LDK_RawBolt11Invoice_expiry_time(int64_t this_arg) {
83049         LDKRawBolt11Invoice this_arg_conv;
83050         this_arg_conv.inner = untag_ptr(this_arg);
83051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83053         this_arg_conv.is_owned = false;
83054         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
83055         int64_t ret_ref = 0;
83056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83058         return ret_ref;
83059 }
83060
83061 int64_t  CS_LDK_RawBolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
83062         LDKRawBolt11Invoice this_arg_conv;
83063         this_arg_conv.inner = untag_ptr(this_arg);
83064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83066         this_arg_conv.is_owned = false;
83067         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
83068         int64_t ret_ref = 0;
83069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83071         return ret_ref;
83072 }
83073
83074 int64_t  CS_LDK_RawBolt11Invoice_payment_secret(int64_t this_arg) {
83075         LDKRawBolt11Invoice this_arg_conv;
83076         this_arg_conv.inner = untag_ptr(this_arg);
83077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83079         this_arg_conv.is_owned = false;
83080         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
83081         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
83082         int64_t ret_ref = tag_ptr(ret_copy, true);
83083         return ret_ref;
83084 }
83085
83086 int64_t  CS_LDK_RawBolt11Invoice_payment_metadata(int64_t this_arg) {
83087         LDKRawBolt11Invoice this_arg_conv;
83088         this_arg_conv.inner = untag_ptr(this_arg);
83089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83091         this_arg_conv.is_owned = false;
83092         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
83093         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
83094         int64_t ret_ref = tag_ptr(ret_copy, true);
83095         return ret_ref;
83096 }
83097
83098 int64_t  CS_LDK_RawBolt11Invoice_features(int64_t this_arg) {
83099         LDKRawBolt11Invoice this_arg_conv;
83100         this_arg_conv.inner = untag_ptr(this_arg);
83101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83103         this_arg_conv.is_owned = false;
83104         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
83105         int64_t ret_ref = 0;
83106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83108         return ret_ref;
83109 }
83110
83111 int64_tArray  CS_LDK_RawBolt11Invoice_private_routes(int64_t this_arg) {
83112         LDKRawBolt11Invoice this_arg_conv;
83113         this_arg_conv.inner = untag_ptr(this_arg);
83114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83116         this_arg_conv.is_owned = false;
83117         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
83118         int64_tArray ret_arr = NULL;
83119         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
83120         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
83121         for (size_t o = 0; o < ret_var.datalen; o++) {
83122                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
83123                 int64_t ret_conv_14_ref = 0;
83124                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
83125                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
83126                 ret_arr_ptr[o] = ret_conv_14_ref;
83127         }
83128         
83129         FREE(ret_var.data);
83130         return ret_arr;
83131 }
83132
83133 int64_t  CS_LDK_RawBolt11Invoice_amount_pico_btc(int64_t this_arg) {
83134         LDKRawBolt11Invoice this_arg_conv;
83135         this_arg_conv.inner = untag_ptr(this_arg);
83136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83138         this_arg_conv.is_owned = false;
83139         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
83140         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
83141         int64_t ret_ref = tag_ptr(ret_copy, true);
83142         return ret_ref;
83143 }
83144
83145 int32_t  CS_LDK_RawBolt11Invoice_currency(int64_t this_arg) {
83146         LDKRawBolt11Invoice this_arg_conv;
83147         this_arg_conv.inner = untag_ptr(this_arg);
83148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83150         this_arg_conv.is_owned = false;
83151         int32_t ret_conv = LDKCurrency_to_cs(RawBolt11Invoice_currency(&this_arg_conv));
83152         return ret_conv;
83153 }
83154
83155 int64_t  CS_LDK_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
83156         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
83157         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
83158         return tag_ptr(ret_conv, true);
83159 }
83160
83161 int64_t  CS_LDK_PositiveTimestamp_from_system_time(int64_t time) {
83162         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
83163         *ret_conv = PositiveTimestamp_from_system_time(time);
83164         return tag_ptr(ret_conv, true);
83165 }
83166
83167 int64_t  CS_LDK_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
83168         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
83169         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
83170         return tag_ptr(ret_conv, true);
83171 }
83172
83173 int64_t  CS_LDK_PositiveTimestamp_as_unix_timestamp(int64_t this_arg) {
83174         LDKPositiveTimestamp this_arg_conv;
83175         this_arg_conv.inner = untag_ptr(this_arg);
83176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83178         this_arg_conv.is_owned = false;
83179         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
83180         return ret_conv;
83181 }
83182
83183 int64_t  CS_LDK_PositiveTimestamp_as_duration_since_epoch(int64_t this_arg) {
83184         LDKPositiveTimestamp this_arg_conv;
83185         this_arg_conv.inner = untag_ptr(this_arg);
83186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83188         this_arg_conv.is_owned = false;
83189         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
83190         return ret_conv;
83191 }
83192
83193 int64_t  CS_LDK_PositiveTimestamp_as_time(int64_t this_arg) {
83194         LDKPositiveTimestamp this_arg_conv;
83195         this_arg_conv.inner = untag_ptr(this_arg);
83196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83198         this_arg_conv.is_owned = false;
83199         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
83200         return ret_conv;
83201 }
83202
83203 int8_tArray  CS_LDK_Bolt11Invoice_signable_hash(int64_t this_arg) {
83204         LDKBolt11Invoice this_arg_conv;
83205         this_arg_conv.inner = untag_ptr(this_arg);
83206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83208         this_arg_conv.is_owned = false;
83209         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
83210         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
83211         return ret_arr;
83212 }
83213
83214 int64_t  CS_LDK_Bolt11Invoice_into_signed_raw(int64_t this_arg) {
83215         LDKBolt11Invoice this_arg_conv;
83216         this_arg_conv.inner = untag_ptr(this_arg);
83217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83219         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
83220         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
83221         int64_t ret_ref = 0;
83222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83224         return ret_ref;
83225 }
83226
83227 int64_t  CS_LDK_Bolt11Invoice_check_signature(int64_t this_arg) {
83228         LDKBolt11Invoice this_arg_conv;
83229         this_arg_conv.inner = untag_ptr(this_arg);
83230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83232         this_arg_conv.is_owned = false;
83233         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
83234         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
83235         return tag_ptr(ret_conv, true);
83236 }
83237
83238 int64_t  CS_LDK_Bolt11Invoice_from_signed(int64_t signed_invoice) {
83239         LDKSignedRawBolt11Invoice signed_invoice_conv;
83240         signed_invoice_conv.inner = untag_ptr(signed_invoice);
83241         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
83242         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
83243         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
83244         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
83245         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
83246         return tag_ptr(ret_conv, true);
83247 }
83248
83249 int64_t  CS_LDK_Bolt11Invoice_timestamp(int64_t this_arg) {
83250         LDKBolt11Invoice this_arg_conv;
83251         this_arg_conv.inner = untag_ptr(this_arg);
83252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83254         this_arg_conv.is_owned = false;
83255         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
83256         return ret_conv;
83257 }
83258
83259 int64_t  CS_LDK_Bolt11Invoice_duration_since_epoch(int64_t this_arg) {
83260         LDKBolt11Invoice this_arg_conv;
83261         this_arg_conv.inner = untag_ptr(this_arg);
83262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83264         this_arg_conv.is_owned = false;
83265         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
83266         return ret_conv;
83267 }
83268
83269 int8_tArray  CS_LDK_Bolt11Invoice_payment_hash(int64_t this_arg) {
83270         LDKBolt11Invoice this_arg_conv;
83271         this_arg_conv.inner = untag_ptr(this_arg);
83272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83274         this_arg_conv.is_owned = false;
83275         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
83276         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
83277         return ret_arr;
83278 }
83279
83280 int8_tArray  CS_LDK_Bolt11Invoice_payee_pub_key(int64_t this_arg) {
83281         LDKBolt11Invoice this_arg_conv;
83282         this_arg_conv.inner = untag_ptr(this_arg);
83283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83285         this_arg_conv.is_owned = false;
83286         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
83287         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
83288         return ret_arr;
83289 }
83290
83291 int8_tArray  CS_LDK_Bolt11Invoice_payment_secret(int64_t this_arg) {
83292         LDKBolt11Invoice this_arg_conv;
83293         this_arg_conv.inner = untag_ptr(this_arg);
83294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83296         this_arg_conv.is_owned = false;
83297         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
83298         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
83299         return ret_arr;
83300 }
83301
83302 int64_t  CS_LDK_Bolt11Invoice_payment_metadata(int64_t this_arg) {
83303         LDKBolt11Invoice this_arg_conv;
83304         this_arg_conv.inner = untag_ptr(this_arg);
83305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83307         this_arg_conv.is_owned = false;
83308         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
83309         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
83310         int64_t ret_ref = tag_ptr(ret_copy, true);
83311         return ret_ref;
83312 }
83313
83314 int64_t  CS_LDK_Bolt11Invoice_features(int64_t this_arg) {
83315         LDKBolt11Invoice this_arg_conv;
83316         this_arg_conv.inner = untag_ptr(this_arg);
83317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83319         this_arg_conv.is_owned = false;
83320         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
83321         int64_t ret_ref = 0;
83322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83324         return ret_ref;
83325 }
83326
83327 int8_tArray  CS_LDK_Bolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
83328         LDKBolt11Invoice this_arg_conv;
83329         this_arg_conv.inner = untag_ptr(this_arg);
83330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83332         this_arg_conv.is_owned = false;
83333         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
83334         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
83335         return ret_arr;
83336 }
83337
83338 int8_tArray  CS_LDK_Bolt11Invoice_get_payee_pub_key(int64_t this_arg) {
83339         LDKBolt11Invoice this_arg_conv;
83340         this_arg_conv.inner = untag_ptr(this_arg);
83341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83343         this_arg_conv.is_owned = false;
83344         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
83345         memcpy(ret_arr->elems, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form, 33);
83346         return ret_arr;
83347 }
83348
83349 int64_t  CS_LDK_Bolt11Invoice_expires_at(int64_t this_arg) {
83350         LDKBolt11Invoice this_arg_conv;
83351         this_arg_conv.inner = untag_ptr(this_arg);
83352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83354         this_arg_conv.is_owned = false;
83355         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
83356         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
83357         int64_t ret_ref = tag_ptr(ret_copy, true);
83358         return ret_ref;
83359 }
83360
83361 int64_t  CS_LDK_Bolt11Invoice_expiry_time(int64_t this_arg) {
83362         LDKBolt11Invoice this_arg_conv;
83363         this_arg_conv.inner = untag_ptr(this_arg);
83364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83366         this_arg_conv.is_owned = false;
83367         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
83368         return ret_conv;
83369 }
83370
83371 jboolean  CS_LDK_Bolt11Invoice_is_expired(int64_t this_arg) {
83372         LDKBolt11Invoice this_arg_conv;
83373         this_arg_conv.inner = untag_ptr(this_arg);
83374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83376         this_arg_conv.is_owned = false;
83377         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
83378         return ret_conv;
83379 }
83380
83381 int64_t  CS_LDK_Bolt11Invoice_duration_until_expiry(int64_t this_arg) {
83382         LDKBolt11Invoice this_arg_conv;
83383         this_arg_conv.inner = untag_ptr(this_arg);
83384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83386         this_arg_conv.is_owned = false;
83387         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
83388         return ret_conv;
83389 }
83390
83391 int64_t  CS_LDK_Bolt11Invoice_expiration_remaining_from_epoch(int64_t this_arg, int64_t time) {
83392         LDKBolt11Invoice this_arg_conv;
83393         this_arg_conv.inner = untag_ptr(this_arg);
83394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83396         this_arg_conv.is_owned = false;
83397         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
83398         return ret_conv;
83399 }
83400
83401 jboolean  CS_LDK_Bolt11Invoice_would_expire(int64_t this_arg, int64_t at_time) {
83402         LDKBolt11Invoice this_arg_conv;
83403         this_arg_conv.inner = untag_ptr(this_arg);
83404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83406         this_arg_conv.is_owned = false;
83407         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
83408         return ret_conv;
83409 }
83410
83411 int64_t  CS_LDK_Bolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
83412         LDKBolt11Invoice this_arg_conv;
83413         this_arg_conv.inner = untag_ptr(this_arg);
83414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83416         this_arg_conv.is_owned = false;
83417         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
83418         return ret_conv;
83419 }
83420
83421 ptrArray  CS_LDK_Bolt11Invoice_fallback_addresses(int64_t this_arg) {
83422         LDKBolt11Invoice this_arg_conv;
83423         this_arg_conv.inner = untag_ptr(this_arg);
83424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83426         this_arg_conv.is_owned = false;
83427         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
83428         ptrArray ret_arr = NULL;
83429         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
83430         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
83431         for (size_t i = 0; i < ret_var.datalen; i++) {
83432                 LDKStr ret_conv_8_str = ret_var.data[i];
83433                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
83434                 Str_free(ret_conv_8_str);
83435                 ret_arr_ptr[i] = ret_conv_8_conv;
83436         }
83437         
83438         FREE(ret_var.data);
83439         return ret_arr;
83440 }
83441
83442 int64_tArray  CS_LDK_Bolt11Invoice_private_routes(int64_t this_arg) {
83443         LDKBolt11Invoice this_arg_conv;
83444         this_arg_conv.inner = untag_ptr(this_arg);
83445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83447         this_arg_conv.is_owned = false;
83448         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
83449         int64_tArray ret_arr = NULL;
83450         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
83451         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
83452         for (size_t o = 0; o < ret_var.datalen; o++) {
83453                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
83454                 int64_t ret_conv_14_ref = 0;
83455                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
83456                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
83457                 ret_arr_ptr[o] = ret_conv_14_ref;
83458         }
83459         
83460         FREE(ret_var.data);
83461         return ret_arr;
83462 }
83463
83464 int64_tArray  CS_LDK_Bolt11Invoice_route_hints(int64_t this_arg) {
83465         LDKBolt11Invoice this_arg_conv;
83466         this_arg_conv.inner = untag_ptr(this_arg);
83467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83469         this_arg_conv.is_owned = false;
83470         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
83471         int64_tArray ret_arr = NULL;
83472         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
83473         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
83474         for (size_t l = 0; l < ret_var.datalen; l++) {
83475                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
83476                 int64_t ret_conv_11_ref = 0;
83477                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
83478                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
83479                 ret_arr_ptr[l] = ret_conv_11_ref;
83480         }
83481         
83482         FREE(ret_var.data);
83483         return ret_arr;
83484 }
83485
83486 int32_t  CS_LDK_Bolt11Invoice_currency(int64_t this_arg) {
83487         LDKBolt11Invoice this_arg_conv;
83488         this_arg_conv.inner = untag_ptr(this_arg);
83489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83491         this_arg_conv.is_owned = false;
83492         int32_t ret_conv = LDKCurrency_to_cs(Bolt11Invoice_currency(&this_arg_conv));
83493         return ret_conv;
83494 }
83495
83496 int64_t  CS_LDK_Bolt11Invoice_amount_milli_satoshis(int64_t this_arg) {
83497         LDKBolt11Invoice this_arg_conv;
83498         this_arg_conv.inner = untag_ptr(this_arg);
83499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83501         this_arg_conv.is_owned = false;
83502         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
83503         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
83504         int64_t ret_ref = tag_ptr(ret_copy, true);
83505         return ret_ref;
83506 }
83507
83508 int64_t  CS_LDK_Description_new(jstring description) {
83509         LDKStr description_conv = str_ref_to_owned_c(description);
83510         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
83511         *ret_conv = Description_new(description_conv);
83512         return tag_ptr(ret_conv, true);
83513 }
83514
83515 int64_t  CS_LDK_Description_into_inner(int64_t this_arg) {
83516         LDKDescription this_arg_conv;
83517         this_arg_conv.inner = untag_ptr(this_arg);
83518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83520         this_arg_conv = Description_clone(&this_arg_conv);
83521         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
83522         int64_t ret_ref = 0;
83523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83525         return ret_ref;
83526 }
83527
83528 jstring  CS_LDK_Description_to_str(int64_t o) {
83529         LDKDescription o_conv;
83530         o_conv.inner = untag_ptr(o);
83531         o_conv.is_owned = ptr_is_owned(o);
83532         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83533         o_conv.is_owned = false;
83534         LDKStr ret_str = Description_to_str(&o_conv);
83535         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
83536         Str_free(ret_str);
83537         return ret_conv;
83538 }
83539
83540 int64_t  CS_LDK_ExpiryTime_from_seconds(int64_t seconds) {
83541         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
83542         int64_t ret_ref = 0;
83543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83545         return ret_ref;
83546 }
83547
83548 int64_t  CS_LDK_ExpiryTime_from_duration(int64_t duration) {
83549         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
83550         int64_t ret_ref = 0;
83551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83553         return ret_ref;
83554 }
83555
83556 int64_t  CS_LDK_ExpiryTime_as_seconds(int64_t this_arg) {
83557         LDKExpiryTime this_arg_conv;
83558         this_arg_conv.inner = untag_ptr(this_arg);
83559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83561         this_arg_conv.is_owned = false;
83562         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
83563         return ret_conv;
83564 }
83565
83566 int64_t  CS_LDK_ExpiryTime_as_duration(int64_t this_arg) {
83567         LDKExpiryTime this_arg_conv;
83568         this_arg_conv.inner = untag_ptr(this_arg);
83569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83571         this_arg_conv.is_owned = false;
83572         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
83573         return ret_conv;
83574 }
83575
83576 int64_t  CS_LDK_PrivateRoute_new(int64_t hops) {
83577         LDKRouteHint hops_conv;
83578         hops_conv.inner = untag_ptr(hops);
83579         hops_conv.is_owned = ptr_is_owned(hops);
83580         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
83581         hops_conv = RouteHint_clone(&hops_conv);
83582         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
83583         *ret_conv = PrivateRoute_new(hops_conv);
83584         return tag_ptr(ret_conv, true);
83585 }
83586
83587 int64_t  CS_LDK_PrivateRoute_into_inner(int64_t this_arg) {
83588         LDKPrivateRoute this_arg_conv;
83589         this_arg_conv.inner = untag_ptr(this_arg);
83590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83592         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
83593         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
83594         int64_t ret_ref = 0;
83595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83597         return ret_ref;
83598 }
83599
83600 int32_t  CS_LDK_CreationError_clone(int64_t orig) {
83601         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
83602         int32_t ret_conv = LDKCreationError_to_cs(CreationError_clone(orig_conv));
83603         return ret_conv;
83604 }
83605
83606 int32_t  CS_LDK_CreationError_description_too_long() {
83607         int32_t ret_conv = LDKCreationError_to_cs(CreationError_description_too_long());
83608         return ret_conv;
83609 }
83610
83611 int32_t  CS_LDK_CreationError_route_too_long() {
83612         int32_t ret_conv = LDKCreationError_to_cs(CreationError_route_too_long());
83613         return ret_conv;
83614 }
83615
83616 int32_t  CS_LDK_CreationError_timestamp_out_of_bounds() {
83617         int32_t ret_conv = LDKCreationError_to_cs(CreationError_timestamp_out_of_bounds());
83618         return ret_conv;
83619 }
83620
83621 int32_t  CS_LDK_CreationError_invalid_amount() {
83622         int32_t ret_conv = LDKCreationError_to_cs(CreationError_invalid_amount());
83623         return ret_conv;
83624 }
83625
83626 int32_t  CS_LDK_CreationError_missing_route_hints() {
83627         int32_t ret_conv = LDKCreationError_to_cs(CreationError_missing_route_hints());
83628         return ret_conv;
83629 }
83630
83631 int32_t  CS_LDK_CreationError_min_final_cltv_expiry_delta_too_short() {
83632         int32_t ret_conv = LDKCreationError_to_cs(CreationError_min_final_cltv_expiry_delta_too_short());
83633         return ret_conv;
83634 }
83635
83636 jboolean  CS_LDK_CreationError_eq(int64_t a, int64_t b) {
83637         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
83638         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
83639         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
83640         return ret_conv;
83641 }
83642
83643 jstring  CS_LDK_CreationError_to_str(int64_t o) {
83644         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
83645         LDKStr ret_str = CreationError_to_str(o_conv);
83646         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
83647         Str_free(ret_str);
83648         return ret_conv;
83649 }
83650
83651 int32_t  CS_LDK_Bolt11SemanticError_clone(int64_t orig) {
83652         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
83653         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_clone(orig_conv));
83654         return ret_conv;
83655 }
83656
83657 int32_t  CS_LDK_Bolt11SemanticError_no_payment_hash() {
83658         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_hash());
83659         return ret_conv;
83660 }
83661
83662 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_hashes() {
83663         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_hashes());
83664         return ret_conv;
83665 }
83666
83667 int32_t  CS_LDK_Bolt11SemanticError_no_description() {
83668         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_description());
83669         return ret_conv;
83670 }
83671
83672 int32_t  CS_LDK_Bolt11SemanticError_multiple_descriptions() {
83673         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_descriptions());
83674         return ret_conv;
83675 }
83676
83677 int32_t  CS_LDK_Bolt11SemanticError_no_payment_secret() {
83678         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_secret());
83679         return ret_conv;
83680 }
83681
83682 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_secrets() {
83683         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_secrets());
83684         return ret_conv;
83685 }
83686
83687 int32_t  CS_LDK_Bolt11SemanticError_invalid_features() {
83688         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_features());
83689         return ret_conv;
83690 }
83691
83692 int32_t  CS_LDK_Bolt11SemanticError_invalid_recovery_id() {
83693         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_recovery_id());
83694         return ret_conv;
83695 }
83696
83697 int32_t  CS_LDK_Bolt11SemanticError_invalid_signature() {
83698         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_signature());
83699         return ret_conv;
83700 }
83701
83702 int32_t  CS_LDK_Bolt11SemanticError_imprecise_amount() {
83703         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_imprecise_amount());
83704         return ret_conv;
83705 }
83706
83707 jboolean  CS_LDK_Bolt11SemanticError_eq(int64_t a, int64_t b) {
83708         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
83709         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
83710         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
83711         return ret_conv;
83712 }
83713
83714 jstring  CS_LDK_Bolt11SemanticError_to_str(int64_t o) {
83715         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
83716         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
83717         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
83718         Str_free(ret_str);
83719         return ret_conv;
83720 }
83721
83722 void  CS_LDK_SignOrCreationError_free(int64_t this_ptr) {
83723         if (!ptr_is_owned(this_ptr)) return;
83724         void* this_ptr_ptr = untag_ptr(this_ptr);
83725         CHECK_ACCESS(this_ptr_ptr);
83726         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
83727         FREE(untag_ptr(this_ptr));
83728         SignOrCreationError_free(this_ptr_conv);
83729 }
83730
83731 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
83732         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83733         *ret_copy = SignOrCreationError_clone(arg);
83734         int64_t ret_ref = tag_ptr(ret_copy, true);
83735         return ret_ref;
83736 }
83737 int64_t  CS_LDK_SignOrCreationError_clone_ptr(int64_t arg) {
83738         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
83739         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
83740         return ret_conv;
83741 }
83742
83743 int64_t  CS_LDK_SignOrCreationError_clone(int64_t orig) {
83744         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
83745         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83746         *ret_copy = SignOrCreationError_clone(orig_conv);
83747         int64_t ret_ref = tag_ptr(ret_copy, true);
83748         return ret_ref;
83749 }
83750
83751 int64_t  CS_LDK_SignOrCreationError_sign_error() {
83752         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83753         *ret_copy = SignOrCreationError_sign_error();
83754         int64_t ret_ref = tag_ptr(ret_copy, true);
83755         return ret_ref;
83756 }
83757
83758 int64_t  CS_LDK_SignOrCreationError_creation_error(int32_t a) {
83759         LDKCreationError a_conv = LDKCreationError_from_cs(a);
83760         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
83761         *ret_copy = SignOrCreationError_creation_error(a_conv);
83762         int64_t ret_ref = tag_ptr(ret_copy, true);
83763         return ret_ref;
83764 }
83765
83766 jboolean  CS_LDK_SignOrCreationError_eq(int64_t a, int64_t b) {
83767         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
83768         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
83769         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
83770         return ret_conv;
83771 }
83772
83773 jstring  CS_LDK_SignOrCreationError_to_str(int64_t o) {
83774         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
83775         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
83776         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
83777         Str_free(ret_str);
83778         return ret_conv;
83779 }
83780
83781 int64_t  CS_LDK_payment_parameters_from_zero_amount_invoice(int64_t invoice, int64_t amount_msat) {
83782         LDKBolt11Invoice invoice_conv;
83783         invoice_conv.inner = untag_ptr(invoice);
83784         invoice_conv.is_owned = ptr_is_owned(invoice);
83785         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83786         invoice_conv.is_owned = false;
83787         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83788         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
83789         return tag_ptr(ret_conv, true);
83790 }
83791
83792 int64_t  CS_LDK_payment_parameters_from_invoice(int64_t invoice) {
83793         LDKBolt11Invoice invoice_conv;
83794         invoice_conv.inner = untag_ptr(invoice);
83795         invoice_conv.is_owned = ptr_is_owned(invoice);
83796         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
83797         invoice_conv.is_owned = false;
83798         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
83799         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
83800         return tag_ptr(ret_conv, true);
83801 }
83802
83803 int64_t  CS_LDK_create_phantom_invoice(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, int32_t network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
83804         void* amt_msat_ptr = untag_ptr(amt_msat);
83805         CHECK_ACCESS(amt_msat_ptr);
83806         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83807         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83808         void* payment_hash_ptr = untag_ptr(payment_hash);
83809         CHECK_ACCESS(payment_hash_ptr);
83810         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83811         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83812         LDKStr description_conv = str_ref_to_owned_c(description);
83813         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83814         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83815         if (phantom_route_hints_constr.datalen > 0)
83816                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83817         else
83818                 phantom_route_hints_constr.data = NULL;
83819         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83820         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83821                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83822                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83823                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83824                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83826                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83827                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83828         }
83829         FREE(phantom_route_hints);
83830         void* entropy_source_ptr = untag_ptr(entropy_source);
83831         CHECK_ACCESS(entropy_source_ptr);
83832         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83833         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83835                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83836         }
83837         void* node_signer_ptr = untag_ptr(node_signer);
83838         CHECK_ACCESS(node_signer_ptr);
83839         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83840         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83842                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83843         }
83844         void* logger_ptr = untag_ptr(logger);
83845         CHECK_ACCESS(logger_ptr);
83846         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83847         if (logger_conv.free == LDKLogger_JCalls_free) {
83848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83849                 LDKLogger_JCalls_cloned(&logger_conv);
83850         }
83851         LDKCurrency network_conv = LDKCurrency_from_cs(network);
83852         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83853         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83854         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83855         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83856         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83857         *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);
83858         return tag_ptr(ret_conv, true);
83859 }
83860
83861 int64_t  CS_LDK_create_phantom_invoice_with_description_hash(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, int32_t network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
83862         void* amt_msat_ptr = untag_ptr(amt_msat);
83863         CHECK_ACCESS(amt_msat_ptr);
83864         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83865         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83866         void* payment_hash_ptr = untag_ptr(payment_hash);
83867         CHECK_ACCESS(payment_hash_ptr);
83868         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
83869         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
83870         LDKSha256 description_hash_conv;
83871         description_hash_conv.inner = untag_ptr(description_hash);
83872         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83873         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83874         description_hash_conv = Sha256_clone(&description_hash_conv);
83875         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
83876         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
83877         if (phantom_route_hints_constr.datalen > 0)
83878                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
83879         else
83880                 phantom_route_hints_constr.data = NULL;
83881         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
83882         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
83883                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
83884                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
83885                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
83886                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
83887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
83888                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
83889                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
83890         }
83891         FREE(phantom_route_hints);
83892         void* entropy_source_ptr = untag_ptr(entropy_source);
83893         CHECK_ACCESS(entropy_source_ptr);
83894         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83895         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83897                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83898         }
83899         void* node_signer_ptr = untag_ptr(node_signer);
83900         CHECK_ACCESS(node_signer_ptr);
83901         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83902         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83904                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83905         }
83906         void* logger_ptr = untag_ptr(logger);
83907         CHECK_ACCESS(logger_ptr);
83908         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83909         if (logger_conv.free == LDKLogger_JCalls_free) {
83910                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83911                 LDKLogger_JCalls_cloned(&logger_conv);
83912         }
83913         LDKCurrency network_conv = LDKCurrency_from_cs(network);
83914         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83915         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83916         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83917         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83918         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83919         *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);
83920         return tag_ptr(ret_conv, true);
83921 }
83922
83923 int64_t  CS_LDK_create_invoice_from_channelmanager(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
83924         LDKChannelManager channelmanager_conv;
83925         channelmanager_conv.inner = untag_ptr(channelmanager);
83926         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83927         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83928         channelmanager_conv.is_owned = false;
83929         void* node_signer_ptr = untag_ptr(node_signer);
83930         CHECK_ACCESS(node_signer_ptr);
83931         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83932         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83934                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83935         }
83936         void* logger_ptr = untag_ptr(logger);
83937         CHECK_ACCESS(logger_ptr);
83938         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83939         if (logger_conv.free == LDKLogger_JCalls_free) {
83940                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83941                 LDKLogger_JCalls_cloned(&logger_conv);
83942         }
83943         LDKCurrency network_conv = LDKCurrency_from_cs(network);
83944         void* amt_msat_ptr = untag_ptr(amt_msat);
83945         CHECK_ACCESS(amt_msat_ptr);
83946         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83947         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83948         LDKStr description_conv = str_ref_to_owned_c(description);
83949         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83950         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83951         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83952         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83953         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83954         *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);
83955         return tag_ptr(ret_conv, true);
83956 }
83957
83958 int64_t  CS_LDK_create_invoice_from_channelmanager_with_description_hash(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
83959         LDKChannelManager channelmanager_conv;
83960         channelmanager_conv.inner = untag_ptr(channelmanager);
83961         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
83962         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
83963         channelmanager_conv.is_owned = false;
83964         void* node_signer_ptr = untag_ptr(node_signer);
83965         CHECK_ACCESS(node_signer_ptr);
83966         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
83967         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
83968                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83969                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
83970         }
83971         void* logger_ptr = untag_ptr(logger);
83972         CHECK_ACCESS(logger_ptr);
83973         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83974         if (logger_conv.free == LDKLogger_JCalls_free) {
83975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83976                 LDKLogger_JCalls_cloned(&logger_conv);
83977         }
83978         LDKCurrency network_conv = LDKCurrency_from_cs(network);
83979         void* amt_msat_ptr = untag_ptr(amt_msat);
83980         CHECK_ACCESS(amt_msat_ptr);
83981         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
83982         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
83983         LDKSha256 description_hash_conv;
83984         description_hash_conv.inner = untag_ptr(description_hash);
83985         description_hash_conv.is_owned = ptr_is_owned(description_hash);
83986         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
83987         description_hash_conv = Sha256_clone(&description_hash_conv);
83988         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
83989         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
83990         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
83991         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
83992         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
83993         *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);
83994         return tag_ptr(ret_conv, true);
83995 }
83996
83997 int64_t  CS_LDK_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
83998         LDKChannelManager channelmanager_conv;
83999         channelmanager_conv.inner = untag_ptr(channelmanager);
84000         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84001         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84002         channelmanager_conv.is_owned = false;
84003         void* node_signer_ptr = untag_ptr(node_signer);
84004         CHECK_ACCESS(node_signer_ptr);
84005         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84006         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84008                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84009         }
84010         void* logger_ptr = untag_ptr(logger);
84011         CHECK_ACCESS(logger_ptr);
84012         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84013         if (logger_conv.free == LDKLogger_JCalls_free) {
84014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84015                 LDKLogger_JCalls_cloned(&logger_conv);
84016         }
84017         LDKCurrency network_conv = LDKCurrency_from_cs(network);
84018         void* amt_msat_ptr = untag_ptr(amt_msat);
84019         CHECK_ACCESS(amt_msat_ptr);
84020         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84021         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84022         LDKSha256 description_hash_conv;
84023         description_hash_conv.inner = untag_ptr(description_hash);
84024         description_hash_conv.is_owned = ptr_is_owned(description_hash);
84025         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
84026         description_hash_conv = Sha256_clone(&description_hash_conv);
84027         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84028         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84029         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84030         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84031         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84032         *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);
84033         return tag_ptr(ret_conv, true);
84034 }
84035
84036 int64_t  CS_LDK_create_invoice_from_channelmanager_and_duration_since_epoch(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
84037         LDKChannelManager channelmanager_conv;
84038         channelmanager_conv.inner = untag_ptr(channelmanager);
84039         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84040         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84041         channelmanager_conv.is_owned = false;
84042         void* node_signer_ptr = untag_ptr(node_signer);
84043         CHECK_ACCESS(node_signer_ptr);
84044         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84045         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84046                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84047                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84048         }
84049         void* logger_ptr = untag_ptr(logger);
84050         CHECK_ACCESS(logger_ptr);
84051         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84052         if (logger_conv.free == LDKLogger_JCalls_free) {
84053                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84054                 LDKLogger_JCalls_cloned(&logger_conv);
84055         }
84056         LDKCurrency network_conv = LDKCurrency_from_cs(network);
84057         void* amt_msat_ptr = untag_ptr(amt_msat);
84058         CHECK_ACCESS(amt_msat_ptr);
84059         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84060         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84061         LDKStr description_conv = str_ref_to_owned_c(description);
84062         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84063         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84064         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84065         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84066         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84067         *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);
84068         return tag_ptr(ret_conv, true);
84069 }
84070
84071 int64_t  CS_LDK_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(int64_t channelmanager, int64_t node_signer, int64_t logger, int32_t 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) {
84072         LDKChannelManager channelmanager_conv;
84073         channelmanager_conv.inner = untag_ptr(channelmanager);
84074         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
84075         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
84076         channelmanager_conv.is_owned = false;
84077         void* node_signer_ptr = untag_ptr(node_signer);
84078         CHECK_ACCESS(node_signer_ptr);
84079         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
84080         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
84081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84082                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
84083         }
84084         void* logger_ptr = untag_ptr(logger);
84085         CHECK_ACCESS(logger_ptr);
84086         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84087         if (logger_conv.free == LDKLogger_JCalls_free) {
84088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84089                 LDKLogger_JCalls_cloned(&logger_conv);
84090         }
84091         LDKCurrency network_conv = LDKCurrency_from_cs(network);
84092         void* amt_msat_ptr = untag_ptr(amt_msat);
84093         CHECK_ACCESS(amt_msat_ptr);
84094         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
84095         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
84096         LDKStr description_conv = str_ref_to_owned_c(description);
84097         LDKThirtyTwoBytes payment_hash_ref;
84098         CHECK(payment_hash->arr_len == 32);
84099         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
84100         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
84101         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
84102         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
84103         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
84104         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
84105         *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);
84106         return tag_ptr(ret_conv, true);
84107 }
84108
84109 int64_t  CS_LDK_SiPrefix_from_str(jstring s) {
84110         LDKStr s_conv = str_ref_to_owned_c(s);
84111         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
84112         *ret_conv = SiPrefix_from_str(s_conv);
84113         return tag_ptr(ret_conv, true);
84114 }
84115
84116 int64_t  CS_LDK_Bolt11Invoice_from_str(jstring s) {
84117         LDKStr s_conv = str_ref_to_owned_c(s);
84118         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
84119         *ret_conv = Bolt11Invoice_from_str(s_conv);
84120         return tag_ptr(ret_conv, true);
84121 }
84122
84123 int64_t  CS_LDK_SignedRawBolt11Invoice_from_str(jstring s) {
84124         LDKStr s_conv = str_ref_to_owned_c(s);
84125         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
84126         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
84127         return tag_ptr(ret_conv, true);
84128 }
84129
84130 jstring  CS_LDK_Bolt11ParseError_to_str(int64_t o) {
84131         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
84132         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
84133         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84134         Str_free(ret_str);
84135         return ret_conv;
84136 }
84137
84138 jstring  CS_LDK_ParseOrSemanticError_to_str(int64_t o) {
84139         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
84140         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
84141         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84142         Str_free(ret_str);
84143         return ret_conv;
84144 }
84145
84146 jstring  CS_LDK_Bolt11Invoice_to_str(int64_t o) {
84147         LDKBolt11Invoice o_conv;
84148         o_conv.inner = untag_ptr(o);
84149         o_conv.is_owned = ptr_is_owned(o);
84150         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84151         o_conv.is_owned = false;
84152         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
84153         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84154         Str_free(ret_str);
84155         return ret_conv;
84156 }
84157
84158 jstring  CS_LDK_SignedRawBolt11Invoice_to_str(int64_t o) {
84159         LDKSignedRawBolt11Invoice o_conv;
84160         o_conv.inner = untag_ptr(o);
84161         o_conv.is_owned = ptr_is_owned(o);
84162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84163         o_conv.is_owned = false;
84164         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
84165         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84166         Str_free(ret_str);
84167         return ret_conv;
84168 }
84169
84170 jstring  CS_LDK_Currency_to_str(int64_t o) {
84171         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
84172         LDKStr ret_str = Currency_to_str(o_conv);
84173         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84174         Str_free(ret_str);
84175         return ret_conv;
84176 }
84177
84178 jstring  CS_LDK_SiPrefix_to_str(int64_t o) {
84179         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
84180         LDKStr ret_str = SiPrefix_to_str(o_conv);
84181         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
84182         Str_free(ret_str);
84183         return ret_conv;
84184 }
84185
84186 void  CS_LDK_GraphSyncError_free(int64_t this_ptr) {
84187         if (!ptr_is_owned(this_ptr)) return;
84188         void* this_ptr_ptr = untag_ptr(this_ptr);
84189         CHECK_ACCESS(this_ptr_ptr);
84190         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
84191         FREE(untag_ptr(this_ptr));
84192         GraphSyncError_free(this_ptr_conv);
84193 }
84194
84195 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
84196         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
84197         *ret_copy = GraphSyncError_clone(arg);
84198         int64_t ret_ref = tag_ptr(ret_copy, true);
84199         return ret_ref;
84200 }
84201 int64_t  CS_LDK_GraphSyncError_clone_ptr(int64_t arg) {
84202         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
84203         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
84204         return ret_conv;
84205 }
84206
84207 int64_t  CS_LDK_GraphSyncError_clone(int64_t orig) {
84208         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
84209         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
84210         *ret_copy = GraphSyncError_clone(orig_conv);
84211         int64_t ret_ref = tag_ptr(ret_copy, true);
84212         return ret_ref;
84213 }
84214
84215 int64_t  CS_LDK_GraphSyncError_decode_error(int64_t a) {
84216         void* a_ptr = untag_ptr(a);
84217         CHECK_ACCESS(a_ptr);
84218         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
84219         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
84220         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
84221         *ret_copy = GraphSyncError_decode_error(a_conv);
84222         int64_t ret_ref = tag_ptr(ret_copy, true);
84223         return ret_ref;
84224 }
84225
84226 int64_t  CS_LDK_GraphSyncError_lightning_error(int64_t a) {
84227         LDKLightningError a_conv;
84228         a_conv.inner = untag_ptr(a);
84229         a_conv.is_owned = ptr_is_owned(a);
84230         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84231         a_conv = LightningError_clone(&a_conv);
84232         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
84233         *ret_copy = GraphSyncError_lightning_error(a_conv);
84234         int64_t ret_ref = tag_ptr(ret_copy, true);
84235         return ret_ref;
84236 }
84237
84238 void  CS_LDK_RapidGossipSync_free(int64_t this_obj) {
84239         LDKRapidGossipSync this_obj_conv;
84240         this_obj_conv.inner = untag_ptr(this_obj);
84241         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84243         RapidGossipSync_free(this_obj_conv);
84244 }
84245
84246 int64_t  CS_LDK_RapidGossipSync_new(int64_t network_graph, int64_t logger) {
84247         LDKNetworkGraph network_graph_conv;
84248         network_graph_conv.inner = untag_ptr(network_graph);
84249         network_graph_conv.is_owned = ptr_is_owned(network_graph);
84250         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
84251         network_graph_conv.is_owned = false;
84252         void* logger_ptr = untag_ptr(logger);
84253         CHECK_ACCESS(logger_ptr);
84254         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
84255         if (logger_conv.free == LDKLogger_JCalls_free) {
84256                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
84257                 LDKLogger_JCalls_cloned(&logger_conv);
84258         }
84259         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
84260         int64_t ret_ref = 0;
84261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84263         return ret_ref;
84264 }
84265
84266 int64_t  CS_LDK_RapidGossipSync_sync_network_graph_with_file_path(int64_t this_arg, jstring sync_path) {
84267         LDKRapidGossipSync this_arg_conv;
84268         this_arg_conv.inner = untag_ptr(this_arg);
84269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84271         this_arg_conv.is_owned = false;
84272         LDKStr sync_path_conv = str_ref_to_owned_c(sync_path);
84273         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
84274         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
84275         return tag_ptr(ret_conv, true);
84276 }
84277
84278 int64_t  CS_LDK_RapidGossipSync_update_network_graph(int64_t this_arg, int8_tArray update_data) {
84279         LDKRapidGossipSync this_arg_conv;
84280         this_arg_conv.inner = untag_ptr(this_arg);
84281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84283         this_arg_conv.is_owned = false;
84284         LDKu8slice update_data_ref;
84285         update_data_ref.datalen = update_data->arr_len;
84286         update_data_ref.data = update_data->elems;
84287         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
84288         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
84289         FREE(update_data);
84290         return tag_ptr(ret_conv, true);
84291 }
84292
84293 int64_t  CS_LDK_RapidGossipSync_update_network_graph_no_std(int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
84294         LDKRapidGossipSync this_arg_conv;
84295         this_arg_conv.inner = untag_ptr(this_arg);
84296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84298         this_arg_conv.is_owned = false;
84299         LDKu8slice update_data_ref;
84300         update_data_ref.datalen = update_data->arr_len;
84301         update_data_ref.data = update_data->elems;
84302         void* current_time_unix_ptr = untag_ptr(current_time_unix);
84303         CHECK_ACCESS(current_time_unix_ptr);
84304         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
84305         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
84306         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
84307         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
84308         FREE(update_data);
84309         return tag_ptr(ret_conv, true);
84310 }
84311
84312 jboolean  CS_LDK_RapidGossipSync_is_initial_sync_complete(int64_t this_arg) {
84313         LDKRapidGossipSync this_arg_conv;
84314         this_arg_conv.inner = untag_ptr(this_arg);
84315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84317         this_arg_conv.is_owned = false;
84318         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
84319         return ret_conv;
84320 }
84321