[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / bindings.c.body
1
2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
3 #define int64_t jlong
4 #include <lightning.h>
5 #include <string.h>
6 #include <stdatomic.h>
7 #include <stdlib.h>
8
9 #define LIKELY(v) __builtin_expect(!!(v), 1)
10 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
11
12 #include <stdio.h>
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define do_MALLOC(a, _b, _c) malloc(a)
15 #define MALLOC(a, _) malloc(a)
16 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
17 #define CHECK_ACCESS(p)
18 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
19 #define DO_ASSERT(a) (void)(a)
20 #define CHECK(a)
21
22
23 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
24 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
25 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
26 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
27
28 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
29
30 // Int types across Windows/Linux are different, so make sure we're using the right headers.
31 _Static_assert(sizeof(void*) == sizeof(uintptr_t), "stdints must be correct");
32 _Static_assert(sizeof(void*) == sizeof(intptr_t), "stdints must be correct");
33 _Static_assert(sizeof(uint64_t) == 8, "stdints must be correct");
34 _Static_assert(sizeof(int64_t) == 8, "stdints must be correct");
35 _Static_assert(sizeof(uint32_t) == 4, "stdints must be correct");
36 _Static_assert(sizeof(int32_t) == 4, "stdints must be correct");
37 _Static_assert(sizeof(uint16_t) == 2, "stdints must be correct");
38 _Static_assert(sizeof(int16_t) == 2, "stdints must be correct");
39 _Static_assert(sizeof(uint8_t) == 1, "stdints must be correct");
40 _Static_assert(sizeof(int8_t) == 1, "stdints must be correct");
41
42 #define DECL_ARR_TYPE(ty, name) \
43         struct name##array { \
44                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
45                 ty elems[]; \
46         }; \
47         typedef struct name##array * name##Array; \
48         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
49                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
50                 arr->arr_len = arr_len; \
51                 return arr; \
52         }
53
54 DECL_ARR_TYPE(int64_t, int64_t);
55 DECL_ARR_TYPE(uint64_t, uint64_t);
56 DECL_ARR_TYPE(int8_t, int8_t);
57 DECL_ARR_TYPE(int16_t, int16_t);
58 DECL_ARR_TYPE(uint32_t, uint32_t);
59 DECL_ARR_TYPE(void*, ptr);
60 DECL_ARR_TYPE(char, char);
61 typedef charArray jstring;
62
63 static inline jstring str_ref_to_cs(const char* chars, size_t len) {
64         charArray arr = init_charArray(len, __LINE__);
65         memcpy(arr->elems, chars, len);
66         return arr;
67 }
68 static inline LDKStr str_ref_to_owned_c(const jstring str) {
69         char* newchars = MALLOC(str->arr_len + 1, "String chars");
70         memcpy(newchars, str->elems, str->arr_len);
71         newchars[str->arr_len] = 0;
72         LDKStr res = {
73                 .chars = newchars,
74                 .len = str->arr_len,
75                 .chars_is_owned = true
76         };
77         return res;
78 }
79
80 typedef bool jboolean;
81
82 int64_t CS_LDK_allocate_buffer(int64_t len) {
83         return (int64_t)MALLOC(len, "C#-requested buffer");
84 }
85
86 void CS_LDK_free_buffer(int64_t buf) {
87         FREE((void*)buf);
88 }
89
90 jstring CS_LDK_get_ldk_c_bindings_version() {
91         return str_ref_to_cs(check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
92 }
93 jstring CS_LDK_get_ldk_version() {
94         return str_ref_to_cs(check_get_ldk_version(), strlen(check_get_ldk_version()));
95 }
96 #include "version.c"
97
98 typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
99 static invoker_l_l js_invoke_function_l_l;
100 int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
101         js_invoke_function_l_l = invoker;
102         return 0;
103 }
104
105 typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
106 static invoker_l_ll js_invoke_function_l_ll;
107 int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
108         js_invoke_function_l_ll = invoker;
109         return 0;
110 }
111
112 typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
113 static invoker_l_ js_invoke_function_l_;
114 int CS_LDK_register_l__invoker(invoker_l_ invoker) {
115         js_invoke_function_l_ = invoker;
116         return 0;
117 }
118
119 typedef void (*invoker_void_l)(int obj_ptr, int fn_id, int64_t a);
120 static invoker_void_l js_invoke_function_void_l;
121 int CS_LDK_register_void_l_invoker(invoker_void_l invoker) {
122         js_invoke_function_void_l = invoker;
123         return 0;
124 }
125
126 typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
127 static invoker_l_lll js_invoke_function_l_lll;
128 int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
129         js_invoke_function_l_lll = invoker;
130         return 0;
131 }
132
133 typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
134 static invoker_l_llll js_invoke_function_l_llll;
135 int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
136         js_invoke_function_l_llll = invoker;
137         return 0;
138 }
139
140 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);
141 static invoker_l_lllll js_invoke_function_l_lllll;
142 int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
143         js_invoke_function_l_lllll = invoker;
144         return 0;
145 }
146
147 typedef void (*invoker_void_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
148 static invoker_void_lll js_invoke_function_void_lll;
149 int CS_LDK_register_void_lll_invoker(invoker_void_lll invoker) {
150         js_invoke_function_void_lll = invoker;
151         return 0;
152 }
153
154 typedef void (*invoker_void_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
155 static invoker_void_ll js_invoke_function_void_ll;
156 int CS_LDK_register_void_ll_invoker(invoker_void_ll invoker) {
157         js_invoke_function_void_ll = invoker;
158         return 0;
159 }
160
161 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
162 static invoker_ChannelMonitorUpdateStatus_ll js_invoke_function_ChannelMonitorUpdateStatus_ll;
163 int CS_LDK_register_ChannelMonitorUpdateStatus_ll_invoker(invoker_ChannelMonitorUpdateStatus_ll invoker) {
164         js_invoke_function_ChannelMonitorUpdateStatus_ll = invoker;
165         return 0;
166 }
167
168 typedef int64_t (*invoker_l_Recipient)(int obj_ptr, int fn_id, int32_t a);
169 static invoker_l_Recipient js_invoke_function_l_Recipient;
170 int CS_LDK_register_l_Recipient_invoker(invoker_l_Recipient invoker) {
171         js_invoke_function_l_Recipient = invoker;
172         return 0;
173 }
174
175 typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
176 static invoker_l_Recipientll js_invoke_function_l_Recipientll;
177 int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
178         js_invoke_function_l_Recipientll = invoker;
179         return 0;
180 }
181
182 typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
183 static invoker_l_llRecipient js_invoke_function_l_llRecipient;
184 int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
185         js_invoke_function_l_llRecipient = invoker;
186         return 0;
187 }
188
189 typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
190 static invoker_l_bll js_invoke_function_l_bll;
191 int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
192         js_invoke_function_l_bll = invoker;
193         return 0;
194 }
195
196 typedef int32_t (*invoker_i_ConfirmationTarget)(int obj_ptr, int fn_id, int32_t a);
197 static invoker_i_ConfirmationTarget js_invoke_function_i_ConfirmationTarget;
198 int CS_LDK_register_i_ConfirmationTarget_invoker(invoker_i_ConfirmationTarget invoker) {
199         js_invoke_function_i_ConfirmationTarget = invoker;
200         return 0;
201 }
202
203 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);
204 static invoker_l_llllll js_invoke_function_l_llllll;
205 int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
206         js_invoke_function_l_llllll = invoker;
207         return 0;
208 }
209
210 typedef int16_t (*invoker_s_)(int obj_ptr, int fn_id);
211 static invoker_s_ js_invoke_function_s_;
212 int CS_LDK_register_s__invoker(invoker_s_ invoker) {
213         js_invoke_function_s_ = invoker;
214         return 0;
215 }
216
217 typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
218 static invoker_l_lllb js_invoke_function_l_lllb;
219 int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
220         js_invoke_function_l_lllb = invoker;
221         return 0;
222 }
223
224 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
225 static invoker_ChannelMonitorUpdateStatus_lll js_invoke_function_ChannelMonitorUpdateStatus_lll;
226 int CS_LDK_register_ChannelMonitorUpdateStatus_lll_invoker(invoker_ChannelMonitorUpdateStatus_lll invoker) {
227         js_invoke_function_ChannelMonitorUpdateStatus_lll = invoker;
228         return 0;
229 }
230
231 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
232 static invoker_ChannelMonitorUpdateStatus_llll js_invoke_function_ChannelMonitorUpdateStatus_llll;
233 int CS_LDK_register_ChannelMonitorUpdateStatus_llll_invoker(invoker_ChannelMonitorUpdateStatus_llll invoker) {
234         js_invoke_function_ChannelMonitorUpdateStatus_llll = invoker;
235         return 0;
236 }
237
238 typedef void (*invoker_void_)(int obj_ptr, int fn_id);
239 static invoker_void_ js_invoke_function_void_;
240 int CS_LDK_register_void__invoker(invoker_void_ invoker) {
241         js_invoke_function_void_ = invoker;
242         return 0;
243 }
244
245 typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
246 static invoker_void_lli js_invoke_function_void_lli;
247 int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
248         js_invoke_function_void_lli = invoker;
249         return 0;
250 }
251
252 typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
253 static invoker_void_li js_invoke_function_void_li;
254 int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
255         js_invoke_function_void_li = invoker;
256         return 0;
257 }
258
259 typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
260 static invoker_l_llb js_invoke_function_l_llb;
261 int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
262         js_invoke_function_l_llb = invoker;
263         return 0;
264 }
265
266 typedef jboolean (*invoker_b_)(int obj_ptr, int fn_id);
267 static invoker_b_ js_invoke_function_b_;
268 int CS_LDK_register_b__invoker(invoker_b_ invoker) {
269         js_invoke_function_b_ = invoker;
270         return 0;
271 }
272
273 typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
274 static invoker_l_sl js_invoke_function_l_sl;
275 int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
276         js_invoke_function_l_sl = invoker;
277         return 0;
278 }
279
280 typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
281 static invoker_l_lb js_invoke_function_l_lb;
282 int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
283         js_invoke_function_l_lb = invoker;
284         return 0;
285 }
286
287 typedef jboolean (*invoker_b_l)(int obj_ptr, int fn_id, int64_t a);
288 static invoker_b_l js_invoke_function_b_l;
289 int CS_LDK_register_b_l_invoker(invoker_b_l invoker) {
290         js_invoke_function_b_l = invoker;
291         return 0;
292 }
293
294 typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
295 static invoker_l_llli js_invoke_function_l_llli;
296 int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
297         js_invoke_function_l_llli = invoker;
298         return 0;
299 }
300 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
301
302 static inline void* untag_ptr(uint64_t ptr) {
303         if (ptr < 4096) return (void*)ptr;
304         if (sizeof(void*) == 4) {
305                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
306                 return (void*)(uintptr_t)ptr;
307         } else {
308                 // For 64-bit systems, assume the top byte is used for tagging, then
309                 // use bit 9 ^ bit 10.
310                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
311                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
312 #ifdef LDK_DEBUG_BUILD
313                 // On debug builds we also use the 11th bit as a debug flag
314                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
315                 CHECK(tenth_bit != eleventh_bit);
316                 p ^= 1ULL << 53;
317 #endif
318                 return (void*)p;
319         }
320 }
321 static inline bool ptr_is_owned(uint64_t ptr) {
322         if(ptr < 4096) return true;
323         if (sizeof(void*) == 4) {
324                 return ptr & (1ULL << 32);
325         } else {
326                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
327                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
328 #ifdef LDK_DEBUG_BUILD
329                 // On debug builds we also use the 11th bit as a debug flag
330                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
331                 CHECK(tenth_bit != eleventh_bit);
332 #endif
333                 return (ninth_bit ^ tenth_bit) ? true : false;
334         }
335 }
336 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
337         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
338         if (sizeof(void*) == 4) {
339                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
340         } else {
341                 CHECK(sizeof(uintptr_t) == 8);
342                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
343                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
344 #ifdef LDK_DEBUG_BUILD
345                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
346                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
347                 CHECK(ninth_bit == tenth_bit);
348                 CHECK(ninth_bit == eleventh_bit);
349                 t ^= 1ULL << 53;
350 #endif
351                 CHECK(ptr_is_owned(t) == is_owned);
352                 CHECK(untag_ptr(t) == ptr);
353                 return t;
354         }
355 }
356
357 static inline LDKBlindedFailure LDKBlindedFailure_from_cs(int32_t ord) {
358         switch (ord) {
359                 case 0: return LDKBlindedFailure_FromIntroductionNode;
360                 case 1: return LDKBlindedFailure_FromBlindedNode;
361                 default: abort();
362         }
363 }
364 static inline int32_t LDKBlindedFailure_to_cs(LDKBlindedFailure val) {
365         switch (val) {
366                 case LDKBlindedFailure_FromIntroductionNode: return 0;
367                 case LDKBlindedFailure_FromBlindedNode: return 1;
368                 default: abort();
369         }
370 }
371 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_cs(int32_t ord) {
372         switch (ord) {
373                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
374                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
375                 case 2: return LDKBolt11SemanticError_NoDescription;
376                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
377                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
378                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
379                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
380                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
381                 case 8: return LDKBolt11SemanticError_InvalidSignature;
382                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
383                 default: abort();
384         }
385 }
386 static inline int32_t LDKBolt11SemanticError_to_cs(LDKBolt11SemanticError val) {
387         switch (val) {
388                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
389                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
390                 case LDKBolt11SemanticError_NoDescription: return 2;
391                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
392                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
393                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
394                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
395                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
396                 case LDKBolt11SemanticError_InvalidSignature: return 8;
397                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
398                 default: abort();
399         }
400 }
401 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_cs(int32_t ord) {
402         switch (ord) {
403                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
404                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
405                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
406                 case 3: return LDKBolt12SemanticError_MissingAmount;
407                 case 4: return LDKBolt12SemanticError_InvalidAmount;
408                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
409                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
410                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
411                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
412                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
413                 case 10: return LDKBolt12SemanticError_MissingDescription;
414                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
415                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
416                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
417                 case 14: return LDKBolt12SemanticError_MissingQuantity;
418                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
419                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
420                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
421                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
422                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
423                 case 20: return LDKBolt12SemanticError_MissingPayerId;
424                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
425                 case 22: return LDKBolt12SemanticError_MissingPaths;
426                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
427                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
428                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
429                 case 26: return LDKBolt12SemanticError_MissingSignature;
430                 default: abort();
431         }
432 }
433 static inline int32_t LDKBolt12SemanticError_to_cs(LDKBolt12SemanticError val) {
434         switch (val) {
435                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
436                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
437                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
438                 case LDKBolt12SemanticError_MissingAmount: return 3;
439                 case LDKBolt12SemanticError_InvalidAmount: return 4;
440                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
441                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
442                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
443                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
444                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
445                 case LDKBolt12SemanticError_MissingDescription: return 10;
446                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
447                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
448                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
449                 case LDKBolt12SemanticError_MissingQuantity: return 14;
450                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
451                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
452                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
453                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
454                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
455                 case LDKBolt12SemanticError_MissingPayerId: return 20;
456                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
457                 case LDKBolt12SemanticError_MissingPaths: return 22;
458                 case LDKBolt12SemanticError_InvalidPayInfo: return 23;
459                 case LDKBolt12SemanticError_MissingCreationTime: return 24;
460                 case LDKBolt12SemanticError_MissingPaymentHash: return 25;
461                 case LDKBolt12SemanticError_MissingSignature: return 26;
462                 default: abort();
463         }
464 }
465 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_cs(int32_t ord) {
466         switch (ord) {
467                 case 0: return LDKCOption_NoneZ_Some;
468                 case 1: return LDKCOption_NoneZ_None;
469                 default: abort();
470         }
471 }
472 static inline int32_t LDKCOption_NoneZ_to_cs(LDKCOption_NoneZ val) {
473         switch (val) {
474                 case LDKCOption_NoneZ_Some: return 0;
475                 case LDKCOption_NoneZ_None: return 1;
476                 default: abort();
477         }
478 }
479 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_cs(int32_t ord) {
480         switch (ord) {
481                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
482                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
483                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
484                 default: abort();
485         }
486 }
487 static inline int32_t LDKChannelMonitorUpdateStatus_to_cs(LDKChannelMonitorUpdateStatus val) {
488         switch (val) {
489                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
490                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
491                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
492                 default: abort();
493         }
494 }
495 static inline LDKChannelShutdownState LDKChannelShutdownState_from_cs(int32_t ord) {
496         switch (ord) {
497                 case 0: return LDKChannelShutdownState_NotShuttingDown;
498                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
499                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
500                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
501                 case 4: return LDKChannelShutdownState_ShutdownComplete;
502                 default: abort();
503         }
504 }
505 static inline int32_t LDKChannelShutdownState_to_cs(LDKChannelShutdownState val) {
506         switch (val) {
507                 case LDKChannelShutdownState_NotShuttingDown: return 0;
508                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
509                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
510                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
511                 case LDKChannelShutdownState_ShutdownComplete: return 4;
512                 default: abort();
513         }
514 }
515 static inline LDKConfirmationTarget LDKConfirmationTarget_from_cs(int32_t ord) {
516         switch (ord) {
517                 case 0: return LDKConfirmationTarget_OnChainSweep;
518                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
519                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
520                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
521                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
522                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
523                 default: abort();
524         }
525 }
526 static inline int32_t LDKConfirmationTarget_to_cs(LDKConfirmationTarget val) {
527         switch (val) {
528                 case LDKConfirmationTarget_OnChainSweep: return 0;
529                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
530                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
531                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
532                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
533                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
534                 default: abort();
535         }
536 }
537 static inline LDKCreationError LDKCreationError_from_cs(int32_t ord) {
538         switch (ord) {
539                 case 0: return LDKCreationError_DescriptionTooLong;
540                 case 1: return LDKCreationError_RouteTooLong;
541                 case 2: return LDKCreationError_TimestampOutOfBounds;
542                 case 3: return LDKCreationError_InvalidAmount;
543                 case 4: return LDKCreationError_MissingRouteHints;
544                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
545                 default: abort();
546         }
547 }
548 static inline int32_t LDKCreationError_to_cs(LDKCreationError val) {
549         switch (val) {
550                 case LDKCreationError_DescriptionTooLong: return 0;
551                 case LDKCreationError_RouteTooLong: return 1;
552                 case LDKCreationError_TimestampOutOfBounds: return 2;
553                 case LDKCreationError_InvalidAmount: return 3;
554                 case LDKCreationError_MissingRouteHints: return 4;
555                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
556                 default: abort();
557         }
558 }
559 static inline LDKCurrency LDKCurrency_from_cs(int32_t ord) {
560         switch (ord) {
561                 case 0: return LDKCurrency_Bitcoin;
562                 case 1: return LDKCurrency_BitcoinTestnet;
563                 case 2: return LDKCurrency_Regtest;
564                 case 3: return LDKCurrency_Simnet;
565                 case 4: return LDKCurrency_Signet;
566                 default: abort();
567         }
568 }
569 static inline int32_t LDKCurrency_to_cs(LDKCurrency val) {
570         switch (val) {
571                 case LDKCurrency_Bitcoin: return 0;
572                 case LDKCurrency_BitcoinTestnet: return 1;
573                 case LDKCurrency_Regtest: return 2;
574                 case LDKCurrency_Simnet: return 3;
575                 case LDKCurrency_Signet: return 4;
576                 default: abort();
577         }
578 }
579 static inline LDKHTLCClaim LDKHTLCClaim_from_cs(int32_t ord) {
580         switch (ord) {
581                 case 0: return LDKHTLCClaim_OfferedTimeout;
582                 case 1: return LDKHTLCClaim_OfferedPreimage;
583                 case 2: return LDKHTLCClaim_AcceptedTimeout;
584                 case 3: return LDKHTLCClaim_AcceptedPreimage;
585                 case 4: return LDKHTLCClaim_Revocation;
586                 default: abort();
587         }
588 }
589 static inline int32_t LDKHTLCClaim_to_cs(LDKHTLCClaim val) {
590         switch (val) {
591                 case LDKHTLCClaim_OfferedTimeout: return 0;
592                 case LDKHTLCClaim_OfferedPreimage: return 1;
593                 case LDKHTLCClaim_AcceptedTimeout: return 2;
594                 case LDKHTLCClaim_AcceptedPreimage: return 3;
595                 case LDKHTLCClaim_Revocation: return 4;
596                 default: abort();
597         }
598 }
599 static inline LDKIOError LDKIOError_from_cs(int32_t ord) {
600         switch (ord) {
601                 case 0: return LDKIOError_NotFound;
602                 case 1: return LDKIOError_PermissionDenied;
603                 case 2: return LDKIOError_ConnectionRefused;
604                 case 3: return LDKIOError_ConnectionReset;
605                 case 4: return LDKIOError_ConnectionAborted;
606                 case 5: return LDKIOError_NotConnected;
607                 case 6: return LDKIOError_AddrInUse;
608                 case 7: return LDKIOError_AddrNotAvailable;
609                 case 8: return LDKIOError_BrokenPipe;
610                 case 9: return LDKIOError_AlreadyExists;
611                 case 10: return LDKIOError_WouldBlock;
612                 case 11: return LDKIOError_InvalidInput;
613                 case 12: return LDKIOError_InvalidData;
614                 case 13: return LDKIOError_TimedOut;
615                 case 14: return LDKIOError_WriteZero;
616                 case 15: return LDKIOError_Interrupted;
617                 case 16: return LDKIOError_Other;
618                 case 17: return LDKIOError_UnexpectedEof;
619                 default: abort();
620         }
621 }
622 static inline int32_t LDKIOError_to_cs(LDKIOError val) {
623         switch (val) {
624                 case LDKIOError_NotFound: return 0;
625                 case LDKIOError_PermissionDenied: return 1;
626                 case LDKIOError_ConnectionRefused: return 2;
627                 case LDKIOError_ConnectionReset: return 3;
628                 case LDKIOError_ConnectionAborted: return 4;
629                 case LDKIOError_NotConnected: return 5;
630                 case LDKIOError_AddrInUse: return 6;
631                 case LDKIOError_AddrNotAvailable: return 7;
632                 case LDKIOError_BrokenPipe: return 8;
633                 case LDKIOError_AlreadyExists: return 9;
634                 case LDKIOError_WouldBlock: return 10;
635                 case LDKIOError_InvalidInput: return 11;
636                 case LDKIOError_InvalidData: return 12;
637                 case LDKIOError_TimedOut: return 13;
638                 case LDKIOError_WriteZero: return 14;
639                 case LDKIOError_Interrupted: return 15;
640                 case LDKIOError_Other: return 16;
641                 case LDKIOError_UnexpectedEof: return 17;
642                 default: abort();
643         }
644 }
645 static inline LDKLevel LDKLevel_from_cs(int32_t ord) {
646         switch (ord) {
647                 case 0: return LDKLevel_Gossip;
648                 case 1: return LDKLevel_Trace;
649                 case 2: return LDKLevel_Debug;
650                 case 3: return LDKLevel_Info;
651                 case 4: return LDKLevel_Warn;
652                 case 5: return LDKLevel_Error;
653                 default: abort();
654         }
655 }
656 static inline int32_t LDKLevel_to_cs(LDKLevel val) {
657         switch (val) {
658                 case LDKLevel_Gossip: return 0;
659                 case LDKLevel_Trace: return 1;
660                 case LDKLevel_Debug: return 2;
661                 case LDKLevel_Info: return 3;
662                 case LDKLevel_Warn: return 4;
663                 case LDKLevel_Error: return 5;
664                 default: abort();
665         }
666 }
667 static inline LDKNetwork LDKNetwork_from_cs(int32_t ord) {
668         switch (ord) {
669                 case 0: return LDKNetwork_Bitcoin;
670                 case 1: return LDKNetwork_Testnet;
671                 case 2: return LDKNetwork_Regtest;
672                 case 3: return LDKNetwork_Signet;
673                 default: abort();
674         }
675 }
676 static inline int32_t LDKNetwork_to_cs(LDKNetwork val) {
677         switch (val) {
678                 case LDKNetwork_Bitcoin: return 0;
679                 case LDKNetwork_Testnet: return 1;
680                 case LDKNetwork_Regtest: return 2;
681                 case LDKNetwork_Signet: return 3;
682                 default: abort();
683         }
684 }
685 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_cs(int32_t ord) {
686         switch (ord) {
687                 case 0: return LDKPaymentFailureReason_RecipientRejected;
688                 case 1: return LDKPaymentFailureReason_UserAbandoned;
689                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
690                 case 3: return LDKPaymentFailureReason_PaymentExpired;
691                 case 4: return LDKPaymentFailureReason_RouteNotFound;
692                 case 5: return LDKPaymentFailureReason_UnexpectedError;
693                 default: abort();
694         }
695 }
696 static inline int32_t LDKPaymentFailureReason_to_cs(LDKPaymentFailureReason val) {
697         switch (val) {
698                 case LDKPaymentFailureReason_RecipientRejected: return 0;
699                 case LDKPaymentFailureReason_UserAbandoned: return 1;
700                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
701                 case LDKPaymentFailureReason_PaymentExpired: return 3;
702                 case LDKPaymentFailureReason_RouteNotFound: return 4;
703                 case LDKPaymentFailureReason_UnexpectedError: return 5;
704                 default: abort();
705         }
706 }
707 static inline LDKRecipient LDKRecipient_from_cs(int32_t ord) {
708         switch (ord) {
709                 case 0: return LDKRecipient_Node;
710                 case 1: return LDKRecipient_PhantomNode;
711                 default: abort();
712         }
713 }
714 static inline int32_t LDKRecipient_to_cs(LDKRecipient val) {
715         switch (val) {
716                 case LDKRecipient_Node: return 0;
717                 case LDKRecipient_PhantomNode: return 1;
718                 default: abort();
719         }
720 }
721 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_cs(int32_t ord) {
722         switch (ord) {
723                 case 0: return LDKRetryableSendFailure_PaymentExpired;
724                 case 1: return LDKRetryableSendFailure_RouteNotFound;
725                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
726                 default: abort();
727         }
728 }
729 static inline int32_t LDKRetryableSendFailure_to_cs(LDKRetryableSendFailure val) {
730         switch (val) {
731                 case LDKRetryableSendFailure_PaymentExpired: return 0;
732                 case LDKRetryableSendFailure_RouteNotFound: return 1;
733                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
734                 default: abort();
735         }
736 }
737 static inline LDKSecp256k1Error LDKSecp256k1Error_from_cs(int32_t ord) {
738         switch (ord) {
739                 case 0: return LDKSecp256k1Error_IncorrectSignature;
740                 case 1: return LDKSecp256k1Error_InvalidMessage;
741                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
742                 case 3: return LDKSecp256k1Error_InvalidSignature;
743                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
744                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
745                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
746                 case 7: return LDKSecp256k1Error_InvalidTweak;
747                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
748                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
749                 case 10: return LDKSecp256k1Error_InvalidParityValue;
750                 default: abort();
751         }
752 }
753 static inline int32_t LDKSecp256k1Error_to_cs(LDKSecp256k1Error val) {
754         switch (val) {
755                 case LDKSecp256k1Error_IncorrectSignature: return 0;
756                 case LDKSecp256k1Error_InvalidMessage: return 1;
757                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
758                 case LDKSecp256k1Error_InvalidSignature: return 3;
759                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
760                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
761                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
762                 case LDKSecp256k1Error_InvalidTweak: return 7;
763                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
764                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
765                 case LDKSecp256k1Error_InvalidParityValue: return 10;
766                 default: abort();
767         }
768 }
769 static inline LDKSiPrefix LDKSiPrefix_from_cs(int32_t ord) {
770         switch (ord) {
771                 case 0: return LDKSiPrefix_Milli;
772                 case 1: return LDKSiPrefix_Micro;
773                 case 2: return LDKSiPrefix_Nano;
774                 case 3: return LDKSiPrefix_Pico;
775                 default: abort();
776         }
777 }
778 static inline int32_t LDKSiPrefix_to_cs(LDKSiPrefix val) {
779         switch (val) {
780                 case LDKSiPrefix_Milli: return 0;
781                 case LDKSiPrefix_Micro: return 1;
782                 case LDKSiPrefix_Nano: return 2;
783                 case LDKSiPrefix_Pico: return 3;
784                 default: abort();
785         }
786 }
787 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_cs(int32_t ord) {
788         switch (ord) {
789                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
790                 case 1: return LDKSocketAddressParseError_InvalidInput;
791                 case 2: return LDKSocketAddressParseError_InvalidPort;
792                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
793                 default: abort();
794         }
795 }
796 static inline int32_t LDKSocketAddressParseError_to_cs(LDKSocketAddressParseError val) {
797         switch (val) {
798                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
799                 case LDKSocketAddressParseError_InvalidInput: return 1;
800                 case LDKSocketAddressParseError_InvalidPort: return 2;
801                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
802                 default: abort();
803         }
804 }
805 static inline LDKUtxoLookupError LDKUtxoLookupError_from_cs(int32_t ord) {
806         switch (ord) {
807                 case 0: return LDKUtxoLookupError_UnknownChain;
808                 case 1: return LDKUtxoLookupError_UnknownTx;
809                 default: abort();
810         }
811 }
812 static inline int32_t LDKUtxoLookupError_to_cs(LDKUtxoLookupError val) {
813         switch (val) {
814                 case LDKUtxoLookupError_UnknownChain: return 0;
815                 case LDKUtxoLookupError_UnknownTx: return 1;
816                 default: abort();
817         }
818 }
819 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
820         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
821         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
822         return ret;
823 }
824 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
825         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
826         return ret;
827 }
828 int8_tArray  CS_LDK_BigEndianScalar_get_bytes(int64_t thing) {
829         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
830         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
831         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
832         return ret_arr;
833 }
834
835 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
836 void  CS_LDK_BigEndianScalar_free(int64_t thing) {
837         if (!ptr_is_owned(thing)) return;
838         void* thing_ptr = untag_ptr(thing);
839         CHECK_ACCESS(thing_ptr);
840         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
841         FREE(untag_ptr(thing));
842         BigEndianScalar_free(thing_conv);
843 }
844
845 uint32_t CS_LDK_LDKBech32Error_ty_from_ptr(int64_t ptr) {
846         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
847         switch(obj->tag) {
848                 case LDKBech32Error_MissingSeparator: return 0;
849                 case LDKBech32Error_InvalidChecksum: return 1;
850                 case LDKBech32Error_InvalidLength: return 2;
851                 case LDKBech32Error_InvalidChar: return 3;
852                 case LDKBech32Error_InvalidData: return 4;
853                 case LDKBech32Error_InvalidPadding: return 5;
854                 case LDKBech32Error_MixedCase: return 6;
855                 default: abort();
856         }
857 }
858 int32_t CS_LDK_LDKBech32Error_InvalidChar_get_invalid_char(int64_t ptr) {
859         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
860         CHECK(obj->tag == LDKBech32Error_InvalidChar);
861         int32_t invalid_char_conv = obj->invalid_char;
862         return invalid_char_conv;
863 }
864 int8_t CS_LDK_LDKBech32Error_InvalidData_get_invalid_data(int64_t ptr) {
865         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
866         CHECK(obj->tag == LDKBech32Error_InvalidData);
867         int8_t invalid_data_conv = obj->invalid_data;
868         return invalid_data_conv;
869 }
870 uint32_t CS_LDK_LDKCOption_u64Z_ty_from_ptr(int64_t ptr) {
871         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
872         switch(obj->tag) {
873                 case LDKCOption_u64Z_Some: return 0;
874                 case LDKCOption_u64Z_None: return 1;
875                 default: abort();
876         }
877 }
878 int64_t CS_LDK_LDKCOption_u64Z_Some_get_some(int64_t ptr) {
879         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
880         CHECK(obj->tag == LDKCOption_u64Z_Some);
881         int64_t some_conv = obj->some;
882         return some_conv;
883 }
884 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
885         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
886         for (size_t i = 0; i < ret.datalen; i++) {
887                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
888         }
889         return ret;
890 }
891 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
892         LDKRefund ret = *owner->contents.result;
893         ret.is_owned = false;
894         return ret;
895 }
896 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_ok(int64_t owner) {
897         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
898         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
899         int64_t ret_ref = 0;
900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
902         return ret_ref;
903 }
904
905 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
906         LDKBolt12ParseError ret = *owner->contents.err;
907         ret.is_owned = false;
908         return ret;
909 }
910 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_err(int64_t owner) {
911         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
912         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
913         int64_t ret_ref = 0;
914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
916         return ret_ref;
917 }
918
919 uint32_t CS_LDK_LDKRetry_ty_from_ptr(int64_t ptr) {
920         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
921         switch(obj->tag) {
922                 case LDKRetry_Attempts: return 0;
923                 case LDKRetry_Timeout: return 1;
924                 default: abort();
925         }
926 }
927 int32_t CS_LDK_LDKRetry_Attempts_get_attempts(int64_t ptr) {
928         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
929         CHECK(obj->tag == LDKRetry_Attempts);
930         int32_t attempts_conv = obj->attempts;
931         return attempts_conv;
932 }
933 int64_t CS_LDK_LDKRetry_Timeout_get_timeout(int64_t ptr) {
934         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
935         CHECK(obj->tag == LDKRetry_Timeout);
936         int64_t timeout_conv = obj->timeout;
937         return timeout_conv;
938 }
939 uint32_t CS_LDK_LDKDecodeError_ty_from_ptr(int64_t ptr) {
940         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
941         switch(obj->tag) {
942                 case LDKDecodeError_UnknownVersion: return 0;
943                 case LDKDecodeError_UnknownRequiredFeature: return 1;
944                 case LDKDecodeError_InvalidValue: return 2;
945                 case LDKDecodeError_ShortRead: return 3;
946                 case LDKDecodeError_BadLengthDescriptor: return 4;
947                 case LDKDecodeError_Io: return 5;
948                 case LDKDecodeError_UnsupportedCompression: return 6;
949                 default: abort();
950         }
951 }
952 int32_t CS_LDK_LDKDecodeError_Io_get_io(int64_t ptr) {
953         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
954         CHECK(obj->tag == LDKDecodeError_Io);
955         int32_t io_conv = LDKIOError_to_cs(obj->io);
956         return io_conv;
957 }
958 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
959 CHECK(owner->result_ok);
960         return Retry_clone(&*owner->contents.result);
961 }
962 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_ok(int64_t owner) {
963         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
964         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
965         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
966         int64_t ret_ref = tag_ptr(ret_copy, true);
967         return ret_ref;
968 }
969
970 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
971 CHECK(!owner->result_ok);
972         return DecodeError_clone(&*owner->contents.err);
973 }
974 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_err(int64_t owner) {
975         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
976         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
977         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
978         int64_t ret_ref = tag_ptr(ret_copy, true);
979         return ret_ref;
980 }
981
982 uint32_t CS_LDK_LDKAPIError_ty_from_ptr(int64_t ptr) {
983         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
984         switch(obj->tag) {
985                 case LDKAPIError_APIMisuseError: return 0;
986                 case LDKAPIError_FeeRateTooHigh: return 1;
987                 case LDKAPIError_InvalidRoute: return 2;
988                 case LDKAPIError_ChannelUnavailable: return 3;
989                 case LDKAPIError_MonitorUpdateInProgress: return 4;
990                 case LDKAPIError_IncompatibleShutdownScript: return 5;
991                 default: abort();
992         }
993 }
994 jstring CS_LDK_LDKAPIError_APIMisuseError_get_err(int64_t ptr) {
995         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
996         CHECK(obj->tag == LDKAPIError_APIMisuseError);
997         LDKStr err_str = obj->api_misuse_error.err;
998                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
999         return err_conv;
1000 }
1001 jstring CS_LDK_LDKAPIError_FeeRateTooHigh_get_err(int64_t ptr) {
1002         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1003         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1004         LDKStr err_str = obj->fee_rate_too_high.err;
1005                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1006         return err_conv;
1007 }
1008 int32_t CS_LDK_LDKAPIError_FeeRateTooHigh_get_feerate(int64_t ptr) {
1009         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1010         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1011         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1012         return feerate_conv;
1013 }
1014 jstring CS_LDK_LDKAPIError_InvalidRoute_get_err(int64_t ptr) {
1015         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1016         CHECK(obj->tag == LDKAPIError_InvalidRoute);
1017         LDKStr err_str = obj->invalid_route.err;
1018                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1019         return err_conv;
1020 }
1021 jstring CS_LDK_LDKAPIError_ChannelUnavailable_get_err(int64_t ptr) {
1022         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1023         CHECK(obj->tag == LDKAPIError_ChannelUnavailable);
1024         LDKStr err_str = obj->channel_unavailable.err;
1025                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1026         return err_conv;
1027 }
1028 int64_t CS_LDK_LDKAPIError_IncompatibleShutdownScript_get_script(int64_t ptr) {
1029         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1030         CHECK(obj->tag == LDKAPIError_IncompatibleShutdownScript);
1031         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1032                         int64_t script_ref = 0;
1033                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1034                         script_ref = tag_ptr(script_var.inner, false);
1035         return script_ref;
1036 }
1037 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1038 CHECK(owner->result_ok);
1039         return *owner->contents.result;
1040 }
1041 void  CS_LDK_CResult_NoneAPIErrorZ_get_ok(int64_t owner) {
1042         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1043         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1044 }
1045
1046 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1047 CHECK(!owner->result_ok);
1048         return APIError_clone(&*owner->contents.err);
1049 }
1050 int64_t  CS_LDK_CResult_NoneAPIErrorZ_get_err(int64_t owner) {
1051         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1052         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1053         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1054         int64_t ret_ref = tag_ptr(ret_copy, true);
1055         return ret_ref;
1056 }
1057
1058 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1059         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1060         for (size_t i = 0; i < ret.datalen; i++) {
1061                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1062         }
1063         return ret;
1064 }
1065 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1066         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1067         for (size_t i = 0; i < ret.datalen; i++) {
1068                 ret.data[i] = APIError_clone(&orig->data[i]);
1069         }
1070         return ret;
1071 }
1072 uint32_t CS_LDK_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(int64_t ptr) {
1073         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1074         switch(obj->tag) {
1075                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
1076                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
1077                 default: abort();
1078         }
1079 }
1080 int8_tArray CS_LDK_LDKCOption_ThirtyTwoBytesZ_Some_get_some(int64_t ptr) {
1081         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1082         CHECK(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
1083         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1084         memcpy(some_arr->elems, obj->some.data, 32);
1085         return some_arr;
1086 }
1087 uint32_t CS_LDK_LDKCOption_CVec_u8ZZ_ty_from_ptr(int64_t ptr) {
1088         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1089         switch(obj->tag) {
1090                 case LDKCOption_CVec_u8ZZ_Some: return 0;
1091                 case LDKCOption_CVec_u8ZZ_None: return 1;
1092                 default: abort();
1093         }
1094 }
1095 int8_tArray CS_LDK_LDKCOption_CVec_u8ZZ_Some_get_some(int64_t ptr) {
1096         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1097         CHECK(obj->tag == LDKCOption_CVec_u8ZZ_Some);
1098         LDKCVec_u8Z some_var = obj->some;
1099                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
1100                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
1101         return some_arr;
1102 }
1103 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1104         LDKRecipientOnionFields ret = *owner->contents.result;
1105         ret.is_owned = false;
1106         return ret;
1107 }
1108 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(int64_t owner) {
1109         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1110         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1111         int64_t ret_ref = 0;
1112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1114         return ret_ref;
1115 }
1116
1117 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1118 CHECK(!owner->result_ok);
1119         return DecodeError_clone(&*owner->contents.err);
1120 }
1121 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(int64_t owner) {
1122         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1124         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1125         int64_t ret_ref = tag_ptr(ret_copy, true);
1126         return ret_ref;
1127 }
1128
1129 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1130         return owner->a;
1131 }
1132 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_a(int64_t owner) {
1133         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1134         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1135         return ret_conv;
1136 }
1137
1138 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1139         return CVec_u8Z_clone(&owner->b);
1140 }
1141 int8_tArray  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_b(int64_t owner) {
1142         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1143         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1146         CVec_u8Z_free(ret_var);
1147         return ret_arr;
1148 }
1149
1150 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1151         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1152         for (size_t i = 0; i < ret.datalen; i++) {
1153                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1154         }
1155         return ret;
1156 }
1157 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1158         LDKRecipientOnionFields ret = *owner->contents.result;
1159         ret.is_owned = false;
1160         return ret;
1161 }
1162 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_ok(int64_t owner) {
1163         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1164         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1165         int64_t ret_ref = 0;
1166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1168         return ret_ref;
1169 }
1170
1171 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1172 CHECK(!owner->result_ok);
1173         return *owner->contents.err;
1174 }
1175 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_err(int64_t owner) {
1176         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1177         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1178 }
1179
1180 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1181         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1182         for (size_t i = 0; i < ret.datalen; i++) {
1183                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1184         }
1185         return ret;
1186 }
1187 uint32_t CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(int64_t ptr) {
1188         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1189         switch(obj->tag) {
1190                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1191                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1192                 default: abort();
1193         }
1194 }
1195 ptrArray CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(int64_t ptr) {
1196         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1197         CHECK(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1198         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1199                         ptrArray some_arr = NULL;
1200                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1201                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1202                         for (size_t i = 0; i < some_var.datalen; i++) {
1203                                 int8_tArray some_conv_8_arr = init_int8_tArray(32, __LINE__);
1204                                 memcpy(some_conv_8_arr->elems, some_var.data[i].data, 32);
1205                                 some_arr_ptr[i] = some_conv_8_arr;
1206                         }
1207                         
1208         return some_arr;
1209 }
1210 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1211 CHECK(owner->result_ok);
1212         return ThirtyTwoBytes_clone(&*owner->contents.result);
1213 }
1214 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_ok(int64_t owner) {
1215         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1216         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1217         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1218         return ret_arr;
1219 }
1220
1221 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1222 CHECK(!owner->result_ok);
1223         return *owner->contents.err;
1224 }
1225 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_err(int64_t owner) {
1226         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1227         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1228 }
1229
1230 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1231         LDKBlindedPayInfo ret = *owner->contents.result;
1232         ret.is_owned = false;
1233         return ret;
1234 }
1235 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_ok(int64_t owner) {
1236         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1237         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1238         int64_t ret_ref = 0;
1239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1241         return ret_ref;
1242 }
1243
1244 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1245 CHECK(!owner->result_ok);
1246         return DecodeError_clone(&*owner->contents.err);
1247 }
1248 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_err(int64_t owner) {
1249         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1251         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1252         int64_t ret_ref = tag_ptr(ret_copy, true);
1253         return ret_ref;
1254 }
1255
1256 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1257         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1258         ret.is_owned = false;
1259         return ret;
1260 }
1261 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1262         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1263         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1264         int64_t ret_ref = 0;
1265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1267         return ret_ref;
1268 }
1269
1270 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1271 CHECK(!owner->result_ok);
1272         return DecodeError_clone(&*owner->contents.err);
1273 }
1274 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1275         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1277         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1278         int64_t ret_ref = tag_ptr(ret_copy, true);
1279         return ret_ref;
1280 }
1281
1282 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1283         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1284         ret.is_owned = false;
1285         return ret;
1286 }
1287 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1288         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1289         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1290         int64_t ret_ref = 0;
1291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1293         return ret_ref;
1294 }
1295
1296 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1297 CHECK(!owner->result_ok);
1298         return DecodeError_clone(&*owner->contents.err);
1299 }
1300 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1301         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1302         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1303         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1304         int64_t ret_ref = tag_ptr(ret_copy, true);
1305         return ret_ref;
1306 }
1307
1308 uint32_t CS_LDK_LDKSpendableOutputDescriptor_ty_from_ptr(int64_t ptr) {
1309         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1310         switch(obj->tag) {
1311                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1312                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1313                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1314                 default: abort();
1315         }
1316 }
1317 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(int64_t ptr) {
1318         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1319         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1320         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1321                         int64_t outpoint_ref = 0;
1322                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1323                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1324         return outpoint_ref;
1325 }
1326 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_output(int64_t ptr) {
1327         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1328         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1329         LDKTxOut* output_ref = &obj->static_output.output;
1330         return tag_ptr(output_ref, false);
1331 }
1332 int8_tArray CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(int64_t ptr) {
1333         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1334         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1335         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1336         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1337         return channel_keys_id_arr;
1338 }
1339 int64_t CS_LDK_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(int64_t ptr) {
1340         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1341         CHECK(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1342         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1343                         int64_t delayed_payment_output_ref = 0;
1344                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1345                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1346         return delayed_payment_output_ref;
1347 }
1348 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(int64_t ptr) {
1349         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1350         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1351         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1352                         int64_t static_payment_output_ref = 0;
1353                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1354                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1355         return static_payment_output_ref;
1356 }
1357 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1358 CHECK(owner->result_ok);
1359         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1360 }
1361 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1362         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1363         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1364         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1365         int64_t ret_ref = tag_ptr(ret_copy, true);
1366         return ret_ref;
1367 }
1368
1369 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1370 CHECK(!owner->result_ok);
1371         return DecodeError_clone(&*owner->contents.err);
1372 }
1373 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1374         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1376         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1377         int64_t ret_ref = tag_ptr(ret_copy, true);
1378         return ret_ref;
1379 }
1380
1381 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1382         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1383         for (size_t i = 0; i < ret.datalen; i++) {
1384                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1385         }
1386         return ret;
1387 }
1388 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1389         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1390         for (size_t i = 0; i < ret.datalen; i++) {
1391                 ret.data[i] = TxOut_clone(&orig->data[i]);
1392         }
1393         return ret;
1394 }
1395 uint32_t CS_LDK_LDKCOption_u32Z_ty_from_ptr(int64_t ptr) {
1396         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1397         switch(obj->tag) {
1398                 case LDKCOption_u32Z_Some: return 0;
1399                 case LDKCOption_u32Z_None: return 1;
1400                 default: abort();
1401         }
1402 }
1403 int32_t CS_LDK_LDKCOption_u32Z_Some_get_some(int64_t ptr) {
1404         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1405         CHECK(obj->tag == LDKCOption_u32Z_Some);
1406         int32_t some_conv = obj->some;
1407         return some_conv;
1408 }
1409 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1410         return CVec_u8Z_clone(&owner->a);
1411 }
1412 int8_tArray  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_a(int64_t owner) {
1413         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1414         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1415         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1416         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1417         CVec_u8Z_free(ret_var);
1418         return ret_arr;
1419 }
1420
1421 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1422         return owner->b;
1423 }
1424 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_b(int64_t owner) {
1425         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1426         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1427         return ret_conv;
1428 }
1429
1430 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1431 CHECK(owner->result_ok);
1432         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1433 }
1434 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(int64_t owner) {
1435         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1436         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1437         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1438         return tag_ptr(ret_conv, true);
1439 }
1440
1441 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1442 CHECK(!owner->result_ok);
1443         return *owner->contents.err;
1444 }
1445 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(int64_t owner) {
1446         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1447         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1448 }
1449
1450 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1451         LDKChannelDerivationParameters ret = *owner->contents.result;
1452         ret.is_owned = false;
1453         return ret;
1454 }
1455 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(int64_t owner) {
1456         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1457         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1458         int64_t ret_ref = 0;
1459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1461         return ret_ref;
1462 }
1463
1464 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1465 CHECK(!owner->result_ok);
1466         return DecodeError_clone(&*owner->contents.err);
1467 }
1468 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(int64_t owner) {
1469         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1471         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1472         int64_t ret_ref = tag_ptr(ret_copy, true);
1473         return ret_ref;
1474 }
1475
1476 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1477         LDKHTLCDescriptor ret = *owner->contents.result;
1478         ret.is_owned = false;
1479         return ret;
1480 }
1481 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1482         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1483         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1484         int64_t ret_ref = 0;
1485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1487         return ret_ref;
1488 }
1489
1490 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1491 CHECK(!owner->result_ok);
1492         return DecodeError_clone(&*owner->contents.err);
1493 }
1494 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_err(int64_t owner) {
1495         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1497         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1498         int64_t ret_ref = tag_ptr(ret_copy, true);
1499         return ret_ref;
1500 }
1501
1502 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1503 CHECK(owner->result_ok);
1504         return *owner->contents.result;
1505 }
1506 void  CS_LDK_CResult_NoneNoneZ_get_ok(int64_t owner) {
1507         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1508         CResult_NoneNoneZ_get_ok(owner_conv);
1509 }
1510
1511 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1512 CHECK(!owner->result_ok);
1513         return *owner->contents.err;
1514 }
1515 void  CS_LDK_CResult_NoneNoneZ_get_err(int64_t owner) {
1516         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1517         CResult_NoneNoneZ_get_err(owner_conv);
1518 }
1519
1520 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1521 CHECK(owner->result_ok);
1522         return *owner->contents.result;
1523 }
1524 int8_tArray  CS_LDK_CResult_PublicKeyNoneZ_get_ok(int64_t owner) {
1525         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1526         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1527         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1528         return ret_arr;
1529 }
1530
1531 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1532 CHECK(!owner->result_ok);
1533         return *owner->contents.err;
1534 }
1535 void  CS_LDK_CResult_PublicKeyNoneZ_get_err(int64_t owner) {
1536         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1537         CResult_PublicKeyNoneZ_get_err(owner_conv);
1538 }
1539
1540 uint32_t CS_LDK_LDKCOption_BigEndianScalarZ_ty_from_ptr(int64_t ptr) {
1541         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1542         switch(obj->tag) {
1543                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1544                 case LDKCOption_BigEndianScalarZ_None: return 1;
1545                 default: abort();
1546         }
1547 }
1548 int64_t CS_LDK_LDKCOption_BigEndianScalarZ_Some_get_some(int64_t ptr) {
1549         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1550         CHECK(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1551         LDKBigEndianScalar* some_ref = &obj->some;
1552         return tag_ptr(some_ref, false);
1553 }
1554 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1555 CHECK(owner->result_ok);
1556         return *owner->contents.result;
1557 }
1558 int8_tArray  CS_LDK_CResult_RecoverableSignatureNoneZ_get_ok(int64_t owner) {
1559         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1560         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1561         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1562         return ret_arr;
1563 }
1564
1565 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1566 CHECK(!owner->result_ok);
1567         return *owner->contents.err;
1568 }
1569 void  CS_LDK_CResult_RecoverableSignatureNoneZ_get_err(int64_t owner) {
1570         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1571         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1572 }
1573
1574 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1575 CHECK(owner->result_ok);
1576         return *owner->contents.result;
1577 }
1578 int8_tArray  CS_LDK_CResult_SchnorrSignatureNoneZ_get_ok(int64_t owner) {
1579         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1580         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1581         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1582         return ret_arr;
1583 }
1584
1585 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1586 CHECK(!owner->result_ok);
1587         return *owner->contents.err;
1588 }
1589 void  CS_LDK_CResult_SchnorrSignatureNoneZ_get_err(int64_t owner) {
1590         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1591         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1592 }
1593
1594 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1595 CHECK(owner->result_ok);
1596         return *owner->contents.result;
1597 }
1598 int8_tArray  CS_LDK_CResult_ECDSASignatureNoneZ_get_ok(int64_t owner) {
1599         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1600         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1601         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1602         return ret_arr;
1603 }
1604
1605 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1606 CHECK(!owner->result_ok);
1607         return *owner->contents.err;
1608 }
1609 void  CS_LDK_CResult_ECDSASignatureNoneZ_get_err(int64_t owner) {
1610         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1611         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1612 }
1613
1614 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1615         return owner->a;
1616 }
1617 int8_tArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(int64_t owner) {
1618         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1619         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1620         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1621         return ret_arr;
1622 }
1623
1624 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1625         return owner->b;
1626 }
1627 ptrArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(int64_t owner) {
1628         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1629         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1630         ptrArray ret_arr = NULL;
1631         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1632         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1633         for (size_t i = 0; i < ret_var.datalen; i++) {
1634                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
1635                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
1636                 ret_arr_ptr[i] = ret_conv_8_arr;
1637         }
1638         
1639         return ret_arr;
1640 }
1641
1642 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1643 CHECK(owner->result_ok);
1644         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1645 }
1646 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(int64_t owner) {
1647         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1648         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1649         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1650         return tag_ptr(ret_conv, true);
1651 }
1652
1653 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1654 CHECK(!owner->result_ok);
1655         return *owner->contents.err;
1656 }
1657 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(int64_t owner) {
1658         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1659         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1660 }
1661
1662 typedef struct LDKChannelSigner_JCalls {
1663         atomic_size_t refcnt;
1664         uint32_t instance_ptr;
1665 } LDKChannelSigner_JCalls;
1666 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1667         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1668         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1669                 FREE(j_calls);
1670         }
1671 }
1672 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1673         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1674         int64_t idx_conv = idx;
1675         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 0, idx_conv);
1676         LDKPublicKey ret_ref;
1677         CHECK(ret->arr_len == 33);
1678         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1679         return ret_ref;
1680 }
1681 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1682         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1683         int64_t idx_conv = idx;
1684         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 1, idx_conv);
1685         LDKThirtyTwoBytes ret_ref;
1686         CHECK(ret->arr_len == 32);
1687         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1688         return ret_ref;
1689 }
1690 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1691         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1692         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1693         int64_t holder_tx_ref = 0;
1694         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1695         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1696         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1697         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1698         ptrArray outbound_htlc_preimages_arr = NULL;
1699         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1700         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1701         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1702                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1703                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1704                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1705         }
1706         
1707         FREE(outbound_htlc_preimages_var.data);
1708         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 2, holder_tx_ref, (int64_t)outbound_htlc_preimages_arr);
1709         void* ret_ptr = untag_ptr(ret);
1710         CHECK_ACCESS(ret_ptr);
1711         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1712         FREE(untag_ptr(ret));
1713         return ret_conv;
1714 }
1715 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1716         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1717         int64_t idx_conv = idx;
1718         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1719         memcpy(secret_arr->elems, *secret, 32);
1720         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 3, idx_conv, (int64_t)secret_arr);
1721         void* ret_ptr = untag_ptr(ret);
1722         CHECK_ACCESS(ret_ptr);
1723         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1724         FREE(untag_ptr(ret));
1725         return ret_conv;
1726 }
1727 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1728         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1729         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 4);
1730         LDKThirtyTwoBytes ret_ref;
1731         CHECK(ret->arr_len == 32);
1732         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1733         return ret_ref;
1734 }
1735 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1736         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1737         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1738         int64_t channel_parameters_ref = 0;
1739         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1740         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1741         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1742         js_invoke_function_void_l(j_calls->instance_ptr, 5, channel_parameters_ref);
1743 }
1744 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1745         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1746         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1747 }
1748 static inline LDKChannelSigner LDKChannelSigner_init (int64_t o, int64_t pubkeys) {
1749         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1750         atomic_init(&calls->refcnt, 1);
1751         calls->instance_ptr = o;
1752
1753         LDKChannelPublicKeys pubkeys_conv;
1754         pubkeys_conv.inner = untag_ptr(pubkeys);
1755         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1756         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1757
1758         LDKChannelSigner ret = {
1759                 .this_arg = (void*) calls,
1760                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1761                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1762                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1763                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
1764                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1765                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1766                 .free = LDKChannelSigner_JCalls_free,
1767                 .pubkeys = pubkeys_conv,
1768                 .set_pubkeys = NULL,
1769         };
1770         return ret;
1771 }
1772 uint64_t  CS_LDK_LDKChannelSigner_new(int32_t o, int64_t pubkeys) {
1773         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1774         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1775         return tag_ptr(res_ptr, true);
1776 }
1777 int8_tArray  CS_LDK_ChannelSigner_get_per_commitment_point(int64_t this_arg, int64_t idx) {
1778         void* this_arg_ptr = untag_ptr(this_arg);
1779         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1780         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1781         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1782         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1783         return ret_arr;
1784 }
1785
1786 int8_tArray  CS_LDK_ChannelSigner_release_commitment_secret(int64_t this_arg, int64_t idx) {
1787         void* this_arg_ptr = untag_ptr(this_arg);
1788         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1789         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1790         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1791         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1792         return ret_arr;
1793 }
1794
1795 int64_t  CS_LDK_ChannelSigner_validate_holder_commitment(int64_t this_arg, int64_t holder_tx, ptrArray outbound_htlc_preimages) {
1796         void* this_arg_ptr = untag_ptr(this_arg);
1797         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1798         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1799         LDKHolderCommitmentTransaction holder_tx_conv;
1800         holder_tx_conv.inner = untag_ptr(holder_tx);
1801         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1802         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1803         holder_tx_conv.is_owned = false;
1804         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
1805         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
1806         if (outbound_htlc_preimages_constr.datalen > 0)
1807                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
1808         else
1809                 outbound_htlc_preimages_constr.data = NULL;
1810         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
1811         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
1812                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
1813                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
1814                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
1815                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
1816                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
1817         }
1818         FREE(outbound_htlc_preimages);
1819         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1820         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
1821         return tag_ptr(ret_conv, true);
1822 }
1823
1824 int64_t  CS_LDK_ChannelSigner_validate_counterparty_revocation(int64_t this_arg, int64_t idx, int8_tArray secret) {
1825         void* this_arg_ptr = untag_ptr(this_arg);
1826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1827         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1828         uint8_t secret_arr[32];
1829         CHECK(secret->arr_len == 32);
1830         memcpy(secret_arr, secret->elems, 32); FREE(secret);
1831         uint8_t (*secret_ref)[32] = &secret_arr;
1832         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1833         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
1834         return tag_ptr(ret_conv, true);
1835 }
1836
1837 int8_tArray  CS_LDK_ChannelSigner_channel_keys_id(int64_t this_arg) {
1838         void* this_arg_ptr = untag_ptr(this_arg);
1839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1840         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1841         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1842         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1843         return ret_arr;
1844 }
1845
1846 void  CS_LDK_ChannelSigner_provide_channel_parameters(int64_t this_arg, int64_t channel_parameters) {
1847         void* this_arg_ptr = untag_ptr(this_arg);
1848         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1849         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1850         LDKChannelTransactionParameters channel_parameters_conv;
1851         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1852         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1853         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1854         channel_parameters_conv.is_owned = false;
1855         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1856 }
1857
1858 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1859         if (this_arg->set_pubkeys != NULL)
1860                 this_arg->set_pubkeys(this_arg);
1861         return this_arg->pubkeys;
1862 }
1863 int64_t  CS_LDK_ChannelSigner_get_pubkeys(int64_t this_arg) {
1864         void* this_arg_ptr = untag_ptr(this_arg);
1865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1866         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1867         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1868         int64_t ret_ref = 0;
1869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1871         return ret_ref;
1872 }
1873
1874 typedef struct LDKEcdsaChannelSigner_JCalls {
1875         atomic_size_t refcnt;
1876         uint32_t instance_ptr;
1877         LDKChannelSigner_JCalls* ChannelSigner;
1878 } LDKEcdsaChannelSigner_JCalls;
1879 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1880         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1881         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1882                 FREE(j_calls);
1883         }
1884 }
1885 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) {
1886         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1887         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1888         int64_t commitment_tx_ref = 0;
1889         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1890         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1891         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1892         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
1893         ptrArray inbound_htlc_preimages_arr = NULL;
1894         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
1895         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
1896         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
1897                 int8_tArray inbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1898                 memcpy(inbound_htlc_preimages_conv_8_arr->elems, inbound_htlc_preimages_var.data[i].data, 32);
1899                 inbound_htlc_preimages_arr_ptr[i] = inbound_htlc_preimages_conv_8_arr;
1900         }
1901         
1902         FREE(inbound_htlc_preimages_var.data);
1903         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1904         ptrArray outbound_htlc_preimages_arr = NULL;
1905         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1906         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1907         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1908                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1909                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1910                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1911         }
1912         
1913         FREE(outbound_htlc_preimages_var.data);
1914         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);
1915         void* ret_ptr = untag_ptr(ret);
1916         CHECK_ACCESS(ret_ptr);
1917         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
1918         FREE(untag_ptr(ret));
1919         return ret_conv;
1920 }
1921 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1922         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1923         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1924         int64_t commitment_tx_ref = 0;
1925         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
1926         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1927         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1928         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 7, commitment_tx_ref);
1929         void* ret_ptr = untag_ptr(ret);
1930         CHECK_ACCESS(ret_ptr);
1931         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1932         FREE(untag_ptr(ret));
1933         return ret_conv;
1934 }
1935 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]) {
1936         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1937         LDKTransaction justice_tx_var = justice_tx;
1938         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1939         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1940         Transaction_free(justice_tx_var);
1941         int64_t input_conv = input;
1942         int64_t amount_conv = amount;
1943         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1944         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1945         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);
1946         void* ret_ptr = untag_ptr(ret);
1947         CHECK_ACCESS(ret_ptr);
1948         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1949         FREE(untag_ptr(ret));
1950         return ret_conv;
1951 }
1952 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) {
1953         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1954         LDKTransaction justice_tx_var = justice_tx;
1955         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
1956         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1957         Transaction_free(justice_tx_var);
1958         int64_t input_conv = input;
1959         int64_t amount_conv = amount;
1960         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
1961         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1962         LDKHTLCOutputInCommitment htlc_var = *htlc;
1963         int64_t htlc_ref = 0;
1964         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1966         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
1967         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);
1968         void* ret_ptr = untag_ptr(ret);
1969         CHECK_ACCESS(ret_ptr);
1970         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1971         FREE(untag_ptr(ret));
1972         return ret_conv;
1973 }
1974 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
1975         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1976         LDKTransaction htlc_tx_var = htlc_tx;
1977         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1978         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1979         Transaction_free(htlc_tx_var);
1980         int64_t input_conv = input;
1981         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
1982         int64_t htlc_descriptor_ref = 0;
1983         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
1984         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
1985         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
1986         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 10, (int64_t)htlc_tx_arr, input_conv, htlc_descriptor_ref);
1987         void* ret_ptr = untag_ptr(ret);
1988         CHECK_ACCESS(ret_ptr);
1989         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
1990         FREE(untag_ptr(ret));
1991         return ret_conv;
1992 }
1993 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) {
1994         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1995         LDKTransaction htlc_tx_var = htlc_tx;
1996         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
1997         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1998         Transaction_free(htlc_tx_var);
1999         int64_t input_conv = input;
2000         int64_t amount_conv = amount;
2001         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2002         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2003         LDKHTLCOutputInCommitment htlc_var = *htlc;
2004         int64_t htlc_ref = 0;
2005         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2006         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2007         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2008         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);
2009         void* ret_ptr = untag_ptr(ret);
2010         CHECK_ACCESS(ret_ptr);
2011         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2012         FREE(untag_ptr(ret));
2013         return ret_conv;
2014 }
2015 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2016         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2017         LDKClosingTransaction closing_tx_var = *closing_tx;
2018         int64_t closing_tx_ref = 0;
2019         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2020         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2021         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2022         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 12, closing_tx_ref);
2023         void* ret_ptr = untag_ptr(ret);
2024         CHECK_ACCESS(ret_ptr);
2025         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2026         FREE(untag_ptr(ret));
2027         return ret_conv;
2028 }
2029 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2030         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2031         LDKTransaction anchor_tx_var = anchor_tx;
2032         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2033         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2034         Transaction_free(anchor_tx_var);
2035         int64_t input_conv = input;
2036         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 13, (int64_t)anchor_tx_arr, input_conv);
2037         void* ret_ptr = untag_ptr(ret);
2038         CHECK_ACCESS(ret_ptr);
2039         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2040         FREE(untag_ptr(ret));
2041         return ret_conv;
2042 }
2043 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2044         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2045         LDKUnsignedChannelAnnouncement msg_var = *msg;
2046         int64_t msg_ref = 0;
2047         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2049         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2050         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 14, msg_ref);
2051         void* ret_ptr = untag_ptr(ret);
2052         CHECK_ACCESS(ret_ptr);
2053         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2054         FREE(untag_ptr(ret));
2055         return ret_conv;
2056 }
2057 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2058         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2059         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2060         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2061 }
2062 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (int64_t o, int64_t ChannelSigner, int64_t pubkeys) {
2063         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2064         atomic_init(&calls->refcnt, 1);
2065         calls->instance_ptr = o;
2066
2067         LDKChannelPublicKeys pubkeys_conv;
2068         pubkeys_conv.inner = untag_ptr(pubkeys);
2069         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2070         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2071
2072         LDKEcdsaChannelSigner ret = {
2073                 .this_arg = (void*) calls,
2074                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2075                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2076                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2077                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2078                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2079                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2080                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2081                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2082                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2083                 .free = LDKEcdsaChannelSigner_JCalls_free,
2084                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2085         };
2086         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2087         return ret;
2088 }
2089 uint64_t  CS_LDK_LDKEcdsaChannelSigner_new(int32_t o, int32_t ChannelSigner, int64_t pubkeys) {
2090         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2091         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2092         return tag_ptr(res_ptr, true);
2093 }
2094 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_commitment(int64_t this_arg, int64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
2095         void* this_arg_ptr = untag_ptr(this_arg);
2096         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2097         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2098         LDKCommitmentTransaction commitment_tx_conv;
2099         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2100         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2101         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2102         commitment_tx_conv.is_owned = false;
2103         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2104         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2105         if (inbound_htlc_preimages_constr.datalen > 0)
2106                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2107         else
2108                 inbound_htlc_preimages_constr.data = NULL;
2109         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2110         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
2111                 int8_tArray inbound_htlc_preimages_conv_8 = inbound_htlc_preimages_vals[i];
2112                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
2113                 CHECK(inbound_htlc_preimages_conv_8->arr_len == 32);
2114                 memcpy(inbound_htlc_preimages_conv_8_ref.data, inbound_htlc_preimages_conv_8->elems, 32); FREE(inbound_htlc_preimages_conv_8);
2115                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
2116         }
2117         FREE(inbound_htlc_preimages);
2118         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2119         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2120         if (outbound_htlc_preimages_constr.datalen > 0)
2121                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2122         else
2123                 outbound_htlc_preimages_constr.data = NULL;
2124         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2125         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2126                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2127                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2128                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2129                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2130                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2131         }
2132         FREE(outbound_htlc_preimages);
2133         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2134         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2135         return tag_ptr(ret_conv, true);
2136 }
2137
2138 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_commitment(int64_t this_arg, int64_t commitment_tx) {
2139         void* this_arg_ptr = untag_ptr(this_arg);
2140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2141         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2142         LDKHolderCommitmentTransaction commitment_tx_conv;
2143         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2144         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2145         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2146         commitment_tx_conv.is_owned = false;
2147         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2148         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2149         return tag_ptr(ret_conv, true);
2150 }
2151
2152 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) {
2153         void* this_arg_ptr = untag_ptr(this_arg);
2154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2155         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2156         LDKTransaction justice_tx_ref;
2157         justice_tx_ref.datalen = justice_tx->arr_len;
2158         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2159         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2160         justice_tx_ref.data_is_owned = true;
2161         uint8_t per_commitment_key_arr[32];
2162         CHECK(per_commitment_key->arr_len == 32);
2163         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2164         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2165         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2166         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2167         return tag_ptr(ret_conv, true);
2168 }
2169
2170 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) {
2171         void* this_arg_ptr = untag_ptr(this_arg);
2172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2173         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2174         LDKTransaction justice_tx_ref;
2175         justice_tx_ref.datalen = justice_tx->arr_len;
2176         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2177         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2178         justice_tx_ref.data_is_owned = true;
2179         uint8_t per_commitment_key_arr[32];
2180         CHECK(per_commitment_key->arr_len == 32);
2181         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2182         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2183         LDKHTLCOutputInCommitment htlc_conv;
2184         htlc_conv.inner = untag_ptr(htlc);
2185         htlc_conv.is_owned = ptr_is_owned(htlc);
2186         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2187         htlc_conv.is_owned = false;
2188         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2189         *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);
2190         return tag_ptr(ret_conv, true);
2191 }
2192
2193 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
2194         void* this_arg_ptr = untag_ptr(this_arg);
2195         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2196         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2197         LDKTransaction htlc_tx_ref;
2198         htlc_tx_ref.datalen = htlc_tx->arr_len;
2199         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2200         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2201         htlc_tx_ref.data_is_owned = true;
2202         LDKHTLCDescriptor htlc_descriptor_conv;
2203         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2204         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2205         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2206         htlc_descriptor_conv.is_owned = false;
2207         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2208         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2209         return tag_ptr(ret_conv, true);
2210 }
2211
2212 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) {
2213         void* this_arg_ptr = untag_ptr(this_arg);
2214         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2215         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2216         LDKTransaction htlc_tx_ref;
2217         htlc_tx_ref.datalen = htlc_tx->arr_len;
2218         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2219         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2220         htlc_tx_ref.data_is_owned = true;
2221         LDKPublicKey per_commitment_point_ref;
2222         CHECK(per_commitment_point->arr_len == 33);
2223         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2224         LDKHTLCOutputInCommitment htlc_conv;
2225         htlc_conv.inner = untag_ptr(htlc);
2226         htlc_conv.is_owned = ptr_is_owned(htlc);
2227         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2228         htlc_conv.is_owned = false;
2229         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2230         *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);
2231         return tag_ptr(ret_conv, true);
2232 }
2233
2234 int64_t  CS_LDK_EcdsaChannelSigner_sign_closing_transaction(int64_t this_arg, int64_t closing_tx) {
2235         void* this_arg_ptr = untag_ptr(this_arg);
2236         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2237         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2238         LDKClosingTransaction closing_tx_conv;
2239         closing_tx_conv.inner = untag_ptr(closing_tx);
2240         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2241         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2242         closing_tx_conv.is_owned = false;
2243         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2244         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2245         return tag_ptr(ret_conv, true);
2246 }
2247
2248 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_anchor_input(int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
2249         void* this_arg_ptr = untag_ptr(this_arg);
2250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2251         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2252         LDKTransaction anchor_tx_ref;
2253         anchor_tx_ref.datalen = anchor_tx->arr_len;
2254         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2255         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2256         anchor_tx_ref.data_is_owned = true;
2257         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2258         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2259         return tag_ptr(ret_conv, true);
2260 }
2261
2262 int64_t  CS_LDK_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(int64_t this_arg, int64_t msg) {
2263         void* this_arg_ptr = untag_ptr(this_arg);
2264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2265         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2266         LDKUnsignedChannelAnnouncement msg_conv;
2267         msg_conv.inner = untag_ptr(msg);
2268         msg_conv.is_owned = ptr_is_owned(msg);
2269         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2270         msg_conv.is_owned = false;
2271         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2272         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2273         return tag_ptr(ret_conv, true);
2274 }
2275
2276 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2277         atomic_size_t refcnt;
2278         uint32_t instance_ptr;
2279         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2280         LDKChannelSigner_JCalls* ChannelSigner;
2281 } LDKWriteableEcdsaChannelSigner_JCalls;
2282 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2283         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2284         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2285                 FREE(j_calls);
2286         }
2287 }
2288 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2289         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2290         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 15);
2291         LDKCVec_u8Z ret_ref;
2292         ret_ref.datalen = ret->arr_len;
2293         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2294         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2295         return ret_ref;
2296 }
2297 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2298         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2299         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2300         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2301         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2302 }
2303 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (int64_t o, int64_t EcdsaChannelSigner, int64_t ChannelSigner, int64_t pubkeys) {
2304         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2305         atomic_init(&calls->refcnt, 1);
2306         calls->instance_ptr = o;
2307
2308         LDKChannelPublicKeys pubkeys_conv;
2309         pubkeys_conv.inner = untag_ptr(pubkeys);
2310         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2311         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2312
2313         LDKWriteableEcdsaChannelSigner ret = {
2314                 .this_arg = (void*) calls,
2315                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2316                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2317                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2318                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2319         };
2320         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2321         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2322         return ret;
2323 }
2324 uint64_t  CS_LDK_LDKWriteableEcdsaChannelSigner_new(int32_t o, int32_t EcdsaChannelSigner, int32_t ChannelSigner, int64_t pubkeys) {
2325         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2326         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2327         return tag_ptr(res_ptr, true);
2328 }
2329 int8_tArray  CS_LDK_WriteableEcdsaChannelSigner_write(int64_t this_arg) {
2330         void* this_arg_ptr = untag_ptr(this_arg);
2331         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2332         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2333         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2334         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2335         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2336         CVec_u8Z_free(ret_var);
2337         return ret_arr;
2338 }
2339
2340 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2341 CHECK(owner->result_ok);
2342         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2343 }
2344 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(int64_t owner) {
2345         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2346         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2347         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2348         return tag_ptr(ret_ret, true);
2349 }
2350
2351 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2352 CHECK(!owner->result_ok);
2353         return DecodeError_clone(&*owner->contents.err);
2354 }
2355 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(int64_t owner) {
2356         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2357         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2358         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2359         int64_t ret_ref = tag_ptr(ret_copy, true);
2360         return ret_ref;
2361 }
2362
2363 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2364 CHECK(owner->result_ok);
2365         return CVec_u8Z_clone(&*owner->contents.result);
2366 }
2367 int8_tArray  CS_LDK_CResult_CVec_u8ZNoneZ_get_ok(int64_t owner) {
2368         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2369         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2372         CVec_u8Z_free(ret_var);
2373         return ret_arr;
2374 }
2375
2376 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2377 CHECK(!owner->result_ok);
2378         return *owner->contents.err;
2379 }
2380 void  CS_LDK_CResult_CVec_u8ZNoneZ_get_err(int64_t owner) {
2381         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2382         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2383 }
2384
2385 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2386         LDKShutdownScript ret = *owner->contents.result;
2387         ret.is_owned = false;
2388         return ret;
2389 }
2390 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_get_ok(int64_t owner) {
2391         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2392         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2393         int64_t ret_ref = 0;
2394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2396         return ret_ref;
2397 }
2398
2399 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2400 CHECK(!owner->result_ok);
2401         return *owner->contents.err;
2402 }
2403 void  CS_LDK_CResult_ShutdownScriptNoneZ_get_err(int64_t owner) {
2404         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2405         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2406 }
2407
2408 uint32_t CS_LDK_LDKCOption_u16Z_ty_from_ptr(int64_t ptr) {
2409         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2410         switch(obj->tag) {
2411                 case LDKCOption_u16Z_Some: return 0;
2412                 case LDKCOption_u16Z_None: return 1;
2413                 default: abort();
2414         }
2415 }
2416 int16_t CS_LDK_LDKCOption_u16Z_Some_get_some(int64_t ptr) {
2417         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2418         CHECK(obj->tag == LDKCOption_u16Z_Some);
2419         int16_t some_conv = obj->some;
2420         return some_conv;
2421 }
2422 uint32_t CS_LDK_LDKCOption_boolZ_ty_from_ptr(int64_t ptr) {
2423         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2424         switch(obj->tag) {
2425                 case LDKCOption_boolZ_Some: return 0;
2426                 case LDKCOption_boolZ_None: return 1;
2427                 default: abort();
2428         }
2429 }
2430 jboolean CS_LDK_LDKCOption_boolZ_Some_get_some(int64_t ptr) {
2431         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2432         CHECK(obj->tag == LDKCOption_boolZ_Some);
2433         jboolean some_conv = obj->some;
2434         return some_conv;
2435 }
2436 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2437 CHECK(owner->result_ok);
2438         return Witness_clone(&*owner->contents.result);
2439 }
2440 int8_tArray  CS_LDK_CResult_WitnessNoneZ_get_ok(int64_t owner) {
2441         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2442         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2443         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2444         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2445         Witness_free(ret_var);
2446         return ret_arr;
2447 }
2448
2449 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2450 CHECK(!owner->result_ok);
2451         return *owner->contents.err;
2452 }
2453 void  CS_LDK_CResult_WitnessNoneZ_get_err(int64_t owner) {
2454         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2455         CResult_WitnessNoneZ_get_err(owner_conv);
2456 }
2457
2458 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2459         LDKInMemorySigner ret = *owner->contents.result;
2460         ret.is_owned = false;
2461         return ret;
2462 }
2463 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_ok(int64_t owner) {
2464         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2465         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2466         int64_t ret_ref = 0;
2467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2469         return ret_ref;
2470 }
2471
2472 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2473 CHECK(!owner->result_ok);
2474         return DecodeError_clone(&*owner->contents.err);
2475 }
2476 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_err(int64_t owner) {
2477         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2478         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2479         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2480         int64_t ret_ref = tag_ptr(ret_copy, true);
2481         return ret_ref;
2482 }
2483
2484 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2485 CHECK(owner->result_ok);
2486         return *owner->contents.result;
2487 }
2488 int8_tArray  CS_LDK_CResult_TransactionNoneZ_get_ok(int64_t owner) {
2489         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2490         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2491         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2492         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2493         return ret_arr;
2494 }
2495
2496 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2497 CHECK(!owner->result_ok);
2498         return *owner->contents.err;
2499 }
2500 void  CS_LDK_CResult_TransactionNoneZ_get_err(int64_t owner) {
2501         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2502         CResult_TransactionNoneZ_get_err(owner_conv);
2503 }
2504
2505 uint32_t CS_LDK_LDKCandidateRouteHop_ty_from_ptr(int64_t ptr) {
2506         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2507         switch(obj->tag) {
2508                 case LDKCandidateRouteHop_FirstHop: return 0;
2509                 case LDKCandidateRouteHop_PublicHop: return 1;
2510                 case LDKCandidateRouteHop_PrivateHop: return 2;
2511                 case LDKCandidateRouteHop_Blinded: return 3;
2512                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
2513                 default: abort();
2514         }
2515 }
2516 int64_t CS_LDK_LDKCandidateRouteHop_FirstHop_get_first_hop(int64_t ptr) {
2517         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2518         CHECK(obj->tag == LDKCandidateRouteHop_FirstHop);
2519         LDKFirstHopCandidate first_hop_var = obj->first_hop;
2520                         int64_t first_hop_ref = 0;
2521                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
2522                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
2523         return first_hop_ref;
2524 }
2525 int64_t CS_LDK_LDKCandidateRouteHop_PublicHop_get_public_hop(int64_t ptr) {
2526         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2527         CHECK(obj->tag == LDKCandidateRouteHop_PublicHop);
2528         LDKPublicHopCandidate public_hop_var = obj->public_hop;
2529                         int64_t public_hop_ref = 0;
2530                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
2531                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
2532         return public_hop_ref;
2533 }
2534 int64_t CS_LDK_LDKCandidateRouteHop_PrivateHop_get_private_hop(int64_t ptr) {
2535         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2536         CHECK(obj->tag == LDKCandidateRouteHop_PrivateHop);
2537         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
2538                         int64_t private_hop_ref = 0;
2539                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
2540                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
2541         return private_hop_ref;
2542 }
2543 int64_t CS_LDK_LDKCandidateRouteHop_Blinded_get_blinded(int64_t ptr) {
2544         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2545         CHECK(obj->tag == LDKCandidateRouteHop_Blinded);
2546         LDKBlindedPathCandidate blinded_var = obj->blinded;
2547                         int64_t blinded_ref = 0;
2548                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
2549                         blinded_ref = tag_ptr(blinded_var.inner, false);
2550         return blinded_ref;
2551 }
2552 int64_t CS_LDK_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(int64_t ptr) {
2553         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2554         CHECK(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
2555         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
2556                         int64_t one_hop_blinded_ref = 0;
2557                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
2558                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
2559         return one_hop_blinded_ref;
2560 }
2561 typedef struct LDKScoreLookUp_JCalls {
2562         atomic_size_t refcnt;
2563         uint32_t instance_ptr;
2564 } LDKScoreLookUp_JCalls;
2565 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
2566         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2567         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2568                 FREE(j_calls);
2569         }
2570 }
2571 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
2572         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2573         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
2574         *ret_candidate = CandidateRouteHop_clone(candidate);
2575         int64_t ref_candidate = tag_ptr(ret_candidate, true);
2576         LDKChannelUsage usage_var = usage;
2577         int64_t usage_ref = 0;
2578         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
2579         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
2580         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
2581         int64_t score_params_ref = 0;
2582         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
2583         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
2584         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
2585         return js_invoke_function_l_lll(j_calls->instance_ptr, 16, ref_candidate, usage_ref, score_params_ref);
2586 }
2587 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
2588         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
2589         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2590 }
2591 static inline LDKScoreLookUp LDKScoreLookUp_init (int64_t o) {
2592         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
2593         atomic_init(&calls->refcnt, 1);
2594         calls->instance_ptr = o;
2595
2596         LDKScoreLookUp ret = {
2597                 .this_arg = (void*) calls,
2598                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
2599                 .free = LDKScoreLookUp_JCalls_free,
2600         };
2601         return ret;
2602 }
2603 uint64_t  CS_LDK_LDKScoreLookUp_new(int32_t o) {
2604         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2605         *res_ptr = LDKScoreLookUp_init(o);
2606         return tag_ptr(res_ptr, true);
2607 }
2608 int64_t  CS_LDK_ScoreLookUp_channel_penalty_msat(int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
2609         void* this_arg_ptr = untag_ptr(this_arg);
2610         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2611         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
2612         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
2613         LDKChannelUsage usage_conv;
2614         usage_conv.inner = untag_ptr(usage);
2615         usage_conv.is_owned = ptr_is_owned(usage);
2616         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
2617         usage_conv = ChannelUsage_clone(&usage_conv);
2618         LDKProbabilisticScoringFeeParameters score_params_conv;
2619         score_params_conv.inner = untag_ptr(score_params);
2620         score_params_conv.is_owned = ptr_is_owned(score_params);
2621         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
2622         score_params_conv.is_owned = false;
2623         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
2624         return ret_conv;
2625 }
2626
2627 typedef struct LDKScoreUpdate_JCalls {
2628         atomic_size_t refcnt;
2629         uint32_t instance_ptr;
2630 } LDKScoreUpdate_JCalls;
2631 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
2632         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2633         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2634                 FREE(j_calls);
2635         }
2636 }
2637 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2638         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2639         LDKPath path_var = *path;
2640         int64_t path_ref = 0;
2641         path_var = Path_clone(&path_var);
2642         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2643         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2644         int64_t short_channel_id_conv = short_channel_id;
2645         int64_t duration_since_epoch_conv = duration_since_epoch;
2646         js_invoke_function_void_lll(j_calls->instance_ptr, 17, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2647 }
2648 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2649         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2650         LDKPath path_var = *path;
2651         int64_t path_ref = 0;
2652         path_var = Path_clone(&path_var);
2653         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2654         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2655         int64_t duration_since_epoch_conv = duration_since_epoch;
2656         js_invoke_function_void_ll(j_calls->instance_ptr, 18, path_ref, duration_since_epoch_conv);
2657 }
2658 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2659         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2660         LDKPath path_var = *path;
2661         int64_t path_ref = 0;
2662         path_var = Path_clone(&path_var);
2663         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2664         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2665         int64_t short_channel_id_conv = short_channel_id;
2666         int64_t duration_since_epoch_conv = duration_since_epoch;
2667         js_invoke_function_void_lll(j_calls->instance_ptr, 19, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2668 }
2669 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2670         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2671         LDKPath path_var = *path;
2672         int64_t path_ref = 0;
2673         path_var = Path_clone(&path_var);
2674         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2675         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2676         int64_t duration_since_epoch_conv = duration_since_epoch;
2677         js_invoke_function_void_ll(j_calls->instance_ptr, 20, path_ref, duration_since_epoch_conv);
2678 }
2679 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
2680         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2681         int64_t duration_since_epoch_conv = duration_since_epoch;
2682         js_invoke_function_void_l(j_calls->instance_ptr, 21, duration_since_epoch_conv);
2683 }
2684 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
2685         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
2686         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2687 }
2688 static inline LDKScoreUpdate LDKScoreUpdate_init (int64_t o) {
2689         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
2690         atomic_init(&calls->refcnt, 1);
2691         calls->instance_ptr = o;
2692
2693         LDKScoreUpdate ret = {
2694                 .this_arg = (void*) calls,
2695                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
2696                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
2697                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
2698                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
2699                 .time_passed = time_passed_LDKScoreUpdate_jcall,
2700                 .free = LDKScoreUpdate_JCalls_free,
2701         };
2702         return ret;
2703 }
2704 uint64_t  CS_LDK_LDKScoreUpdate_new(int32_t o) {
2705         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2706         *res_ptr = LDKScoreUpdate_init(o);
2707         return tag_ptr(res_ptr, true);
2708 }
2709 void  CS_LDK_ScoreUpdate_payment_path_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2710         void* this_arg_ptr = untag_ptr(this_arg);
2711         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2712         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2713         LDKPath path_conv;
2714         path_conv.inner = untag_ptr(path);
2715         path_conv.is_owned = ptr_is_owned(path);
2716         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2717         path_conv.is_owned = false;
2718         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2719 }
2720
2721 void  CS_LDK_ScoreUpdate_payment_path_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2722         void* this_arg_ptr = untag_ptr(this_arg);
2723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2724         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2725         LDKPath path_conv;
2726         path_conv.inner = untag_ptr(path);
2727         path_conv.is_owned = ptr_is_owned(path);
2728         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2729         path_conv.is_owned = false;
2730         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2731 }
2732
2733 void  CS_LDK_ScoreUpdate_probe_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2734         void* this_arg_ptr = untag_ptr(this_arg);
2735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2736         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2737         LDKPath path_conv;
2738         path_conv.inner = untag_ptr(path);
2739         path_conv.is_owned = ptr_is_owned(path);
2740         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2741         path_conv.is_owned = false;
2742         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2743 }
2744
2745 void  CS_LDK_ScoreUpdate_probe_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2746         void* this_arg_ptr = untag_ptr(this_arg);
2747         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2748         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2749         LDKPath path_conv;
2750         path_conv.inner = untag_ptr(path);
2751         path_conv.is_owned = ptr_is_owned(path);
2752         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2753         path_conv.is_owned = false;
2754         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2755 }
2756
2757 void  CS_LDK_ScoreUpdate_time_passed(int64_t this_arg, int64_t duration_since_epoch) {
2758         void* this_arg_ptr = untag_ptr(this_arg);
2759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2760         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2761         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
2762 }
2763
2764 typedef struct LDKLockableScore_JCalls {
2765         atomic_size_t refcnt;
2766         uint32_t instance_ptr;
2767 } LDKLockableScore_JCalls;
2768 static void LDKLockableScore_JCalls_free(void* this_arg) {
2769         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2770         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2771                 FREE(j_calls);
2772         }
2773 }
2774 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
2775         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2776         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 22);
2777         void* ret_ptr = untag_ptr(ret);
2778         CHECK_ACCESS(ret_ptr);
2779         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
2780         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
2781                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2782                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
2783         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
2784         
2785         return ret_conv;
2786 }
2787 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
2788         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2789         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 23);
2790         void* ret_ptr = untag_ptr(ret);
2791         CHECK_ACCESS(ret_ptr);
2792         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
2793         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
2794                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2795                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
2796         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
2797         
2798         return ret_conv;
2799 }
2800 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
2801         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
2802         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2803 }
2804 static inline LDKLockableScore LDKLockableScore_init (int64_t o) {
2805         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
2806         atomic_init(&calls->refcnt, 1);
2807         calls->instance_ptr = o;
2808
2809         LDKLockableScore ret = {
2810                 .this_arg = (void*) calls,
2811                 .read_lock = read_lock_LDKLockableScore_jcall,
2812                 .write_lock = write_lock_LDKLockableScore_jcall,
2813                 .free = LDKLockableScore_JCalls_free,
2814         };
2815         return ret;
2816 }
2817 uint64_t  CS_LDK_LDKLockableScore_new(int32_t o) {
2818         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
2819         *res_ptr = LDKLockableScore_init(o);
2820         return tag_ptr(res_ptr, true);
2821 }
2822 int64_t  CS_LDK_LockableScore_read_lock(int64_t this_arg) {
2823         void* this_arg_ptr = untag_ptr(this_arg);
2824         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2825         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2826         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2827         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
2828         return tag_ptr(ret_ret, true);
2829 }
2830
2831 int64_t  CS_LDK_LockableScore_write_lock(int64_t this_arg) {
2832         void* this_arg_ptr = untag_ptr(this_arg);
2833         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2834         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2835         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2836         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
2837         return tag_ptr(ret_ret, true);
2838 }
2839
2840 typedef struct LDKWriteableScore_JCalls {
2841         atomic_size_t refcnt;
2842         uint32_t instance_ptr;
2843         LDKLockableScore_JCalls* LockableScore;
2844 } LDKWriteableScore_JCalls;
2845 static void LDKWriteableScore_JCalls_free(void* this_arg) {
2846         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2847         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2848                 FREE(j_calls);
2849         }
2850 }
2851 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
2852         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2853         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 24);
2854         LDKCVec_u8Z ret_ref;
2855         ret_ref.datalen = ret->arr_len;
2856         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2857         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2858         return ret_ref;
2859 }
2860 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
2861         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
2862         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2863         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
2864 }
2865 static inline LDKWriteableScore LDKWriteableScore_init (int64_t o, int64_t LockableScore) {
2866         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
2867         atomic_init(&calls->refcnt, 1);
2868         calls->instance_ptr = o;
2869
2870         LDKWriteableScore ret = {
2871                 .this_arg = (void*) calls,
2872                 .write = write_LDKWriteableScore_jcall,
2873                 .free = LDKWriteableScore_JCalls_free,
2874                 .LockableScore = LDKLockableScore_init(LockableScore),
2875         };
2876         calls->LockableScore = ret.LockableScore.this_arg;
2877         return ret;
2878 }
2879 uint64_t  CS_LDK_LDKWriteableScore_new(int32_t o, int32_t LockableScore) {
2880         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2881         *res_ptr = LDKWriteableScore_init(o, LockableScore);
2882         return tag_ptr(res_ptr, true);
2883 }
2884 int8_tArray  CS_LDK_WriteableScore_write(int64_t this_arg) {
2885         void* this_arg_ptr = untag_ptr(this_arg);
2886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2887         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
2888         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2889         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2890         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2891         CVec_u8Z_free(ret_var);
2892         return ret_arr;
2893 }
2894
2895 uint32_t CS_LDK_LDKCOption_WriteableScoreZ_ty_from_ptr(int64_t ptr) {
2896         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2897         switch(obj->tag) {
2898                 case LDKCOption_WriteableScoreZ_Some: return 0;
2899                 case LDKCOption_WriteableScoreZ_None: return 1;
2900                 default: abort();
2901         }
2902 }
2903 int64_t CS_LDK_LDKCOption_WriteableScoreZ_Some_get_some(int64_t ptr) {
2904         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2905         CHECK(obj->tag == LDKCOption_WriteableScoreZ_Some);
2906         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2907         *some_ret = obj->some;
2908                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2909                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
2910                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2911                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
2912                         }
2913         return tag_ptr(some_ret, true);
2914 }
2915 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
2916 CHECK(owner->result_ok);
2917         return *owner->contents.result;
2918 }
2919 void  CS_LDK_CResult_NoneIOErrorZ_get_ok(int64_t owner) {
2920         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
2921         CResult_NoneIOErrorZ_get_ok(owner_conv);
2922 }
2923
2924 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
2925 CHECK(!owner->result_ok);
2926         return *owner->contents.err;
2927 }
2928 int32_t  CS_LDK_CResult_NoneIOErrorZ_get_err(int64_t owner) {
2929         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
2930         int32_t ret_conv = LDKIOError_to_cs(CResult_NoneIOErrorZ_get_err(owner_conv));
2931         return ret_conv;
2932 }
2933
2934 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2935         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2936         for (size_t i = 0; i < ret.datalen; i++) {
2937                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2938         }
2939         return ret;
2940 }
2941 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2942         LDKRoute ret = *owner->contents.result;
2943         ret.is_owned = false;
2944         return ret;
2945 }
2946 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_ok(int64_t owner) {
2947         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2948         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2949         int64_t ret_ref = 0;
2950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2952         return ret_ref;
2953 }
2954
2955 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2956         LDKLightningError ret = *owner->contents.err;
2957         ret.is_owned = false;
2958         return ret;
2959 }
2960 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_err(int64_t owner) {
2961         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2962         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2963         int64_t ret_ref = 0;
2964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2966         return ret_ref;
2967 }
2968
2969 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2970         LDKBlindedPayInfo ret = owner->a;
2971         ret.is_owned = false;
2972         return ret;
2973 }
2974 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(int64_t owner) {
2975         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2976         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2977         int64_t ret_ref = 0;
2978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2980         return ret_ref;
2981 }
2982
2983 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2984         LDKBlindedPath ret = owner->b;
2985         ret.is_owned = false;
2986         return ret;
2987 }
2988 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(int64_t owner) {
2989         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2990         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2991         int64_t ret_ref = 0;
2992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2994         return ret_ref;
2995 }
2996
2997 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2998         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2999         for (size_t i = 0; i < ret.datalen; i++) {
3000                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
3001         }
3002         return ret;
3003 }
3004 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3005 CHECK(owner->result_ok);
3006         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
3007 }
3008 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(int64_t owner) {
3009         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3010         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
3011         int64_tArray ret_arr = NULL;
3012         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3013         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3014         for (size_t l = 0; l < ret_var.datalen; l++) {
3015                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
3016                 *ret_conv_37_conv = ret_var.data[l];
3017                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
3018         }
3019         
3020         FREE(ret_var.data);
3021         return ret_arr;
3022 }
3023
3024 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3025 CHECK(!owner->result_ok);
3026         return *owner->contents.err;
3027 }
3028 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(int64_t owner) {
3029         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3030         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
3031 }
3032
3033 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3034         LDKOnionMessagePath ret = *owner->contents.result;
3035         ret.is_owned = false;
3036         return ret;
3037 }
3038 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_get_ok(int64_t owner) {
3039         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3040         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
3041         int64_t ret_ref = 0;
3042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3044         return ret_ref;
3045 }
3046
3047 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3048 CHECK(!owner->result_ok);
3049         return *owner->contents.err;
3050 }
3051 void  CS_LDK_CResult_OnionMessagePathNoneZ_get_err(int64_t owner) {
3052         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3053         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
3054 }
3055
3056 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3057 CHECK(owner->result_ok);
3058         return CVec_BlindedPathZ_clone(&*owner->contents.result);
3059 }
3060 int64_tArray  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_ok(int64_t owner) {
3061         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3062         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
3063         int64_tArray ret_arr = NULL;
3064         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3065         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3066         for (size_t n = 0; n < ret_var.datalen; n++) {
3067                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
3068                 int64_t ret_conv_13_ref = 0;
3069                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
3070                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
3071                 ret_arr_ptr[n] = ret_conv_13_ref;
3072         }
3073         
3074         FREE(ret_var.data);
3075         return ret_arr;
3076 }
3077
3078 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3079 CHECK(!owner->result_ok);
3080         return *owner->contents.err;
3081 }
3082 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_err(int64_t owner) {
3083         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3084         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
3085 }
3086
3087 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3088         LDKInFlightHtlcs ret = *owner->contents.result;
3089         ret.is_owned = false;
3090         return ret;
3091 }
3092 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_ok(int64_t owner) {
3093         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3094         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
3095         int64_t ret_ref = 0;
3096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3098         return ret_ref;
3099 }
3100
3101 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3102 CHECK(!owner->result_ok);
3103         return DecodeError_clone(&*owner->contents.err);
3104 }
3105 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_err(int64_t owner) {
3106         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3108         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
3109         int64_t ret_ref = tag_ptr(ret_copy, true);
3110         return ret_ref;
3111 }
3112
3113 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3114         LDKRouteHop ret = *owner->contents.result;
3115         ret.is_owned = false;
3116         return ret;
3117 }
3118 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_ok(int64_t owner) {
3119         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3120         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
3121         int64_t ret_ref = 0;
3122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3124         return ret_ref;
3125 }
3126
3127 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3128 CHECK(!owner->result_ok);
3129         return DecodeError_clone(&*owner->contents.err);
3130 }
3131 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_err(int64_t owner) {
3132         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3134         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
3135         int64_t ret_ref = tag_ptr(ret_copy, true);
3136         return ret_ref;
3137 }
3138
3139 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
3140         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
3141         for (size_t i = 0; i < ret.datalen; i++) {
3142                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
3143         }
3144         return ret;
3145 }
3146 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3147         LDKBlindedTail ret = *owner->contents.result;
3148         ret.is_owned = false;
3149         return ret;
3150 }
3151 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_ok(int64_t owner) {
3152         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3153         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
3154         int64_t ret_ref = 0;
3155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3157         return ret_ref;
3158 }
3159
3160 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3161 CHECK(!owner->result_ok);
3162         return DecodeError_clone(&*owner->contents.err);
3163 }
3164 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_err(int64_t owner) {
3165         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3167         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
3168         int64_t ret_ref = tag_ptr(ret_copy, true);
3169         return ret_ref;
3170 }
3171
3172 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3173         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3174         for (size_t i = 0; i < ret.datalen; i++) {
3175                 ret.data[i] = RouteHop_clone(&orig->data[i]);
3176         }
3177         return ret;
3178 }
3179 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
3180         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
3181         for (size_t i = 0; i < ret.datalen; i++) {
3182                 ret.data[i] = Path_clone(&orig->data[i]);
3183         }
3184         return ret;
3185 }
3186 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3187         LDKRoute ret = *owner->contents.result;
3188         ret.is_owned = false;
3189         return ret;
3190 }
3191 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_ok(int64_t owner) {
3192         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3193         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
3194         int64_t ret_ref = 0;
3195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3197         return ret_ref;
3198 }
3199
3200 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3201 CHECK(!owner->result_ok);
3202         return DecodeError_clone(&*owner->contents.err);
3203 }
3204 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_err(int64_t owner) {
3205         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3206         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3207         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
3208         int64_t ret_ref = tag_ptr(ret_copy, true);
3209         return ret_ref;
3210 }
3211
3212 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3213         LDKRouteParameters ret = *owner->contents.result;
3214         ret.is_owned = false;
3215         return ret;
3216 }
3217 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_ok(int64_t owner) {
3218         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3219         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
3220         int64_t ret_ref = 0;
3221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3223         return ret_ref;
3224 }
3225
3226 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3227 CHECK(!owner->result_ok);
3228         return DecodeError_clone(&*owner->contents.err);
3229 }
3230 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_err(int64_t owner) {
3231         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3233         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
3234         int64_t ret_ref = tag_ptr(ret_copy, true);
3235         return ret_ref;
3236 }
3237
3238 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3239         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3240         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3241         return ret;
3242 }
3243 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3244         LDKPaymentParameters ret = *owner->contents.result;
3245         ret.is_owned = false;
3246         return ret;
3247 }
3248 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_ok(int64_t owner) {
3249         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3250         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
3251         int64_t ret_ref = 0;
3252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3254         return ret_ref;
3255 }
3256
3257 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3258 CHECK(!owner->result_ok);
3259         return DecodeError_clone(&*owner->contents.err);
3260 }
3261 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_err(int64_t owner) {
3262         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3264         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
3265         int64_t ret_ref = tag_ptr(ret_copy, true);
3266         return ret_ref;
3267 }
3268
3269 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3270         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3271         for (size_t i = 0; i < ret.datalen; i++) {
3272                 ret.data[i] = RouteHint_clone(&orig->data[i]);
3273         }
3274         return ret;
3275 }
3276 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
3277         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
3278         for (size_t i = 0; i < ret.datalen; i++) {
3279                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
3280         }
3281         return ret;
3282 }
3283 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3284         LDKRouteHint ret = *owner->contents.result;
3285         ret.is_owned = false;
3286         return ret;
3287 }
3288 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_ok(int64_t owner) {
3289         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3290         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
3291         int64_t ret_ref = 0;
3292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3294         return ret_ref;
3295 }
3296
3297 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3298 CHECK(!owner->result_ok);
3299         return DecodeError_clone(&*owner->contents.err);
3300 }
3301 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_err(int64_t owner) {
3302         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3303         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3304         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
3305         int64_t ret_ref = tag_ptr(ret_copy, true);
3306         return ret_ref;
3307 }
3308
3309 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3310         LDKRouteHintHop ret = *owner->contents.result;
3311         ret.is_owned = false;
3312         return ret;
3313 }
3314 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_ok(int64_t owner) {
3315         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3316         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
3317         int64_t ret_ref = 0;
3318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3320         return ret_ref;
3321 }
3322
3323 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3324 CHECK(!owner->result_ok);
3325         return DecodeError_clone(&*owner->contents.err);
3326 }
3327 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_err(int64_t owner) {
3328         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3329         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3330         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
3331         int64_t ret_ref = tag_ptr(ret_copy, true);
3332         return ret_ref;
3333 }
3334
3335 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3336         LDKFixedPenaltyScorer ret = *owner->contents.result;
3337         ret.is_owned = false;
3338         return ret;
3339 }
3340 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(int64_t owner) {
3341         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3342         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3343         int64_t ret_ref = 0;
3344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3346         return ret_ref;
3347 }
3348
3349 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3350 CHECK(!owner->result_ok);
3351         return DecodeError_clone(&*owner->contents.err);
3352 }
3353 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(int64_t owner) {
3354         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3355         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3356         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3357         int64_t ret_ref = tag_ptr(ret_copy, true);
3358         return ret_ref;
3359 }
3360
3361 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3362         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3363         for (size_t i = 0; i < ret.datalen; i++) {
3364                 ret.data[i] = NodeId_clone(&orig->data[i]);
3365         }
3366         return ret;
3367 }
3368 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3369         return owner->a;
3370 }
3371 int64_t  CS_LDK_C2Tuple_u64u64Z_get_a(int64_t owner) {
3372         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3373         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3374         return ret_conv;
3375 }
3376
3377 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3378         return owner->b;
3379 }
3380 int64_t  CS_LDK_C2Tuple_u64u64Z_get_b(int64_t owner) {
3381         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3382         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3383         return ret_conv;
3384 }
3385
3386 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(int64_t ptr) {
3387         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3388         switch(obj->tag) {
3389                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3390                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3391                 default: abort();
3392         }
3393 }
3394 int64_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(int64_t ptr) {
3395         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3396         CHECK(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3397         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3398         *some_conv = obj->some;
3399                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3400         return tag_ptr(some_conv, true);
3401 }
3402 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3403         return owner->a;
3404 }
3405 int16_tArray  CS_LDK_C2Tuple_Z_get_a(int64_t owner) {
3406         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3407         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3408         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
3409         return ret_arr;
3410 }
3411
3412 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3413         return owner->b;
3414 }
3415 int16_tArray  CS_LDK_C2Tuple_Z_get_b(int64_t owner) {
3416         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3417         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3418         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
3419         return ret_arr;
3420 }
3421
3422 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3423         return owner->a;
3424 }
3425 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_a(int64_t owner) {
3426         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3427         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3428         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
3429         return ret_arr;
3430 }
3431
3432 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3433         return owner->b;
3434 }
3435 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_b(int64_t owner) {
3436         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3437         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3438         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3439         return ret_arr;
3440 }
3441
3442 uint32_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(int64_t ptr) {
3443         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3444         switch(obj->tag) {
3445                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3446                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3447                 default: abort();
3448         }
3449 }
3450 int64_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(int64_t ptr) {
3451         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3452         CHECK(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3453         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3454                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3455         return tag_ptr(some_conv, false);
3456 }
3457 uint32_t CS_LDK_LDKCOption_f64Z_ty_from_ptr(int64_t ptr) {
3458         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3459         switch(obj->tag) {
3460                 case LDKCOption_f64Z_Some: return 0;
3461                 case LDKCOption_f64Z_None: return 1;
3462                 default: abort();
3463         }
3464 }
3465 double CS_LDK_LDKCOption_f64Z_Some_get_some(int64_t ptr) {
3466         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3467         CHECK(obj->tag == LDKCOption_f64Z_Some);
3468         double some_conv = obj->some;
3469         return some_conv;
3470 }
3471 typedef struct LDKLogger_JCalls {
3472         atomic_size_t refcnt;
3473         uint32_t instance_ptr;
3474 } LDKLogger_JCalls;
3475 static void LDKLogger_JCalls_free(void* this_arg) {
3476         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3477         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3478                 FREE(j_calls);
3479         }
3480 }
3481 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3482         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3483         LDKRecord record_var = record;
3484         int64_t record_ref = 0;
3485         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3486         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3487         js_invoke_function_void_l(j_calls->instance_ptr, 25, record_ref);
3488 }
3489 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3490         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3491         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3492 }
3493 static inline LDKLogger LDKLogger_init (int64_t o) {
3494         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3495         atomic_init(&calls->refcnt, 1);
3496         calls->instance_ptr = o;
3497
3498         LDKLogger ret = {
3499                 .this_arg = (void*) calls,
3500                 .log = log_LDKLogger_jcall,
3501                 .free = LDKLogger_JCalls_free,
3502         };
3503         return ret;
3504 }
3505 uint64_t  CS_LDK_LDKLogger_new(int32_t o) {
3506         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3507         *res_ptr = LDKLogger_init(o);
3508         return tag_ptr(res_ptr, true);
3509 }
3510 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3511         LDKProbabilisticScorer ret = *owner->contents.result;
3512         ret.is_owned = false;
3513         return ret;
3514 }
3515 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(int64_t owner) {
3516         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3517         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3518         int64_t ret_ref = 0;
3519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3521         return ret_ref;
3522 }
3523
3524 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3525 CHECK(!owner->result_ok);
3526         return DecodeError_clone(&*owner->contents.err);
3527 }
3528 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_err(int64_t owner) {
3529         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3531         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3532         int64_t ret_ref = tag_ptr(ret_copy, true);
3533         return ret_ref;
3534 }
3535
3536 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3537         return owner->a;
3538 }
3539 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_get_a(int64_t owner) {
3540         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3541         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3542         return ret_conv;
3543 }
3544
3545 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3546         return owner->b;
3547 }
3548 int8_tArray  CS_LDK_C2Tuple_usizeTransactionZ_get_b(int64_t owner) {
3549         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3550         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3551         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3552         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3553         return ret_arr;
3554 }
3555
3556 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3557         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3558         for (size_t i = 0; i < ret.datalen; i++) {
3559                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3560         }
3561         return ret;
3562 }
3563 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3564         return ThirtyTwoBytes_clone(&owner->a);
3565 }
3566 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(int64_t owner) {
3567         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3568         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3569         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3570         return ret_arr;
3571 }
3572
3573 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3574         return owner->b;
3575 }
3576 int32_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(int64_t owner) {
3577         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3578         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3579         return ret_conv;
3580 }
3581
3582 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3583         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3584 }
3585 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(int64_t owner) {
3586         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3587         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3588         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3589         int64_t ret_ref = tag_ptr(ret_copy, true);
3590         return ret_ref;
3591 }
3592
3593 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3594         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3595         for (size_t i = 0; i < ret.datalen; i++) {
3596                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3597         }
3598         return ret;
3599 }
3600 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3601 CHECK(owner->result_ok);
3602         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3603 }
3604 int32_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(int64_t owner) {
3605         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3606         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3607         return ret_conv;
3608 }
3609
3610 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3611 CHECK(!owner->result_ok);
3612         return *owner->contents.err;
3613 }
3614 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(int64_t owner) {
3615         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3616         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3617 }
3618
3619 uint32_t CS_LDK_LDKMonitorEvent_ty_from_ptr(int64_t ptr) {
3620         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3621         switch(obj->tag) {
3622                 case LDKMonitorEvent_HTLCEvent: return 0;
3623                 case LDKMonitorEvent_HolderForceClosed: return 1;
3624                 case LDKMonitorEvent_Completed: return 2;
3625                 default: abort();
3626         }
3627 }
3628 int64_t CS_LDK_LDKMonitorEvent_HTLCEvent_get_htlc_event(int64_t ptr) {
3629         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3630         CHECK(obj->tag == LDKMonitorEvent_HTLCEvent);
3631         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3632                         int64_t htlc_event_ref = 0;
3633                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3634                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3635         return htlc_event_ref;
3636 }
3637 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(int64_t ptr) {
3638         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3639         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosed);
3640         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3641                         int64_t holder_force_closed_ref = 0;
3642                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3643                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3644         return holder_force_closed_ref;
3645 }
3646 int64_t CS_LDK_LDKMonitorEvent_Completed_get_funding_txo(int64_t ptr) {
3647         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3648         CHECK(obj->tag == LDKMonitorEvent_Completed);
3649         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3650                         int64_t funding_txo_ref = 0;
3651                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3652                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3653         return funding_txo_ref;
3654 }
3655 int64_t CS_LDK_LDKMonitorEvent_Completed_get_monitor_update_id(int64_t ptr) {
3656         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3657         CHECK(obj->tag == LDKMonitorEvent_Completed);
3658         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3659         return monitor_update_id_conv;
3660 }
3661 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3662         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3663         for (size_t i = 0; i < ret.datalen; i++) {
3664                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3665         }
3666         return ret;
3667 }
3668 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3669         LDKOutPoint ret = owner->a;
3670         ret.is_owned = false;
3671         return ret;
3672 }
3673 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(int64_t owner) {
3674         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3675         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3676         int64_t ret_ref = 0;
3677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3679         return ret_ref;
3680 }
3681
3682 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3683         return CVec_MonitorEventZ_clone(&owner->b);
3684 }
3685 int64_tArray  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(int64_t owner) {
3686         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3687         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3688         int64_tArray ret_arr = NULL;
3689         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3690         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3691         for (size_t o = 0; o < ret_var.datalen; o++) {
3692                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3693                 *ret_conv_14_copy = ret_var.data[o];
3694                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3695                 ret_arr_ptr[o] = ret_conv_14_ref;
3696         }
3697         
3698         FREE(ret_var.data);
3699         return ret_arr;
3700 }
3701
3702 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3703         return owner->c;
3704 }
3705 int8_tArray  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(int64_t owner) {
3706         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3707         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3708         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3709         return ret_arr;
3710 }
3711
3712 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3713         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3714         for (size_t i = 0; i < ret.datalen; i++) {
3715                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3716         }
3717         return ret;
3718 }
3719 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3720         LDKInitFeatures ret = *owner->contents.result;
3721         ret.is_owned = false;
3722         return ret;
3723 }
3724 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3725         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3726         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3727         int64_t ret_ref = 0;
3728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3730         return ret_ref;
3731 }
3732
3733 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3734 CHECK(!owner->result_ok);
3735         return DecodeError_clone(&*owner->contents.err);
3736 }
3737 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_err(int64_t owner) {
3738         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3739         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3740         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3741         int64_t ret_ref = tag_ptr(ret_copy, true);
3742         return ret_ref;
3743 }
3744
3745 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3746         LDKChannelFeatures ret = *owner->contents.result;
3747         ret.is_owned = false;
3748         return ret;
3749 }
3750 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3751         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3752         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3753         int64_t ret_ref = 0;
3754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3756         return ret_ref;
3757 }
3758
3759 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3760 CHECK(!owner->result_ok);
3761         return DecodeError_clone(&*owner->contents.err);
3762 }
3763 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_err(int64_t owner) {
3764         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3766         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3767         int64_t ret_ref = tag_ptr(ret_copy, true);
3768         return ret_ref;
3769 }
3770
3771 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3772         LDKNodeFeatures ret = *owner->contents.result;
3773         ret.is_owned = false;
3774         return ret;
3775 }
3776 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3777         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3778         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3779         int64_t ret_ref = 0;
3780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3782         return ret_ref;
3783 }
3784
3785 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3786 CHECK(!owner->result_ok);
3787         return DecodeError_clone(&*owner->contents.err);
3788 }
3789 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_err(int64_t owner) {
3790         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3792         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3793         int64_t ret_ref = tag_ptr(ret_copy, true);
3794         return ret_ref;
3795 }
3796
3797 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3798         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3799         ret.is_owned = false;
3800         return ret;
3801 }
3802 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3803         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3804         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3805         int64_t ret_ref = 0;
3806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3808         return ret_ref;
3809 }
3810
3811 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3812 CHECK(!owner->result_ok);
3813         return DecodeError_clone(&*owner->contents.err);
3814 }
3815 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
3816         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3817         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3818         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3819         int64_t ret_ref = tag_ptr(ret_copy, true);
3820         return ret_ref;
3821 }
3822
3823 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3824         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3825         ret.is_owned = false;
3826         return ret;
3827 }
3828 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3829         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3830         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3831         int64_t ret_ref = 0;
3832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3834         return ret_ref;
3835 }
3836
3837 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3838 CHECK(!owner->result_ok);
3839         return DecodeError_clone(&*owner->contents.err);
3840 }
3841 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
3842         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3843         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3844         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3845         int64_t ret_ref = tag_ptr(ret_copy, true);
3846         return ret_ref;
3847 }
3848
3849 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3850         LDKBlindedHopFeatures ret = *owner->contents.result;
3851         ret.is_owned = false;
3852         return ret;
3853 }
3854 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3855         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3856         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3857         int64_t ret_ref = 0;
3858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3860         return ret_ref;
3861 }
3862
3863 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3864 CHECK(!owner->result_ok);
3865         return DecodeError_clone(&*owner->contents.err);
3866 }
3867 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(int64_t owner) {
3868         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3870         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3871         int64_t ret_ref = tag_ptr(ret_copy, true);
3872         return ret_ref;
3873 }
3874
3875 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3876         LDKChannelTypeFeatures ret = *owner->contents.result;
3877         ret.is_owned = false;
3878         return ret;
3879 }
3880 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
3881         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3882         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3883         int64_t ret_ref = 0;
3884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3886         return ret_ref;
3887 }
3888
3889 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3890 CHECK(!owner->result_ok);
3891         return DecodeError_clone(&*owner->contents.err);
3892 }
3893 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(int64_t owner) {
3894         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3896         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3897         int64_t ret_ref = tag_ptr(ret_copy, true);
3898         return ret_ref;
3899 }
3900
3901 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3902         LDKOffer ret = *owner->contents.result;
3903         ret.is_owned = false;
3904         return ret;
3905 }
3906 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_ok(int64_t owner) {
3907         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3908         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
3909         int64_t ret_ref = 0;
3910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3912         return ret_ref;
3913 }
3914
3915 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
3916         LDKBolt12ParseError ret = *owner->contents.err;
3917         ret.is_owned = false;
3918         return ret;
3919 }
3920 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_err(int64_t owner) {
3921         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
3922         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
3923         int64_t ret_ref = 0;
3924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3926         return ret_ref;
3927 }
3928
3929 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3930 CHECK(owner->result_ok);
3931         return *owner->contents.result;
3932 }
3933 int8_tArray  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_ok(int64_t owner) {
3934         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3935         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3936         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
3937         return ret_arr;
3938 }
3939
3940 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
3941 CHECK(!owner->result_ok);
3942         return *owner->contents.err;
3943 }
3944 int32_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_err(int64_t owner) {
3945         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
3946         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
3947         return ret_conv;
3948 }
3949
3950 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3951         LDKNodeId ret = *owner->contents.result;
3952         ret.is_owned = false;
3953         return ret;
3954 }
3955 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_ok(int64_t owner) {
3956         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3957         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3958         int64_t ret_ref = 0;
3959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3961         return ret_ref;
3962 }
3963
3964 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3965 CHECK(!owner->result_ok);
3966         return DecodeError_clone(&*owner->contents.err);
3967 }
3968 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_err(int64_t owner) {
3969         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3970         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3971         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3972         int64_t ret_ref = tag_ptr(ret_copy, true);
3973         return ret_ref;
3974 }
3975
3976 uint32_t CS_LDK_LDKNetworkUpdate_ty_from_ptr(int64_t ptr) {
3977         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3978         switch(obj->tag) {
3979                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3980                 case LDKNetworkUpdate_ChannelFailure: return 1;
3981                 case LDKNetworkUpdate_NodeFailure: return 2;
3982                 default: abort();
3983         }
3984 }
3985 int64_t CS_LDK_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(int64_t ptr) {
3986         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3987         CHECK(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3988         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3989                         int64_t msg_ref = 0;
3990                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3991                         msg_ref = tag_ptr(msg_var.inner, false);
3992         return msg_ref;
3993 }
3994 int64_t CS_LDK_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(int64_t ptr) {
3995         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3996         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
3997         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3998         return short_channel_id_conv;
3999 }
4000 jboolean CS_LDK_LDKNetworkUpdate_ChannelFailure_get_is_permanent(int64_t ptr) {
4001         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4002         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4003         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
4004         return is_permanent_conv;
4005 }
4006 int8_tArray CS_LDK_LDKNetworkUpdate_NodeFailure_get_node_id(int64_t ptr) {
4007         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4008         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4009         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4010         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
4011         return node_id_arr;
4012 }
4013 jboolean CS_LDK_LDKNetworkUpdate_NodeFailure_get_is_permanent(int64_t ptr) {
4014         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4015         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4016         jboolean is_permanent_conv = obj->node_failure.is_permanent;
4017         return is_permanent_conv;
4018 }
4019 uint32_t CS_LDK_LDKCOption_NetworkUpdateZ_ty_from_ptr(int64_t ptr) {
4020         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4021         switch(obj->tag) {
4022                 case LDKCOption_NetworkUpdateZ_Some: return 0;
4023                 case LDKCOption_NetworkUpdateZ_None: return 1;
4024                 default: abort();
4025         }
4026 }
4027 int64_t CS_LDK_LDKCOption_NetworkUpdateZ_Some_get_some(int64_t ptr) {
4028         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4029         CHECK(obj->tag == LDKCOption_NetworkUpdateZ_Some);
4030         int64_t some_ref = tag_ptr(&obj->some, false);
4031         return some_ref;
4032 }
4033 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4034 CHECK(owner->result_ok);
4035         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4036 }
4037 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(int64_t owner) {
4038         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4039         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4040         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4041         int64_t ret_ref = tag_ptr(ret_copy, true);
4042         return ret_ref;
4043 }
4044
4045 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4046 CHECK(!owner->result_ok);
4047         return DecodeError_clone(&*owner->contents.err);
4048 }
4049 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(int64_t owner) {
4050         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4052         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4053         int64_t ret_ref = tag_ptr(ret_copy, true);
4054         return ret_ref;
4055 }
4056
4057 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4058 CHECK(owner->result_ok);
4059         return TxOut_clone(&*owner->contents.result);
4060 }
4061 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_ok(int64_t owner) {
4062         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4063         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4064         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
4065         return tag_ptr(ret_ref, true);
4066 }
4067
4068 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4069 CHECK(!owner->result_ok);
4070         return UtxoLookupError_clone(&*owner->contents.err);
4071 }
4072 int32_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_err(int64_t owner) {
4073         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4074         int32_t ret_conv = LDKUtxoLookupError_to_cs(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
4075         return ret_conv;
4076 }
4077
4078 uint32_t CS_LDK_LDKUtxoResult_ty_from_ptr(int64_t ptr) {
4079         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4080         switch(obj->tag) {
4081                 case LDKUtxoResult_Sync: return 0;
4082                 case LDKUtxoResult_Async: return 1;
4083                 default: abort();
4084         }
4085 }
4086 int64_t CS_LDK_LDKUtxoResult_Sync_get_sync(int64_t ptr) {
4087         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4088         CHECK(obj->tag == LDKUtxoResult_Sync);
4089         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
4090         *sync_conv = obj->sync;
4091                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
4092         return tag_ptr(sync_conv, true);
4093 }
4094 int64_t CS_LDK_LDKUtxoResult_Async_get_async(int64_t ptr) {
4095         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4096         CHECK(obj->tag == LDKUtxoResult_Async);
4097         LDKUtxoFuture async_var = obj->async;
4098                         int64_t async_ref = 0;
4099                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
4100                         async_ref = tag_ptr(async_var.inner, false);
4101         return async_ref;
4102 }
4103 typedef struct LDKUtxoLookup_JCalls {
4104         atomic_size_t refcnt;
4105         uint32_t instance_ptr;
4106 } LDKUtxoLookup_JCalls;
4107 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
4108         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4109         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4110                 FREE(j_calls);
4111         }
4112 }
4113 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
4114         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4115         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
4116         memcpy(chain_hash_arr->elems, *chain_hash, 32);
4117         int64_t short_channel_id_conv = short_channel_id;
4118         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 26, (int64_t)chain_hash_arr, short_channel_id_conv);
4119         void* ret_ptr = untag_ptr(ret);
4120         CHECK_ACCESS(ret_ptr);
4121         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
4122         FREE(untag_ptr(ret));
4123         return ret_conv;
4124 }
4125 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
4126         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
4127         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4128 }
4129 static inline LDKUtxoLookup LDKUtxoLookup_init (int64_t o) {
4130         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
4131         atomic_init(&calls->refcnt, 1);
4132         calls->instance_ptr = o;
4133
4134         LDKUtxoLookup ret = {
4135                 .this_arg = (void*) calls,
4136                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
4137                 .free = LDKUtxoLookup_JCalls_free,
4138         };
4139         return ret;
4140 }
4141 uint64_t  CS_LDK_LDKUtxoLookup_new(int32_t o) {
4142         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4143         *res_ptr = LDKUtxoLookup_init(o);
4144         return tag_ptr(res_ptr, true);
4145 }
4146 int64_t  CS_LDK_UtxoLookup_get_utxo(int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
4147         void* this_arg_ptr = untag_ptr(this_arg);
4148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4149         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
4150         uint8_t chain_hash_arr[32];
4151         CHECK(chain_hash->arr_len == 32);
4152         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
4153         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
4154         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
4155         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
4156         int64_t ret_ref = tag_ptr(ret_copy, true);
4157         return ret_ref;
4158 }
4159
4160 uint32_t CS_LDK_LDKCOption_UtxoLookupZ_ty_from_ptr(int64_t ptr) {
4161         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4162         switch(obj->tag) {
4163                 case LDKCOption_UtxoLookupZ_Some: return 0;
4164                 case LDKCOption_UtxoLookupZ_None: return 1;
4165                 default: abort();
4166         }
4167 }
4168 int64_t CS_LDK_LDKCOption_UtxoLookupZ_Some_get_some(int64_t ptr) {
4169         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4170         CHECK(obj->tag == LDKCOption_UtxoLookupZ_Some);
4171         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4172         *some_ret = obj->some;
4173                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4174                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4175                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4176                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4177                         }
4178         return tag_ptr(some_ret, true);
4179 }
4180 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4181 CHECK(owner->result_ok);
4182         return *owner->contents.result;
4183 }
4184 void  CS_LDK_CResult_NoneLightningErrorZ_get_ok(int64_t owner) {
4185         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4186         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4187 }
4188
4189 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4190         LDKLightningError ret = *owner->contents.err;
4191         ret.is_owned = false;
4192         return ret;
4193 }
4194 int64_t  CS_LDK_CResult_NoneLightningErrorZ_get_err(int64_t owner) {
4195         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4196         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4197         int64_t ret_ref = 0;
4198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4200         return ret_ref;
4201 }
4202
4203 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4204 CHECK(owner->result_ok);
4205         return *owner->contents.result;
4206 }
4207 jboolean  CS_LDK_CResult_boolLightningErrorZ_get_ok(int64_t owner) {
4208         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4209         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4210         return ret_conv;
4211 }
4212
4213 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4214         LDKLightningError ret = *owner->contents.err;
4215         ret.is_owned = false;
4216         return ret;
4217 }
4218 int64_t  CS_LDK_CResult_boolLightningErrorZ_get_err(int64_t owner) {
4219         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4220         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4221         int64_t ret_ref = 0;
4222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4224         return ret_ref;
4225 }
4226
4227 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4228         LDKChannelAnnouncement ret = owner->a;
4229         ret.is_owned = false;
4230         return ret;
4231 }
4232 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(int64_t owner) {
4233         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4234         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4235         int64_t ret_ref = 0;
4236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4238         return ret_ref;
4239 }
4240
4241 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4242         LDKChannelUpdate ret = owner->b;
4243         ret.is_owned = false;
4244         return ret;
4245 }
4246 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(int64_t owner) {
4247         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4248         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4249         int64_t ret_ref = 0;
4250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4252         return ret_ref;
4253 }
4254
4255 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4256         LDKChannelUpdate ret = owner->c;
4257         ret.is_owned = false;
4258         return ret;
4259 }
4260 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(int64_t owner) {
4261         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4262         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4263         int64_t ret_ref = 0;
4264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4266         return ret_ref;
4267 }
4268
4269 uint32_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(int64_t ptr) {
4270         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4271         switch(obj->tag) {
4272                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4273                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4274                 default: abort();
4275         }
4276 }
4277 int64_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(int64_t ptr) {
4278         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4279         CHECK(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4280         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4281         *some_conv = obj->some;
4282                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4283         return tag_ptr(some_conv, true);
4284 }
4285 uint32_t CS_LDK_LDKErrorAction_ty_from_ptr(int64_t ptr) {
4286         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4287         switch(obj->tag) {
4288                 case LDKErrorAction_DisconnectPeer: return 0;
4289                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4290                 case LDKErrorAction_IgnoreError: return 2;
4291                 case LDKErrorAction_IgnoreAndLog: return 3;
4292                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4293                 case LDKErrorAction_SendErrorMessage: return 5;
4294                 case LDKErrorAction_SendWarningMessage: return 6;
4295                 default: abort();
4296         }
4297 }
4298 int64_t CS_LDK_LDKErrorAction_DisconnectPeer_get_msg(int64_t ptr) {
4299         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4300         CHECK(obj->tag == LDKErrorAction_DisconnectPeer);
4301         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4302                         int64_t msg_ref = 0;
4303                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4304                         msg_ref = tag_ptr(msg_var.inner, false);
4305         return msg_ref;
4306 }
4307 int64_t CS_LDK_LDKErrorAction_DisconnectPeerWithWarning_get_msg(int64_t ptr) {
4308         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4309         CHECK(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4310         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4311                         int64_t msg_ref = 0;
4312                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4313                         msg_ref = tag_ptr(msg_var.inner, false);
4314         return msg_ref;
4315 }
4316 int32_t CS_LDK_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(int64_t ptr) {
4317         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4318         CHECK(obj->tag == LDKErrorAction_IgnoreAndLog);
4319         int32_t ignore_and_log_conv = LDKLevel_to_cs(obj->ignore_and_log);
4320         return ignore_and_log_conv;
4321 }
4322 int64_t CS_LDK_LDKErrorAction_SendErrorMessage_get_msg(int64_t ptr) {
4323         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4324         CHECK(obj->tag == LDKErrorAction_SendErrorMessage);
4325         LDKErrorMessage msg_var = obj->send_error_message.msg;
4326                         int64_t msg_ref = 0;
4327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4328                         msg_ref = tag_ptr(msg_var.inner, false);
4329         return msg_ref;
4330 }
4331 int64_t CS_LDK_LDKErrorAction_SendWarningMessage_get_msg(int64_t ptr) {
4332         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4333         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4334         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4335                         int64_t msg_ref = 0;
4336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4337                         msg_ref = tag_ptr(msg_var.inner, false);
4338         return msg_ref;
4339 }
4340 int32_t CS_LDK_LDKErrorAction_SendWarningMessage_get_log_level(int64_t ptr) {
4341         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4342         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4343         int32_t log_level_conv = LDKLevel_to_cs(obj->send_warning_message.log_level);
4344         return log_level_conv;
4345 }
4346 uint32_t CS_LDK_LDKMessageSendEvent_ty_from_ptr(int64_t ptr) {
4347         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4348         switch(obj->tag) {
4349                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4350                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4351                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4352                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4353                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4354                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4355                 case LDKMessageSendEvent_SendStfu: return 6;
4356                 case LDKMessageSendEvent_SendSplice: return 7;
4357                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4358                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4359                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4360                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4361                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4362                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4363                 case LDKMessageSendEvent_SendTxComplete: return 14;
4364                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4365                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4366                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4367                 case LDKMessageSendEvent_SendTxAbort: return 18;
4368                 case LDKMessageSendEvent_SendChannelReady: return 19;
4369                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4370                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4371                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4372                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4373                 case LDKMessageSendEvent_SendShutdown: return 24;
4374                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4375                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4376                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4377                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4378                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4379                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4380                 case LDKMessageSendEvent_HandleError: return 31;
4381                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4382                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4383                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4384                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4385                 default: abort();
4386         }
4387 }
4388 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_node_id(int64_t ptr) {
4389         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4390         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4391         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4392         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4393         return node_id_arr;
4394 }
4395 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_msg(int64_t ptr) {
4396         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4397         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4398         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4399                         int64_t msg_ref = 0;
4400                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4401                         msg_ref = tag_ptr(msg_var.inner, false);
4402         return msg_ref;
4403 }
4404 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(int64_t ptr) {
4405         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4406         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4407         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4408         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4409         return node_id_arr;
4410 }
4411 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(int64_t ptr) {
4412         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4413         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4414         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4415                         int64_t msg_ref = 0;
4416                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4417                         msg_ref = tag_ptr(msg_var.inner, false);
4418         return msg_ref;
4419 }
4420 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_node_id(int64_t ptr) {
4421         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4422         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4423         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4424         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4425         return node_id_arr;
4426 }
4427 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_msg(int64_t ptr) {
4428         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4429         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4430         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4431                         int64_t msg_ref = 0;
4432                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4433                         msg_ref = tag_ptr(msg_var.inner, false);
4434         return msg_ref;
4435 }
4436 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(int64_t ptr) {
4437         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4438         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4439         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4440         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4441         return node_id_arr;
4442 }
4443 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_msg(int64_t ptr) {
4444         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4445         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4446         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4447                         int64_t msg_ref = 0;
4448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4449                         msg_ref = tag_ptr(msg_var.inner, false);
4450         return msg_ref;
4451 }
4452 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_node_id(int64_t ptr) {
4453         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4454         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4455         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4456         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4457         return node_id_arr;
4458 }
4459 int64_t CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_msg(int64_t ptr) {
4460         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4461         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4462         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4463                         int64_t msg_ref = 0;
4464                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4465                         msg_ref = tag_ptr(msg_var.inner, false);
4466         return msg_ref;
4467 }
4468 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_node_id(int64_t ptr) {
4469         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4470         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4471         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4472         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4473         return node_id_arr;
4474 }
4475 int64_t CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_msg(int64_t ptr) {
4476         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4477         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4478         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4479                         int64_t msg_ref = 0;
4480                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4481                         msg_ref = tag_ptr(msg_var.inner, false);
4482         return msg_ref;
4483 }
4484 int8_tArray CS_LDK_LDKMessageSendEvent_SendStfu_get_node_id(int64_t ptr) {
4485         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4486         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4487         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4488         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4489         return node_id_arr;
4490 }
4491 int64_t CS_LDK_LDKMessageSendEvent_SendStfu_get_msg(int64_t ptr) {
4492         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4493         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4494         LDKStfu msg_var = obj->send_stfu.msg;
4495                         int64_t msg_ref = 0;
4496                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4497                         msg_ref = tag_ptr(msg_var.inner, false);
4498         return msg_ref;
4499 }
4500 int8_tArray CS_LDK_LDKMessageSendEvent_SendSplice_get_node_id(int64_t ptr) {
4501         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4502         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4503         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4504         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4505         return node_id_arr;
4506 }
4507 int64_t CS_LDK_LDKMessageSendEvent_SendSplice_get_msg(int64_t ptr) {
4508         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4509         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4510         LDKSplice msg_var = obj->send_splice.msg;
4511                         int64_t msg_ref = 0;
4512                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4513                         msg_ref = tag_ptr(msg_var.inner, false);
4514         return msg_ref;
4515 }
4516 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_node_id(int64_t ptr) {
4517         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4518         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4519         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4520         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4521         return node_id_arr;
4522 }
4523 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_msg(int64_t ptr) {
4524         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4525         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4526         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
4527                         int64_t msg_ref = 0;
4528                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4529                         msg_ref = tag_ptr(msg_var.inner, false);
4530         return msg_ref;
4531 }
4532 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_node_id(int64_t ptr) {
4533         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4534         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4535         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4536         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
4537         return node_id_arr;
4538 }
4539 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_msg(int64_t ptr) {
4540         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4541         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
4542         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
4543                         int64_t msg_ref = 0;
4544                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4545                         msg_ref = tag_ptr(msg_var.inner, false);
4546         return msg_ref;
4547 }
4548 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_node_id(int64_t ptr) {
4549         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4550         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4551         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4552         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4553         return node_id_arr;
4554 }
4555 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_msg(int64_t ptr) {
4556         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4557         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4558         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4559                         int64_t msg_ref = 0;
4560                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4561                         msg_ref = tag_ptr(msg_var.inner, false);
4562         return msg_ref;
4563 }
4564 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_node_id(int64_t ptr) {
4565         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4566         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4567         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4568         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4569         return node_id_arr;
4570 }
4571 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_msg(int64_t ptr) {
4572         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4573         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4574         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4575                         int64_t msg_ref = 0;
4576                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4577                         msg_ref = tag_ptr(msg_var.inner, false);
4578         return msg_ref;
4579 }
4580 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(int64_t ptr) {
4581         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4582         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4583         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4584         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4585         return node_id_arr;
4586 }
4587 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_msg(int64_t ptr) {
4588         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4589         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4590         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4591                         int64_t msg_ref = 0;
4592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4593                         msg_ref = tag_ptr(msg_var.inner, false);
4594         return msg_ref;
4595 }
4596 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(int64_t ptr) {
4597         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4598         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4599         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4600         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4601         return node_id_arr;
4602 }
4603 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(int64_t ptr) {
4604         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4605         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4606         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4607                         int64_t msg_ref = 0;
4608                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4609                         msg_ref = tag_ptr(msg_var.inner, false);
4610         return msg_ref;
4611 }
4612 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxComplete_get_node_id(int64_t ptr) {
4613         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4614         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
4615         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4616         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4617         return node_id_arr;
4618 }
4619 int64_t CS_LDK_LDKMessageSendEvent_SendTxComplete_get_msg(int64_t ptr) {
4620         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4621         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
4622         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4623                         int64_t msg_ref = 0;
4624                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4625                         msg_ref = tag_ptr(msg_var.inner, false);
4626         return msg_ref;
4627 }
4628 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_node_id(int64_t ptr) {
4629         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4630         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4631         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4632         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4633         return node_id_arr;
4634 }
4635 int64_t CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_msg(int64_t ptr) {
4636         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4637         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4638         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4639                         int64_t msg_ref = 0;
4640                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4641                         msg_ref = tag_ptr(msg_var.inner, false);
4642         return msg_ref;
4643 }
4644 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_node_id(int64_t ptr) {
4645         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4646         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4647         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4648         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4649         return node_id_arr;
4650 }
4651 int64_t CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_msg(int64_t ptr) {
4652         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4653         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4654         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4655                         int64_t msg_ref = 0;
4656                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4657                         msg_ref = tag_ptr(msg_var.inner, false);
4658         return msg_ref;
4659 }
4660 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_node_id(int64_t ptr) {
4661         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4662         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4663         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4664         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4665         return node_id_arr;
4666 }
4667 int64_t CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_msg(int64_t ptr) {
4668         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4669         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4670         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4671                         int64_t msg_ref = 0;
4672                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4673                         msg_ref = tag_ptr(msg_var.inner, false);
4674         return msg_ref;
4675 }
4676 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAbort_get_node_id(int64_t ptr) {
4677         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4678         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
4679         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4680         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4681         return node_id_arr;
4682 }
4683 int64_t CS_LDK_LDKMessageSendEvent_SendTxAbort_get_msg(int64_t ptr) {
4684         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4685         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
4686         LDKTxAbort msg_var = obj->send_tx_abort.msg;
4687                         int64_t msg_ref = 0;
4688                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4689                         msg_ref = tag_ptr(msg_var.inner, false);
4690         return msg_ref;
4691 }
4692 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReady_get_node_id(int64_t ptr) {
4693         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4694         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
4695         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4696         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4697         return node_id_arr;
4698 }
4699 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReady_get_msg(int64_t ptr) {
4700         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4701         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
4702         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4703                         int64_t msg_ref = 0;
4704                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4705                         msg_ref = tag_ptr(msg_var.inner, false);
4706         return msg_ref;
4707 }
4708 int8_tArray CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(int64_t ptr) {
4709         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4710         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4711         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4712         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4713         return node_id_arr;
4714 }
4715 int64_t CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(int64_t ptr) {
4716         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4717         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4718         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4719                         int64_t msg_ref = 0;
4720                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4721                         msg_ref = tag_ptr(msg_var.inner, false);
4722         return msg_ref;
4723 }
4724 int8_tArray CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_node_id(int64_t ptr) {
4725         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4726         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4727         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4728         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4729         return node_id_arr;
4730 }
4731 int64_t CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_updates(int64_t ptr) {
4732         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4733         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4734         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4735                         int64_t updates_ref = 0;
4736                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4737                         updates_ref = tag_ptr(updates_var.inner, false);
4738         return updates_ref;
4739 }
4740 int8_tArray CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(int64_t ptr) {
4741         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4742         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4743         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4744         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4745         return node_id_arr;
4746 }
4747 int64_t CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_msg(int64_t ptr) {
4748         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4749         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4750         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4751                         int64_t msg_ref = 0;
4752                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4753                         msg_ref = tag_ptr(msg_var.inner, false);
4754         return msg_ref;
4755 }
4756 int8_tArray CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_node_id(int64_t ptr) {
4757         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4758         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4759         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4760         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4761         return node_id_arr;
4762 }
4763 int64_t CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_msg(int64_t ptr) {
4764         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4765         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4766         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4767                         int64_t msg_ref = 0;
4768                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4769                         msg_ref = tag_ptr(msg_var.inner, false);
4770         return msg_ref;
4771 }
4772 int8_tArray CS_LDK_LDKMessageSendEvent_SendShutdown_get_node_id(int64_t ptr) {
4773         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4774         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
4775         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4776         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
4777         return node_id_arr;
4778 }
4779 int64_t CS_LDK_LDKMessageSendEvent_SendShutdown_get_msg(int64_t ptr) {
4780         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4781         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
4782         LDKShutdown msg_var = obj->send_shutdown.msg;
4783                         int64_t msg_ref = 0;
4784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4785                         msg_ref = tag_ptr(msg_var.inner, false);
4786         return msg_ref;
4787 }
4788 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_node_id(int64_t ptr) {
4789         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4790         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4791         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4792         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
4793         return node_id_arr;
4794 }
4795 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_msg(int64_t ptr) {
4796         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4797         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
4798         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
4799                         int64_t msg_ref = 0;
4800                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4801                         msg_ref = tag_ptr(msg_var.inner, false);
4802         return msg_ref;
4803 }
4804 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(int64_t ptr) {
4805         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4806         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4807         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4808         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
4809         return node_id_arr;
4810 }
4811 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(int64_t ptr) {
4812         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4813         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4814         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
4815                         int64_t msg_ref = 0;
4816                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4817                         msg_ref = tag_ptr(msg_var.inner, false);
4818         return msg_ref;
4819 }
4820 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(int64_t ptr) {
4821         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4822         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
4823         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
4824                         int64_t update_msg_ref = 0;
4825                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4826                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4827         return update_msg_ref;
4828 }
4829 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(int64_t ptr) {
4830         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4831         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4832         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
4833                         int64_t msg_ref = 0;
4834                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4835                         msg_ref = tag_ptr(msg_var.inner, false);
4836         return msg_ref;
4837 }
4838 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(int64_t ptr) {
4839         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4840         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
4841         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
4842                         int64_t update_msg_ref = 0;
4843                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
4844                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
4845         return update_msg_ref;
4846 }
4847 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(int64_t ptr) {
4848         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4849         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
4850         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
4851                         int64_t msg_ref = 0;
4852                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4853                         msg_ref = tag_ptr(msg_var.inner, false);
4854         return msg_ref;
4855 }
4856 int64_t CS_LDK_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(int64_t ptr) {
4857         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4858         CHECK(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
4859         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
4860                         int64_t msg_ref = 0;
4861                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4862                         msg_ref = tag_ptr(msg_var.inner, false);
4863         return msg_ref;
4864 }
4865 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_node_id(int64_t ptr) {
4866         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4867         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4868         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4869         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
4870         return node_id_arr;
4871 }
4872 int64_t CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_msg(int64_t ptr) {
4873         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4874         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
4875         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
4876                         int64_t msg_ref = 0;
4877                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4878                         msg_ref = tag_ptr(msg_var.inner, false);
4879         return msg_ref;
4880 }
4881 int8_tArray CS_LDK_LDKMessageSendEvent_HandleError_get_node_id(int64_t ptr) {
4882         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4883         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
4884         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4885         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
4886         return node_id_arr;
4887 }
4888 int64_t CS_LDK_LDKMessageSendEvent_HandleError_get_action(int64_t ptr) {
4889         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4890         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
4891         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
4892         return action_ref;
4893 }
4894 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(int64_t ptr) {
4895         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4896         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4897         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4898         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
4899         return node_id_arr;
4900 }
4901 int64_t CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(int64_t ptr) {
4902         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4903         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
4904         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
4905                         int64_t msg_ref = 0;
4906                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4907                         msg_ref = tag_ptr(msg_var.inner, false);
4908         return msg_ref;
4909 }
4910 int8_tArray CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(int64_t ptr) {
4911         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4912         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4913         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4914         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
4915         return node_id_arr;
4916 }
4917 int64_t CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_msg(int64_t ptr) {
4918         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4919         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
4920         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
4921                         int64_t msg_ref = 0;
4922                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4923                         msg_ref = tag_ptr(msg_var.inner, false);
4924         return msg_ref;
4925 }
4926 int8_tArray CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(int64_t ptr) {
4927         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4928         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4929         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4930         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
4931         return node_id_arr;
4932 }
4933 int64_t CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_msg(int64_t ptr) {
4934         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4935         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
4936         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
4937                         int64_t msg_ref = 0;
4938                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4939                         msg_ref = tag_ptr(msg_var.inner, false);
4940         return msg_ref;
4941 }
4942 int8_tArray CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(int64_t ptr) {
4943         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4944         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4945         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4946         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
4947         return node_id_arr;
4948 }
4949 int64_t CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(int64_t ptr) {
4950         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4951         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
4952         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
4953                         int64_t msg_ref = 0;
4954                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4955                         msg_ref = tag_ptr(msg_var.inner, false);
4956         return msg_ref;
4957 }
4958 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
4959         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
4960         for (size_t i = 0; i < ret.datalen; i++) {
4961                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
4962         }
4963         return ret;
4964 }
4965 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4966         LDKChannelUpdateInfo ret = *owner->contents.result;
4967         ret.is_owned = false;
4968         return ret;
4969 }
4970 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(int64_t owner) {
4971         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4972         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4973         int64_t ret_ref = 0;
4974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4976         return ret_ref;
4977 }
4978
4979 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4980 CHECK(!owner->result_ok);
4981         return DecodeError_clone(&*owner->contents.err);
4982 }
4983 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(int64_t owner) {
4984         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4986         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4987         int64_t ret_ref = tag_ptr(ret_copy, true);
4988         return ret_ref;
4989 }
4990
4991 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4992         LDKChannelInfo ret = *owner->contents.result;
4993         ret.is_owned = false;
4994         return ret;
4995 }
4996 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_ok(int64_t owner) {
4997         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4998         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4999         int64_t ret_ref = 0;
5000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5002         return ret_ref;
5003 }
5004
5005 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5006 CHECK(!owner->result_ok);
5007         return DecodeError_clone(&*owner->contents.err);
5008 }
5009 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_err(int64_t owner) {
5010         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5012         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5013         int64_t ret_ref = tag_ptr(ret_copy, true);
5014         return ret_ref;
5015 }
5016
5017 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5018         LDKRoutingFees ret = *owner->contents.result;
5019         ret.is_owned = false;
5020         return ret;
5021 }
5022 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_ok(int64_t owner) {
5023         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5024         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5025         int64_t ret_ref = 0;
5026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5028         return ret_ref;
5029 }
5030
5031 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5032 CHECK(!owner->result_ok);
5033         return DecodeError_clone(&*owner->contents.err);
5034 }
5035 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_err(int64_t owner) {
5036         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5038         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5039         int64_t ret_ref = tag_ptr(ret_copy, true);
5040         return ret_ref;
5041 }
5042
5043 uint32_t CS_LDK_LDKSocketAddress_ty_from_ptr(int64_t ptr) {
5044         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5045         switch(obj->tag) {
5046                 case LDKSocketAddress_TcpIpV4: return 0;
5047                 case LDKSocketAddress_TcpIpV6: return 1;
5048                 case LDKSocketAddress_OnionV2: return 2;
5049                 case LDKSocketAddress_OnionV3: return 3;
5050                 case LDKSocketAddress_Hostname: return 4;
5051                 default: abort();
5052         }
5053 }
5054 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV4_get_addr(int64_t ptr) {
5055         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5056         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5057         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5058         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
5059         return addr_arr;
5060 }
5061 int16_t CS_LDK_LDKSocketAddress_TcpIpV4_get_port(int64_t ptr) {
5062         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5063         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5064         int16_t port_conv = obj->tcp_ip_v4.port;
5065         return port_conv;
5066 }
5067 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV6_get_addr(int64_t ptr) {
5068         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5069         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5070         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5071         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
5072         return addr_arr;
5073 }
5074 int16_t CS_LDK_LDKSocketAddress_TcpIpV6_get_port(int64_t ptr) {
5075         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5076         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5077         int16_t port_conv = obj->tcp_ip_v6.port;
5078         return port_conv;
5079 }
5080 int8_tArray CS_LDK_LDKSocketAddress_OnionV2_get_onion_v2(int64_t ptr) {
5081         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5082         CHECK(obj->tag == LDKSocketAddress_OnionV2);
5083         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5084         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5085         return onion_v2_arr;
5086 }
5087 int8_tArray CS_LDK_LDKSocketAddress_OnionV3_get_ed25519_pubkey(int64_t ptr) {
5088         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5089         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5090         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5091         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5092         return ed25519_pubkey_arr;
5093 }
5094 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_checksum(int64_t ptr) {
5095         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5096         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5097         int16_t checksum_conv = obj->onion_v3.checksum;
5098         return checksum_conv;
5099 }
5100 int8_t CS_LDK_LDKSocketAddress_OnionV3_get_version(int64_t ptr) {
5101         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5102         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5103         int8_t version_conv = obj->onion_v3.version;
5104         return version_conv;
5105 }
5106 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_port(int64_t ptr) {
5107         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5108         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5109         int16_t port_conv = obj->onion_v3.port;
5110         return port_conv;
5111 }
5112 int64_t CS_LDK_LDKSocketAddress_Hostname_get_hostname(int64_t ptr) {
5113         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5114         CHECK(obj->tag == LDKSocketAddress_Hostname);
5115         LDKHostname hostname_var = obj->hostname.hostname;
5116                         int64_t hostname_ref = 0;
5117                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5118                         hostname_ref = tag_ptr(hostname_var.inner, false);
5119         return hostname_ref;
5120 }
5121 int16_t CS_LDK_LDKSocketAddress_Hostname_get_port(int64_t ptr) {
5122         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5123         CHECK(obj->tag == LDKSocketAddress_Hostname);
5124         int16_t port_conv = obj->hostname.port;
5125         return port_conv;
5126 }
5127 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
5128         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
5129         for (size_t i = 0; i < ret.datalen; i++) {
5130                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
5131         }
5132         return ret;
5133 }
5134 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5135         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5136         ret.is_owned = false;
5137         return ret;
5138 }
5139 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(int64_t owner) {
5140         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5141         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5142         int64_t ret_ref = 0;
5143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5145         return ret_ref;
5146 }
5147
5148 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5149 CHECK(!owner->result_ok);
5150         return DecodeError_clone(&*owner->contents.err);
5151 }
5152 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(int64_t owner) {
5153         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5154         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5155         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5156         int64_t ret_ref = tag_ptr(ret_copy, true);
5157         return ret_ref;
5158 }
5159
5160 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5161         LDKNodeAlias ret = *owner->contents.result;
5162         ret.is_owned = false;
5163         return ret;
5164 }
5165 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_ok(int64_t owner) {
5166         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5167         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5168         int64_t ret_ref = 0;
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5171         return ret_ref;
5172 }
5173
5174 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5175 CHECK(!owner->result_ok);
5176         return DecodeError_clone(&*owner->contents.err);
5177 }
5178 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_err(int64_t owner) {
5179         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5180         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5181         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5182         int64_t ret_ref = tag_ptr(ret_copy, true);
5183         return ret_ref;
5184 }
5185
5186 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5187         LDKNodeInfo ret = *owner->contents.result;
5188         ret.is_owned = false;
5189         return ret;
5190 }
5191 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_ok(int64_t owner) {
5192         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5193         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5194         int64_t ret_ref = 0;
5195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5197         return ret_ref;
5198 }
5199
5200 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5201 CHECK(!owner->result_ok);
5202         return DecodeError_clone(&*owner->contents.err);
5203 }
5204 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_err(int64_t owner) {
5205         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5206         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5207         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5208         int64_t ret_ref = tag_ptr(ret_copy, true);
5209         return ret_ref;
5210 }
5211
5212 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5213         LDKNetworkGraph ret = *owner->contents.result;
5214         ret.is_owned = false;
5215         return ret;
5216 }
5217 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_ok(int64_t owner) {
5218         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5219         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5220         int64_t ret_ref = 0;
5221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5223         return ret_ref;
5224 }
5225
5226 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5227 CHECK(!owner->result_ok);
5228         return DecodeError_clone(&*owner->contents.err);
5229 }
5230 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_err(int64_t owner) {
5231         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5233         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5234         int64_t ret_ref = tag_ptr(ret_copy, true);
5235         return ret_ref;
5236 }
5237
5238 uint32_t CS_LDK_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(int64_t ptr) {
5239         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5240         switch(obj->tag) {
5241                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5242                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5243                 default: abort();
5244         }
5245 }
5246 int64_tArray CS_LDK_LDKCOption_CVec_SocketAddressZZ_Some_get_some(int64_t ptr) {
5247         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5248         CHECK(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5249         LDKCVec_SocketAddressZ some_var = obj->some;
5250                         int64_tArray some_arr = NULL;
5251                         some_arr = init_int64_tArray(some_var.datalen, __LINE__);
5252                         int64_t *some_arr_ptr = (int64_t*)(((uint8_t*)some_arr) + 8);
5253                         for (size_t p = 0; p < some_var.datalen; p++) {
5254                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5255                                 some_arr_ptr[p] = some_conv_15_ref;
5256                         }
5257                         
5258         return some_arr;
5259 }
5260 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5261         LDKPendingHTLCInfo ret = *owner->contents.result;
5262         ret.is_owned = false;
5263         return ret;
5264 }
5265 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(int64_t owner) {
5266         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5267         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5268         int64_t ret_ref = 0;
5269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5271         return ret_ref;
5272 }
5273
5274 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5275         LDKInboundHTLCErr ret = *owner->contents.err;
5276         ret.is_owned = false;
5277         return ret;
5278 }
5279 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(int64_t owner) {
5280         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5281         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5282         int64_t ret_ref = 0;
5283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5285         return ret_ref;
5286 }
5287
5288 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5289         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5290         for (size_t i = 0; i < ret.datalen; i++) {
5291                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5292         }
5293         return ret;
5294 }
5295 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5296         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5297         for (size_t i = 0; i < ret.datalen; i++) {
5298                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5299         }
5300         return ret;
5301 }
5302 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5303         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5304         for (size_t i = 0; i < ret.datalen; i++) {
5305                 ret.data[i] = Utxo_clone(&orig->data[i]);
5306         }
5307         return ret;
5308 }
5309 uint32_t CS_LDK_LDKCOption_TxOutZ_ty_from_ptr(int64_t ptr) {
5310         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5311         switch(obj->tag) {
5312                 case LDKCOption_TxOutZ_Some: return 0;
5313                 case LDKCOption_TxOutZ_None: return 1;
5314                 default: abort();
5315         }
5316 }
5317 int64_t CS_LDK_LDKCOption_TxOutZ_Some_get_some(int64_t ptr) {
5318         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5319         CHECK(obj->tag == LDKCOption_TxOutZ_Some);
5320         LDKTxOut* some_ref = &obj->some;
5321         return tag_ptr(some_ref, false);
5322 }
5323 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5324         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5325         for (size_t i = 0; i < ret.datalen; i++) {
5326                 ret.data[i] = Input_clone(&orig->data[i]);
5327         }
5328         return ret;
5329 }
5330 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5331         LDKCoinSelection ret = *owner->contents.result;
5332         ret.is_owned = false;
5333         return ret;
5334 }
5335 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_get_ok(int64_t owner) {
5336         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5337         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5338         int64_t ret_ref = 0;
5339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5341         return ret_ref;
5342 }
5343
5344 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5345 CHECK(!owner->result_ok);
5346         return *owner->contents.err;
5347 }
5348 void  CS_LDK_CResult_CoinSelectionNoneZ_get_err(int64_t owner) {
5349         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5350         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5351 }
5352
5353 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5354 CHECK(owner->result_ok);
5355         return CVec_UtxoZ_clone(&*owner->contents.result);
5356 }
5357 int64_tArray  CS_LDK_CResult_CVec_UtxoZNoneZ_get_ok(int64_t owner) {
5358         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5359         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5360         int64_tArray ret_arr = NULL;
5361         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5362         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5363         for (size_t g = 0; g < ret_var.datalen; g++) {
5364                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5365                 int64_t ret_conv_6_ref = 0;
5366                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5367                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5368                 ret_arr_ptr[g] = ret_conv_6_ref;
5369         }
5370         
5371         FREE(ret_var.data);
5372         return ret_arr;
5373 }
5374
5375 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5376 CHECK(!owner->result_ok);
5377         return *owner->contents.err;
5378 }
5379 void  CS_LDK_CResult_CVec_UtxoZNoneZ_get_err(int64_t owner) {
5380         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5381         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5382 }
5383
5384 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5385         return owner->a;
5386 }
5387 int64_t  CS_LDK_C2Tuple_u64u16Z_get_a(int64_t owner) {
5388         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5389         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5390         return ret_conv;
5391 }
5392
5393 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5394         return owner->b;
5395 }
5396 int16_t  CS_LDK_C2Tuple_u64u16Z_get_b(int64_t owner) {
5397         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5398         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5399         return ret_conv;
5400 }
5401
5402 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(int64_t ptr) {
5403         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5404         switch(obj->tag) {
5405                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5406                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5407                 default: abort();
5408         }
5409 }
5410 int64_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(int64_t ptr) {
5411         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5412         CHECK(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5413         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5414         *some_conv = obj->some;
5415                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5416         return tag_ptr(some_conv, true);
5417 }
5418 uint32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(int64_t ptr) {
5419         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5420         switch(obj->tag) {
5421                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5422                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5423                 default: abort();
5424         }
5425 }
5426 int32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_Some_get_some(int64_t ptr) {
5427         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5428         CHECK(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5429         int32_t some_conv = LDKChannelShutdownState_to_cs(obj->some);
5430         return some_conv;
5431 }
5432 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5433 CHECK(owner->result_ok);
5434         return ThirtyTwoBytes_clone(&*owner->contents.result);
5435 }
5436 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(int64_t owner) {
5437         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5438         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5439         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
5440         return ret_arr;
5441 }
5442
5443 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
5444 CHECK(!owner->result_ok);
5445         return APIError_clone(&*owner->contents.err);
5446 }
5447 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_err(int64_t owner) {
5448         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
5449         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5450         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
5451         int64_t ret_ref = tag_ptr(ret_copy, true);
5452         return ret_ref;
5453 }
5454
5455 uint32_t CS_LDK_LDKRecentPaymentDetails_ty_from_ptr(int64_t ptr) {
5456         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5457         switch(obj->tag) {
5458                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5459                 case LDKRecentPaymentDetails_Pending: return 1;
5460                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5461                 case LDKRecentPaymentDetails_Abandoned: return 3;
5462                 default: abort();
5463         }
5464 }
5465 int8_tArray CS_LDK_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(int64_t ptr) {
5466         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5467         CHECK(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
5468         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5469         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
5470         return payment_id_arr;
5471 }
5472 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_id(int64_t ptr) {
5473         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5474         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5475         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5476         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
5477         return payment_id_arr;
5478 }
5479 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_hash(int64_t ptr) {
5480         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5481         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5482         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5483         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5484         return payment_hash_arr;
5485 }
5486 int64_t CS_LDK_LDKRecentPaymentDetails_Pending_get_total_msat(int64_t ptr) {
5487         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5488         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
5489         int64_t total_msat_conv = obj->pending.total_msat;
5490         return total_msat_conv;
5491 }
5492 int8_tArray CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_id(int64_t ptr) {
5493         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5494         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5495         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5496         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
5497         return payment_id_arr;
5498 }
5499 int64_t CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(int64_t ptr) {
5500         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5501         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5502         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5503         return payment_hash_ref;
5504 }
5505 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_id(int64_t ptr) {
5506         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5507         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
5508         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5509         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
5510         return payment_id_arr;
5511 }
5512 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_hash(int64_t ptr) {
5513         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5514         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
5515         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5516         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5517         return payment_hash_arr;
5518 }
5519 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5520         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5521         for (size_t i = 0; i < ret.datalen; i++) {
5522                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5523         }
5524         return ret;
5525 }
5526 uint32_t CS_LDK_LDKPaymentSendFailure_ty_from_ptr(int64_t ptr) {
5527         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5528         switch(obj->tag) {
5529                 case LDKPaymentSendFailure_ParameterError: return 0;
5530                 case LDKPaymentSendFailure_PathParameterError: return 1;
5531                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5532                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5533                 case LDKPaymentSendFailure_PartialFailure: return 4;
5534                 default: abort();
5535         }
5536 }
5537 int64_t CS_LDK_LDKPaymentSendFailure_ParameterError_get_parameter_error(int64_t ptr) {
5538         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5539         CHECK(obj->tag == LDKPaymentSendFailure_ParameterError);
5540         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5541         return parameter_error_ref;
5542 }
5543 int64_tArray CS_LDK_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(int64_t ptr) {
5544         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5545         CHECK(obj->tag == LDKPaymentSendFailure_PathParameterError);
5546         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5547                         int64_tArray path_parameter_error_arr = NULL;
5548                         path_parameter_error_arr = init_int64_tArray(path_parameter_error_var.datalen, __LINE__);
5549                         int64_t *path_parameter_error_arr_ptr = (int64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
5550                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5551                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5552                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5553                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5554                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5555                         }
5556                         
5557         return path_parameter_error_arr;
5558 }
5559 int64_tArray CS_LDK_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(int64_t ptr) {
5560         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5561         CHECK(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
5562         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
5563                         int64_tArray all_failed_resend_safe_arr = NULL;
5564                         all_failed_resend_safe_arr = init_int64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
5565                         int64_t *all_failed_resend_safe_arr_ptr = (int64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
5566                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
5567                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
5568                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
5569                         }
5570                         
5571         return all_failed_resend_safe_arr;
5572 }
5573 int64_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_results(int64_t ptr) {
5574         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5575         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5576         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5577                         int64_tArray results_arr = NULL;
5578                         results_arr = init_int64_tArray(results_var.datalen, __LINE__);
5579                         int64_t *results_arr_ptr = (int64_t*)(((uint8_t*)results_arr) + 8);
5580                         for (size_t w = 0; w < results_var.datalen; w++) {
5581                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5582                                 *results_conv_22_conv = results_var.data[w];
5583                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5584                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5585                         }
5586                         
5587         return results_arr;
5588 }
5589 int64_t CS_LDK_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(int64_t ptr) {
5590         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5591         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5592         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5593                         int64_t failed_paths_retry_ref = 0;
5594                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5595                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5596         return failed_paths_retry_ref;
5597 }
5598 int8_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_payment_id(int64_t ptr) {
5599         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5600         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
5601         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
5602         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5603         return payment_id_arr;
5604 }
5605 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5606 CHECK(owner->result_ok);
5607         return *owner->contents.result;
5608 }
5609 void  CS_LDK_CResult_NonePaymentSendFailureZ_get_ok(int64_t owner) {
5610         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5611         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5612 }
5613
5614 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5615 CHECK(!owner->result_ok);
5616         return PaymentSendFailure_clone(&*owner->contents.err);
5617 }
5618 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_get_err(int64_t owner) {
5619         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5620         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5621         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5622         int64_t ret_ref = tag_ptr(ret_copy, true);
5623         return ret_ref;
5624 }
5625
5626 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5627 CHECK(owner->result_ok);
5628         return *owner->contents.result;
5629 }
5630 void  CS_LDK_CResult_NoneRetryableSendFailureZ_get_ok(int64_t owner) {
5631         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5632         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
5633 }
5634
5635 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
5636 CHECK(!owner->result_ok);
5637         return RetryableSendFailure_clone(&*owner->contents.err);
5638 }
5639 int32_t  CS_LDK_CResult_NoneRetryableSendFailureZ_get_err(int64_t owner) {
5640         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
5641         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
5642         return ret_conv;
5643 }
5644
5645 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5646 CHECK(owner->result_ok);
5647         return ThirtyTwoBytes_clone(&*owner->contents.result);
5648 }
5649 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(int64_t owner) {
5650         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5651         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5652         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5653         return ret_arr;
5654 }
5655
5656 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
5657 CHECK(!owner->result_ok);
5658         return PaymentSendFailure_clone(&*owner->contents.err);
5659 }
5660 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(int64_t owner) {
5661         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
5662         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5663         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
5664         int64_t ret_ref = tag_ptr(ret_copy, true);
5665         return ret_ref;
5666 }
5667
5668 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5669 CHECK(owner->result_ok);
5670         return ThirtyTwoBytes_clone(&*owner->contents.result);
5671 }
5672 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(int64_t owner) {
5673         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5675         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
5676         return ret_arr;
5677 }
5678
5679 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
5680 CHECK(!owner->result_ok);
5681         return RetryableSendFailure_clone(&*owner->contents.err);
5682 }
5683 int32_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(int64_t owner) {
5684         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
5685         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
5686         return ret_conv;
5687 }
5688
5689 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5690         return ThirtyTwoBytes_clone(&owner->a);
5691 }
5692 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(int64_t owner) {
5693         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5694         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5695         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
5696         return ret_arr;
5697 }
5698
5699 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
5700         return ThirtyTwoBytes_clone(&owner->b);
5701 }
5702 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(int64_t owner) {
5703         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
5704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5705         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
5706         return ret_arr;
5707 }
5708
5709 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5710 CHECK(owner->result_ok);
5711         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5712 }
5713 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(int64_t owner) {
5714         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5715         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5716         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
5717         return tag_ptr(ret_conv, true);
5718 }
5719
5720 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
5721 CHECK(!owner->result_ok);
5722         return PaymentSendFailure_clone(&*owner->contents.err);
5723 }
5724 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(int64_t owner) {
5725         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
5726         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5727         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
5728         int64_t ret_ref = tag_ptr(ret_copy, true);
5729         return ret_ref;
5730 }
5731
5732 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
5733         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
5734         for (size_t i = 0; i < ret.datalen; i++) {
5735                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
5736         }
5737         return ret;
5738 }
5739 uint32_t CS_LDK_LDKProbeSendFailure_ty_from_ptr(int64_t ptr) {
5740         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5741         switch(obj->tag) {
5742                 case LDKProbeSendFailure_RouteNotFound: return 0;
5743                 case LDKProbeSendFailure_SendingFailed: return 1;
5744                 default: abort();
5745         }
5746 }
5747 int64_t CS_LDK_LDKProbeSendFailure_SendingFailed_get_sending_failed(int64_t ptr) {
5748         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
5749         CHECK(obj->tag == LDKProbeSendFailure_SendingFailed);
5750         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
5751         return sending_failed_ref;
5752 }
5753 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5754 CHECK(owner->result_ok);
5755         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
5756 }
5757 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(int64_t owner) {
5758         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5759         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
5760         int64_tArray ret_arr = NULL;
5761         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5762         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5763         for (size_t o = 0; o < ret_var.datalen; o++) {
5764                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5765                 *ret_conv_40_conv = ret_var.data[o];
5766                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
5767         }
5768         
5769         FREE(ret_var.data);
5770         return ret_arr;
5771 }
5772
5773 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
5774 CHECK(!owner->result_ok);
5775         return ProbeSendFailure_clone(&*owner->contents.err);
5776 }
5777 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(int64_t owner) {
5778         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
5779         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
5780         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
5781         int64_t ret_ref = tag_ptr(ret_copy, true);
5782         return ret_ref;
5783 }
5784
5785 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5786         return ThirtyTwoBytes_clone(&owner->a);
5787 }
5788 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(int64_t owner) {
5789         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5790         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5791         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data, 32);
5792         return ret_arr;
5793 }
5794
5795 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
5796         return owner->b;
5797 }
5798 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(int64_t owner) {
5799         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
5800         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5801         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form, 33);
5802         return ret_arr;
5803 }
5804
5805 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
5806         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5807         for (size_t i = 0; i < ret.datalen; i++) {
5808                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
5809         }
5810         return ret;
5811 }
5812 uint32_t CS_LDK_LDKCOption_StrZ_ty_from_ptr(int64_t ptr) {
5813         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5814         switch(obj->tag) {
5815                 case LDKCOption_StrZ_Some: return 0;
5816                 case LDKCOption_StrZ_None: return 1;
5817                 default: abort();
5818         }
5819 }
5820 jstring CS_LDK_LDKCOption_StrZ_Some_get_some(int64_t ptr) {
5821         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
5822         CHECK(obj->tag == LDKCOption_StrZ_Some);
5823         LDKStr some_str = obj->some;
5824                         jstring some_conv = str_ref_to_cs(some_str.chars, some_str.len);
5825         return some_conv;
5826 }
5827 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5828 CHECK(owner->result_ok);
5829         return *owner->contents.result;
5830 }
5831 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_ok(int64_t owner) {
5832         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5833         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
5834 }
5835
5836 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
5837 CHECK(!owner->result_ok);
5838         return Bolt12SemanticError_clone(&*owner->contents.err);
5839 }
5840 int32_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_err(int64_t owner) {
5841         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
5842         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
5843         return ret_conv;
5844 }
5845
5846 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5847 CHECK(owner->result_ok);
5848         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
5849 }
5850 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(int64_t owner) {
5851         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5852         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
5853         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
5854         return tag_ptr(ret_conv, true);
5855 }
5856
5857 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
5858 CHECK(!owner->result_ok);
5859         return *owner->contents.err;
5860 }
5861 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(int64_t owner) {
5862         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
5863         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
5864 }
5865
5866 uint32_t CS_LDK_LDKOffersMessage_ty_from_ptr(int64_t ptr) {
5867         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5868         switch(obj->tag) {
5869                 case LDKOffersMessage_InvoiceRequest: return 0;
5870                 case LDKOffersMessage_Invoice: return 1;
5871                 case LDKOffersMessage_InvoiceError: return 2;
5872                 default: abort();
5873         }
5874 }
5875 int64_t CS_LDK_LDKOffersMessage_InvoiceRequest_get_invoice_request(int64_t ptr) {
5876         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5877         CHECK(obj->tag == LDKOffersMessage_InvoiceRequest);
5878         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
5879                         int64_t invoice_request_ref = 0;
5880                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
5881                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
5882         return invoice_request_ref;
5883 }
5884 int64_t CS_LDK_LDKOffersMessage_Invoice_get_invoice(int64_t ptr) {
5885         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5886         CHECK(obj->tag == LDKOffersMessage_Invoice);
5887         LDKBolt12Invoice invoice_var = obj->invoice;
5888                         int64_t invoice_ref = 0;
5889                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
5890                         invoice_ref = tag_ptr(invoice_var.inner, false);
5891         return invoice_ref;
5892 }
5893 int64_t CS_LDK_LDKOffersMessage_InvoiceError_get_invoice_error(int64_t ptr) {
5894         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
5895         CHECK(obj->tag == LDKOffersMessage_InvoiceError);
5896         LDKInvoiceError invoice_error_var = obj->invoice_error;
5897                         int64_t invoice_error_ref = 0;
5898                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
5899                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
5900         return invoice_error_ref;
5901 }
5902 uint32_t CS_LDK_LDKCOption_OffersMessageZ_ty_from_ptr(int64_t ptr) {
5903         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5904         switch(obj->tag) {
5905                 case LDKCOption_OffersMessageZ_Some: return 0;
5906                 case LDKCOption_OffersMessageZ_None: return 1;
5907                 default: abort();
5908         }
5909 }
5910 int64_t CS_LDK_LDKCOption_OffersMessageZ_Some_get_some(int64_t ptr) {
5911         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
5912         CHECK(obj->tag == LDKCOption_OffersMessageZ_Some);
5913         int64_t some_ref = tag_ptr(&obj->some, false);
5914         return some_ref;
5915 }
5916 uint32_t CS_LDK_LDKDestination_ty_from_ptr(int64_t ptr) {
5917         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5918         switch(obj->tag) {
5919                 case LDKDestination_Node: return 0;
5920                 case LDKDestination_BlindedPath: return 1;
5921                 default: abort();
5922         }
5923 }
5924 int8_tArray CS_LDK_LDKDestination_Node_get_node(int64_t ptr) {
5925         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5926         CHECK(obj->tag == LDKDestination_Node);
5927         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
5928         memcpy(node_arr->elems, obj->node.compressed_form, 33);
5929         return node_arr;
5930 }
5931 int64_t CS_LDK_LDKDestination_BlindedPath_get_blinded_path(int64_t ptr) {
5932         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
5933         CHECK(obj->tag == LDKDestination_BlindedPath);
5934         LDKBlindedPath blinded_path_var = obj->blinded_path;
5935                         int64_t blinded_path_ref = 0;
5936                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
5937                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
5938         return blinded_path_ref;
5939 }
5940 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5941         return OffersMessage_clone(&owner->a);
5942 }
5943 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(int64_t owner) {
5944         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5945         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
5946         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
5947         int64_t ret_ref = tag_ptr(ret_copy, true);
5948         return ret_ref;
5949 }
5950
5951 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5952         return Destination_clone(&owner->b);
5953 }
5954 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(int64_t owner) {
5955         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5956         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
5957         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
5958         int64_t ret_ref = tag_ptr(ret_copy, true);
5959         return ret_ref;
5960 }
5961
5962 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
5963         LDKBlindedPath ret = owner->c;
5964         ret.is_owned = false;
5965         return ret;
5966 }
5967 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(int64_t owner) {
5968         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
5969         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
5970         int64_t ret_ref = 0;
5971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5973         return ret_ref;
5974 }
5975
5976 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
5977         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
5978         for (size_t i = 0; i < ret.datalen; i++) {
5979                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
5980         }
5981         return ret;
5982 }
5983 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5984         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5985         ret.is_owned = false;
5986         return ret;
5987 }
5988 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(int64_t owner) {
5989         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5990         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5991         int64_t ret_ref = 0;
5992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5994         return ret_ref;
5995 }
5996
5997 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5998 CHECK(!owner->result_ok);
5999         return DecodeError_clone(&*owner->contents.err);
6000 }
6001 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(int64_t owner) {
6002         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6004         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6005         int64_t ret_ref = tag_ptr(ret_copy, true);
6006         return ret_ref;
6007 }
6008
6009 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6010         LDKChannelCounterparty ret = *owner->contents.result;
6011         ret.is_owned = false;
6012         return ret;
6013 }
6014 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(int64_t owner) {
6015         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6016         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6017         int64_t ret_ref = 0;
6018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6020         return ret_ref;
6021 }
6022
6023 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6024 CHECK(!owner->result_ok);
6025         return DecodeError_clone(&*owner->contents.err);
6026 }
6027 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_err(int64_t owner) {
6028         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6030         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6031         int64_t ret_ref = tag_ptr(ret_copy, true);
6032         return ret_ref;
6033 }
6034
6035 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6036         LDKChannelDetails ret = *owner->contents.result;
6037         ret.is_owned = false;
6038         return ret;
6039 }
6040 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_ok(int64_t owner) {
6041         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6042         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6043         int64_t ret_ref = 0;
6044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6046         return ret_ref;
6047 }
6048
6049 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6050 CHECK(!owner->result_ok);
6051         return DecodeError_clone(&*owner->contents.err);
6052 }
6053 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_err(int64_t owner) {
6054         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6056         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6057         int64_t ret_ref = tag_ptr(ret_copy, true);
6058         return ret_ref;
6059 }
6060
6061 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6062         LDKPhantomRouteHints ret = *owner->contents.result;
6063         ret.is_owned = false;
6064         return ret;
6065 }
6066 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(int64_t owner) {
6067         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6068         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6069         int64_t ret_ref = 0;
6070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6072         return ret_ref;
6073 }
6074
6075 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6076 CHECK(!owner->result_ok);
6077         return DecodeError_clone(&*owner->contents.err);
6078 }
6079 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_err(int64_t owner) {
6080         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6082         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6083         int64_t ret_ref = tag_ptr(ret_copy, true);
6084         return ret_ref;
6085 }
6086
6087 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6088         LDKBlindedForward ret = *owner->contents.result;
6089         ret.is_owned = false;
6090         return ret;
6091 }
6092 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_ok(int64_t owner) {
6093         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6094         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
6095         int64_t ret_ref = 0;
6096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6098         return ret_ref;
6099 }
6100
6101 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6102 CHECK(!owner->result_ok);
6103         return DecodeError_clone(&*owner->contents.err);
6104 }
6105 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_err(int64_t owner) {
6106         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6108         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6109         int64_t ret_ref = tag_ptr(ret_copy, true);
6110         return ret_ref;
6111 }
6112
6113 uint32_t CS_LDK_LDKPendingHTLCRouting_ty_from_ptr(int64_t ptr) {
6114         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6115         switch(obj->tag) {
6116                 case LDKPendingHTLCRouting_Forward: return 0;
6117                 case LDKPendingHTLCRouting_Receive: return 1;
6118                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6119                 default: abort();
6120         }
6121 }
6122 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_onion_packet(int64_t ptr) {
6123         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6124         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6125         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6126                         int64_t onion_packet_ref = 0;
6127                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6128                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6129         return onion_packet_ref;
6130 }
6131 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_short_channel_id(int64_t ptr) {
6132         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6133         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6134         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6135         return short_channel_id_conv;
6136 }
6137 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_blinded(int64_t ptr) {
6138         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6139         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6140         LDKBlindedForward blinded_var = obj->forward.blinded;
6141                         int64_t blinded_ref = 0;
6142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6143                         blinded_ref = tag_ptr(blinded_var.inner, false);
6144         return blinded_ref;
6145 }
6146 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_data(int64_t ptr) {
6147         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6148         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6149         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6150                         int64_t payment_data_ref = 0;
6151                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6152                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6153         return payment_data_ref;
6154 }
6155 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_metadata(int64_t ptr) {
6156         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6157         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6158         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6159         return payment_metadata_ref;
6160 }
6161 int32_t CS_LDK_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(int64_t ptr) {
6162         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6163         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6164         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6165         return incoming_cltv_expiry_conv;
6166 }
6167 int8_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(int64_t ptr) {
6168         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6169         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6170         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6171         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6172         return phantom_shared_secret_arr;
6173 }
6174 int64_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_custom_tlvs(int64_t ptr) {
6175         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6176         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6177         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6178                         int64_tArray custom_tlvs_arr = NULL;
6179                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6180                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6181                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6182                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6183                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6184                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6185                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6186                         }
6187                         
6188         return custom_tlvs_arr;
6189 }
6190 jboolean CS_LDK_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(int64_t ptr) {
6191         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6192         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6193         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6194         return requires_blinded_error_conv;
6195 }
6196 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(int64_t ptr) {
6197         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6198         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6199         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6200                         int64_t payment_data_ref = 0;
6201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6202                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6203         return payment_data_ref;
6204 }
6205 int8_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(int64_t ptr) {
6206         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6207         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6208         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6209         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6210         return payment_preimage_arr;
6211 }
6212 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(int64_t ptr) {
6213         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6214         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6215         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6216         return payment_metadata_ref;
6217 }
6218 int32_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(int64_t ptr) {
6219         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6220         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6221         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6222         return incoming_cltv_expiry_conv;
6223 }
6224 int64_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(int64_t ptr) {
6225         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6226         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6227         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6228                         int64_tArray custom_tlvs_arr = NULL;
6229                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6230                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6231                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6232                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6233                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6234                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6235                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6236                         }
6237                         
6238         return custom_tlvs_arr;
6239 }
6240 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6241 CHECK(owner->result_ok);
6242         return PendingHTLCRouting_clone(&*owner->contents.result);
6243 }
6244 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(int64_t owner) {
6245         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6246         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6247         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6248         int64_t ret_ref = tag_ptr(ret_copy, true);
6249         return ret_ref;
6250 }
6251
6252 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6253 CHECK(!owner->result_ok);
6254         return DecodeError_clone(&*owner->contents.err);
6255 }
6256 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(int64_t owner) {
6257         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6258         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6259         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6260         int64_t ret_ref = tag_ptr(ret_copy, true);
6261         return ret_ref;
6262 }
6263
6264 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6265         LDKPendingHTLCInfo ret = *owner->contents.result;
6266         ret.is_owned = false;
6267         return ret;
6268 }
6269 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(int64_t owner) {
6270         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6271         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6272         int64_t ret_ref = 0;
6273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6275         return ret_ref;
6276 }
6277
6278 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6279 CHECK(!owner->result_ok);
6280         return DecodeError_clone(&*owner->contents.err);
6281 }
6282 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_err(int64_t owner) {
6283         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6284         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6285         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6286         int64_t ret_ref = tag_ptr(ret_copy, true);
6287         return ret_ref;
6288 }
6289
6290 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6291 CHECK(owner->result_ok);
6292         return BlindedFailure_clone(&*owner->contents.result);
6293 }
6294 int32_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_ok(int64_t owner) {
6295         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6296         int32_t ret_conv = LDKBlindedFailure_to_cs(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6297         return ret_conv;
6298 }
6299
6300 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6301 CHECK(!owner->result_ok);
6302         return DecodeError_clone(&*owner->contents.err);
6303 }
6304 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_err(int64_t owner) {
6305         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6307         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6308         int64_t ret_ref = tag_ptr(ret_copy, true);
6309         return ret_ref;
6310 }
6311
6312 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6313 CHECK(owner->result_ok);
6314         return ChannelShutdownState_clone(&*owner->contents.result);
6315 }
6316 int32_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(int64_t owner) {
6317         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6318         int32_t ret_conv = LDKChannelShutdownState_to_cs(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6319         return ret_conv;
6320 }
6321
6322 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6323 CHECK(!owner->result_ok);
6324         return DecodeError_clone(&*owner->contents.err);
6325 }
6326 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_err(int64_t owner) {
6327         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6328         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6329         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6330         int64_t ret_ref = tag_ptr(ret_copy, true);
6331         return ret_ref;
6332 }
6333
6334 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6335         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6336         for (size_t i = 0; i < ret.datalen; i++) {
6337                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6338         }
6339         return ret;
6340 }
6341 typedef struct LDKWatch_JCalls {
6342         atomic_size_t refcnt;
6343         uint32_t instance_ptr;
6344 } LDKWatch_JCalls;
6345 static void LDKWatch_JCalls_free(void* this_arg) {
6346         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6347         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6348                 FREE(j_calls);
6349         }
6350 }
6351 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6352         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6353         LDKOutPoint funding_txo_var = funding_txo;
6354         int64_t funding_txo_ref = 0;
6355         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6356         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6357         LDKChannelMonitor monitor_var = monitor;
6358         int64_t monitor_ref = 0;
6359         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6360         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6361         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 27, funding_txo_ref, monitor_ref);
6362         void* ret_ptr = untag_ptr(ret);
6363         CHECK_ACCESS(ret_ptr);
6364         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6365         FREE(untag_ptr(ret));
6366         return ret_conv;
6367 }
6368 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6369         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6370         LDKOutPoint funding_txo_var = funding_txo;
6371         int64_t funding_txo_ref = 0;
6372         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6373         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6374         LDKChannelMonitorUpdate update_var = *update;
6375         int64_t update_ref = 0;
6376         update_var = ChannelMonitorUpdate_clone(&update_var);
6377         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6378         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6379         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_ll(j_calls->instance_ptr, 28, funding_txo_ref, update_ref);
6380         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
6381         return ret_conv;
6382 }
6383 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6384         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6385         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 29);
6386         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6387         ret_constr.datalen = ret->arr_len;
6388         if (ret_constr.datalen > 0)
6389                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6390         else
6391                 ret_constr.data = NULL;
6392         int64_t* ret_vals = ret->elems;
6393         for (size_t x = 0; x < ret_constr.datalen; x++) {
6394                 int64_t ret_conv_49 = ret_vals[x];
6395                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6396                 CHECK_ACCESS(ret_conv_49_ptr);
6397                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6398                 FREE(untag_ptr(ret_conv_49));
6399                 ret_constr.data[x] = ret_conv_49_conv;
6400         }
6401         FREE(ret);
6402         return ret_constr;
6403 }
6404 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6405         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6406         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6407 }
6408 static inline LDKWatch LDKWatch_init (int64_t o) {
6409         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6410         atomic_init(&calls->refcnt, 1);
6411         calls->instance_ptr = o;
6412
6413         LDKWatch ret = {
6414                 .this_arg = (void*) calls,
6415                 .watch_channel = watch_channel_LDKWatch_jcall,
6416                 .update_channel = update_channel_LDKWatch_jcall,
6417                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6418                 .free = LDKWatch_JCalls_free,
6419         };
6420         return ret;
6421 }
6422 uint64_t  CS_LDK_LDKWatch_new(int32_t o) {
6423         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6424         *res_ptr = LDKWatch_init(o);
6425         return tag_ptr(res_ptr, true);
6426 }
6427 int64_t  CS_LDK_Watch_watch_channel(int64_t this_arg, int64_t funding_txo, int64_t monitor) {
6428         void* this_arg_ptr = untag_ptr(this_arg);
6429         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6430         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6431         LDKOutPoint funding_txo_conv;
6432         funding_txo_conv.inner = untag_ptr(funding_txo);
6433         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6434         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6435         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6436         LDKChannelMonitor monitor_conv;
6437         monitor_conv.inner = untag_ptr(monitor);
6438         monitor_conv.is_owned = ptr_is_owned(monitor);
6439         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6440         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6441         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6442         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6443         return tag_ptr(ret_conv, true);
6444 }
6445
6446 int32_t  CS_LDK_Watch_update_channel(int64_t this_arg, int64_t funding_txo, int64_t update) {
6447         void* this_arg_ptr = untag_ptr(this_arg);
6448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6449         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6450         LDKOutPoint funding_txo_conv;
6451         funding_txo_conv.inner = untag_ptr(funding_txo);
6452         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6453         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6454         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6455         LDKChannelMonitorUpdate update_conv;
6456         update_conv.inner = untag_ptr(update);
6457         update_conv.is_owned = ptr_is_owned(update);
6458         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6459         update_conv.is_owned = false;
6460         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6461         return ret_conv;
6462 }
6463
6464 int64_tArray  CS_LDK_Watch_release_pending_monitor_events(int64_t this_arg) {
6465         void* this_arg_ptr = untag_ptr(this_arg);
6466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6467         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6468         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6469         int64_tArray ret_arr = NULL;
6470         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
6471         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
6472         for (size_t x = 0; x < ret_var.datalen; x++) {
6473                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6474                 *ret_conv_49_conv = ret_var.data[x];
6475                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6476         }
6477         
6478         FREE(ret_var.data);
6479         return ret_arr;
6480 }
6481
6482 typedef struct LDKBroadcasterInterface_JCalls {
6483         atomic_size_t refcnt;
6484         uint32_t instance_ptr;
6485 } LDKBroadcasterInterface_JCalls;
6486 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6487         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6488         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6489                 FREE(j_calls);
6490         }
6491 }
6492 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6493         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6494         LDKCVec_TransactionZ txs_var = txs;
6495         ptrArray txs_arr = NULL;
6496         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6497         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6498         for (size_t i = 0; i < txs_var.datalen; i++) {
6499                 LDKTransaction txs_conv_8_var = txs_var.data[i];
6500                 int8_tArray txs_conv_8_arr = init_int8_tArray(txs_conv_8_var.datalen, __LINE__);
6501                 memcpy(txs_conv_8_arr->elems, txs_conv_8_var.data, txs_conv_8_var.datalen);
6502                 Transaction_free(txs_conv_8_var);
6503                 txs_arr_ptr[i] = txs_conv_8_arr;
6504         }
6505         
6506         FREE(txs_var.data);
6507         js_invoke_function_void_l(j_calls->instance_ptr, 30, (int64_t)txs_arr);
6508 }
6509 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6510         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6511         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6512 }
6513 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (int64_t o) {
6514         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6515         atomic_init(&calls->refcnt, 1);
6516         calls->instance_ptr = o;
6517
6518         LDKBroadcasterInterface ret = {
6519                 .this_arg = (void*) calls,
6520                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6521                 .free = LDKBroadcasterInterface_JCalls_free,
6522         };
6523         return ret;
6524 }
6525 uint64_t  CS_LDK_LDKBroadcasterInterface_new(int32_t o) {
6526         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6527         *res_ptr = LDKBroadcasterInterface_init(o);
6528         return tag_ptr(res_ptr, true);
6529 }
6530 void  CS_LDK_BroadcasterInterface_broadcast_transactions(int64_t this_arg, ptrArray txs) {
6531         void* this_arg_ptr = untag_ptr(this_arg);
6532         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6533         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6534         LDKCVec_TransactionZ txs_constr;
6535         txs_constr.datalen = txs->arr_len;
6536         if (txs_constr.datalen > 0)
6537                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6538         else
6539                 txs_constr.data = NULL;
6540         int8_tArray* txs_vals = (void*) txs->elems;
6541         for (size_t i = 0; i < txs_constr.datalen; i++) {
6542                 int8_tArray txs_conv_8 = txs_vals[i];
6543                 LDKTransaction txs_conv_8_ref;
6544                 txs_conv_8_ref.datalen = txs_conv_8->arr_len;
6545                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
6546                 memcpy(txs_conv_8_ref.data, txs_conv_8->elems, txs_conv_8_ref.datalen); FREE(txs_conv_8);
6547                 txs_conv_8_ref.data_is_owned = true;
6548                 txs_constr.data[i] = txs_conv_8_ref;
6549         }
6550         FREE(txs);
6551         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6552 }
6553
6554 typedef struct LDKEntropySource_JCalls {
6555         atomic_size_t refcnt;
6556         uint32_t instance_ptr;
6557 } LDKEntropySource_JCalls;
6558 static void LDKEntropySource_JCalls_free(void* this_arg) {
6559         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6560         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6561                 FREE(j_calls);
6562         }
6563 }
6564 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6565         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6566         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 31);
6567         LDKThirtyTwoBytes ret_ref;
6568         CHECK(ret->arr_len == 32);
6569         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6570         return ret_ref;
6571 }
6572 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6573         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6574         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6575 }
6576 static inline LDKEntropySource LDKEntropySource_init (int64_t o) {
6577         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6578         atomic_init(&calls->refcnt, 1);
6579         calls->instance_ptr = o;
6580
6581         LDKEntropySource ret = {
6582                 .this_arg = (void*) calls,
6583                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6584                 .free = LDKEntropySource_JCalls_free,
6585         };
6586         return ret;
6587 }
6588 uint64_t  CS_LDK_LDKEntropySource_new(int32_t o) {
6589         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6590         *res_ptr = LDKEntropySource_init(o);
6591         return tag_ptr(res_ptr, true);
6592 }
6593 int8_tArray  CS_LDK_EntropySource_get_secure_random_bytes(int64_t this_arg) {
6594         void* this_arg_ptr = untag_ptr(this_arg);
6595         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6596         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6597         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6598         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6599         return ret_arr;
6600 }
6601
6602 uint32_t CS_LDK_LDKUnsignedGossipMessage_ty_from_ptr(int64_t ptr) {
6603         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6604         switch(obj->tag) {
6605                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6606                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6607                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6608                 default: abort();
6609         }
6610 }
6611 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(int64_t ptr) {
6612         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6613         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6614         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6615                         int64_t channel_announcement_ref = 0;
6616                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6617                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6618         return channel_announcement_ref;
6619 }
6620 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(int64_t ptr) {
6621         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6622         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6623         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6624                         int64_t channel_update_ref = 0;
6625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6626                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6627         return channel_update_ref;
6628 }
6629 int64_t CS_LDK_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(int64_t ptr) {
6630         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6631         CHECK(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6632         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6633                         int64_t node_announcement_ref = 0;
6634                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6635                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6636         return node_announcement_ref;
6637 }
6638 typedef struct LDKNodeSigner_JCalls {
6639         atomic_size_t refcnt;
6640         uint32_t instance_ptr;
6641 } LDKNodeSigner_JCalls;
6642 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6643         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6644         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6645                 FREE(j_calls);
6646         }
6647 }
6648 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6649         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6650         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 32);
6651         LDKThirtyTwoBytes ret_ref;
6652         CHECK(ret->arr_len == 32);
6653         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6654         return ret_ref;
6655 }
6656 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6657         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6658         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6659         uint64_t ret = js_invoke_function_l_Recipient(j_calls->instance_ptr, 33, recipient_conv);
6660         void* ret_ptr = untag_ptr(ret);
6661         CHECK_ACCESS(ret_ptr);
6662         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6663         FREE(untag_ptr(ret));
6664         return ret_conv;
6665 }
6666 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
6667         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6668         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6669         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6670         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6671         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
6672         *tweak_copy = tweak;
6673         int64_t tweak_ref = tag_ptr(tweak_copy, true);
6674         uint64_t ret = js_invoke_function_l_Recipientll(j_calls->instance_ptr, 34, recipient_conv, (int64_t)other_key_arr, tweak_ref);
6675         void* ret_ptr = untag_ptr(ret);
6676         CHECK_ACCESS(ret_ptr);
6677         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
6678         FREE(untag_ptr(ret));
6679         return ret_conv;
6680 }
6681 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6682         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6683         LDKu8slice hrp_bytes_var = hrp_bytes;
6684         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6685         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6686         LDKCVec_U5Z invoice_data_var = invoice_data;
6687         ptrArray invoice_data_arr = NULL;
6688         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6689         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6690         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6691                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6692                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6693         }
6694         
6695         FREE(invoice_data_var.data);
6696         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
6697         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);
6698         void* ret_ptr = untag_ptr(ret);
6699         CHECK_ACCESS(ret_ptr);
6700         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6701         FREE(untag_ptr(ret));
6702         return ret_conv;
6703 }
6704 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
6705         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6706         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
6707         int64_t invoice_request_ref = 0;
6708         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
6709         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6710         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
6711         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 36, invoice_request_ref);
6712         void* ret_ptr = untag_ptr(ret);
6713         CHECK_ACCESS(ret_ptr);
6714         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6715         FREE(untag_ptr(ret));
6716         return ret_conv;
6717 }
6718 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
6719         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6720         LDKUnsignedBolt12Invoice invoice_var = *invoice;
6721         int64_t invoice_ref = 0;
6722         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
6723         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6724         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
6725         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 37, invoice_ref);
6726         void* ret_ptr = untag_ptr(ret);
6727         CHECK_ACCESS(ret_ptr);
6728         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
6729         FREE(untag_ptr(ret));
6730         return ret_conv;
6731 }
6732 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6733         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6734         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6735         *msg_copy = msg;
6736         int64_t msg_ref = tag_ptr(msg_copy, true);
6737         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 38, msg_ref);
6738         void* ret_ptr = untag_ptr(ret);
6739         CHECK_ACCESS(ret_ptr);
6740         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
6741         FREE(untag_ptr(ret));
6742         return ret_conv;
6743 }
6744 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6745         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6746         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6747 }
6748 static inline LDKNodeSigner LDKNodeSigner_init (int64_t o) {
6749         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6750         atomic_init(&calls->refcnt, 1);
6751         calls->instance_ptr = o;
6752
6753         LDKNodeSigner ret = {
6754                 .this_arg = (void*) calls,
6755                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6756                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6757                 .ecdh = ecdh_LDKNodeSigner_jcall,
6758                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6759                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
6760                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
6761                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6762                 .free = LDKNodeSigner_JCalls_free,
6763         };
6764         return ret;
6765 }
6766 uint64_t  CS_LDK_LDKNodeSigner_new(int32_t o) {
6767         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6768         *res_ptr = LDKNodeSigner_init(o);
6769         return tag_ptr(res_ptr, true);
6770 }
6771 int8_tArray  CS_LDK_NodeSigner_get_inbound_payment_key_material(int64_t this_arg) {
6772         void* this_arg_ptr = untag_ptr(this_arg);
6773         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6774         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6775         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6776         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6777         return ret_arr;
6778 }
6779
6780 int64_t  CS_LDK_NodeSigner_get_node_id(int64_t this_arg, int32_t recipient) {
6781         void* this_arg_ptr = untag_ptr(this_arg);
6782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6783         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6784         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6785         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6786         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6787         return tag_ptr(ret_conv, true);
6788 }
6789
6790 int64_t  CS_LDK_NodeSigner_ecdh(int64_t this_arg, int32_t recipient, int8_tArray other_key, int64_t tweak) {
6791         void* this_arg_ptr = untag_ptr(this_arg);
6792         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6793         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6794         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6795         LDKPublicKey other_key_ref;
6796         CHECK(other_key->arr_len == 33);
6797         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6798         void* tweak_ptr = untag_ptr(tweak);
6799         CHECK_ACCESS(tweak_ptr);
6800         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
6801         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
6802         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
6803         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6804         return tag_ptr(ret_conv, true);
6805 }
6806
6807 int64_t  CS_LDK_NodeSigner_sign_invoice(int64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, int32_t recipient) {
6808         void* this_arg_ptr = untag_ptr(this_arg);
6809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6810         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6811         LDKu8slice hrp_bytes_ref;
6812         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6813         hrp_bytes_ref.data = hrp_bytes->elems;
6814         LDKCVec_U5Z invoice_data_constr;
6815         invoice_data_constr.datalen = invoice_data->arr_len;
6816         if (invoice_data_constr.datalen > 0)
6817                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6818         else
6819                 invoice_data_constr.data = NULL;
6820         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6821         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6822                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6823                 
6824                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6825         }
6826         FREE(invoice_data);
6827         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
6828         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6829         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6830         FREE(hrp_bytes);
6831         return tag_ptr(ret_conv, true);
6832 }
6833
6834 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice_request(int64_t this_arg, int64_t invoice_request) {
6835         void* this_arg_ptr = untag_ptr(this_arg);
6836         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6837         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6838         LDKUnsignedInvoiceRequest invoice_request_conv;
6839         invoice_request_conv.inner = untag_ptr(invoice_request);
6840         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
6841         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
6842         invoice_request_conv.is_owned = false;
6843         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6844         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
6845         return tag_ptr(ret_conv, true);
6846 }
6847
6848 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice(int64_t this_arg, int64_t invoice) {
6849         void* this_arg_ptr = untag_ptr(this_arg);
6850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6851         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6852         LDKUnsignedBolt12Invoice invoice_conv;
6853         invoice_conv.inner = untag_ptr(invoice);
6854         invoice_conv.is_owned = ptr_is_owned(invoice);
6855         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
6856         invoice_conv.is_owned = false;
6857         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
6858         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
6859         return tag_ptr(ret_conv, true);
6860 }
6861
6862 int64_t  CS_LDK_NodeSigner_sign_gossip_message(int64_t this_arg, int64_t msg) {
6863         void* this_arg_ptr = untag_ptr(this_arg);
6864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6865         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6866         void* msg_ptr = untag_ptr(msg);
6867         CHECK_ACCESS(msg_ptr);
6868         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6869         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6870         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
6871         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6872         return tag_ptr(ret_conv, true);
6873 }
6874
6875 typedef struct LDKSignerProvider_JCalls {
6876         atomic_size_t refcnt;
6877         uint32_t instance_ptr;
6878 } LDKSignerProvider_JCalls;
6879 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6880         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6881         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6882                 FREE(j_calls);
6883         }
6884 }
6885 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6886         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6887         jboolean inbound_conv = inbound;
6888         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6889         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6890         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6891         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);
6892         LDKThirtyTwoBytes ret_ref;
6893         CHECK(ret->arr_len == 32);
6894         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6895         return ret_ref;
6896 }
6897 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6898         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6899         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6900         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6901         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6902         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 40, channel_value_satoshis_conv, (int64_t)channel_keys_id_arr);
6903         void* ret_ptr = untag_ptr(ret);
6904         CHECK_ACCESS(ret_ptr);
6905         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6906         FREE(untag_ptr(ret));
6907         return ret_conv;
6908 }
6909 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6910         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6911         LDKu8slice reader_var = reader;
6912         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6913         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6914         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 41, (int64_t)reader_arr);
6915         void* ret_ptr = untag_ptr(ret);
6916         CHECK_ACCESS(ret_ptr);
6917         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6918         FREE(untag_ptr(ret));
6919         return ret_conv;
6920 }
6921 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
6922         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6923         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6924         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6925         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 42, (int64_t)channel_keys_id_arr);
6926         void* ret_ptr = untag_ptr(ret);
6927         CHECK_ACCESS(ret_ptr);
6928         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
6929         FREE(untag_ptr(ret));
6930         return ret_conv;
6931 }
6932 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6933         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6934         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 43);
6935         void* ret_ptr = untag_ptr(ret);
6936         CHECK_ACCESS(ret_ptr);
6937         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6938         FREE(untag_ptr(ret));
6939         return ret_conv;
6940 }
6941 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6942         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6943         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6944 }
6945 static inline LDKSignerProvider LDKSignerProvider_init (int64_t o) {
6946         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6947         atomic_init(&calls->refcnt, 1);
6948         calls->instance_ptr = o;
6949
6950         LDKSignerProvider ret = {
6951                 .this_arg = (void*) calls,
6952                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6953                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6954                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6955                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6956                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6957                 .free = LDKSignerProvider_JCalls_free,
6958         };
6959         return ret;
6960 }
6961 uint64_t  CS_LDK_LDKSignerProvider_new(int32_t o) {
6962         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
6963         *res_ptr = LDKSignerProvider_init(o);
6964         return tag_ptr(res_ptr, true);
6965 }
6966 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) {
6967         void* this_arg_ptr = untag_ptr(this_arg);
6968         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6969         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6970         LDKU128 user_channel_id_ref;
6971         CHECK(user_channel_id->arr_len == 16);
6972         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
6973         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6974         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);
6975         return ret_arr;
6976 }
6977
6978 int64_t  CS_LDK_SignerProvider_derive_channel_signer(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
6979         void* this_arg_ptr = untag_ptr(this_arg);
6980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6981         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6982         LDKThirtyTwoBytes channel_keys_id_ref;
6983         CHECK(channel_keys_id->arr_len == 32);
6984         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
6985         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
6986         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
6987         return tag_ptr(ret_ret, true);
6988 }
6989
6990 int64_t  CS_LDK_SignerProvider_read_chan_signer(int64_t this_arg, int8_tArray reader) {
6991         void* this_arg_ptr = untag_ptr(this_arg);
6992         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6993         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
6994         LDKu8slice reader_ref;
6995         reader_ref.datalen = reader->arr_len;
6996         reader_ref.data = reader->elems;
6997         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
6998         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6999         FREE(reader);
7000         return tag_ptr(ret_conv, true);
7001 }
7002
7003 int64_t  CS_LDK_SignerProvider_get_destination_script(int64_t this_arg, int8_tArray channel_keys_id) {
7004         void* this_arg_ptr = untag_ptr(this_arg);
7005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7006         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7007         LDKThirtyTwoBytes channel_keys_id_ref;
7008         CHECK(channel_keys_id->arr_len == 32);
7009         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7010         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
7011         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
7012         return tag_ptr(ret_conv, true);
7013 }
7014
7015 int64_t  CS_LDK_SignerProvider_get_shutdown_scriptpubkey(int64_t this_arg) {
7016         void* this_arg_ptr = untag_ptr(this_arg);
7017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7018         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7019         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7020         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7021         return tag_ptr(ret_conv, true);
7022 }
7023
7024 typedef struct LDKFeeEstimator_JCalls {
7025         atomic_size_t refcnt;
7026         uint32_t instance_ptr;
7027 } LDKFeeEstimator_JCalls;
7028 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7029         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7030         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7031                 FREE(j_calls);
7032         }
7033 }
7034 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7035         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7036         int32_t confirmation_target_conv = LDKConfirmationTarget_to_cs(confirmation_target);
7037         return js_invoke_function_i_ConfirmationTarget(j_calls->instance_ptr, 44, confirmation_target_conv);
7038 }
7039 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7040         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7041         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7042 }
7043 static inline LDKFeeEstimator LDKFeeEstimator_init (int64_t o) {
7044         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7045         atomic_init(&calls->refcnt, 1);
7046         calls->instance_ptr = o;
7047
7048         LDKFeeEstimator ret = {
7049                 .this_arg = (void*) calls,
7050                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7051                 .free = LDKFeeEstimator_JCalls_free,
7052         };
7053         return ret;
7054 }
7055 uint64_t  CS_LDK_LDKFeeEstimator_new(int32_t o) {
7056         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7057         *res_ptr = LDKFeeEstimator_init(o);
7058         return tag_ptr(res_ptr, true);
7059 }
7060 int32_t  CS_LDK_FeeEstimator_get_est_sat_per_1000_weight(int64_t this_arg, int32_t confirmation_target) {
7061         void* this_arg_ptr = untag_ptr(this_arg);
7062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7063         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7064         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_cs(confirmation_target);
7065         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7066         return ret_conv;
7067 }
7068
7069 typedef struct LDKMessageRouter_JCalls {
7070         atomic_size_t refcnt;
7071         uint32_t instance_ptr;
7072 } LDKMessageRouter_JCalls;
7073 static void LDKMessageRouter_JCalls_free(void* this_arg) {
7074         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7075         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7076                 FREE(j_calls);
7077         }
7078 }
7079 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
7080         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7081         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
7082         memcpy(sender_arr->elems, sender.compressed_form, 33);
7083         LDKCVec_PublicKeyZ peers_var = peers;
7084         ptrArray peers_arr = NULL;
7085         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7086         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7087         for (size_t i = 0; i < peers_var.datalen; i++) {
7088                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7089                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7090                 peers_arr_ptr[i] = peers_conv_8_arr;
7091         }
7092         
7093         FREE(peers_var.data);
7094         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7095         *destination_copy = destination;
7096         int64_t destination_ref = tag_ptr(destination_copy, true);
7097         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 45, (int64_t)sender_arr, (int64_t)peers_arr, destination_ref);
7098         void* ret_ptr = untag_ptr(ret);
7099         CHECK_ACCESS(ret_ptr);
7100         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7101         FREE(untag_ptr(ret));
7102         return ret_conv;
7103 }
7104 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7105         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7106         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7107         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7108         LDKCVec_PublicKeyZ peers_var = peers;
7109         ptrArray peers_arr = NULL;
7110         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7111         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7112         for (size_t i = 0; i < peers_var.datalen; i++) {
7113                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7114                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7115                 peers_arr_ptr[i] = peers_conv_8_arr;
7116         }
7117         
7118         FREE(peers_var.data);
7119         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 46, (int64_t)recipient_arr, (int64_t)peers_arr);
7120         void* ret_ptr = untag_ptr(ret);
7121         CHECK_ACCESS(ret_ptr);
7122         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7123         FREE(untag_ptr(ret));
7124         return ret_conv;
7125 }
7126 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7127         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7128         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7129 }
7130 static inline LDKMessageRouter LDKMessageRouter_init (int64_t o) {
7131         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7132         atomic_init(&calls->refcnt, 1);
7133         calls->instance_ptr = o;
7134
7135         LDKMessageRouter ret = {
7136                 .this_arg = (void*) calls,
7137                 .find_path = find_path_LDKMessageRouter_jcall,
7138                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7139                 .free = LDKMessageRouter_JCalls_free,
7140         };
7141         return ret;
7142 }
7143 uint64_t  CS_LDK_LDKMessageRouter_new(int32_t o) {
7144         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7145         *res_ptr = LDKMessageRouter_init(o);
7146         return tag_ptr(res_ptr, true);
7147 }
7148 int64_t  CS_LDK_MessageRouter_find_path(int64_t this_arg, int8_tArray sender, ptrArray peers, int64_t destination) {
7149         void* this_arg_ptr = untag_ptr(this_arg);
7150         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7151         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7152         LDKPublicKey sender_ref;
7153         CHECK(sender->arr_len == 33);
7154         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7155         LDKCVec_PublicKeyZ peers_constr;
7156         peers_constr.datalen = peers->arr_len;
7157         if (peers_constr.datalen > 0)
7158                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7159         else
7160                 peers_constr.data = NULL;
7161         int8_tArray* peers_vals = (void*) peers->elems;
7162         for (size_t i = 0; i < peers_constr.datalen; i++) {
7163                 int8_tArray peers_conv_8 = peers_vals[i];
7164                 LDKPublicKey peers_conv_8_ref;
7165                 CHECK(peers_conv_8->arr_len == 33);
7166                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7167                 peers_constr.data[i] = peers_conv_8_ref;
7168         }
7169         FREE(peers);
7170         void* destination_ptr = untag_ptr(destination);
7171         CHECK_ACCESS(destination_ptr);
7172         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7173         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7174         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7175         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7176         return tag_ptr(ret_conv, true);
7177 }
7178
7179 int64_t  CS_LDK_MessageRouter_create_blinded_paths(int64_t this_arg, int8_tArray recipient, ptrArray peers) {
7180         void* this_arg_ptr = untag_ptr(this_arg);
7181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7182         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7183         LDKPublicKey recipient_ref;
7184         CHECK(recipient->arr_len == 33);
7185         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7186         LDKCVec_PublicKeyZ peers_constr;
7187         peers_constr.datalen = peers->arr_len;
7188         if (peers_constr.datalen > 0)
7189                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7190         else
7191                 peers_constr.data = NULL;
7192         int8_tArray* peers_vals = (void*) peers->elems;
7193         for (size_t i = 0; i < peers_constr.datalen; i++) {
7194                 int8_tArray peers_conv_8 = peers_vals[i];
7195                 LDKPublicKey peers_conv_8_ref;
7196                 CHECK(peers_conv_8->arr_len == 33);
7197                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7198                 peers_constr.data[i] = peers_conv_8_ref;
7199         }
7200         FREE(peers);
7201         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7202         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7203         return tag_ptr(ret_conv, true);
7204 }
7205
7206 typedef struct LDKRouter_JCalls {
7207         atomic_size_t refcnt;
7208         uint32_t instance_ptr;
7209         LDKMessageRouter_JCalls* MessageRouter;
7210 } LDKRouter_JCalls;
7211 static void LDKRouter_JCalls_free(void* this_arg) {
7212         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7213         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7214                 FREE(j_calls);
7215         }
7216 }
7217 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7218         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7219         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7220         memcpy(payer_arr->elems, payer.compressed_form, 33);
7221         LDKRouteParameters route_params_var = *route_params;
7222         int64_t route_params_ref = 0;
7223         route_params_var = RouteParameters_clone(&route_params_var);
7224         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7225         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7226         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7227         int64_tArray first_hops_arr = NULL;
7228         if (first_hops != NULL) {
7229                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7230                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7231                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7232                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7233                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7234                         int64_t first_hops_conv_16_ref = 0;
7235                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7236                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7237                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7238                 }
7239         
7240         }
7241         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7242         int64_t inflight_htlcs_ref = 0;
7243         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7244         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7245         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);
7246         void* ret_ptr = untag_ptr(ret);
7247         CHECK_ACCESS(ret_ptr);
7248         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7249         FREE(untag_ptr(ret));
7250         return ret_conv;
7251 }
7252 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) {
7253         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7254         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7255         memcpy(payer_arr->elems, payer.compressed_form, 33);
7256         LDKRouteParameters route_params_var = *route_params;
7257         int64_t route_params_ref = 0;
7258         route_params_var = RouteParameters_clone(&route_params_var);
7259         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7260         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7261         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7262         int64_tArray first_hops_arr = NULL;
7263         if (first_hops != NULL) {
7264                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7265                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7266                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7267                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7268                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7269                         int64_t first_hops_conv_16_ref = 0;
7270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7271                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7272                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7273                 }
7274         
7275         }
7276         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7277         int64_t inflight_htlcs_ref = 0;
7278         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7279         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7280         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7281         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7282         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7283         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7284         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);
7285         void* ret_ptr = untag_ptr(ret);
7286         CHECK_ACCESS(ret_ptr);
7287         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7288         FREE(untag_ptr(ret));
7289         return ret_conv;
7290 }
7291 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) {
7292         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7293         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7294         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7295         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7296         int64_tArray first_hops_arr = NULL;
7297         first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7298         int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7299         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7300                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7301                 int64_t first_hops_conv_16_ref = 0;
7302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7303                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7304                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7305         }
7306         
7307         FREE(first_hops_var.data);
7308         LDKReceiveTlvs tlvs_var = tlvs;
7309         int64_t tlvs_ref = 0;
7310         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7311         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7312         int64_t amount_msats_conv = amount_msats;
7313         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);
7314         void* ret_ptr = untag_ptr(ret);
7315         CHECK_ACCESS(ret_ptr);
7316         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7317         FREE(untag_ptr(ret));
7318         return ret_conv;
7319 }
7320 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7321         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7322         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7323         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7324 }
7325 static inline LDKRouter LDKRouter_init (int64_t o, int64_t MessageRouter) {
7326         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7327         atomic_init(&calls->refcnt, 1);
7328         calls->instance_ptr = o;
7329
7330         LDKRouter ret = {
7331                 .this_arg = (void*) calls,
7332                 .find_route = find_route_LDKRouter_jcall,
7333                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7334                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7335                 .free = LDKRouter_JCalls_free,
7336                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7337         };
7338         calls->MessageRouter = ret.MessageRouter.this_arg;
7339         return ret;
7340 }
7341 uint64_t  CS_LDK_LDKRouter_new(int32_t o, int32_t MessageRouter) {
7342         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7343         *res_ptr = LDKRouter_init(o, MessageRouter);
7344         return tag_ptr(res_ptr, true);
7345 }
7346 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) {
7347         void* this_arg_ptr = untag_ptr(this_arg);
7348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7349         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7350         LDKPublicKey payer_ref;
7351         CHECK(payer->arr_len == 33);
7352         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7353         LDKRouteParameters route_params_conv;
7354         route_params_conv.inner = untag_ptr(route_params);
7355         route_params_conv.is_owned = ptr_is_owned(route_params);
7356         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7357         route_params_conv.is_owned = false;
7358         LDKCVec_ChannelDetailsZ first_hops_constr;
7359         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7360         if (first_hops != NULL) {
7361                 first_hops_constr.datalen = first_hops->arr_len;
7362                 if (first_hops_constr.datalen > 0)
7363                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7364                 else
7365                         first_hops_constr.data = NULL;
7366                 int64_t* first_hops_vals = first_hops->elems;
7367                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7368                         int64_t first_hops_conv_16 = first_hops_vals[q];
7369                         LDKChannelDetails first_hops_conv_16_conv;
7370                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7371                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7372                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7373                         first_hops_conv_16_conv.is_owned = false;
7374                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7375                 }
7376                 FREE(first_hops);
7377                 first_hops_ptr = &first_hops_constr;
7378         }
7379         LDKInFlightHtlcs inflight_htlcs_conv;
7380         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7381         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7382         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7383         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7384         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7385         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7386         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7387         return tag_ptr(ret_conv, true);
7388 }
7389
7390 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) {
7391         void* this_arg_ptr = untag_ptr(this_arg);
7392         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7393         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7394         LDKPublicKey payer_ref;
7395         CHECK(payer->arr_len == 33);
7396         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7397         LDKRouteParameters route_params_conv;
7398         route_params_conv.inner = untag_ptr(route_params);
7399         route_params_conv.is_owned = ptr_is_owned(route_params);
7400         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7401         route_params_conv.is_owned = false;
7402         LDKCVec_ChannelDetailsZ first_hops_constr;
7403         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7404         if (first_hops != NULL) {
7405                 first_hops_constr.datalen = first_hops->arr_len;
7406                 if (first_hops_constr.datalen > 0)
7407                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7408                 else
7409                         first_hops_constr.data = NULL;
7410                 int64_t* first_hops_vals = first_hops->elems;
7411                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7412                         int64_t first_hops_conv_16 = first_hops_vals[q];
7413                         LDKChannelDetails first_hops_conv_16_conv;
7414                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7415                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7416                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7417                         first_hops_conv_16_conv.is_owned = false;
7418                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7419                 }
7420                 FREE(first_hops);
7421                 first_hops_ptr = &first_hops_constr;
7422         }
7423         LDKInFlightHtlcs inflight_htlcs_conv;
7424         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7425         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7426         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7427         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7428         LDKThirtyTwoBytes _payment_hash_ref;
7429         CHECK(_payment_hash->arr_len == 32);
7430         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7431         LDKThirtyTwoBytes _payment_id_ref;
7432         CHECK(_payment_id->arr_len == 32);
7433         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7434         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7435         *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);
7436         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7437         return tag_ptr(ret_conv, true);
7438 }
7439
7440 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) {
7441         void* this_arg_ptr = untag_ptr(this_arg);
7442         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7443         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7444         LDKPublicKey recipient_ref;
7445         CHECK(recipient->arr_len == 33);
7446         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7447         LDKCVec_ChannelDetailsZ first_hops_constr;
7448         first_hops_constr.datalen = first_hops->arr_len;
7449         if (first_hops_constr.datalen > 0)
7450                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7451         else
7452                 first_hops_constr.data = NULL;
7453         int64_t* first_hops_vals = first_hops->elems;
7454         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7455                 int64_t first_hops_conv_16 = first_hops_vals[q];
7456                 LDKChannelDetails first_hops_conv_16_conv;
7457                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7458                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7459                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7460                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7461                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7462         }
7463         FREE(first_hops);
7464         LDKReceiveTlvs tlvs_conv;
7465         tlvs_conv.inner = untag_ptr(tlvs);
7466         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7467         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7468         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7469         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7470         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7471         return tag_ptr(ret_conv, true);
7472 }
7473
7474 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7475         return ThirtyTwoBytes_clone(&owner->a);
7476 }
7477 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(int64_t owner) {
7478         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7479         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7480         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7481         return ret_arr;
7482 }
7483
7484 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7485         LDKChannelManager ret = owner->b;
7486         ret.is_owned = false;
7487         return ret;
7488 }
7489 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(int64_t owner) {
7490         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7491         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7492         int64_t ret_ref = 0;
7493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7495         return ret_ref;
7496 }
7497
7498 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7499 CHECK(owner->result_ok);
7500         return &*owner->contents.result;
7501 }
7502 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(int64_t owner) {
7503         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7504         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7505         return ret_ret;
7506 }
7507
7508 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7509 CHECK(!owner->result_ok);
7510         return DecodeError_clone(&*owner->contents.err);
7511 }
7512 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(int64_t owner) {
7513         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7514         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7515         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
7516         int64_t ret_ref = tag_ptr(ret_copy, true);
7517         return ret_ref;
7518 }
7519
7520 uint32_t CS_LDK_LDKMaxDustHTLCExposure_ty_from_ptr(int64_t ptr) {
7521         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7522         switch(obj->tag) {
7523                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7524                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7525                 default: abort();
7526         }
7527 }
7528 int64_t CS_LDK_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(int64_t ptr) {
7529         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7530         CHECK(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7531         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7532         return fixed_limit_msat_conv;
7533 }
7534 int64_t CS_LDK_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(int64_t ptr) {
7535         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7536         CHECK(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7537         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7538         return fee_rate_multiplier_conv;
7539 }
7540 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7541 CHECK(owner->result_ok);
7542         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7543 }
7544 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(int64_t owner) {
7545         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7546         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7547         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7548         int64_t ret_ref = tag_ptr(ret_copy, true);
7549         return ret_ref;
7550 }
7551
7552 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7553 CHECK(!owner->result_ok);
7554         return DecodeError_clone(&*owner->contents.err);
7555 }
7556 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(int64_t owner) {
7557         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7558         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7559         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7560         int64_t ret_ref = tag_ptr(ret_copy, true);
7561         return ret_ref;
7562 }
7563
7564 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7565         LDKChannelConfig ret = *owner->contents.result;
7566         ret.is_owned = false;
7567         return ret;
7568 }
7569 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_ok(int64_t owner) {
7570         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7571         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7572         int64_t ret_ref = 0;
7573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7575         return ret_ref;
7576 }
7577
7578 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7579 CHECK(!owner->result_ok);
7580         return DecodeError_clone(&*owner->contents.err);
7581 }
7582 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_err(int64_t owner) {
7583         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7584         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7585         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7586         int64_t ret_ref = tag_ptr(ret_copy, true);
7587         return ret_ref;
7588 }
7589
7590 uint32_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(int64_t ptr) {
7591         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7592         switch(obj->tag) {
7593                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7594                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7595                 default: abort();
7596         }
7597 }
7598 int64_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(int64_t ptr) {
7599         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7600         CHECK(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7601         int64_t some_ref = tag_ptr(&obj->some, false);
7602         return some_ref;
7603 }
7604 uint32_t CS_LDK_LDKCOption_APIErrorZ_ty_from_ptr(int64_t ptr) {
7605         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7606         switch(obj->tag) {
7607                 case LDKCOption_APIErrorZ_Some: return 0;
7608                 case LDKCOption_APIErrorZ_None: return 1;
7609                 default: abort();
7610         }
7611 }
7612 int64_t CS_LDK_LDKCOption_APIErrorZ_Some_get_some(int64_t ptr) {
7613         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7614         CHECK(obj->tag == LDKCOption_APIErrorZ_Some);
7615         int64_t some_ref = tag_ptr(&obj->some, false);
7616         return some_ref;
7617 }
7618 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7619 CHECK(owner->result_ok);
7620         return COption_APIErrorZ_clone(&*owner->contents.result);
7621 }
7622 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_ok(int64_t owner) {
7623         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7624         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7625         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7626         int64_t ret_ref = tag_ptr(ret_copy, true);
7627         return ret_ref;
7628 }
7629
7630 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7631 CHECK(!owner->result_ok);
7632         return DecodeError_clone(&*owner->contents.err);
7633 }
7634 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_err(int64_t owner) {
7635         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7636         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7637         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7638         int64_t ret_ref = tag_ptr(ret_copy, true);
7639         return ret_ref;
7640 }
7641
7642 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7643         LDKChannelMonitorUpdate ret = *owner->contents.result;
7644         ret.is_owned = false;
7645         return ret;
7646 }
7647 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(int64_t owner) {
7648         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7649         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7650         int64_t ret_ref = 0;
7651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7653         return ret_ref;
7654 }
7655
7656 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7657 CHECK(!owner->result_ok);
7658         return DecodeError_clone(&*owner->contents.err);
7659 }
7660 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(int64_t owner) {
7661         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7662         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7663         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7664         int64_t ret_ref = tag_ptr(ret_copy, true);
7665         return ret_ref;
7666 }
7667
7668 uint32_t CS_LDK_LDKCOption_MonitorEventZ_ty_from_ptr(int64_t ptr) {
7669         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7670         switch(obj->tag) {
7671                 case LDKCOption_MonitorEventZ_Some: return 0;
7672                 case LDKCOption_MonitorEventZ_None: return 1;
7673                 default: abort();
7674         }
7675 }
7676 int64_t CS_LDK_LDKCOption_MonitorEventZ_Some_get_some(int64_t ptr) {
7677         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7678         CHECK(obj->tag == LDKCOption_MonitorEventZ_Some);
7679         int64_t some_ref = tag_ptr(&obj->some, false);
7680         return some_ref;
7681 }
7682 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7683 CHECK(owner->result_ok);
7684         return COption_MonitorEventZ_clone(&*owner->contents.result);
7685 }
7686 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(int64_t owner) {
7687         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7688         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7689         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7690         int64_t ret_ref = tag_ptr(ret_copy, true);
7691         return ret_ref;
7692 }
7693
7694 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7695 CHECK(!owner->result_ok);
7696         return DecodeError_clone(&*owner->contents.err);
7697 }
7698 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_err(int64_t owner) {
7699         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7700         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7701         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7702         int64_t ret_ref = tag_ptr(ret_copy, true);
7703         return ret_ref;
7704 }
7705
7706 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7707         LDKHTLCUpdate ret = *owner->contents.result;
7708         ret.is_owned = false;
7709         return ret;
7710 }
7711 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_ok(int64_t owner) {
7712         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7713         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7714         int64_t ret_ref = 0;
7715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7717         return ret_ref;
7718 }
7719
7720 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7721 CHECK(!owner->result_ok);
7722         return DecodeError_clone(&*owner->contents.err);
7723 }
7724 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_err(int64_t owner) {
7725         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7726         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7727         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7728         int64_t ret_ref = tag_ptr(ret_copy, true);
7729         return ret_ref;
7730 }
7731
7732 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7733         LDKOutPoint ret = owner->a;
7734         ret.is_owned = false;
7735         return ret;
7736 }
7737 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_a(int64_t owner) {
7738         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7739         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
7740         int64_t ret_ref = 0;
7741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7743         return ret_ref;
7744 }
7745
7746 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
7747         return CVec_u8Z_clone(&owner->b);
7748 }
7749 int8_tArray  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_b(int64_t owner) {
7750         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
7751         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
7752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7754         CVec_u8Z_free(ret_var);
7755         return ret_arr;
7756 }
7757
7758 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7759         return owner->a;
7760 }
7761 int32_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_a(int64_t owner) {
7762         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7763         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
7764         return ret_conv;
7765 }
7766
7767 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
7768         return CVec_u8Z_clone(&owner->b);
7769 }
7770 int8_tArray  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_b(int64_t owner) {
7771         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
7772         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
7773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7775         CVec_u8Z_free(ret_var);
7776         return ret_arr;
7777 }
7778
7779 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
7780         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
7781         for (size_t i = 0; i < ret.datalen; i++) {
7782                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
7783         }
7784         return ret;
7785 }
7786 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7787         return ThirtyTwoBytes_clone(&owner->a);
7788 }
7789 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(int64_t owner) {
7790         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7791         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7792         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
7793         return ret_arr;
7794 }
7795
7796 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
7797         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
7798 }
7799 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(int64_t owner) {
7800         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
7801         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
7802         int64_tArray ret_arr = NULL;
7803         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
7804         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
7805         for (size_t x = 0; x < ret_var.datalen; x++) {
7806                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
7807                 *ret_conv_23_conv = ret_var.data[x];
7808                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
7809         }
7810         
7811         FREE(ret_var.data);
7812         return ret_arr;
7813 }
7814
7815 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
7816         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 };
7817         for (size_t i = 0; i < ret.datalen; i++) {
7818                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
7819         }
7820         return ret;
7821 }
7822 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
7823         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
7824         for (size_t i = 0; i < ret.datalen; i++) {
7825                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
7826         }
7827         return ret;
7828 }
7829 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7830         return owner->a;
7831 }
7832 int32_t  CS_LDK_C2Tuple_u32TxOutZ_get_a(int64_t owner) {
7833         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7834         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7835         return ret_conv;
7836 }
7837
7838 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7839         return TxOut_clone(&owner->b);
7840 }
7841 int64_t  CS_LDK_C2Tuple_u32TxOutZ_get_b(int64_t owner) {
7842         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7843         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7844         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7845         return tag_ptr(ret_ref, true);
7846 }
7847
7848 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7849         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7850         for (size_t i = 0; i < ret.datalen; i++) {
7851                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7852         }
7853         return ret;
7854 }
7855 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7856         return ThirtyTwoBytes_clone(&owner->a);
7857 }
7858 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(int64_t owner) {
7859         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7860         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7861         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
7862         return ret_arr;
7863 }
7864
7865 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7866         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7867 }
7868 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(int64_t owner) {
7869         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7870         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7871         int64_tArray ret_arr = NULL;
7872         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
7873         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
7874         for (size_t u = 0; u < ret_var.datalen; u++) {
7875                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7876                 *ret_conv_20_conv = ret_var.data[u];
7877                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7878         }
7879         
7880         FREE(ret_var.data);
7881         return ret_arr;
7882 }
7883
7884 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
7885         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 };
7886         for (size_t i = 0; i < ret.datalen; i++) {
7887                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7888         }
7889         return ret;
7890 }
7891 uint32_t CS_LDK_LDKBalance_ty_from_ptr(int64_t ptr) {
7892         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7893         switch(obj->tag) {
7894                 case LDKBalance_ClaimableOnChannelClose: return 0;
7895                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
7896                 case LDKBalance_ContentiousClaimable: return 2;
7897                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
7898                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
7899                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
7900                 default: abort();
7901         }
7902 }
7903 int64_t CS_LDK_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(int64_t ptr) {
7904         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7905         CHECK(obj->tag == LDKBalance_ClaimableOnChannelClose);
7906         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
7907         return amount_satoshis_conv;
7908 }
7909 int64_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(int64_t ptr) {
7910         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7911         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7912         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
7913         return amount_satoshis_conv;
7914 }
7915 int32_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(int64_t ptr) {
7916         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7917         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
7918         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7919         return confirmation_height_conv;
7920 }
7921 int64_t CS_LDK_LDKBalance_ContentiousClaimable_get_amount_satoshis(int64_t ptr) {
7922         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7923         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7924         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
7925         return amount_satoshis_conv;
7926 }
7927 int32_t CS_LDK_LDKBalance_ContentiousClaimable_get_timeout_height(int64_t ptr) {
7928         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7929         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7930         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7931         return timeout_height_conv;
7932 }
7933 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_hash(int64_t ptr) {
7934         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7935         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7936         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7937         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
7938         return payment_hash_arr;
7939 }
7940 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_preimage(int64_t ptr) {
7941         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7942         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
7943         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
7944         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
7945         return payment_preimage_arr;
7946 }
7947 int64_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(int64_t ptr) {
7948         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7949         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7950         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
7951         return amount_satoshis_conv;
7952 }
7953 int32_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(int64_t ptr) {
7954         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7955         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7956         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
7957         return claimable_height_conv;
7958 }
7959 int8_tArray CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(int64_t ptr) {
7960         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7961         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
7962         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7963         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
7964         return payment_hash_arr;
7965 }
7966 int64_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(int64_t ptr) {
7967         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7968         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7969         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
7970         return amount_satoshis_conv;
7971 }
7972 int32_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(int64_t ptr) {
7973         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7974         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7975         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
7976         return expiry_height_conv;
7977 }
7978 int8_tArray CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(int64_t ptr) {
7979         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7980         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
7981         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
7982         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
7983         return payment_hash_arr;
7984 }
7985 int64_t CS_LDK_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(int64_t ptr) {
7986         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7987         CHECK(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
7988         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
7989         return amount_satoshis_conv;
7990 }
7991 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7992         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7993         for (size_t i = 0; i < ret.datalen; i++) {
7994                 ret.data[i] = Balance_clone(&orig->data[i]);
7995         }
7996         return ret;
7997 }
7998 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
7999         return ThirtyTwoBytes_clone(&owner->a);
8000 }
8001 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(int64_t owner) {
8002         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8003         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8004         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
8005         return ret_arr;
8006 }
8007
8008 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8009         LDKChannelMonitor ret = owner->b;
8010         ret.is_owned = false;
8011         return ret;
8012 }
8013 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(int64_t owner) {
8014         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8015         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
8016         int64_t ret_ref = 0;
8017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8019         return ret_ref;
8020 }
8021
8022 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8023 CHECK(owner->result_ok);
8024         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8025 }
8026 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(int64_t owner) {
8027         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8028         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8029         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8030         return tag_ptr(ret_conv, true);
8031 }
8032
8033 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8034 CHECK(!owner->result_ok);
8035         return DecodeError_clone(&*owner->contents.err);
8036 }
8037 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(int64_t owner) {
8038         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8040         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8041         int64_t ret_ref = tag_ptr(ret_copy, true);
8042         return ret_ref;
8043 }
8044
8045 typedef struct LDKType_JCalls {
8046         atomic_size_t refcnt;
8047         uint32_t instance_ptr;
8048 } LDKType_JCalls;
8049 static void LDKType_JCalls_free(void* this_arg) {
8050         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8051         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8052                 FREE(j_calls);
8053         }
8054 }
8055 uint16_t type_id_LDKType_jcall(const void* this_arg) {
8056         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8057         return js_invoke_function_s_(j_calls->instance_ptr, 50);
8058 }
8059 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
8060         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8061         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 51);
8062         LDKStr ret_conv = str_ref_to_owned_c(ret);
8063         return ret_conv;
8064 }
8065 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
8066         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8067         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 52);
8068         LDKCVec_u8Z ret_ref;
8069         ret_ref.datalen = ret->arr_len;
8070         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8071         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8072         return ret_ref;
8073 }
8074 static void LDKType_JCalls_cloned(LDKType* new_obj) {
8075         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
8076         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8077 }
8078 static inline LDKType LDKType_init (int64_t o) {
8079         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
8080         atomic_init(&calls->refcnt, 1);
8081         calls->instance_ptr = o;
8082
8083         LDKType ret = {
8084                 .this_arg = (void*) calls,
8085                 .type_id = type_id_LDKType_jcall,
8086                 .debug_str = debug_str_LDKType_jcall,
8087                 .write = write_LDKType_jcall,
8088                 .cloned = LDKType_JCalls_cloned,
8089                 .free = LDKType_JCalls_free,
8090         };
8091         return ret;
8092 }
8093 uint64_t  CS_LDK_LDKType_new(int32_t o) {
8094         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8095         *res_ptr = LDKType_init(o);
8096         return tag_ptr(res_ptr, true);
8097 }
8098 int16_t  CS_LDK_Type_type_id(int64_t this_arg) {
8099         void* this_arg_ptr = untag_ptr(this_arg);
8100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8101         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8102         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8103         return ret_conv;
8104 }
8105
8106 jstring  CS_LDK_Type_debug_str(int64_t this_arg) {
8107         void* this_arg_ptr = untag_ptr(this_arg);
8108         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8109         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8110         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8111         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8112         Str_free(ret_str);
8113         return ret_conv;
8114 }
8115
8116 int8_tArray  CS_LDK_Type_write(int64_t this_arg) {
8117         void* this_arg_ptr = untag_ptr(this_arg);
8118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8119         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8120         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8121         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8122         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8123         CVec_u8Z_free(ret_var);
8124         return ret_arr;
8125 }
8126
8127 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8128         return owner->a;
8129 }
8130 int8_tArray  CS_LDK_C2Tuple_PublicKeyTypeZ_get_a(int64_t owner) {
8131         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8132         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8133         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8134         return ret_arr;
8135 }
8136
8137 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8138         return Type_clone(&owner->b);
8139 }
8140 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_get_b(int64_t owner) {
8141         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8142         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8143         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8144         return tag_ptr(ret_ret, true);
8145 }
8146
8147 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8148         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8149         for (size_t i = 0; i < ret.datalen; i++) {
8150                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8151         }
8152         return ret;
8153 }
8154 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8155         return owner->a;
8156 }
8157 int8_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(int64_t owner) {
8158         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8159         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8160         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8161         return ret_arr;
8162 }
8163
8164 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8165         return CVec_SocketAddressZ_clone(&owner->b);
8166 }
8167 int64_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(int64_t owner) {
8168         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8169         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8170         int64_tArray ret_arr = NULL;
8171         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8172         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8173         for (size_t p = 0; p < ret_var.datalen; p++) {
8174                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8175                 *ret_conv_15_copy = ret_var.data[p];
8176                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8177                 ret_arr_ptr[p] = ret_conv_15_ref;
8178         }
8179         
8180         FREE(ret_var.data);
8181         return ret_arr;
8182 }
8183
8184 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8185         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8186         for (size_t i = 0; i < ret.datalen; i++) {
8187                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8188         }
8189         return ret;
8190 }
8191 typedef struct LDKOnionMessageContents_JCalls {
8192         atomic_size_t refcnt;
8193         uint32_t instance_ptr;
8194 } LDKOnionMessageContents_JCalls;
8195 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8196         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8197         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8198                 FREE(j_calls);
8199         }
8200 }
8201 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8202         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8203         return js_invoke_function_l_(j_calls->instance_ptr, 53);
8204 }
8205 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8206         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8207         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 54);
8208         LDKCVec_u8Z ret_ref;
8209         ret_ref.datalen = ret->arr_len;
8210         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8211         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8212         return ret_ref;
8213 }
8214 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8215         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8216         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 55);
8217         LDKStr ret_conv = str_ref_to_owned_c(ret);
8218         return ret_conv;
8219 }
8220 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8221         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8222         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8223 }
8224 static inline LDKOnionMessageContents LDKOnionMessageContents_init (int64_t o) {
8225         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8226         atomic_init(&calls->refcnt, 1);
8227         calls->instance_ptr = o;
8228
8229         LDKOnionMessageContents ret = {
8230                 .this_arg = (void*) calls,
8231                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8232                 .write = write_LDKOnionMessageContents_jcall,
8233                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8234                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8235                 .free = LDKOnionMessageContents_JCalls_free,
8236         };
8237         return ret;
8238 }
8239 uint64_t  CS_LDK_LDKOnionMessageContents_new(int32_t o) {
8240         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8241         *res_ptr = LDKOnionMessageContents_init(o);
8242         return tag_ptr(res_ptr, true);
8243 }
8244 int64_t  CS_LDK_OnionMessageContents_tlv_type(int64_t this_arg) {
8245         void* this_arg_ptr = untag_ptr(this_arg);
8246         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8247         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8248         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8249         return ret_conv;
8250 }
8251
8252 int8_tArray  CS_LDK_OnionMessageContents_write(int64_t this_arg) {
8253         void* this_arg_ptr = untag_ptr(this_arg);
8254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8255         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8256         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8259         CVec_u8Z_free(ret_var);
8260         return ret_arr;
8261 }
8262
8263 jstring  CS_LDK_OnionMessageContents_debug_str(int64_t this_arg) {
8264         void* this_arg_ptr = untag_ptr(this_arg);
8265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8266         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8267         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8268         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8269         Str_free(ret_str);
8270         return ret_conv;
8271 }
8272
8273 uint32_t CS_LDK_LDKCOption_OnionMessageContentsZ_ty_from_ptr(int64_t ptr) {
8274         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8275         switch(obj->tag) {
8276                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8277                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8278                 default: abort();
8279         }
8280 }
8281 int64_t CS_LDK_LDKCOption_OnionMessageContentsZ_Some_get_some(int64_t ptr) {
8282         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8283         CHECK(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8284         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8285         *some_ret = OnionMessageContents_clone(&obj->some);
8286         return tag_ptr(some_ret, true);
8287 }
8288 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8289 CHECK(owner->result_ok);
8290         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8291 }
8292 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(int64_t owner) {
8293         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8294         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8295         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8296         int64_t ret_ref = tag_ptr(ret_copy, true);
8297         return ret_ref;
8298 }
8299
8300 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8301 CHECK(!owner->result_ok);
8302         return DecodeError_clone(&*owner->contents.err);
8303 }
8304 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(int64_t owner) {
8305         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8306         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8307         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8308         int64_t ret_ref = tag_ptr(ret_copy, true);
8309         return ret_ref;
8310 }
8311
8312 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8313         return OnionMessageContents_clone(&owner->a);
8314 }
8315 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(int64_t owner) {
8316         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8317         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8318         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8319         return tag_ptr(ret_ret, true);
8320 }
8321
8322 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8323         return Destination_clone(&owner->b);
8324 }
8325 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(int64_t owner) {
8326         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8327         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8328         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8329         int64_t ret_ref = tag_ptr(ret_copy, true);
8330         return ret_ref;
8331 }
8332
8333 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8334         LDKBlindedPath ret = owner->c;
8335         ret.is_owned = false;
8336         return ret;
8337 }
8338 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(int64_t owner) {
8339         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8340         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8341         int64_t ret_ref = 0;
8342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8344         return ret_ref;
8345 }
8346
8347 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8348         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8349         for (size_t i = 0; i < ret.datalen; i++) {
8350                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8351         }
8352         return ret;
8353 }
8354 uint32_t CS_LDK_LDKCOption_TypeZ_ty_from_ptr(int64_t ptr) {
8355         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8356         switch(obj->tag) {
8357                 case LDKCOption_TypeZ_Some: return 0;
8358                 case LDKCOption_TypeZ_None: return 1;
8359                 default: abort();
8360         }
8361 }
8362 int64_t CS_LDK_LDKCOption_TypeZ_Some_get_some(int64_t ptr) {
8363         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8364         CHECK(obj->tag == LDKCOption_TypeZ_Some);
8365         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8366         *some_ret = Type_clone(&obj->some);
8367         return tag_ptr(some_ret, true);
8368 }
8369 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8370 CHECK(owner->result_ok);
8371         return COption_TypeZ_clone(&*owner->contents.result);
8372 }
8373 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_ok(int64_t owner) {
8374         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8375         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8376         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8377         int64_t ret_ref = tag_ptr(ret_copy, true);
8378         return ret_ref;
8379 }
8380
8381 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8382 CHECK(!owner->result_ok);
8383         return DecodeError_clone(&*owner->contents.err);
8384 }
8385 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_err(int64_t owner) {
8386         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8387         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8388         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8389         int64_t ret_ref = tag_ptr(ret_copy, true);
8390         return ret_ref;
8391 }
8392
8393 uint32_t CS_LDK_LDKCOption_SocketAddressZ_ty_from_ptr(int64_t ptr) {
8394         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8395         switch(obj->tag) {
8396                 case LDKCOption_SocketAddressZ_Some: return 0;
8397                 case LDKCOption_SocketAddressZ_None: return 1;
8398                 default: abort();
8399         }
8400 }
8401 int64_t CS_LDK_LDKCOption_SocketAddressZ_Some_get_some(int64_t ptr) {
8402         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8403         CHECK(obj->tag == LDKCOption_SocketAddressZ_Some);
8404         int64_t some_ref = tag_ptr(&obj->some, false);
8405         return some_ref;
8406 }
8407 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
8408         return owner->a;
8409 }
8410 int8_tArray  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(int64_t owner) {
8411         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
8412         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8413         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8414         return ret_arr;
8415 }
8416
8417 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
8418         return COption_SocketAddressZ_clone(&owner->b);
8419 }
8420 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(int64_t owner) {
8421         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
8422         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
8423         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
8424         int64_t ret_ref = tag_ptr(ret_copy, true);
8425         return ret_ref;
8426 }
8427
8428 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
8429         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8430         for (size_t i = 0; i < ret.datalen; i++) {
8431                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
8432         }
8433         return ret;
8434 }
8435 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8436 CHECK(owner->result_ok);
8437         return CVec_u8Z_clone(&*owner->contents.result);
8438 }
8439 int8_tArray  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(int64_t owner) {
8440         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8441         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8442         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8443         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8444         CVec_u8Z_free(ret_var);
8445         return ret_arr;
8446 }
8447
8448 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8449         LDKPeerHandleError ret = *owner->contents.err;
8450         ret.is_owned = false;
8451         return ret;
8452 }
8453 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_err(int64_t owner) {
8454         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8455         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8456         int64_t ret_ref = 0;
8457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8459         return ret_ref;
8460 }
8461
8462 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8463 CHECK(owner->result_ok);
8464         return *owner->contents.result;
8465 }
8466 void  CS_LDK_CResult_NonePeerHandleErrorZ_get_ok(int64_t owner) {
8467         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8468         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8469 }
8470
8471 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8472         LDKPeerHandleError ret = *owner->contents.err;
8473         ret.is_owned = false;
8474         return ret;
8475 }
8476 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_get_err(int64_t owner) {
8477         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8478         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8479         int64_t ret_ref = 0;
8480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8482         return ret_ref;
8483 }
8484
8485 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8486 CHECK(owner->result_ok);
8487         return *owner->contents.result;
8488 }
8489 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_get_ok(int64_t owner) {
8490         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8491         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8492         return ret_conv;
8493 }
8494
8495 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8496         LDKPeerHandleError ret = *owner->contents.err;
8497         ret.is_owned = false;
8498         return ret;
8499 }
8500 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_get_err(int64_t owner) {
8501         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8502         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8503         int64_t ret_ref = 0;
8504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8506         return ret_ref;
8507 }
8508
8509 uint32_t CS_LDK_LDKGraphSyncError_ty_from_ptr(int64_t ptr) {
8510         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8511         switch(obj->tag) {
8512                 case LDKGraphSyncError_DecodeError: return 0;
8513                 case LDKGraphSyncError_LightningError: return 1;
8514                 default: abort();
8515         }
8516 }
8517 int64_t CS_LDK_LDKGraphSyncError_DecodeError_get_decode_error(int64_t ptr) {
8518         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8519         CHECK(obj->tag == LDKGraphSyncError_DecodeError);
8520         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8521         return decode_error_ref;
8522 }
8523 int64_t CS_LDK_LDKGraphSyncError_LightningError_get_lightning_error(int64_t ptr) {
8524         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8525         CHECK(obj->tag == LDKGraphSyncError_LightningError);
8526         LDKLightningError lightning_error_var = obj->lightning_error;
8527                         int64_t lightning_error_ref = 0;
8528                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8529                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8530         return lightning_error_ref;
8531 }
8532 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8533 CHECK(owner->result_ok);
8534         return *owner->contents.result;
8535 }
8536 int32_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_ok(int64_t owner) {
8537         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8538         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8539         return ret_conv;
8540 }
8541
8542 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8543 CHECK(!owner->result_ok);
8544         return GraphSyncError_clone(&*owner->contents.err);
8545 }
8546 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_err(int64_t owner) {
8547         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8548         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8549         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8550         int64_t ret_ref = tag_ptr(ret_copy, true);
8551         return ret_ref;
8552 }
8553
8554 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8555 CHECK(owner->result_ok);
8556         return CVec_u8Z_clone(&*owner->contents.result);
8557 }
8558 int8_tArray  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_ok(int64_t owner) {
8559         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8560         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
8561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8563         CVec_u8Z_free(ret_var);
8564         return ret_arr;
8565 }
8566
8567 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
8568 CHECK(!owner->result_ok);
8569         return *owner->contents.err;
8570 }
8571 int32_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_err(int64_t owner) {
8572         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
8573         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
8574         return ret_conv;
8575 }
8576
8577 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8578 CHECK(owner->result_ok);
8579         return *owner->contents.result;
8580 }
8581 ptrArray  CS_LDK_CResult_CVec_StrZIOErrorZ_get_ok(int64_t owner) {
8582         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8583         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
8584         ptrArray ret_arr = NULL;
8585         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8586         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
8587         for (size_t i = 0; i < ret_var.datalen; i++) {
8588                 LDKStr ret_conv_8_str = ret_var.data[i];
8589                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
8590                 ret_arr_ptr[i] = ret_conv_8_conv;
8591         }
8592         
8593         return ret_arr;
8594 }
8595
8596 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
8597 CHECK(!owner->result_ok);
8598         return *owner->contents.err;
8599 }
8600 int32_t  CS_LDK_CResult_CVec_StrZIOErrorZ_get_err(int64_t owner) {
8601         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
8602         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
8603         return ret_conv;
8604 }
8605
8606 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
8607         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
8608         for (size_t i = 0; i < ret.datalen; i++) {
8609                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
8610         }
8611         return ret;
8612 }
8613 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8614 CHECK(owner->result_ok);
8615         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
8616 }
8617 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(int64_t owner) {
8618         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8619         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
8620         int64_tArray ret_arr = NULL;
8621         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8622         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8623         for (size_t o = 0; o < ret_var.datalen; o++) {
8624                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8625                 *ret_conv_40_conv = ret_var.data[o];
8626                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8627         }
8628         
8629         FREE(ret_var.data);
8630         return ret_arr;
8631 }
8632
8633 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
8634 CHECK(!owner->result_ok);
8635         return *owner->contents.err;
8636 }
8637 int32_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(int64_t owner) {
8638         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
8639         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
8640         return ret_conv;
8641 }
8642
8643 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8644 CHECK(owner->result_ok);
8645         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8646 }
8647 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(int64_t owner) {
8648         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8649         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8650         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
8651         return tag_ptr(ret_conv, true);
8652 }
8653
8654 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
8655 CHECK(!owner->result_ok);
8656         return *owner->contents.err;
8657 }
8658 int32_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(int64_t owner) {
8659         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
8660         int32_t ret_conv = LDKIOError_to_cs(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
8661         return ret_conv;
8662 }
8663
8664 uint32_t CS_LDK_LDKCOption_SecretKeyZ_ty_from_ptr(int64_t ptr) {
8665         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8666         switch(obj->tag) {
8667                 case LDKCOption_SecretKeyZ_Some: return 0;
8668                 case LDKCOption_SecretKeyZ_None: return 1;
8669                 default: abort();
8670         }
8671 }
8672 int8_tArray CS_LDK_LDKCOption_SecretKeyZ_Some_get_some(int64_t ptr) {
8673         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
8674         CHECK(obj->tag == LDKCOption_SecretKeyZ_Some);
8675         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8676         memcpy(some_arr->elems, obj->some.bytes, 32);
8677         return some_arr;
8678 }
8679 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8680         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
8681         ret.is_owned = false;
8682         return ret;
8683 }
8684 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_ok(int64_t owner) {
8685         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8686         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
8687         int64_t ret_ref = 0;
8688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8690         return ret_ref;
8691 }
8692
8693 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
8694 CHECK(!owner->result_ok);
8695         return *owner->contents.err;
8696 }
8697 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_err(int64_t owner) {
8698         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
8699         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
8700 }
8701
8702 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8703         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8704         for (size_t i = 0; i < ret.datalen; i++) {
8705                 ret.data[i] = Witness_clone(&orig->data[i]);
8706         }
8707         return ret;
8708 }
8709 uint32_t CS_LDK_LDKCOption_i64Z_ty_from_ptr(int64_t ptr) {
8710         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8711         switch(obj->tag) {
8712                 case LDKCOption_i64Z_Some: return 0;
8713                 case LDKCOption_i64Z_None: return 1;
8714                 default: abort();
8715         }
8716 }
8717 int64_t CS_LDK_LDKCOption_i64Z_Some_get_some(int64_t ptr) {
8718         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8719         CHECK(obj->tag == LDKCOption_i64Z_Some);
8720         int64_t some_conv = obj->some;
8721         return some_conv;
8722 }
8723 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8724 CHECK(owner->result_ok);
8725         return SocketAddress_clone(&*owner->contents.result);
8726 }
8727 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_ok(int64_t owner) {
8728         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8729         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8730         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
8731         int64_t ret_ref = tag_ptr(ret_copy, true);
8732         return ret_ref;
8733 }
8734
8735 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
8736 CHECK(!owner->result_ok);
8737         return DecodeError_clone(&*owner->contents.err);
8738 }
8739 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_err(int64_t owner) {
8740         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
8741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8742         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
8743         int64_t ret_ref = tag_ptr(ret_copy, true);
8744         return ret_ref;
8745 }
8746
8747 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8748 CHECK(owner->result_ok);
8749         return SocketAddress_clone(&*owner->contents.result);
8750 }
8751 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(int64_t owner) {
8752         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8753         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8754         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
8755         int64_t ret_ref = tag_ptr(ret_copy, true);
8756         return ret_ref;
8757 }
8758
8759 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
8760 CHECK(!owner->result_ok);
8761         return SocketAddressParseError_clone(&*owner->contents.err);
8762 }
8763 int32_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_err(int64_t owner) {
8764         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
8765         int32_t ret_conv = LDKSocketAddressParseError_to_cs(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
8766         return ret_conv;
8767 }
8768
8769 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8770         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8771         for (size_t i = 0; i < ret.datalen; i++) {
8772                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8773         }
8774         return ret;
8775 }
8776 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8777         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8778         for (size_t i = 0; i < ret.datalen; i++) {
8779                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8780         }
8781         return ret;
8782 }
8783 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8784         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8785         for (size_t i = 0; i < ret.datalen; i++) {
8786                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8787         }
8788         return ret;
8789 }
8790 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8791         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8792         for (size_t i = 0; i < ret.datalen; i++) {
8793                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8794         }
8795         return ret;
8796 }
8797 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8798         LDKAcceptChannel ret = *owner->contents.result;
8799         ret.is_owned = false;
8800         return ret;
8801 }
8802 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_ok(int64_t owner) {
8803         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8804         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8805         int64_t ret_ref = 0;
8806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8808         return ret_ref;
8809 }
8810
8811 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8812 CHECK(!owner->result_ok);
8813         return DecodeError_clone(&*owner->contents.err);
8814 }
8815 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_err(int64_t owner) {
8816         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8817         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8818         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8819         int64_t ret_ref = tag_ptr(ret_copy, true);
8820         return ret_ref;
8821 }
8822
8823 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8824         LDKAcceptChannelV2 ret = *owner->contents.result;
8825         ret.is_owned = false;
8826         return ret;
8827 }
8828 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_ok(int64_t owner) {
8829         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8830         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8831         int64_t ret_ref = 0;
8832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8834         return ret_ref;
8835 }
8836
8837 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8838 CHECK(!owner->result_ok);
8839         return DecodeError_clone(&*owner->contents.err);
8840 }
8841 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_err(int64_t owner) {
8842         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8843         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8844         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8845         int64_t ret_ref = tag_ptr(ret_copy, true);
8846         return ret_ref;
8847 }
8848
8849 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8850         LDKStfu ret = *owner->contents.result;
8851         ret.is_owned = false;
8852         return ret;
8853 }
8854 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_ok(int64_t owner) {
8855         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8856         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
8857         int64_t ret_ref = 0;
8858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8860         return ret_ref;
8861 }
8862
8863 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
8864 CHECK(!owner->result_ok);
8865         return DecodeError_clone(&*owner->contents.err);
8866 }
8867 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_err(int64_t owner) {
8868         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
8869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8870         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
8871         int64_t ret_ref = tag_ptr(ret_copy, true);
8872         return ret_ref;
8873 }
8874
8875 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8876         LDKSplice ret = *owner->contents.result;
8877         ret.is_owned = false;
8878         return ret;
8879 }
8880 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_ok(int64_t owner) {
8881         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8882         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
8883         int64_t ret_ref = 0;
8884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8886         return ret_ref;
8887 }
8888
8889 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
8890 CHECK(!owner->result_ok);
8891         return DecodeError_clone(&*owner->contents.err);
8892 }
8893 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_err(int64_t owner) {
8894         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
8895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8896         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
8897         int64_t ret_ref = tag_ptr(ret_copy, true);
8898         return ret_ref;
8899 }
8900
8901 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8902         LDKSpliceAck ret = *owner->contents.result;
8903         ret.is_owned = false;
8904         return ret;
8905 }
8906 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_ok(int64_t owner) {
8907         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8908         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
8909         int64_t ret_ref = 0;
8910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8912         return ret_ref;
8913 }
8914
8915 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
8916 CHECK(!owner->result_ok);
8917         return DecodeError_clone(&*owner->contents.err);
8918 }
8919 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_err(int64_t owner) {
8920         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
8921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8922         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
8923         int64_t ret_ref = tag_ptr(ret_copy, true);
8924         return ret_ref;
8925 }
8926
8927 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8928         LDKSpliceLocked ret = *owner->contents.result;
8929         ret.is_owned = false;
8930         return ret;
8931 }
8932 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_ok(int64_t owner) {
8933         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8934         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
8935         int64_t ret_ref = 0;
8936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8938         return ret_ref;
8939 }
8940
8941 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
8942 CHECK(!owner->result_ok);
8943         return DecodeError_clone(&*owner->contents.err);
8944 }
8945 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_err(int64_t owner) {
8946         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
8947         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8948         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
8949         int64_t ret_ref = tag_ptr(ret_copy, true);
8950         return ret_ref;
8951 }
8952
8953 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8954         LDKTxAddInput ret = *owner->contents.result;
8955         ret.is_owned = false;
8956         return ret;
8957 }
8958 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_ok(int64_t owner) {
8959         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8960         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8961         int64_t ret_ref = 0;
8962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8964         return ret_ref;
8965 }
8966
8967 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8968 CHECK(!owner->result_ok);
8969         return DecodeError_clone(&*owner->contents.err);
8970 }
8971 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_err(int64_t owner) {
8972         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8973         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8974         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8975         int64_t ret_ref = tag_ptr(ret_copy, true);
8976         return ret_ref;
8977 }
8978
8979 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8980         LDKTxAddOutput ret = *owner->contents.result;
8981         ret.is_owned = false;
8982         return ret;
8983 }
8984 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_ok(int64_t owner) {
8985         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8986         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8987         int64_t ret_ref = 0;
8988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8990         return ret_ref;
8991 }
8992
8993 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8994 CHECK(!owner->result_ok);
8995         return DecodeError_clone(&*owner->contents.err);
8996 }
8997 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_err(int64_t owner) {
8998         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8999         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9000         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9001         int64_t ret_ref = tag_ptr(ret_copy, true);
9002         return ret_ref;
9003 }
9004
9005 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9006         LDKTxRemoveInput ret = *owner->contents.result;
9007         ret.is_owned = false;
9008         return ret;
9009 }
9010 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_ok(int64_t owner) {
9011         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9012         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9020 CHECK(!owner->result_ok);
9021         return DecodeError_clone(&*owner->contents.err);
9022 }
9023 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_err(int64_t owner) {
9024         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9025         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9026         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9027         int64_t ret_ref = tag_ptr(ret_copy, true);
9028         return ret_ref;
9029 }
9030
9031 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9032         LDKTxRemoveOutput ret = *owner->contents.result;
9033         ret.is_owned = false;
9034         return ret;
9035 }
9036 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_ok(int64_t owner) {
9037         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9038         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9039         int64_t ret_ref = 0;
9040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9042         return ret_ref;
9043 }
9044
9045 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9046 CHECK(!owner->result_ok);
9047         return DecodeError_clone(&*owner->contents.err);
9048 }
9049 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_err(int64_t owner) {
9050         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9052         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9053         int64_t ret_ref = tag_ptr(ret_copy, true);
9054         return ret_ref;
9055 }
9056
9057 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9058         LDKTxComplete ret = *owner->contents.result;
9059         ret.is_owned = false;
9060         return ret;
9061 }
9062 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_ok(int64_t owner) {
9063         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9064         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9065         int64_t ret_ref = 0;
9066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9068         return ret_ref;
9069 }
9070
9071 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9072 CHECK(!owner->result_ok);
9073         return DecodeError_clone(&*owner->contents.err);
9074 }
9075 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_err(int64_t owner) {
9076         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9077         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9078         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9079         int64_t ret_ref = tag_ptr(ret_copy, true);
9080         return ret_ref;
9081 }
9082
9083 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9084         LDKTxSignatures ret = *owner->contents.result;
9085         ret.is_owned = false;
9086         return ret;
9087 }
9088 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9089         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9090         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9091         int64_t ret_ref = 0;
9092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9094         return ret_ref;
9095 }
9096
9097 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9098 CHECK(!owner->result_ok);
9099         return DecodeError_clone(&*owner->contents.err);
9100 }
9101 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_err(int64_t owner) {
9102         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9104         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9105         int64_t ret_ref = tag_ptr(ret_copy, true);
9106         return ret_ref;
9107 }
9108
9109 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9110         LDKTxInitRbf ret = *owner->contents.result;
9111         ret.is_owned = false;
9112         return ret;
9113 }
9114 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_ok(int64_t owner) {
9115         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9116         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9117         int64_t ret_ref = 0;
9118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9120         return ret_ref;
9121 }
9122
9123 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9124 CHECK(!owner->result_ok);
9125         return DecodeError_clone(&*owner->contents.err);
9126 }
9127 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_err(int64_t owner) {
9128         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9129         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9130         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9131         int64_t ret_ref = tag_ptr(ret_copy, true);
9132         return ret_ref;
9133 }
9134
9135 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9136         LDKTxAckRbf ret = *owner->contents.result;
9137         ret.is_owned = false;
9138         return ret;
9139 }
9140 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_ok(int64_t owner) {
9141         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9142         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9143         int64_t ret_ref = 0;
9144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9146         return ret_ref;
9147 }
9148
9149 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9150 CHECK(!owner->result_ok);
9151         return DecodeError_clone(&*owner->contents.err);
9152 }
9153 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_err(int64_t owner) {
9154         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9155         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9156         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9157         int64_t ret_ref = tag_ptr(ret_copy, true);
9158         return ret_ref;
9159 }
9160
9161 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9162         LDKTxAbort ret = *owner->contents.result;
9163         ret.is_owned = false;
9164         return ret;
9165 }
9166 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_ok(int64_t owner) {
9167         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9168         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9169         int64_t ret_ref = 0;
9170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9172         return ret_ref;
9173 }
9174
9175 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9176 CHECK(!owner->result_ok);
9177         return DecodeError_clone(&*owner->contents.err);
9178 }
9179 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_err(int64_t owner) {
9180         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9181         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9182         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9183         int64_t ret_ref = tag_ptr(ret_copy, true);
9184         return ret_ref;
9185 }
9186
9187 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9188         LDKAnnouncementSignatures ret = *owner->contents.result;
9189         ret.is_owned = false;
9190         return ret;
9191 }
9192 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9193         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9194         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9195         int64_t ret_ref = 0;
9196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9198         return ret_ref;
9199 }
9200
9201 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9202 CHECK(!owner->result_ok);
9203         return DecodeError_clone(&*owner->contents.err);
9204 }
9205 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(int64_t owner) {
9206         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9208         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9209         int64_t ret_ref = tag_ptr(ret_copy, true);
9210         return ret_ref;
9211 }
9212
9213 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9214         LDKChannelReestablish ret = *owner->contents.result;
9215         ret.is_owned = false;
9216         return ret;
9217 }
9218 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_ok(int64_t owner) {
9219         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9220         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9221         int64_t ret_ref = 0;
9222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9224         return ret_ref;
9225 }
9226
9227 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9228 CHECK(!owner->result_ok);
9229         return DecodeError_clone(&*owner->contents.err);
9230 }
9231 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_err(int64_t owner) {
9232         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9233         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9234         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9235         int64_t ret_ref = tag_ptr(ret_copy, true);
9236         return ret_ref;
9237 }
9238
9239 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9240         LDKClosingSigned ret = *owner->contents.result;
9241         ret.is_owned = false;
9242         return ret;
9243 }
9244 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_ok(int64_t owner) {
9245         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9246         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9247         int64_t ret_ref = 0;
9248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9250         return ret_ref;
9251 }
9252
9253 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9254 CHECK(!owner->result_ok);
9255         return DecodeError_clone(&*owner->contents.err);
9256 }
9257 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_err(int64_t owner) {
9258         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9259         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9260         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9261         int64_t ret_ref = tag_ptr(ret_copy, true);
9262         return ret_ref;
9263 }
9264
9265 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9266         LDKClosingSignedFeeRange ret = *owner->contents.result;
9267         ret.is_owned = false;
9268         return ret;
9269 }
9270 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(int64_t owner) {
9271         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9272         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9273         int64_t ret_ref = 0;
9274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9276         return ret_ref;
9277 }
9278
9279 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9280 CHECK(!owner->result_ok);
9281         return DecodeError_clone(&*owner->contents.err);
9282 }
9283 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(int64_t owner) {
9284         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9286         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9287         int64_t ret_ref = tag_ptr(ret_copy, true);
9288         return ret_ref;
9289 }
9290
9291 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9292         LDKCommitmentSigned ret = *owner->contents.result;
9293         ret.is_owned = false;
9294         return ret;
9295 }
9296 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_ok(int64_t owner) {
9297         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9298         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9299         int64_t ret_ref = 0;
9300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9302         return ret_ref;
9303 }
9304
9305 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9306 CHECK(!owner->result_ok);
9307         return DecodeError_clone(&*owner->contents.err);
9308 }
9309 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_err(int64_t owner) {
9310         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9311         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9312         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9313         int64_t ret_ref = tag_ptr(ret_copy, true);
9314         return ret_ref;
9315 }
9316
9317 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9318         LDKFundingCreated ret = *owner->contents.result;
9319         ret.is_owned = false;
9320         return ret;
9321 }
9322 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_ok(int64_t owner) {
9323         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9324         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9325         int64_t ret_ref = 0;
9326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9328         return ret_ref;
9329 }
9330
9331 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9332 CHECK(!owner->result_ok);
9333         return DecodeError_clone(&*owner->contents.err);
9334 }
9335 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_err(int64_t owner) {
9336         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9337         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9338         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9339         int64_t ret_ref = tag_ptr(ret_copy, true);
9340         return ret_ref;
9341 }
9342
9343 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9344         LDKFundingSigned ret = *owner->contents.result;
9345         ret.is_owned = false;
9346         return ret;
9347 }
9348 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_ok(int64_t owner) {
9349         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9350         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9351         int64_t ret_ref = 0;
9352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9354         return ret_ref;
9355 }
9356
9357 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9358 CHECK(!owner->result_ok);
9359         return DecodeError_clone(&*owner->contents.err);
9360 }
9361 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_err(int64_t owner) {
9362         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9363         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9364         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9365         int64_t ret_ref = tag_ptr(ret_copy, true);
9366         return ret_ref;
9367 }
9368
9369 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9370         LDKChannelReady ret = *owner->contents.result;
9371         ret.is_owned = false;
9372         return ret;
9373 }
9374 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_ok(int64_t owner) {
9375         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9376         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9377         int64_t ret_ref = 0;
9378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9380         return ret_ref;
9381 }
9382
9383 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9384 CHECK(!owner->result_ok);
9385         return DecodeError_clone(&*owner->contents.err);
9386 }
9387 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_err(int64_t owner) {
9388         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9389         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9390         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9391         int64_t ret_ref = tag_ptr(ret_copy, true);
9392         return ret_ref;
9393 }
9394
9395 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9396         LDKInit ret = *owner->contents.result;
9397         ret.is_owned = false;
9398         return ret;
9399 }
9400 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_ok(int64_t owner) {
9401         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9402         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9403         int64_t ret_ref = 0;
9404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9406         return ret_ref;
9407 }
9408
9409 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9410 CHECK(!owner->result_ok);
9411         return DecodeError_clone(&*owner->contents.err);
9412 }
9413 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_err(int64_t owner) {
9414         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9415         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9416         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9417         int64_t ret_ref = tag_ptr(ret_copy, true);
9418         return ret_ref;
9419 }
9420
9421 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9422         LDKOpenChannel ret = *owner->contents.result;
9423         ret.is_owned = false;
9424         return ret;
9425 }
9426 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_ok(int64_t owner) {
9427         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9428         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9429         int64_t ret_ref = 0;
9430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9432         return ret_ref;
9433 }
9434
9435 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9436 CHECK(!owner->result_ok);
9437         return DecodeError_clone(&*owner->contents.err);
9438 }
9439 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_err(int64_t owner) {
9440         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9441         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9442         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9443         int64_t ret_ref = tag_ptr(ret_copy, true);
9444         return ret_ref;
9445 }
9446
9447 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9448         LDKOpenChannelV2 ret = *owner->contents.result;
9449         ret.is_owned = false;
9450         return ret;
9451 }
9452 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_ok(int64_t owner) {
9453         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9454         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9455         int64_t ret_ref = 0;
9456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9458         return ret_ref;
9459 }
9460
9461 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9462 CHECK(!owner->result_ok);
9463         return DecodeError_clone(&*owner->contents.err);
9464 }
9465 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_err(int64_t owner) {
9466         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9468         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9469         int64_t ret_ref = tag_ptr(ret_copy, true);
9470         return ret_ref;
9471 }
9472
9473 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9474         LDKRevokeAndACK ret = *owner->contents.result;
9475         ret.is_owned = false;
9476         return ret;
9477 }
9478 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_ok(int64_t owner) {
9479         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9480         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9481         int64_t ret_ref = 0;
9482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9484         return ret_ref;
9485 }
9486
9487 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9488 CHECK(!owner->result_ok);
9489         return DecodeError_clone(&*owner->contents.err);
9490 }
9491 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_err(int64_t owner) {
9492         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9493         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9494         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9495         int64_t ret_ref = tag_ptr(ret_copy, true);
9496         return ret_ref;
9497 }
9498
9499 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9500         LDKShutdown ret = *owner->contents.result;
9501         ret.is_owned = false;
9502         return ret;
9503 }
9504 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_ok(int64_t owner) {
9505         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9506         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9507         int64_t ret_ref = 0;
9508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9510         return ret_ref;
9511 }
9512
9513 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9514 CHECK(!owner->result_ok);
9515         return DecodeError_clone(&*owner->contents.err);
9516 }
9517 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_err(int64_t owner) {
9518         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9520         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9521         int64_t ret_ref = tag_ptr(ret_copy, true);
9522         return ret_ref;
9523 }
9524
9525 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9526         LDKUpdateFailHTLC ret = *owner->contents.result;
9527         ret.is_owned = false;
9528         return ret;
9529 }
9530 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(int64_t owner) {
9531         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9532         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9533         int64_t ret_ref = 0;
9534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9536         return ret_ref;
9537 }
9538
9539 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9540 CHECK(!owner->result_ok);
9541         return DecodeError_clone(&*owner->contents.err);
9542 }
9543 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_err(int64_t owner) {
9544         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9546         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9547         int64_t ret_ref = tag_ptr(ret_copy, true);
9548         return ret_ref;
9549 }
9550
9551 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9552         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9553         ret.is_owned = false;
9554         return ret;
9555 }
9556 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(int64_t owner) {
9557         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9558         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9559         int64_t ret_ref = 0;
9560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9562         return ret_ref;
9563 }
9564
9565 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9566 CHECK(!owner->result_ok);
9567         return DecodeError_clone(&*owner->contents.err);
9568 }
9569 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(int64_t owner) {
9570         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9572         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9573         int64_t ret_ref = tag_ptr(ret_copy, true);
9574         return ret_ref;
9575 }
9576
9577 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9578         LDKUpdateFee ret = *owner->contents.result;
9579         ret.is_owned = false;
9580         return ret;
9581 }
9582 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_ok(int64_t owner) {
9583         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9584         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9585         int64_t ret_ref = 0;
9586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9588         return ret_ref;
9589 }
9590
9591 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9592 CHECK(!owner->result_ok);
9593         return DecodeError_clone(&*owner->contents.err);
9594 }
9595 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_err(int64_t owner) {
9596         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9597         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9598         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9599         int64_t ret_ref = tag_ptr(ret_copy, true);
9600         return ret_ref;
9601 }
9602
9603 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9604         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9605         ret.is_owned = false;
9606         return ret;
9607 }
9608 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(int64_t owner) {
9609         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9610         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9611         int64_t ret_ref = 0;
9612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9614         return ret_ref;
9615 }
9616
9617 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9618 CHECK(!owner->result_ok);
9619         return DecodeError_clone(&*owner->contents.err);
9620 }
9621 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(int64_t owner) {
9622         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9623         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9624         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9625         int64_t ret_ref = tag_ptr(ret_copy, true);
9626         return ret_ref;
9627 }
9628
9629 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9630         LDKOnionPacket ret = *owner->contents.result;
9631         ret.is_owned = false;
9632         return ret;
9633 }
9634 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_ok(int64_t owner) {
9635         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9636         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
9637         int64_t ret_ref = 0;
9638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9640         return ret_ref;
9641 }
9642
9643 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
9644 CHECK(!owner->result_ok);
9645         return DecodeError_clone(&*owner->contents.err);
9646 }
9647 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_err(int64_t owner) {
9648         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
9649         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9650         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
9651         int64_t ret_ref = tag_ptr(ret_copy, true);
9652         return ret_ref;
9653 }
9654
9655 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9656         LDKUpdateAddHTLC ret = *owner->contents.result;
9657         ret.is_owned = false;
9658         return ret;
9659 }
9660 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(int64_t owner) {
9661         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9662         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9663         int64_t ret_ref = 0;
9664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9666         return ret_ref;
9667 }
9668
9669 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9670 CHECK(!owner->result_ok);
9671         return DecodeError_clone(&*owner->contents.err);
9672 }
9673 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_err(int64_t owner) {
9674         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9675         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9676         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9677         int64_t ret_ref = tag_ptr(ret_copy, true);
9678         return ret_ref;
9679 }
9680
9681 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9682         LDKOnionMessage ret = *owner->contents.result;
9683         ret.is_owned = false;
9684         return ret;
9685 }
9686 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_ok(int64_t owner) {
9687         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9688         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9689         int64_t ret_ref = 0;
9690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9692         return ret_ref;
9693 }
9694
9695 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9696 CHECK(!owner->result_ok);
9697         return DecodeError_clone(&*owner->contents.err);
9698 }
9699 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_err(int64_t owner) {
9700         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9701         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9702         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9703         int64_t ret_ref = tag_ptr(ret_copy, true);
9704         return ret_ref;
9705 }
9706
9707 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9708         LDKFinalOnionHopData ret = *owner->contents.result;
9709         ret.is_owned = false;
9710         return ret;
9711 }
9712 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(int64_t owner) {
9713         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9714         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
9715         int64_t ret_ref = 0;
9716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9718         return ret_ref;
9719 }
9720
9721 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
9722 CHECK(!owner->result_ok);
9723         return DecodeError_clone(&*owner->contents.err);
9724 }
9725 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_err(int64_t owner) {
9726         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
9727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9728         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
9729         int64_t ret_ref = tag_ptr(ret_copy, true);
9730         return ret_ref;
9731 }
9732
9733 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9734         LDKPing ret = *owner->contents.result;
9735         ret.is_owned = false;
9736         return ret;
9737 }
9738 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_ok(int64_t owner) {
9739         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9740         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9741         int64_t ret_ref = 0;
9742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9744         return ret_ref;
9745 }
9746
9747 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9748 CHECK(!owner->result_ok);
9749         return DecodeError_clone(&*owner->contents.err);
9750 }
9751 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_err(int64_t owner) {
9752         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9753         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9754         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9755         int64_t ret_ref = tag_ptr(ret_copy, true);
9756         return ret_ref;
9757 }
9758
9759 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9760         LDKPong ret = *owner->contents.result;
9761         ret.is_owned = false;
9762         return ret;
9763 }
9764 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_ok(int64_t owner) {
9765         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9766         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9767         int64_t ret_ref = 0;
9768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9770         return ret_ref;
9771 }
9772
9773 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9774 CHECK(!owner->result_ok);
9775         return DecodeError_clone(&*owner->contents.err);
9776 }
9777 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_err(int64_t owner) {
9778         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9779         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9780         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9781         int64_t ret_ref = tag_ptr(ret_copy, true);
9782         return ret_ref;
9783 }
9784
9785 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9786         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9787         ret.is_owned = false;
9788         return ret;
9789 }
9790 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9791         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9792         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9793         int64_t ret_ref = 0;
9794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9796         return ret_ref;
9797 }
9798
9799 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9800 CHECK(!owner->result_ok);
9801         return DecodeError_clone(&*owner->contents.err);
9802 }
9803 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9804         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9806         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9807         int64_t ret_ref = tag_ptr(ret_copy, true);
9808         return ret_ref;
9809 }
9810
9811 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9812         LDKChannelAnnouncement ret = *owner->contents.result;
9813         ret.is_owned = false;
9814         return ret;
9815 }
9816 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9817         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9818         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9819         int64_t ret_ref = 0;
9820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9822         return ret_ref;
9823 }
9824
9825 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9826 CHECK(!owner->result_ok);
9827         return DecodeError_clone(&*owner->contents.err);
9828 }
9829 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9830         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9831         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9832         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9833         int64_t ret_ref = tag_ptr(ret_copy, true);
9834         return ret_ref;
9835 }
9836
9837 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9838         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9839         ret.is_owned = false;
9840         return ret;
9841 }
9842 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
9843         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9844         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9845         int64_t ret_ref = 0;
9846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9848         return ret_ref;
9849 }
9850
9851 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9852 CHECK(!owner->result_ok);
9853         return DecodeError_clone(&*owner->contents.err);
9854 }
9855 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
9856         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9857         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9858         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9859         int64_t ret_ref = tag_ptr(ret_copy, true);
9860         return ret_ref;
9861 }
9862
9863 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9864         LDKChannelUpdate ret = *owner->contents.result;
9865         ret.is_owned = false;
9866         return ret;
9867 }
9868 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
9869         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9870         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9871         int64_t ret_ref = 0;
9872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9874         return ret_ref;
9875 }
9876
9877 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9878 CHECK(!owner->result_ok);
9879         return DecodeError_clone(&*owner->contents.err);
9880 }
9881 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
9882         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9884         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9885         int64_t ret_ref = tag_ptr(ret_copy, true);
9886         return ret_ref;
9887 }
9888
9889 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9890         LDKErrorMessage ret = *owner->contents.result;
9891         ret.is_owned = false;
9892         return ret;
9893 }
9894 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_ok(int64_t owner) {
9895         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9896         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9897         int64_t ret_ref = 0;
9898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9900         return ret_ref;
9901 }
9902
9903 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9904 CHECK(!owner->result_ok);
9905         return DecodeError_clone(&*owner->contents.err);
9906 }
9907 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_err(int64_t owner) {
9908         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9909         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9910         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9911         int64_t ret_ref = tag_ptr(ret_copy, true);
9912         return ret_ref;
9913 }
9914
9915 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9916         LDKWarningMessage ret = *owner->contents.result;
9917         ret.is_owned = false;
9918         return ret;
9919 }
9920 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_ok(int64_t owner) {
9921         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9922         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9923         int64_t ret_ref = 0;
9924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9926         return ret_ref;
9927 }
9928
9929 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9930 CHECK(!owner->result_ok);
9931         return DecodeError_clone(&*owner->contents.err);
9932 }
9933 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_err(int64_t owner) {
9934         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9935         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9936         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9937         int64_t ret_ref = tag_ptr(ret_copy, true);
9938         return ret_ref;
9939 }
9940
9941 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9942         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9943         ret.is_owned = false;
9944         return ret;
9945 }
9946 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9947         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9948         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9949         int64_t ret_ref = 0;
9950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9952         return ret_ref;
9953 }
9954
9955 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9956 CHECK(!owner->result_ok);
9957         return DecodeError_clone(&*owner->contents.err);
9958 }
9959 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9960         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9961         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9962         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9963         int64_t ret_ref = tag_ptr(ret_copy, true);
9964         return ret_ref;
9965 }
9966
9967 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9968         LDKNodeAnnouncement ret = *owner->contents.result;
9969         ret.is_owned = false;
9970         return ret;
9971 }
9972 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
9973         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9974         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9975         int64_t ret_ref = 0;
9976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9978         return ret_ref;
9979 }
9980
9981 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9982 CHECK(!owner->result_ok);
9983         return DecodeError_clone(&*owner->contents.err);
9984 }
9985 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
9986         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9987         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9988         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9989         int64_t ret_ref = tag_ptr(ret_copy, true);
9990         return ret_ref;
9991 }
9992
9993 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9994         LDKQueryShortChannelIds ret = *owner->contents.result;
9995         ret.is_owned = false;
9996         return ret;
9997 }
9998 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(int64_t owner) {
9999         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10000         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10001         int64_t ret_ref = 0;
10002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10004         return ret_ref;
10005 }
10006
10007 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10008 CHECK(!owner->result_ok);
10009         return DecodeError_clone(&*owner->contents.err);
10010 }
10011 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(int64_t owner) {
10012         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10013         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10014         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10015         int64_t ret_ref = tag_ptr(ret_copy, true);
10016         return ret_ref;
10017 }
10018
10019 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10020         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10021         ret.is_owned = false;
10022         return ret;
10023 }
10024 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(int64_t owner) {
10025         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10026         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10027         int64_t ret_ref = 0;
10028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10030         return ret_ref;
10031 }
10032
10033 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10034 CHECK(!owner->result_ok);
10035         return DecodeError_clone(&*owner->contents.err);
10036 }
10037 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(int64_t owner) {
10038         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10039         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10040         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10041         int64_t ret_ref = tag_ptr(ret_copy, true);
10042         return ret_ref;
10043 }
10044
10045 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10046         LDKQueryChannelRange ret = *owner->contents.result;
10047         ret.is_owned = false;
10048         return ret;
10049 }
10050 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10051         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10052         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10053         int64_t ret_ref = 0;
10054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10056         return ret_ref;
10057 }
10058
10059 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10060 CHECK(!owner->result_ok);
10061         return DecodeError_clone(&*owner->contents.err);
10062 }
10063 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10064         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10065         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10066         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10067         int64_t ret_ref = tag_ptr(ret_copy, true);
10068         return ret_ref;
10069 }
10070
10071 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10072         LDKReplyChannelRange ret = *owner->contents.result;
10073         ret.is_owned = false;
10074         return ret;
10075 }
10076 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10077         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10078         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10079         int64_t ret_ref = 0;
10080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10082         return ret_ref;
10083 }
10084
10085 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10086 CHECK(!owner->result_ok);
10087         return DecodeError_clone(&*owner->contents.err);
10088 }
10089 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10090         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10091         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10092         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10093         int64_t ret_ref = tag_ptr(ret_copy, true);
10094         return ret_ref;
10095 }
10096
10097 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10098         LDKGossipTimestampFilter ret = *owner->contents.result;
10099         ret.is_owned = false;
10100         return ret;
10101 }
10102 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(int64_t owner) {
10103         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10104         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10105         int64_t ret_ref = 0;
10106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10108         return ret_ref;
10109 }
10110
10111 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10112 CHECK(!owner->result_ok);
10113         return DecodeError_clone(&*owner->contents.err);
10114 }
10115 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_err(int64_t owner) {
10116         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10117         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10118         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10119         int64_t ret_ref = tag_ptr(ret_copy, true);
10120         return ret_ref;
10121 }
10122
10123 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10124         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10125         for (size_t i = 0; i < ret.datalen; i++) {
10126                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10127         }
10128         return ret;
10129 }
10130 uint32_t CS_LDK_LDKSignOrCreationError_ty_from_ptr(int64_t ptr) {
10131         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10132         switch(obj->tag) {
10133                 case LDKSignOrCreationError_SignError: return 0;
10134                 case LDKSignOrCreationError_CreationError: return 1;
10135                 default: abort();
10136         }
10137 }
10138 int32_t CS_LDK_LDKSignOrCreationError_CreationError_get_creation_error(int64_t ptr) {
10139         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10140         CHECK(obj->tag == LDKSignOrCreationError_CreationError);
10141         int32_t creation_error_conv = LDKCreationError_to_cs(obj->creation_error);
10142         return creation_error_conv;
10143 }
10144 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10145         LDKBolt11Invoice ret = *owner->contents.result;
10146         ret.is_owned = false;
10147         return ret;
10148 }
10149 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(int64_t owner) {
10150         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10151         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_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 LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10159 CHECK(!owner->result_ok);
10160         return SignOrCreationError_clone(&*owner->contents.err);
10161 }
10162 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(int64_t owner) {
10163         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10164         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10165         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10166         int64_t ret_ref = tag_ptr(ret_copy, true);
10167         return ret_ref;
10168 }
10169
10170 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
10171         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
10172         for (size_t i = 0; i < ret.datalen; i++) {
10173                 ret.data[i] = Future_clone(&orig->data[i]);
10174         }
10175         return ret;
10176 }
10177 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10178 CHECK(owner->result_ok);
10179         return OffersMessage_clone(&*owner->contents.result);
10180 }
10181 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_ok(int64_t owner) {
10182         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10183         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
10184         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
10185         int64_t ret_ref = tag_ptr(ret_copy, true);
10186         return ret_ref;
10187 }
10188
10189 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
10190 CHECK(!owner->result_ok);
10191         return DecodeError_clone(&*owner->contents.err);
10192 }
10193 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_err(int64_t owner) {
10194         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
10195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10196         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
10197         int64_t ret_ref = tag_ptr(ret_copy, true);
10198         return ret_ref;
10199 }
10200
10201 uint32_t CS_LDK_LDKCOption_HTLCClaimZ_ty_from_ptr(int64_t ptr) {
10202         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10203         switch(obj->tag) {
10204                 case LDKCOption_HTLCClaimZ_Some: return 0;
10205                 case LDKCOption_HTLCClaimZ_None: return 1;
10206                 default: abort();
10207         }
10208 }
10209 int32_t CS_LDK_LDKCOption_HTLCClaimZ_Some_get_some(int64_t ptr) {
10210         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
10211         CHECK(obj->tag == LDKCOption_HTLCClaimZ_Some);
10212         int32_t some_conv = LDKHTLCClaim_to_cs(obj->some);
10213         return some_conv;
10214 }
10215 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10216         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
10217         ret.is_owned = false;
10218         return ret;
10219 }
10220 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(int64_t owner) {
10221         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10222         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
10223         int64_t ret_ref = 0;
10224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10226         return ret_ref;
10227 }
10228
10229 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
10230 CHECK(!owner->result_ok);
10231         return DecodeError_clone(&*owner->contents.err);
10232 }
10233 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(int64_t owner) {
10234         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
10235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10236         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
10237         int64_t ret_ref = tag_ptr(ret_copy, true);
10238         return ret_ref;
10239 }
10240
10241 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10242         LDKTxCreationKeys ret = *owner->contents.result;
10243         ret.is_owned = false;
10244         return ret;
10245 }
10246 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_ok(int64_t owner) {
10247         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10248         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
10249         int64_t ret_ref = 0;
10250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10252         return ret_ref;
10253 }
10254
10255 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
10256 CHECK(!owner->result_ok);
10257         return DecodeError_clone(&*owner->contents.err);
10258 }
10259 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_err(int64_t owner) {
10260         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
10261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10262         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
10263         int64_t ret_ref = tag_ptr(ret_copy, true);
10264         return ret_ref;
10265 }
10266
10267 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10268         LDKChannelPublicKeys ret = *owner->contents.result;
10269         ret.is_owned = false;
10270         return ret;
10271 }
10272 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(int64_t owner) {
10273         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10274         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
10275         int64_t ret_ref = 0;
10276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10278         return ret_ref;
10279 }
10280
10281 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
10282 CHECK(!owner->result_ok);
10283         return DecodeError_clone(&*owner->contents.err);
10284 }
10285 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_err(int64_t owner) {
10286         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
10287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10288         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
10289         int64_t ret_ref = tag_ptr(ret_copy, true);
10290         return ret_ref;
10291 }
10292
10293 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10294         LDKHTLCOutputInCommitment ret = *owner->contents.result;
10295         ret.is_owned = false;
10296         return ret;
10297 }
10298 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(int64_t owner) {
10299         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10300         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
10301         int64_t ret_ref = 0;
10302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10304         return ret_ref;
10305 }
10306
10307 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
10308 CHECK(!owner->result_ok);
10309         return DecodeError_clone(&*owner->contents.err);
10310 }
10311 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(int64_t owner) {
10312         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
10313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10314         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
10315         int64_t ret_ref = tag_ptr(ret_copy, true);
10316         return ret_ref;
10317 }
10318
10319 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10320         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
10321         ret.is_owned = false;
10322         return ret;
10323 }
10324 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
10325         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10326         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10327         int64_t ret_ref = 0;
10328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10330         return ret_ref;
10331 }
10332
10333 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10334 CHECK(!owner->result_ok);
10335         return DecodeError_clone(&*owner->contents.err);
10336 }
10337 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
10338         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10340         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10341         int64_t ret_ref = tag_ptr(ret_copy, true);
10342         return ret_ref;
10343 }
10344
10345 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10346         LDKChannelTransactionParameters ret = *owner->contents.result;
10347         ret.is_owned = false;
10348         return ret;
10349 }
10350 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
10351         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10352         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
10353         int64_t ret_ref = 0;
10354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10356         return ret_ref;
10357 }
10358
10359 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
10360 CHECK(!owner->result_ok);
10361         return DecodeError_clone(&*owner->contents.err);
10362 }
10363 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
10364         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
10365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10366         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
10367         int64_t ret_ref = tag_ptr(ret_copy, true);
10368         return ret_ref;
10369 }
10370
10371 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10372         LDKHolderCommitmentTransaction ret = *owner->contents.result;
10373         ret.is_owned = false;
10374         return ret;
10375 }
10376 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10377         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10378         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10379         int64_t ret_ref = 0;
10380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10382         return ret_ref;
10383 }
10384
10385 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10386 CHECK(!owner->result_ok);
10387         return DecodeError_clone(&*owner->contents.err);
10388 }
10389 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10390         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10392         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10393         int64_t ret_ref = tag_ptr(ret_copy, true);
10394         return ret_ref;
10395 }
10396
10397 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10398         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
10399         ret.is_owned = false;
10400         return ret;
10401 }
10402 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10403         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10404         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10405         int64_t ret_ref = 0;
10406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10408         return ret_ref;
10409 }
10410
10411 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10412 CHECK(!owner->result_ok);
10413         return DecodeError_clone(&*owner->contents.err);
10414 }
10415 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10416         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10417         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10418         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10419         int64_t ret_ref = tag_ptr(ret_copy, true);
10420         return ret_ref;
10421 }
10422
10423 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10424         LDKTrustedClosingTransaction ret = *owner->contents.result;
10425         ret.is_owned = false;
10426         return ret;
10427 }
10428 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_ok(int64_t owner) {
10429         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10430         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
10431         int64_t ret_ref = 0;
10432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10434         return ret_ref;
10435 }
10436
10437 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
10438 CHECK(!owner->result_ok);
10439         return *owner->contents.err;
10440 }
10441 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_err(int64_t owner) {
10442         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
10443         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
10444 }
10445
10446 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10447         LDKCommitmentTransaction ret = *owner->contents.result;
10448         ret.is_owned = false;
10449         return ret;
10450 }
10451 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
10452         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10453         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
10454         int64_t ret_ref = 0;
10455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10457         return ret_ref;
10458 }
10459
10460 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
10461 CHECK(!owner->result_ok);
10462         return DecodeError_clone(&*owner->contents.err);
10463 }
10464 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
10465         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
10466         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10467         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
10468         int64_t ret_ref = tag_ptr(ret_copy, true);
10469         return ret_ref;
10470 }
10471
10472 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10473         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
10474         ret.is_owned = false;
10475         return ret;
10476 }
10477 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_ok(int64_t owner) {
10478         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10479         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
10480         int64_t ret_ref = 0;
10481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10483         return ret_ref;
10484 }
10485
10486 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
10487 CHECK(!owner->result_ok);
10488         return *owner->contents.err;
10489 }
10490 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_err(int64_t owner) {
10491         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
10492         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
10493 }
10494
10495 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10496 CHECK(owner->result_ok);
10497         return *owner->contents.result;
10498 }
10499 ptrArray  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_ok(int64_t owner) {
10500         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10501         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
10502         ptrArray ret_arr = NULL;
10503         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
10504         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
10505         for (size_t i = 0; i < ret_var.datalen; i++) {
10506                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
10507                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
10508                 ret_arr_ptr[i] = ret_conv_8_arr;
10509         }
10510         
10511         return ret_arr;
10512 }
10513
10514 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
10515 CHECK(!owner->result_ok);
10516         return *owner->contents.err;
10517 }
10518 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_err(int64_t owner) {
10519         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
10520         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
10521 }
10522
10523 uint32_t CS_LDK_LDKCOption_usizeZ_ty_from_ptr(int64_t ptr) {
10524         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10525         switch(obj->tag) {
10526                 case LDKCOption_usizeZ_Some: return 0;
10527                 case LDKCOption_usizeZ_None: return 1;
10528                 default: abort();
10529         }
10530 }
10531 int64_t CS_LDK_LDKCOption_usizeZ_Some_get_some(int64_t ptr) {
10532         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
10533         CHECK(obj->tag == LDKCOption_usizeZ_Some);
10534         int64_t some_conv = obj->some;
10535         return some_conv;
10536 }
10537 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10538         LDKShutdownScript ret = *owner->contents.result;
10539         ret.is_owned = false;
10540         return ret;
10541 }
10542 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_ok(int64_t owner) {
10543         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10544         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
10545         int64_t ret_ref = 0;
10546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10548         return ret_ref;
10549 }
10550
10551 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
10552 CHECK(!owner->result_ok);
10553         return DecodeError_clone(&*owner->contents.err);
10554 }
10555 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_err(int64_t owner) {
10556         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
10557         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10558         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
10559         int64_t ret_ref = tag_ptr(ret_copy, true);
10560         return ret_ref;
10561 }
10562
10563 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10564         LDKShutdownScript ret = *owner->contents.result;
10565         ret.is_owned = false;
10566         return ret;
10567 }
10568 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(int64_t owner) {
10569         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10570         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
10571         int64_t ret_ref = 0;
10572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10574         return ret_ref;
10575 }
10576
10577 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
10578         LDKInvalidShutdownScript ret = *owner->contents.err;
10579         ret.is_owned = false;
10580         return ret;
10581 }
10582 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(int64_t owner) {
10583         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
10584         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
10585         int64_t ret_ref = 0;
10586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10588         return ret_ref;
10589 }
10590
10591 uint32_t CS_LDK_LDKPaymentPurpose_ty_from_ptr(int64_t ptr) {
10592         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10593         switch(obj->tag) {
10594                 case LDKPaymentPurpose_InvoicePayment: return 0;
10595                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
10596                 default: abort();
10597         }
10598 }
10599 int64_t CS_LDK_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(int64_t ptr) {
10600         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10601         CHECK(obj->tag == LDKPaymentPurpose_InvoicePayment);
10602         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
10603         return payment_preimage_ref;
10604 }
10605 int8_tArray CS_LDK_LDKPaymentPurpose_InvoicePayment_get_payment_secret(int64_t ptr) {
10606         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10607         CHECK(obj->tag == LDKPaymentPurpose_InvoicePayment);
10608         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10609         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
10610         return payment_secret_arr;
10611 }
10612 int8_tArray CS_LDK_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(int64_t ptr) {
10613         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
10614         CHECK(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
10615         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
10616         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
10617         return spontaneous_payment_arr;
10618 }
10619 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10620 CHECK(owner->result_ok);
10621         return PaymentPurpose_clone(&*owner->contents.result);
10622 }
10623 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_ok(int64_t owner) {
10624         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10625         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
10626         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
10627         int64_t ret_ref = tag_ptr(ret_copy, true);
10628         return ret_ref;
10629 }
10630
10631 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
10632 CHECK(!owner->result_ok);
10633         return DecodeError_clone(&*owner->contents.err);
10634 }
10635 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_err(int64_t owner) {
10636         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
10637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10638         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
10639         int64_t ret_ref = tag_ptr(ret_copy, true);
10640         return ret_ref;
10641 }
10642
10643 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10644         LDKClaimedHTLC ret = *owner->contents.result;
10645         ret.is_owned = false;
10646         return ret;
10647 }
10648 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_ok(int64_t owner) {
10649         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10650         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
10651         int64_t ret_ref = 0;
10652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10654         return ret_ref;
10655 }
10656
10657 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
10658 CHECK(!owner->result_ok);
10659         return DecodeError_clone(&*owner->contents.err);
10660 }
10661 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_err(int64_t owner) {
10662         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
10663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10664         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
10665         int64_t ret_ref = tag_ptr(ret_copy, true);
10666         return ret_ref;
10667 }
10668
10669 uint32_t CS_LDK_LDKPathFailure_ty_from_ptr(int64_t ptr) {
10670         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10671         switch(obj->tag) {
10672                 case LDKPathFailure_InitialSend: return 0;
10673                 case LDKPathFailure_OnPath: return 1;
10674                 default: abort();
10675         }
10676 }
10677 int64_t CS_LDK_LDKPathFailure_InitialSend_get_err(int64_t ptr) {
10678         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10679         CHECK(obj->tag == LDKPathFailure_InitialSend);
10680         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
10681         return err_ref;
10682 }
10683 int64_t CS_LDK_LDKPathFailure_OnPath_get_network_update(int64_t ptr) {
10684         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
10685         CHECK(obj->tag == LDKPathFailure_OnPath);
10686         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
10687         return network_update_ref;
10688 }
10689 uint32_t CS_LDK_LDKCOption_PathFailureZ_ty_from_ptr(int64_t ptr) {
10690         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10691         switch(obj->tag) {
10692                 case LDKCOption_PathFailureZ_Some: return 0;
10693                 case LDKCOption_PathFailureZ_None: return 1;
10694                 default: abort();
10695         }
10696 }
10697 int64_t CS_LDK_LDKCOption_PathFailureZ_Some_get_some(int64_t ptr) {
10698         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
10699         CHECK(obj->tag == LDKCOption_PathFailureZ_Some);
10700         int64_t some_ref = tag_ptr(&obj->some, false);
10701         return some_ref;
10702 }
10703 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10704 CHECK(owner->result_ok);
10705         return COption_PathFailureZ_clone(&*owner->contents.result);
10706 }
10707 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_ok(int64_t owner) {
10708         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10709         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
10710         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
10711         int64_t ret_ref = tag_ptr(ret_copy, true);
10712         return ret_ref;
10713 }
10714
10715 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
10716 CHECK(!owner->result_ok);
10717         return DecodeError_clone(&*owner->contents.err);
10718 }
10719 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_err(int64_t owner) {
10720         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
10721         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10722         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
10723         int64_t ret_ref = tag_ptr(ret_copy, true);
10724         return ret_ref;
10725 }
10726
10727 uint32_t CS_LDK_LDKClosureReason_ty_from_ptr(int64_t ptr) {
10728         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10729         switch(obj->tag) {
10730                 case LDKClosureReason_CounterpartyForceClosed: return 0;
10731                 case LDKClosureReason_HolderForceClosed: return 1;
10732                 case LDKClosureReason_CooperativeClosure: return 2;
10733                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
10734                 case LDKClosureReason_FundingTimedOut: return 4;
10735                 case LDKClosureReason_ProcessingError: return 5;
10736                 case LDKClosureReason_DisconnectedPeer: return 6;
10737                 case LDKClosureReason_OutdatedChannelManager: return 7;
10738                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
10739                 case LDKClosureReason_FundingBatchClosure: return 9;
10740                 default: abort();
10741         }
10742 }
10743 int64_t CS_LDK_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(int64_t ptr) {
10744         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10745         CHECK(obj->tag == LDKClosureReason_CounterpartyForceClosed);
10746         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
10747                         int64_t peer_msg_ref = 0;
10748                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
10749                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
10750         return peer_msg_ref;
10751 }
10752 jstring CS_LDK_LDKClosureReason_ProcessingError_get_err(int64_t ptr) {
10753         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
10754         CHECK(obj->tag == LDKClosureReason_ProcessingError);
10755         LDKStr err_str = obj->processing_error.err;
10756                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
10757         return err_conv;
10758 }
10759 uint32_t CS_LDK_LDKCOption_ClosureReasonZ_ty_from_ptr(int64_t ptr) {
10760         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10761         switch(obj->tag) {
10762                 case LDKCOption_ClosureReasonZ_Some: return 0;
10763                 case LDKCOption_ClosureReasonZ_None: return 1;
10764                 default: abort();
10765         }
10766 }
10767 int64_t CS_LDK_LDKCOption_ClosureReasonZ_Some_get_some(int64_t ptr) {
10768         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
10769         CHECK(obj->tag == LDKCOption_ClosureReasonZ_Some);
10770         int64_t some_ref = tag_ptr(&obj->some, false);
10771         return some_ref;
10772 }
10773 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10774 CHECK(owner->result_ok);
10775         return COption_ClosureReasonZ_clone(&*owner->contents.result);
10776 }
10777 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(int64_t owner) {
10778         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10779         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
10780         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
10781         int64_t ret_ref = tag_ptr(ret_copy, true);
10782         return ret_ref;
10783 }
10784
10785 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
10786 CHECK(!owner->result_ok);
10787         return DecodeError_clone(&*owner->contents.err);
10788 }
10789 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(int64_t owner) {
10790         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
10791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10792         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
10793         int64_t ret_ref = tag_ptr(ret_copy, true);
10794         return ret_ref;
10795 }
10796
10797 uint32_t CS_LDK_LDKHTLCDestination_ty_from_ptr(int64_t ptr) {
10798         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10799         switch(obj->tag) {
10800                 case LDKHTLCDestination_NextHopChannel: return 0;
10801                 case LDKHTLCDestination_UnknownNextHop: return 1;
10802                 case LDKHTLCDestination_InvalidForward: return 2;
10803                 case LDKHTLCDestination_FailedPayment: return 3;
10804                 default: abort();
10805         }
10806 }
10807 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_node_id(int64_t ptr) {
10808         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10809         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
10810         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
10811         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
10812         return node_id_arr;
10813 }
10814 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_channel_id(int64_t ptr) {
10815         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10816         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
10817         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
10818         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
10819         return channel_id_arr;
10820 }
10821 int64_t CS_LDK_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(int64_t ptr) {
10822         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10823         CHECK(obj->tag == LDKHTLCDestination_UnknownNextHop);
10824         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
10825         return requested_forward_scid_conv;
10826 }
10827 int64_t CS_LDK_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(int64_t ptr) {
10828         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10829         CHECK(obj->tag == LDKHTLCDestination_InvalidForward);
10830         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
10831         return requested_forward_scid_conv;
10832 }
10833 int8_tArray CS_LDK_LDKHTLCDestination_FailedPayment_get_payment_hash(int64_t ptr) {
10834         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
10835         CHECK(obj->tag == LDKHTLCDestination_FailedPayment);
10836         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10837         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
10838         return payment_hash_arr;
10839 }
10840 uint32_t CS_LDK_LDKCOption_HTLCDestinationZ_ty_from_ptr(int64_t ptr) {
10841         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10842         switch(obj->tag) {
10843                 case LDKCOption_HTLCDestinationZ_Some: return 0;
10844                 case LDKCOption_HTLCDestinationZ_None: return 1;
10845                 default: abort();
10846         }
10847 }
10848 int64_t CS_LDK_LDKCOption_HTLCDestinationZ_Some_get_some(int64_t ptr) {
10849         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
10850         CHECK(obj->tag == LDKCOption_HTLCDestinationZ_Some);
10851         int64_t some_ref = tag_ptr(&obj->some, false);
10852         return some_ref;
10853 }
10854 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10855 CHECK(owner->result_ok);
10856         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
10857 }
10858 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(int64_t owner) {
10859         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10860         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
10861         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
10862         int64_t ret_ref = tag_ptr(ret_copy, true);
10863         return ret_ref;
10864 }
10865
10866 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
10867 CHECK(!owner->result_ok);
10868         return DecodeError_clone(&*owner->contents.err);
10869 }
10870 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(int64_t owner) {
10871         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
10872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10873         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
10874         int64_t ret_ref = tag_ptr(ret_copy, true);
10875         return ret_ref;
10876 }
10877
10878 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10879 CHECK(owner->result_ok);
10880         return PaymentFailureReason_clone(&*owner->contents.result);
10881 }
10882 int32_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(int64_t owner) {
10883         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10884         int32_t ret_conv = LDKPaymentFailureReason_to_cs(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
10885         return ret_conv;
10886 }
10887
10888 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
10889 CHECK(!owner->result_ok);
10890         return DecodeError_clone(&*owner->contents.err);
10891 }
10892 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_err(int64_t owner) {
10893         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
10894         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10895         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
10896         int64_t ret_ref = tag_ptr(ret_copy, true);
10897         return ret_ref;
10898 }
10899
10900 uint32_t CS_LDK_LDKCOption_U128Z_ty_from_ptr(int64_t ptr) {
10901         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10902         switch(obj->tag) {
10903                 case LDKCOption_U128Z_Some: return 0;
10904                 case LDKCOption_U128Z_None: return 1;
10905                 default: abort();
10906         }
10907 }
10908 int8_tArray CS_LDK_LDKCOption_U128Z_Some_get_some(int64_t ptr) {
10909         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
10910         CHECK(obj->tag == LDKCOption_U128Z_Some);
10911         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
10912         memcpy(some_arr->elems, obj->some.le_bytes, 16);
10913         return some_arr;
10914 }
10915 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
10916         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
10917         for (size_t i = 0; i < ret.datalen; i++) {
10918                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
10919         }
10920         return ret;
10921 }
10922 uint32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(int64_t ptr) {
10923         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10924         switch(obj->tag) {
10925                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
10926                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
10927                 default: abort();
10928         }
10929 }
10930 int32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_Some_get_some(int64_t ptr) {
10931         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
10932         CHECK(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
10933         int32_t some_conv = LDKPaymentFailureReason_to_cs(obj->some);
10934         return some_conv;
10935 }
10936 uint32_t CS_LDK_LDKBumpTransactionEvent_ty_from_ptr(int64_t ptr) {
10937         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10938         switch(obj->tag) {
10939                 case LDKBumpTransactionEvent_ChannelClose: return 0;
10940                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
10941                 default: abort();
10942         }
10943 }
10944 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_claim_id(int64_t ptr) {
10945         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10946         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10947         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
10948         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
10949         return claim_id_arr;
10950 }
10951 int32_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(int64_t ptr) {
10952         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10953         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10954         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
10955         return package_target_feerate_sat_per_1000_weight_conv;
10956 }
10957 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(int64_t ptr) {
10958         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10959         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10960         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
10961                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
10962                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
10963         return commitment_tx_arr;
10964 }
10965 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(int64_t ptr) {
10966         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10967         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10968         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
10969         return commitment_tx_fee_satoshis_conv;
10970 }
10971 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(int64_t ptr) {
10972         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10973         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10974         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
10975                         int64_t anchor_descriptor_ref = 0;
10976                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
10977                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
10978         return anchor_descriptor_ref;
10979 }
10980 int64_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(int64_t ptr) {
10981         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10982         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
10983         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
10984                         int64_tArray pending_htlcs_arr = NULL;
10985                         pending_htlcs_arr = init_int64_tArray(pending_htlcs_var.datalen, __LINE__);
10986                         int64_t *pending_htlcs_arr_ptr = (int64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
10987                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
10988                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
10989                                 int64_t pending_htlcs_conv_24_ref = 0;
10990                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
10991                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
10992                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
10993                         }
10994                         
10995         return pending_htlcs_arr;
10996 }
10997 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(int64_t ptr) {
10998         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
10999         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11000         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11001         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11002         return claim_id_arr;
11003 }
11004 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(int64_t ptr) {
11005         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11006         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11007         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11008         return target_feerate_sat_per_1000_weight_conv;
11009 }
11010 int64_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(int64_t ptr) {
11011         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11012         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11013         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11014                         int64_tArray htlc_descriptors_arr = NULL;
11015                         htlc_descriptors_arr = init_int64_tArray(htlc_descriptors_var.datalen, __LINE__);
11016                         int64_t *htlc_descriptors_arr_ptr = (int64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11017                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11018                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11019                                 int64_t htlc_descriptors_conv_16_ref = 0;
11020                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11021                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11022                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11023                         }
11024                         
11025         return htlc_descriptors_arr;
11026 }
11027 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(int64_t ptr) {
11028         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11029         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11030         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11031         return tx_lock_time_conv;
11032 }
11033 uint32_t CS_LDK_LDKEvent_ty_from_ptr(int64_t ptr) {
11034         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11035         switch(obj->tag) {
11036                 case LDKEvent_FundingGenerationReady: return 0;
11037                 case LDKEvent_PaymentClaimable: return 1;
11038                 case LDKEvent_PaymentClaimed: return 2;
11039                 case LDKEvent_ConnectionNeeded: return 3;
11040                 case LDKEvent_InvoiceRequestFailed: return 4;
11041                 case LDKEvent_PaymentSent: return 5;
11042                 case LDKEvent_PaymentFailed: return 6;
11043                 case LDKEvent_PaymentPathSuccessful: return 7;
11044                 case LDKEvent_PaymentPathFailed: return 8;
11045                 case LDKEvent_ProbeSuccessful: return 9;
11046                 case LDKEvent_ProbeFailed: return 10;
11047                 case LDKEvent_PendingHTLCsForwardable: return 11;
11048                 case LDKEvent_HTLCIntercepted: return 12;
11049                 case LDKEvent_SpendableOutputs: return 13;
11050                 case LDKEvent_PaymentForwarded: return 14;
11051                 case LDKEvent_ChannelPending: return 15;
11052                 case LDKEvent_ChannelReady: return 16;
11053                 case LDKEvent_ChannelClosed: return 17;
11054                 case LDKEvent_DiscardFunding: return 18;
11055                 case LDKEvent_OpenChannelRequest: return 19;
11056                 case LDKEvent_HTLCHandlingFailed: return 20;
11057                 case LDKEvent_BumpTransaction: return 21;
11058                 default: abort();
11059         }
11060 }
11061 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_temporary_channel_id(int64_t ptr) {
11062         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11063         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11064         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
11065         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
11066         return temporary_channel_id_arr;
11067 }
11068 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_counterparty_node_id(int64_t ptr) {
11069         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11070         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11071         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11072         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11073         return counterparty_node_id_arr;
11074 }
11075 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(int64_t ptr) {
11076         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11077         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11078         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11079         return channel_value_satoshis_conv;
11080 }
11081 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_output_script(int64_t ptr) {
11082         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11083         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11084         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11085                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11086                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11087         return output_script_arr;
11088 }
11089 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_user_channel_id(int64_t ptr) {
11090         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11091         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11092         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11093         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11094         return user_channel_id_arr;
11095 }
11096 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_receiver_node_id(int64_t ptr) {
11097         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11098         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11099         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11100         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11101         return receiver_node_id_arr;
11102 }
11103 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_payment_hash(int64_t ptr) {
11104         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11105         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11106         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11107         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
11108         return payment_hash_arr;
11109 }
11110 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_onion_fields(int64_t ptr) {
11111         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11112         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11113         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
11114                         int64_t onion_fields_ref = 0;
11115                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
11116                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
11117         return onion_fields_ref;
11118 }
11119 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_amount_msat(int64_t ptr) {
11120         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11121         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11122         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
11123         return amount_msat_conv;
11124 }
11125 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(int64_t ptr) {
11126         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11127         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11128         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
11129         return counterparty_skimmed_fee_msat_conv;
11130 }
11131 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_purpose(int64_t ptr) {
11132         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11133         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11134         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
11135         return purpose_ref;
11136 }
11137 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_channel_id(int64_t ptr) {
11138         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11139         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11140         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
11141         return via_channel_id_ref;
11142 }
11143 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_user_channel_id(int64_t ptr) {
11144         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11145         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11146         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
11147         return via_user_channel_id_ref;
11148 }
11149 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_claim_deadline(int64_t ptr) {
11150         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11151         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11152         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
11153         return claim_deadline_ref;
11154 }
11155 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_receiver_node_id(int64_t ptr) {
11156         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11157         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11158         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11159         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
11160         return receiver_node_id_arr;
11161 }
11162 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_payment_hash(int64_t ptr) {
11163         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11164         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11165         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11166         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
11167         return payment_hash_arr;
11168 }
11169 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_amount_msat(int64_t ptr) {
11170         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11171         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11172         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
11173         return amount_msat_conv;
11174 }
11175 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_purpose(int64_t ptr) {
11176         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11177         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11178         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
11179         return purpose_ref;
11180 }
11181 int64_tArray CS_LDK_LDKEvent_PaymentClaimed_get_htlcs(int64_t ptr) {
11182         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11183         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11184         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
11185                         int64_tArray htlcs_arr = NULL;
11186                         htlcs_arr = init_int64_tArray(htlcs_var.datalen, __LINE__);
11187                         int64_t *htlcs_arr_ptr = (int64_t*)(((uint8_t*)htlcs_arr) + 8);
11188                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
11189                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
11190                                 int64_t htlcs_conv_13_ref = 0;
11191                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
11192                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
11193                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
11194                         }
11195                         
11196         return htlcs_arr;
11197 }
11198 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(int64_t ptr) {
11199         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11200         CHECK(obj->tag == LDKEvent_PaymentClaimed);
11201         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
11202         return sender_intended_total_msat_ref;
11203 }
11204 int8_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_node_id(int64_t ptr) {
11205         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11206         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11207         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11208         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
11209         return node_id_arr;
11210 }
11211 int64_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_addresses(int64_t ptr) {
11212         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11213         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
11214         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
11215                         int64_tArray addresses_arr = NULL;
11216                         addresses_arr = init_int64_tArray(addresses_var.datalen, __LINE__);
11217                         int64_t *addresses_arr_ptr = (int64_t*)(((uint8_t*)addresses_arr) + 8);
11218                         for (size_t p = 0; p < addresses_var.datalen; p++) {
11219                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
11220                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
11221                         }
11222                         
11223         return addresses_arr;
11224 }
11225 int8_tArray CS_LDK_LDKEvent_InvoiceRequestFailed_get_payment_id(int64_t ptr) {
11226         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11227         CHECK(obj->tag == LDKEvent_InvoiceRequestFailed);
11228         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11229         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
11230         return payment_id_arr;
11231 }
11232 int64_t CS_LDK_LDKEvent_PaymentSent_get_payment_id(int64_t ptr) {
11233         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11234         CHECK(obj->tag == LDKEvent_PaymentSent);
11235         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
11236         return payment_id_ref;
11237 }
11238 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_preimage(int64_t ptr) {
11239         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11240         CHECK(obj->tag == LDKEvent_PaymentSent);
11241         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11242         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
11243         return payment_preimage_arr;
11244 }
11245 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_hash(int64_t ptr) {
11246         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11247         CHECK(obj->tag == LDKEvent_PaymentSent);
11248         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11249         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
11250         return payment_hash_arr;
11251 }
11252 int64_t CS_LDK_LDKEvent_PaymentSent_get_fee_paid_msat(int64_t ptr) {
11253         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11254         CHECK(obj->tag == LDKEvent_PaymentSent);
11255         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
11256         return fee_paid_msat_ref;
11257 }
11258 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_id(int64_t ptr) {
11259         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11260         CHECK(obj->tag == LDKEvent_PaymentFailed);
11261         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11262         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
11263         return payment_id_arr;
11264 }
11265 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_hash(int64_t ptr) {
11266         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11267         CHECK(obj->tag == LDKEvent_PaymentFailed);
11268         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11269         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
11270         return payment_hash_arr;
11271 }
11272 int64_t CS_LDK_LDKEvent_PaymentFailed_get_reason(int64_t ptr) {
11273         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11274         CHECK(obj->tag == LDKEvent_PaymentFailed);
11275         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
11276         return reason_ref;
11277 }
11278 int8_tArray CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_id(int64_t ptr) {
11279         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11280         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11281         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11282         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
11283         return payment_id_arr;
11284 }
11285 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_hash(int64_t ptr) {
11286         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11287         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11288         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
11289         return payment_hash_ref;
11290 }
11291 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_path(int64_t ptr) {
11292         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11293         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
11294         LDKPath path_var = obj->payment_path_successful.path;
11295                         int64_t path_ref = 0;
11296                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11297                         path_ref = tag_ptr(path_var.inner, false);
11298         return path_ref;
11299 }
11300 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_payment_id(int64_t ptr) {
11301         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11302         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11303         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
11304         return payment_id_ref;
11305 }
11306 int8_tArray CS_LDK_LDKEvent_PaymentPathFailed_get_payment_hash(int64_t ptr) {
11307         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11308         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11309         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11310         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
11311         return payment_hash_arr;
11312 }
11313 jboolean CS_LDK_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(int64_t ptr) {
11314         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11315         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11316         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
11317         return payment_failed_permanently_conv;
11318 }
11319 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_failure(int64_t ptr) {
11320         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11321         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11322         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
11323         return failure_ref;
11324 }
11325 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_path(int64_t ptr) {
11326         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11327         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11328         LDKPath path_var = obj->payment_path_failed.path;
11329                         int64_t path_ref = 0;
11330                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11331                         path_ref = tag_ptr(path_var.inner, false);
11332         return path_ref;
11333 }
11334 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_short_channel_id(int64_t ptr) {
11335         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11336         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
11337         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
11338         return short_channel_id_ref;
11339 }
11340 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_id(int64_t ptr) {
11341         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11342         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11343         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11344         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
11345         return payment_id_arr;
11346 }
11347 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_hash(int64_t ptr) {
11348         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11349         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11350         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11351         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
11352         return payment_hash_arr;
11353 }
11354 int64_t CS_LDK_LDKEvent_ProbeSuccessful_get_path(int64_t ptr) {
11355         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11356         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
11357         LDKPath path_var = obj->probe_successful.path;
11358                         int64_t path_ref = 0;
11359                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11360                         path_ref = tag_ptr(path_var.inner, false);
11361         return path_ref;
11362 }
11363 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_id(int64_t ptr) {
11364         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11365         CHECK(obj->tag == LDKEvent_ProbeFailed);
11366         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11367         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
11368         return payment_id_arr;
11369 }
11370 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_hash(int64_t ptr) {
11371         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11372         CHECK(obj->tag == LDKEvent_ProbeFailed);
11373         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11374         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
11375         return payment_hash_arr;
11376 }
11377 int64_t CS_LDK_LDKEvent_ProbeFailed_get_path(int64_t ptr) {
11378         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11379         CHECK(obj->tag == LDKEvent_ProbeFailed);
11380         LDKPath path_var = obj->probe_failed.path;
11381                         int64_t path_ref = 0;
11382                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
11383                         path_ref = tag_ptr(path_var.inner, false);
11384         return path_ref;
11385 }
11386 int64_t CS_LDK_LDKEvent_ProbeFailed_get_short_channel_id(int64_t ptr) {
11387         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11388         CHECK(obj->tag == LDKEvent_ProbeFailed);
11389         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
11390         return short_channel_id_ref;
11391 }
11392 int64_t CS_LDK_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(int64_t ptr) {
11393         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11394         CHECK(obj->tag == LDKEvent_PendingHTLCsForwardable);
11395         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
11396         return time_forwardable_conv;
11397 }
11398 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_intercept_id(int64_t ptr) {
11399         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11400         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11401         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
11402         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
11403         return intercept_id_arr;
11404 }
11405 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(int64_t ptr) {
11406         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11407         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11408         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
11409         return requested_next_hop_scid_conv;
11410 }
11411 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_payment_hash(int64_t ptr) {
11412         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11413         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11414         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11415         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
11416         return payment_hash_arr;
11417 }
11418 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(int64_t ptr) {
11419         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11420         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11421         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
11422         return inbound_amount_msat_conv;
11423 }
11424 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(int64_t ptr) {
11425         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11426         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
11427         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
11428         return expected_outbound_amount_msat_conv;
11429 }
11430 int64_tArray CS_LDK_LDKEvent_SpendableOutputs_get_outputs(int64_t ptr) {
11431         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11432         CHECK(obj->tag == LDKEvent_SpendableOutputs);
11433         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
11434                         int64_tArray outputs_arr = NULL;
11435                         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
11436                         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
11437                         for (size_t b = 0; b < outputs_var.datalen; b++) {
11438                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
11439                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
11440                         }
11441                         
11442         return outputs_arr;
11443 }
11444 int64_t CS_LDK_LDKEvent_SpendableOutputs_get_channel_id(int64_t ptr) {
11445         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11446         CHECK(obj->tag == LDKEvent_SpendableOutputs);
11447         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
11448         return channel_id_ref;
11449 }
11450 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_channel_id(int64_t ptr) {
11451         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11452         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11453         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
11454         return prev_channel_id_ref;
11455 }
11456 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_channel_id(int64_t ptr) {
11457         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11458         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11459         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
11460         return next_channel_id_ref;
11461 }
11462 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_fee_earned_msat(int64_t ptr) {
11463         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11464         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11465         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
11466         return fee_earned_msat_ref;
11467 }
11468 jboolean CS_LDK_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(int64_t ptr) {
11469         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11470         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11471         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
11472         return claim_from_onchain_tx_conv;
11473 }
11474 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(int64_t ptr) {
11475         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11476         CHECK(obj->tag == LDKEvent_PaymentForwarded);
11477         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
11478         return outbound_amount_forwarded_msat_ref;
11479 }
11480 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_channel_id(int64_t ptr) {
11481         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11482         CHECK(obj->tag == LDKEvent_ChannelPending);
11483         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11484         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
11485         return channel_id_arr;
11486 }
11487 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_user_channel_id(int64_t ptr) {
11488         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11489         CHECK(obj->tag == LDKEvent_ChannelPending);
11490         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11491         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
11492         return user_channel_id_arr;
11493 }
11494 int64_t CS_LDK_LDKEvent_ChannelPending_get_former_temporary_channel_id(int64_t ptr) {
11495         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11496         CHECK(obj->tag == LDKEvent_ChannelPending);
11497         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
11498         return former_temporary_channel_id_ref;
11499 }
11500 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_counterparty_node_id(int64_t ptr) {
11501         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11502         CHECK(obj->tag == LDKEvent_ChannelPending);
11503         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11504         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
11505         return counterparty_node_id_arr;
11506 }
11507 int64_t CS_LDK_LDKEvent_ChannelPending_get_funding_txo(int64_t ptr) {
11508         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11509         CHECK(obj->tag == LDKEvent_ChannelPending);
11510         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
11511                         int64_t funding_txo_ref = 0;
11512                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
11513                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
11514         return funding_txo_ref;
11515 }
11516 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_channel_id(int64_t ptr) {
11517         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11518         CHECK(obj->tag == LDKEvent_ChannelReady);
11519         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11520         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
11521         return channel_id_arr;
11522 }
11523 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_user_channel_id(int64_t ptr) {
11524         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11525         CHECK(obj->tag == LDKEvent_ChannelReady);
11526         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11527         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
11528         return user_channel_id_arr;
11529 }
11530 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_counterparty_node_id(int64_t ptr) {
11531         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11532         CHECK(obj->tag == LDKEvent_ChannelReady);
11533         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11534         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
11535         return counterparty_node_id_arr;
11536 }
11537 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_type(int64_t ptr) {
11538         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11539         CHECK(obj->tag == LDKEvent_ChannelReady);
11540         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
11541                         int64_t channel_type_ref = 0;
11542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11543                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11544         return channel_type_ref;
11545 }
11546 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_channel_id(int64_t ptr) {
11547         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11548         CHECK(obj->tag == LDKEvent_ChannelClosed);
11549         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11550         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
11551         return channel_id_arr;
11552 }
11553 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_user_channel_id(int64_t ptr) {
11554         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11555         CHECK(obj->tag == LDKEvent_ChannelClosed);
11556         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11557         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
11558         return user_channel_id_arr;
11559 }
11560 int64_t CS_LDK_LDKEvent_ChannelClosed_get_reason(int64_t ptr) {
11561         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11562         CHECK(obj->tag == LDKEvent_ChannelClosed);
11563         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
11564         return reason_ref;
11565 }
11566 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_counterparty_node_id(int64_t ptr) {
11567         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11568         CHECK(obj->tag == LDKEvent_ChannelClosed);
11569         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11570         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
11571         return counterparty_node_id_arr;
11572 }
11573 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_capacity_sats(int64_t ptr) {
11574         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11575         CHECK(obj->tag == LDKEvent_ChannelClosed);
11576         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
11577         return channel_capacity_sats_ref;
11578 }
11579 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_funding_txo(int64_t ptr) {
11580         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11581         CHECK(obj->tag == LDKEvent_ChannelClosed);
11582         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
11583                         int64_t channel_funding_txo_ref = 0;
11584                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
11585                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
11586         return channel_funding_txo_ref;
11587 }
11588 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_channel_id(int64_t ptr) {
11589         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11590         CHECK(obj->tag == LDKEvent_DiscardFunding);
11591         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
11592         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
11593         return channel_id_arr;
11594 }
11595 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_transaction(int64_t ptr) {
11596         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11597         CHECK(obj->tag == LDKEvent_DiscardFunding);
11598         LDKTransaction transaction_var = obj->discard_funding.transaction;
11599                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
11600                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
11601         return transaction_arr;
11602 }
11603 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_temporary_channel_id(int64_t ptr) {
11604         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11605         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11606         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
11607         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
11608         return temporary_channel_id_arr;
11609 }
11610 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_counterparty_node_id(int64_t ptr) {
11611         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11612         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11613         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11614         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
11615         return counterparty_node_id_arr;
11616 }
11617 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_funding_satoshis(int64_t ptr) {
11618         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11619         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11620         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
11621         return funding_satoshis_conv;
11622 }
11623 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_push_msat(int64_t ptr) {
11624         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11625         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11626         int64_t push_msat_conv = obj->open_channel_request.push_msat;
11627         return push_msat_conv;
11628 }
11629 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_channel_type(int64_t ptr) {
11630         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11631         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
11632         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
11633                         int64_t channel_type_ref = 0;
11634                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
11635                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
11636         return channel_type_ref;
11637 }
11638 int8_tArray CS_LDK_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(int64_t ptr) {
11639         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11640         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
11641         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
11642         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
11643         return prev_channel_id_arr;
11644 }
11645 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(int64_t ptr) {
11646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11647         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
11648         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
11649         return failed_next_destination_ref;
11650 }
11651 int64_t CS_LDK_LDKEvent_BumpTransaction_get_bump_transaction(int64_t ptr) {
11652         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11653         CHECK(obj->tag == LDKEvent_BumpTransaction);
11654         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
11655         return bump_transaction_ref;
11656 }
11657 uint32_t CS_LDK_LDKCOption_EventZ_ty_from_ptr(int64_t ptr) {
11658         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11659         switch(obj->tag) {
11660                 case LDKCOption_EventZ_Some: return 0;
11661                 case LDKCOption_EventZ_None: return 1;
11662                 default: abort();
11663         }
11664 }
11665 int64_t CS_LDK_LDKCOption_EventZ_Some_get_some(int64_t ptr) {
11666         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
11667         CHECK(obj->tag == LDKCOption_EventZ_Some);
11668         int64_t some_ref = tag_ptr(&obj->some, false);
11669         return some_ref;
11670 }
11671 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11672 CHECK(owner->result_ok);
11673         return COption_EventZ_clone(&*owner->contents.result);
11674 }
11675 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_ok(int64_t owner) {
11676         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11677         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11678         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
11679         int64_t ret_ref = tag_ptr(ret_copy, true);
11680         return ret_ref;
11681 }
11682
11683 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
11684 CHECK(!owner->result_ok);
11685         return DecodeError_clone(&*owner->contents.err);
11686 }
11687 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_err(int64_t owner) {
11688         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
11689         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11690         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
11691         int64_t ret_ref = tag_ptr(ret_copy, true);
11692         return ret_ref;
11693 }
11694
11695 uint32_t CS_LDK_LDKBolt11ParseError_ty_from_ptr(int64_t ptr) {
11696         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11697         switch(obj->tag) {
11698                 case LDKBolt11ParseError_Bech32Error: return 0;
11699                 case LDKBolt11ParseError_ParseAmountError: return 1;
11700                 case LDKBolt11ParseError_MalformedSignature: return 2;
11701                 case LDKBolt11ParseError_BadPrefix: return 3;
11702                 case LDKBolt11ParseError_UnknownCurrency: return 4;
11703                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
11704                 case LDKBolt11ParseError_MalformedHRP: return 6;
11705                 case LDKBolt11ParseError_TooShortDataPart: return 7;
11706                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
11707                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
11708                 case LDKBolt11ParseError_PaddingError: return 10;
11709                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
11710                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
11711                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
11712                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
11713                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
11714                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
11715                 case LDKBolt11ParseError_Skip: return 17;
11716                 default: abort();
11717         }
11718 }
11719 int64_t CS_LDK_LDKBolt11ParseError_Bech32Error_get_bech32_error(int64_t ptr) {
11720         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11721         CHECK(obj->tag == LDKBolt11ParseError_Bech32Error);
11722         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
11723         return bech32_error_ref;
11724 }
11725 int32_t CS_LDK_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(int64_t ptr) {
11726         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11727         CHECK(obj->tag == LDKBolt11ParseError_ParseAmountError);
11728         /*obj->parse_amount_error*/
11729         return 0;
11730 }
11731 int32_t CS_LDK_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(int64_t ptr) {
11732         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11733         CHECK(obj->tag == LDKBolt11ParseError_MalformedSignature);
11734         int32_t malformed_signature_conv = LDKSecp256k1Error_to_cs(obj->malformed_signature);
11735         return malformed_signature_conv;
11736 }
11737 int32_t CS_LDK_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(int64_t ptr) {
11738         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11739         CHECK(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
11740         /*obj->description_decode_error*/
11741         return 0;
11742 }
11743 jstring CS_LDK_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(int64_t ptr) {
11744         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
11745         CHECK(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
11746         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
11747                         jstring invalid_slice_length_conv = str_ref_to_cs(invalid_slice_length_str.chars, invalid_slice_length_str.len);
11748         return invalid_slice_length_conv;
11749 }
11750 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11751 CHECK(owner->result_ok);
11752         return SiPrefix_clone(&*owner->contents.result);
11753 }
11754 int32_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_ok(int64_t owner) {
11755         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11756         int32_t ret_conv = LDKSiPrefix_to_cs(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
11757         return ret_conv;
11758 }
11759
11760 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
11761 CHECK(!owner->result_ok);
11762         return Bolt11ParseError_clone(&*owner->contents.err);
11763 }
11764 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_err(int64_t owner) {
11765         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
11766         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11767         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
11768         int64_t ret_ref = tag_ptr(ret_copy, true);
11769         return ret_ref;
11770 }
11771
11772 uint32_t CS_LDK_LDKParseOrSemanticError_ty_from_ptr(int64_t ptr) {
11773         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11774         switch(obj->tag) {
11775                 case LDKParseOrSemanticError_ParseError: return 0;
11776                 case LDKParseOrSemanticError_SemanticError: return 1;
11777                 default: abort();
11778         }
11779 }
11780 int64_t CS_LDK_LDKParseOrSemanticError_ParseError_get_parse_error(int64_t ptr) {
11781         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11782         CHECK(obj->tag == LDKParseOrSemanticError_ParseError);
11783         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
11784         return parse_error_ref;
11785 }
11786 int32_t CS_LDK_LDKParseOrSemanticError_SemanticError_get_semantic_error(int64_t ptr) {
11787         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
11788         CHECK(obj->tag == LDKParseOrSemanticError_SemanticError);
11789         int32_t semantic_error_conv = LDKBolt11SemanticError_to_cs(obj->semantic_error);
11790         return semantic_error_conv;
11791 }
11792 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11793         LDKBolt11Invoice ret = *owner->contents.result;
11794         ret.is_owned = false;
11795         return ret;
11796 }
11797 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(int64_t owner) {
11798         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11799         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
11800         int64_t ret_ref = 0;
11801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11803         return ret_ref;
11804 }
11805
11806 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
11807 CHECK(!owner->result_ok);
11808         return ParseOrSemanticError_clone(&*owner->contents.err);
11809 }
11810 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(int64_t owner) {
11811         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
11812         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
11813         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
11814         int64_t ret_ref = tag_ptr(ret_copy, true);
11815         return ret_ref;
11816 }
11817
11818 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11819         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
11820         ret.is_owned = false;
11821         return ret;
11822 }
11823 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(int64_t owner) {
11824         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11825         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
11826         int64_t ret_ref = 0;
11827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11829         return ret_ref;
11830 }
11831
11832 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
11833 CHECK(!owner->result_ok);
11834         return Bolt11ParseError_clone(&*owner->contents.err);
11835 }
11836 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(int64_t owner) {
11837         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
11838         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
11839         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
11840         int64_t ret_ref = tag_ptr(ret_copy, true);
11841         return ret_ref;
11842 }
11843
11844 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11845         LDKRawBolt11Invoice ret = owner->a;
11846         ret.is_owned = false;
11847         return ret;
11848 }
11849 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(int64_t owner) {
11850         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11851         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
11852         int64_t ret_ref = 0;
11853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11855         return ret_ref;
11856 }
11857
11858 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11859         return ThirtyTwoBytes_clone(&owner->b);
11860 }
11861 int8_tArray  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(int64_t owner) {
11862         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
11864         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
11865         return ret_arr;
11866 }
11867
11868 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
11869         LDKBolt11InvoiceSignature ret = owner->c;
11870         ret.is_owned = false;
11871         return ret;
11872 }
11873 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(int64_t owner) {
11874         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
11875         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
11876         int64_t ret_ref = 0;
11877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11879         return ret_ref;
11880 }
11881
11882 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11883         LDKPayeePubKey ret = *owner->contents.result;
11884         ret.is_owned = false;
11885         return ret;
11886 }
11887 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(int64_t owner) {
11888         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11889         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
11890         int64_t ret_ref = 0;
11891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11893         return ret_ref;
11894 }
11895
11896 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
11897 CHECK(!owner->result_ok);
11898         return *owner->contents.err;
11899 }
11900 int32_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_err(int64_t owner) {
11901         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
11902         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
11903         return ret_conv;
11904 }
11905
11906 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
11907         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
11908         for (size_t i = 0; i < ret.datalen; i++) {
11909                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
11910         }
11911         return ret;
11912 }
11913 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11914         LDKPositiveTimestamp ret = *owner->contents.result;
11915         ret.is_owned = false;
11916         return ret;
11917 }
11918 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_ok(int64_t owner) {
11919         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11920         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
11921         int64_t ret_ref = 0;
11922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11924         return ret_ref;
11925 }
11926
11927 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
11928 CHECK(!owner->result_ok);
11929         return CreationError_clone(&*owner->contents.err);
11930 }
11931 int32_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_err(int64_t owner) {
11932         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
11933         int32_t ret_conv = LDKCreationError_to_cs(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
11934         return ret_conv;
11935 }
11936
11937 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11938 CHECK(owner->result_ok);
11939         return *owner->contents.result;
11940 }
11941 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_ok(int64_t owner) {
11942         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11943         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
11944 }
11945
11946 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
11947 CHECK(!owner->result_ok);
11948         return Bolt11SemanticError_clone(&*owner->contents.err);
11949 }
11950 int32_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_err(int64_t owner) {
11951         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
11952         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
11953         return ret_conv;
11954 }
11955
11956 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11957         LDKBolt11Invoice ret = *owner->contents.result;
11958         ret.is_owned = false;
11959         return ret;
11960 }
11961 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(int64_t owner) {
11962         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11963         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
11964         int64_t ret_ref = 0;
11965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11967         return ret_ref;
11968 }
11969
11970 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
11971 CHECK(!owner->result_ok);
11972         return Bolt11SemanticError_clone(&*owner->contents.err);
11973 }
11974 int32_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(int64_t owner) {
11975         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
11976         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
11977         return ret_conv;
11978 }
11979
11980 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11981         LDKDescription ret = *owner->contents.result;
11982         ret.is_owned = false;
11983         return ret;
11984 }
11985 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_ok(int64_t owner) {
11986         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
11987         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
11988         int64_t ret_ref = 0;
11989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11991         return ret_ref;
11992 }
11993
11994 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
11995 CHECK(!owner->result_ok);
11996         return CreationError_clone(&*owner->contents.err);
11997 }
11998 int32_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_err(int64_t owner) {
11999         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12000         int32_t ret_conv = LDKCreationError_to_cs(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12001         return ret_conv;
12002 }
12003
12004 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12005         LDKPrivateRoute ret = *owner->contents.result;
12006         ret.is_owned = false;
12007         return ret;
12008 }
12009 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_ok(int64_t owner) {
12010         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12011         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12012         int64_t ret_ref = 0;
12013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12015         return ret_ref;
12016 }
12017
12018 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12019 CHECK(!owner->result_ok);
12020         return CreationError_clone(&*owner->contents.err);
12021 }
12022 int32_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_err(int64_t owner) {
12023         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12024         int32_t ret_conv = LDKCreationError_to_cs(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12025         return ret_conv;
12026 }
12027
12028 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12029         LDKOutPoint ret = *owner->contents.result;
12030         ret.is_owned = false;
12031         return ret;
12032 }
12033 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_ok(int64_t owner) {
12034         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12035         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12036         int64_t ret_ref = 0;
12037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12039         return ret_ref;
12040 }
12041
12042 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12043 CHECK(!owner->result_ok);
12044         return DecodeError_clone(&*owner->contents.err);
12045 }
12046 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_err(int64_t owner) {
12047         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12048         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12049         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12050         int64_t ret_ref = tag_ptr(ret_copy, true);
12051         return ret_ref;
12052 }
12053
12054 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12055         LDKBigSize ret = *owner->contents.result;
12056         ret.is_owned = false;
12057         return ret;
12058 }
12059 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_ok(int64_t owner) {
12060         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12061         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
12062         int64_t ret_ref = 0;
12063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12065         return ret_ref;
12066 }
12067
12068 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
12069 CHECK(!owner->result_ok);
12070         return DecodeError_clone(&*owner->contents.err);
12071 }
12072 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_err(int64_t owner) {
12073         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
12074         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12075         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
12076         int64_t ret_ref = tag_ptr(ret_copy, true);
12077         return ret_ref;
12078 }
12079
12080 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12081         LDKHostname ret = *owner->contents.result;
12082         ret.is_owned = false;
12083         return ret;
12084 }
12085 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_ok(int64_t owner) {
12086         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12087         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
12088         int64_t ret_ref = 0;
12089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12091         return ret_ref;
12092 }
12093
12094 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
12095 CHECK(!owner->result_ok);
12096         return DecodeError_clone(&*owner->contents.err);
12097 }
12098 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_err(int64_t owner) {
12099         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
12100         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12101         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
12102         int64_t ret_ref = tag_ptr(ret_copy, true);
12103         return ret_ref;
12104 }
12105
12106 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12107         LDKTransactionU16LenLimited ret = *owner->contents.result;
12108         ret.is_owned = false;
12109         return ret;
12110 }
12111 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_ok(int64_t owner) {
12112         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12113         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
12114         int64_t ret_ref = 0;
12115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12117         return ret_ref;
12118 }
12119
12120 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
12121 CHECK(!owner->result_ok);
12122         return *owner->contents.err;
12123 }
12124 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_err(int64_t owner) {
12125         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
12126         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
12127 }
12128
12129 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12130         LDKTransactionU16LenLimited ret = *owner->contents.result;
12131         ret.is_owned = false;
12132         return ret;
12133 }
12134 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(int64_t owner) {
12135         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12136         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
12137         int64_t ret_ref = 0;
12138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12140         return ret_ref;
12141 }
12142
12143 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
12144 CHECK(!owner->result_ok);
12145         return DecodeError_clone(&*owner->contents.err);
12146 }
12147 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(int64_t owner) {
12148         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
12149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12150         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
12151         int64_t ret_ref = tag_ptr(ret_copy, true);
12152         return ret_ref;
12153 }
12154
12155 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12156         LDKUntrustedString ret = *owner->contents.result;
12157         ret.is_owned = false;
12158         return ret;
12159 }
12160 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_ok(int64_t owner) {
12161         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12162         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
12163         int64_t ret_ref = 0;
12164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12166         return ret_ref;
12167 }
12168
12169 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
12170 CHECK(!owner->result_ok);
12171         return DecodeError_clone(&*owner->contents.err);
12172 }
12173 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_err(int64_t owner) {
12174         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
12175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12176         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
12177         int64_t ret_ref = tag_ptr(ret_copy, true);
12178         return ret_ref;
12179 }
12180
12181 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12182         return ThirtyTwoBytes_clone(&owner->a);
12183 }
12184 int8_tArray  CS_LDK_C2Tuple__u832u16Z_get_a(int64_t owner) {
12185         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12186         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12187         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
12188         return ret_arr;
12189 }
12190
12191 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
12192         return owner->b;
12193 }
12194 int16_t  CS_LDK_C2Tuple__u832u16Z_get_b(int64_t owner) {
12195         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
12196         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
12197         return ret_conv;
12198 }
12199
12200 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12201         LDKPaymentRelay ret = *owner->contents.result;
12202         ret.is_owned = false;
12203         return ret;
12204 }
12205 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_ok(int64_t owner) {
12206         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12207         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
12208         int64_t ret_ref = 0;
12209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12211         return ret_ref;
12212 }
12213
12214 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
12215 CHECK(!owner->result_ok);
12216         return DecodeError_clone(&*owner->contents.err);
12217 }
12218 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_err(int64_t owner) {
12219         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
12220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12221         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
12222         int64_t ret_ref = tag_ptr(ret_copy, true);
12223         return ret_ref;
12224 }
12225
12226 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12227         LDKPaymentConstraints ret = *owner->contents.result;
12228         ret.is_owned = false;
12229         return ret;
12230 }
12231 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_ok(int64_t owner) {
12232         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12233         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
12234         int64_t ret_ref = 0;
12235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12237         return ret_ref;
12238 }
12239
12240 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
12241 CHECK(!owner->result_ok);
12242         return DecodeError_clone(&*owner->contents.err);
12243 }
12244 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_err(int64_t owner) {
12245         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
12246         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12247         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
12248         int64_t ret_ref = tag_ptr(ret_copy, true);
12249         return ret_ref;
12250 }
12251
12252 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12253         return ThirtyTwoBytes_clone(&owner->a);
12254 }
12255 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(int64_t owner) {
12256         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12257         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12258         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
12259         return ret_arr;
12260 }
12261
12262 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12263         LDKRecipientOnionFields ret = owner->b;
12264         ret.is_owned = false;
12265         return ret;
12266 }
12267 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(int64_t owner) {
12268         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12269         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
12270         int64_t ret_ref = 0;
12271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12273         return ret_ref;
12274 }
12275
12276 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
12277         LDKRouteParameters ret = owner->c;
12278         ret.is_owned = false;
12279         return ret;
12280 }
12281 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(int64_t owner) {
12282         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
12283         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
12284         int64_t ret_ref = 0;
12285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12287         return ret_ref;
12288 }
12289
12290 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12291 CHECK(owner->result_ok);
12292         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
12293 }
12294 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(int64_t owner) {
12295         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12296         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
12297         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
12298         return tag_ptr(ret_conv, true);
12299 }
12300
12301 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
12302 CHECK(!owner->result_ok);
12303         return *owner->contents.err;
12304 }
12305 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(int64_t owner) {
12306         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
12307         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
12308 }
12309
12310 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12311 CHECK(owner->result_ok);
12312         return *owner->contents.result;
12313 }
12314 jstring  CS_LDK_CResult_StrSecp256k1ErrorZ_get_ok(int64_t owner) {
12315         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12316         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
12317         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
12318         return ret_conv;
12319 }
12320
12321 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
12322 CHECK(!owner->result_ok);
12323         return *owner->contents.err;
12324 }
12325 int32_t  CS_LDK_CResult_StrSecp256k1ErrorZ_get_err(int64_t owner) {
12326         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
12327         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
12328         return ret_conv;
12329 }
12330
12331 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12332         return owner->a;
12333 }
12334 int8_tArray  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(int64_t owner) {
12335         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12336         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
12337         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
12338         return ret_arr;
12339 }
12340
12341 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12342         LDKOnionMessage ret = owner->b;
12343         ret.is_owned = false;
12344         return ret;
12345 }
12346 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(int64_t owner) {
12347         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12348         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
12349         int64_t ret_ref = 0;
12350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12352         return ret_ref;
12353 }
12354
12355 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
12356         return COption_CVec_SocketAddressZZ_clone(&owner->c);
12357 }
12358 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(int64_t owner) {
12359         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
12360         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
12361         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
12362         int64_t ret_ref = tag_ptr(ret_copy, true);
12363         return ret_ref;
12364 }
12365
12366 uint32_t CS_LDK_LDKSendError_ty_from_ptr(int64_t ptr) {
12367         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12368         switch(obj->tag) {
12369                 case LDKSendError_Secp256k1: return 0;
12370                 case LDKSendError_TooBigPacket: return 1;
12371                 case LDKSendError_TooFewBlindedHops: return 2;
12372                 case LDKSendError_InvalidFirstHop: return 3;
12373                 case LDKSendError_PathNotFound: return 4;
12374                 case LDKSendError_InvalidMessage: return 5;
12375                 case LDKSendError_BufferFull: return 6;
12376                 case LDKSendError_GetNodeIdFailed: return 7;
12377                 case LDKSendError_BlindedPathAdvanceFailed: return 8;
12378                 default: abort();
12379         }
12380 }
12381 int32_t CS_LDK_LDKSendError_Secp256k1_get_secp256k1(int64_t ptr) {
12382         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12383         CHECK(obj->tag == LDKSendError_Secp256k1);
12384         int32_t secp256k1_conv = LDKSecp256k1Error_to_cs(obj->secp256k1);
12385         return secp256k1_conv;
12386 }
12387 int8_tArray CS_LDK_LDKSendError_InvalidFirstHop_get_invalid_first_hop(int64_t ptr) {
12388         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
12389         CHECK(obj->tag == LDKSendError_InvalidFirstHop);
12390         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
12391         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
12392         return invalid_first_hop_arr;
12393 }
12394 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12395 CHECK(owner->result_ok);
12396         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
12397 }
12398 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(int64_t owner) {
12399         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12400         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
12401         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
12402         return tag_ptr(ret_conv, true);
12403 }
12404
12405 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
12406 CHECK(!owner->result_ok);
12407         return SendError_clone(&*owner->contents.err);
12408 }
12409 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(int64_t owner) {
12410         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
12411         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12412         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
12413         int64_t ret_ref = tag_ptr(ret_copy, true);
12414         return ret_ref;
12415 }
12416
12417 uint32_t CS_LDK_LDKParsedOnionMessageContents_ty_from_ptr(int64_t ptr) {
12418         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12419         switch(obj->tag) {
12420                 case LDKParsedOnionMessageContents_Offers: return 0;
12421                 case LDKParsedOnionMessageContents_Custom: return 1;
12422                 default: abort();
12423         }
12424 }
12425 int64_t CS_LDK_LDKParsedOnionMessageContents_Offers_get_offers(int64_t ptr) {
12426         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12427         CHECK(obj->tag == LDKParsedOnionMessageContents_Offers);
12428         int64_t offers_ref = tag_ptr(&obj->offers, false);
12429         return offers_ref;
12430 }
12431 int64_t CS_LDK_LDKParsedOnionMessageContents_Custom_get_custom(int64_t ptr) {
12432         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
12433         CHECK(obj->tag == LDKParsedOnionMessageContents_Custom);
12434         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
12435         *custom_ret = OnionMessageContents_clone(&obj->custom);
12436         return tag_ptr(custom_ret, true);
12437 }
12438 uint32_t CS_LDK_LDKPeeledOnion_ty_from_ptr(int64_t ptr) {
12439         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12440         switch(obj->tag) {
12441                 case LDKPeeledOnion_Forward: return 0;
12442                 case LDKPeeledOnion_Receive: return 1;
12443                 default: abort();
12444         }
12445 }
12446 int8_tArray CS_LDK_LDKPeeledOnion_Forward_get__0(int64_t ptr) {
12447         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12448         CHECK(obj->tag == LDKPeeledOnion_Forward);
12449         int8_tArray _0_arr = init_int8_tArray(33, __LINE__);
12450         memcpy(_0_arr->elems, obj->forward._0.compressed_form, 33);
12451         return _0_arr;
12452 }
12453 int64_t CS_LDK_LDKPeeledOnion_Forward_get__1(int64_t ptr) {
12454         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12455         CHECK(obj->tag == LDKPeeledOnion_Forward);
12456         LDKOnionMessage _1_var = obj->forward._1;
12457                         int64_t _1_ref = 0;
12458                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
12459                         _1_ref = tag_ptr(_1_var.inner, false);
12460         return _1_ref;
12461 }
12462 int64_t CS_LDK_LDKPeeledOnion_Receive_get__0(int64_t ptr) {
12463         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12464         CHECK(obj->tag == LDKPeeledOnion_Receive);
12465         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
12466         return _0_ref;
12467 }
12468 int8_tArray CS_LDK_LDKPeeledOnion_Receive_get__1(int64_t ptr) {
12469         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12470         CHECK(obj->tag == LDKPeeledOnion_Receive);
12471         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
12472         memcpy(_1_arr->elems, obj->receive._1.data, 32);
12473         return _1_arr;
12474 }
12475 int64_t CS_LDK_LDKPeeledOnion_Receive_get__2(int64_t ptr) {
12476         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
12477         CHECK(obj->tag == LDKPeeledOnion_Receive);
12478         LDKBlindedPath _2_var = obj->receive._2;
12479                         int64_t _2_ref = 0;
12480                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
12481                         _2_ref = tag_ptr(_2_var.inner, false);
12482         return _2_ref;
12483 }
12484 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12485 CHECK(owner->result_ok);
12486         return PeeledOnion_clone(&*owner->contents.result);
12487 }
12488 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_get_ok(int64_t owner) {
12489         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12490         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
12491         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
12492         int64_t ret_ref = tag_ptr(ret_copy, true);
12493         return ret_ref;
12494 }
12495
12496 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
12497 CHECK(!owner->result_ok);
12498         return *owner->contents.err;
12499 }
12500 void  CS_LDK_CResult_PeeledOnionNoneZ_get_err(int64_t owner) {
12501         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
12502         CResult_PeeledOnionNoneZ_get_err(owner_conv);
12503 }
12504
12505 uint32_t CS_LDK_LDKSendSuccess_ty_from_ptr(int64_t ptr) {
12506         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12507         switch(obj->tag) {
12508                 case LDKSendSuccess_Buffered: return 0;
12509                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
12510                 default: abort();
12511         }
12512 }
12513 int8_tArray CS_LDK_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(int64_t ptr) {
12514         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
12515         CHECK(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
12516         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
12517         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
12518         return buffered_awaiting_connection_arr;
12519 }
12520 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12521 CHECK(owner->result_ok);
12522         return SendSuccess_clone(&*owner->contents.result);
12523 }
12524 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_ok(int64_t owner) {
12525         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12526         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
12527         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
12528         int64_t ret_ref = tag_ptr(ret_copy, true);
12529         return ret_ref;
12530 }
12531
12532 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
12533 CHECK(!owner->result_ok);
12534         return SendError_clone(&*owner->contents.err);
12535 }
12536 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_err(int64_t owner) {
12537         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
12538         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
12539         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
12540         int64_t ret_ref = tag_ptr(ret_copy, true);
12541         return ret_ref;
12542 }
12543
12544 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12545         LDKBlindedPath ret = *owner->contents.result;
12546         ret.is_owned = false;
12547         return ret;
12548 }
12549 int64_t  CS_LDK_CResult_BlindedPathNoneZ_get_ok(int64_t owner) {
12550         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12551         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
12552         int64_t ret_ref = 0;
12553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12555         return ret_ref;
12556 }
12557
12558 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
12559 CHECK(!owner->result_ok);
12560         return *owner->contents.err;
12561 }
12562 void  CS_LDK_CResult_BlindedPathNoneZ_get_err(int64_t owner) {
12563         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
12564         CResult_BlindedPathNoneZ_get_err(owner_conv);
12565 }
12566
12567 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12568 CHECK(owner->result_ok);
12569         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
12570 }
12571 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(int64_t owner) {
12572         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12573         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
12574         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
12575         return tag_ptr(ret_conv, true);
12576 }
12577
12578 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
12579 CHECK(!owner->result_ok);
12580         return *owner->contents.err;
12581 }
12582 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(int64_t owner) {
12583         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
12584         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
12585 }
12586
12587 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
12588         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
12589         for (size_t i = 0; i < ret.datalen; i++) {
12590                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
12591         }
12592         return ret;
12593 }
12594 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12595         LDKBlindedPath ret = *owner->contents.result;
12596         ret.is_owned = false;
12597         return ret;
12598 }
12599 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_ok(int64_t owner) {
12600         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12601         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
12602         int64_t ret_ref = 0;
12603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12605         return ret_ref;
12606 }
12607
12608 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
12609 CHECK(!owner->result_ok);
12610         return DecodeError_clone(&*owner->contents.err);
12611 }
12612 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_err(int64_t owner) {
12613         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
12614         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12615         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
12616         int64_t ret_ref = tag_ptr(ret_copy, true);
12617         return ret_ref;
12618 }
12619
12620 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12621         LDKBlindedHop ret = *owner->contents.result;
12622         ret.is_owned = false;
12623         return ret;
12624 }
12625 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_ok(int64_t owner) {
12626         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12627         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
12628         int64_t ret_ref = 0;
12629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12631         return ret_ref;
12632 }
12633
12634 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
12635 CHECK(!owner->result_ok);
12636         return DecodeError_clone(&*owner->contents.err);
12637 }
12638 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_err(int64_t owner) {
12639         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
12640         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12641         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
12642         int64_t ret_ref = tag_ptr(ret_copy, true);
12643         return ret_ref;
12644 }
12645
12646 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12647         LDKInvoiceError ret = *owner->contents.result;
12648         ret.is_owned = false;
12649         return ret;
12650 }
12651 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_ok(int64_t owner) {
12652         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12653         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
12654         int64_t ret_ref = 0;
12655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12657         return ret_ref;
12658 }
12659
12660 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
12661 CHECK(!owner->result_ok);
12662         return DecodeError_clone(&*owner->contents.err);
12663 }
12664 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_err(int64_t owner) {
12665         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
12666         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12667         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
12668         int64_t ret_ref = tag_ptr(ret_copy, true);
12669         return ret_ref;
12670 }
12671
12672 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12673         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
12674         ret.is_owned = false;
12675         return ret;
12676 }
12677 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(int64_t owner) {
12678         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12679         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
12680         int64_t ret_ref = 0;
12681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12683         return ret_ref;
12684 }
12685
12686 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
12687 CHECK(!owner->result_ok);
12688         return DecodeError_clone(&*owner->contents.err);
12689 }
12690 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(int64_t owner) {
12691         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
12692         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12693         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
12694         int64_t ret_ref = tag_ptr(ret_copy, true);
12695         return ret_ref;
12696 }
12697
12698 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12699         LDKDelayedPaymentKey ret = *owner->contents.result;
12700         ret.is_owned = false;
12701         return ret;
12702 }
12703 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(int64_t owner) {
12704         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12705         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
12706         int64_t ret_ref = 0;
12707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12709         return ret_ref;
12710 }
12711
12712 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
12713 CHECK(!owner->result_ok);
12714         return DecodeError_clone(&*owner->contents.err);
12715 }
12716 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(int64_t owner) {
12717         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
12718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12719         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
12720         int64_t ret_ref = tag_ptr(ret_copy, true);
12721         return ret_ref;
12722 }
12723
12724 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12725         LDKHtlcBasepoint ret = *owner->contents.result;
12726         ret.is_owned = false;
12727         return ret;
12728 }
12729 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_ok(int64_t owner) {
12730         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12731         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
12732         int64_t ret_ref = 0;
12733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12735         return ret_ref;
12736 }
12737
12738 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
12739 CHECK(!owner->result_ok);
12740         return DecodeError_clone(&*owner->contents.err);
12741 }
12742 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_err(int64_t owner) {
12743         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
12744         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12745         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
12746         int64_t ret_ref = tag_ptr(ret_copy, true);
12747         return ret_ref;
12748 }
12749
12750 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12751         LDKHtlcKey ret = *owner->contents.result;
12752         ret.is_owned = false;
12753         return ret;
12754 }
12755 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_ok(int64_t owner) {
12756         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12757         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
12758         int64_t ret_ref = 0;
12759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12761         return ret_ref;
12762 }
12763
12764 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
12765 CHECK(!owner->result_ok);
12766         return DecodeError_clone(&*owner->contents.err);
12767 }
12768 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_err(int64_t owner) {
12769         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
12770         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12771         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
12772         int64_t ret_ref = tag_ptr(ret_copy, true);
12773         return ret_ref;
12774 }
12775
12776 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12777         LDKRevocationBasepoint ret = *owner->contents.result;
12778         ret.is_owned = false;
12779         return ret;
12780 }
12781 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_ok(int64_t owner) {
12782         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12783         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
12784         int64_t ret_ref = 0;
12785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12787         return ret_ref;
12788 }
12789
12790 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
12791 CHECK(!owner->result_ok);
12792         return DecodeError_clone(&*owner->contents.err);
12793 }
12794 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_err(int64_t owner) {
12795         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
12796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12797         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
12798         int64_t ret_ref = tag_ptr(ret_copy, true);
12799         return ret_ref;
12800 }
12801
12802 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12803         LDKRevocationKey ret = *owner->contents.result;
12804         ret.is_owned = false;
12805         return ret;
12806 }
12807 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_ok(int64_t owner) {
12808         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12809         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
12810         int64_t ret_ref = 0;
12811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12813         return ret_ref;
12814 }
12815
12816 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
12817 CHECK(!owner->result_ok);
12818         return DecodeError_clone(&*owner->contents.err);
12819 }
12820 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_err(int64_t owner) {
12821         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
12822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12823         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
12824         int64_t ret_ref = tag_ptr(ret_copy, true);
12825         return ret_ref;
12826 }
12827
12828 typedef struct LDKFilter_JCalls {
12829         atomic_size_t refcnt;
12830         uint32_t instance_ptr;
12831 } LDKFilter_JCalls;
12832 static void LDKFilter_JCalls_free(void* this_arg) {
12833         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12834         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12835                 FREE(j_calls);
12836         }
12837 }
12838 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
12839         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12840         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
12841         memcpy(txid_arr->elems, *txid, 32);
12842         LDKu8slice script_pubkey_var = script_pubkey;
12843         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
12844         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
12845         js_invoke_function_void_ll(j_calls->instance_ptr, 56, (int64_t)txid_arr, (int64_t)script_pubkey_arr);
12846 }
12847 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
12848         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
12849         LDKWatchedOutput output_var = output;
12850         int64_t output_ref = 0;
12851         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
12852         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
12853         js_invoke_function_void_l(j_calls->instance_ptr, 57, output_ref);
12854 }
12855 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
12856         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
12857         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12858 }
12859 static inline LDKFilter LDKFilter_init (int64_t o) {
12860         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
12861         atomic_init(&calls->refcnt, 1);
12862         calls->instance_ptr = o;
12863
12864         LDKFilter ret = {
12865                 .this_arg = (void*) calls,
12866                 .register_tx = register_tx_LDKFilter_jcall,
12867                 .register_output = register_output_LDKFilter_jcall,
12868                 .free = LDKFilter_JCalls_free,
12869         };
12870         return ret;
12871 }
12872 uint64_t  CS_LDK_LDKFilter_new(int32_t o) {
12873         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
12874         *res_ptr = LDKFilter_init(o);
12875         return tag_ptr(res_ptr, true);
12876 }
12877 void  CS_LDK_Filter_register_tx(int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
12878         void* this_arg_ptr = untag_ptr(this_arg);
12879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12880         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12881         uint8_t txid_arr[32];
12882         CHECK(txid->arr_len == 32);
12883         memcpy(txid_arr, txid->elems, 32); FREE(txid);
12884         uint8_t (*txid_ref)[32] = &txid_arr;
12885         LDKu8slice script_pubkey_ref;
12886         script_pubkey_ref.datalen = script_pubkey->arr_len;
12887         script_pubkey_ref.data = script_pubkey->elems;
12888         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
12889         FREE(script_pubkey);
12890 }
12891
12892 void  CS_LDK_Filter_register_output(int64_t this_arg, int64_t output) {
12893         void* this_arg_ptr = untag_ptr(this_arg);
12894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12895         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
12896         LDKWatchedOutput output_conv;
12897         output_conv.inner = untag_ptr(output);
12898         output_conv.is_owned = ptr_is_owned(output);
12899         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
12900         output_conv = WatchedOutput_clone(&output_conv);
12901         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
12902 }
12903
12904 uint32_t CS_LDK_LDKCOption_FilterZ_ty_from_ptr(int64_t ptr) {
12905         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12906         switch(obj->tag) {
12907                 case LDKCOption_FilterZ_Some: return 0;
12908                 case LDKCOption_FilterZ_None: return 1;
12909                 default: abort();
12910         }
12911 }
12912 int64_t CS_LDK_LDKCOption_FilterZ_Some_get_some(int64_t ptr) {
12913         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
12914         CHECK(obj->tag == LDKCOption_FilterZ_Some);
12915         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
12916         *some_ret = obj->some;
12917                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
12918                         if ((*some_ret).free == LDKFilter_JCalls_free) {
12919                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12920                                 LDKFilter_JCalls_cloned(&(*some_ret));
12921                         }
12922         return tag_ptr(some_ret, true);
12923 }
12924 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12925         LDKLockedChannelMonitor ret = *owner->contents.result;
12926         ret.is_owned = false;
12927         return ret;
12928 }
12929 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_ok(int64_t owner) {
12930         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12931         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_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 void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
12939 CHECK(!owner->result_ok);
12940         return *owner->contents.err;
12941 }
12942 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_err(int64_t owner) {
12943         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
12944         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
12945 }
12946
12947 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
12948         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
12949         for (size_t i = 0; i < ret.datalen; i++) {
12950                 ret.data[i] = OutPoint_clone(&orig->data[i]);
12951         }
12952         return ret;
12953 }
12954 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
12955         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
12956         for (size_t i = 0; i < ret.datalen; i++) {
12957                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
12958         }
12959         return ret;
12960 }
12961 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12962         LDKOutPoint ret = owner->a;
12963         ret.is_owned = false;
12964         return ret;
12965 }
12966 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(int64_t owner) {
12967         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12968         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
12969         int64_t ret_ref = 0;
12970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12972         return ret_ref;
12973 }
12974
12975 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
12976         return CVec_MonitorUpdateIdZ_clone(&owner->b);
12977 }
12978 int64_tArray  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(int64_t owner) {
12979         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
12980         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
12981         int64_tArray ret_arr = NULL;
12982         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
12983         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
12984         for (size_t r = 0; r < ret_var.datalen; r++) {
12985                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
12986                 int64_t ret_conv_17_ref = 0;
12987                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
12988                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
12989                 ret_arr_ptr[r] = ret_conv_17_ref;
12990         }
12991         
12992         FREE(ret_var.data);
12993         return ret_arr;
12994 }
12995
12996 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
12997         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
12998         for (size_t i = 0; i < ret.datalen; i++) {
12999                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13000         }
13001         return ret;
13002 }
13003 typedef struct LDKKVStore_JCalls {
13004         atomic_size_t refcnt;
13005         uint32_t instance_ptr;
13006 } LDKKVStore_JCalls;
13007 static void LDKKVStore_JCalls_free(void* this_arg) {
13008         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13009         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13010                 FREE(j_calls);
13011         }
13012 }
13013 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
13014         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13015         LDKStr primary_namespace_str = primary_namespace;
13016         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13017         Str_free(primary_namespace_str);
13018         LDKStr secondary_namespace_str = secondary_namespace;
13019         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13020         Str_free(secondary_namespace_str);
13021         LDKStr key_str = key;
13022         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13023         Str_free(key_str);
13024         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 58, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
13025         void* ret_ptr = untag_ptr(ret);
13026         CHECK_ACCESS(ret_ptr);
13027         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
13028         FREE(untag_ptr(ret));
13029         return ret_conv;
13030 }
13031 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
13032         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13033         LDKStr primary_namespace_str = primary_namespace;
13034         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13035         Str_free(primary_namespace_str);
13036         LDKStr secondary_namespace_str = secondary_namespace;
13037         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13038         Str_free(secondary_namespace_str);
13039         LDKStr key_str = key;
13040         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13041         Str_free(key_str);
13042         LDKu8slice buf_var = buf;
13043         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
13044         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
13045         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 59, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
13046         void* ret_ptr = untag_ptr(ret);
13047         CHECK_ACCESS(ret_ptr);
13048         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13049         FREE(untag_ptr(ret));
13050         return ret_conv;
13051 }
13052 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
13053         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13054         LDKStr primary_namespace_str = primary_namespace;
13055         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13056         Str_free(primary_namespace_str);
13057         LDKStr secondary_namespace_str = secondary_namespace;
13058         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13059         Str_free(secondary_namespace_str);
13060         LDKStr key_str = key;
13061         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
13062         Str_free(key_str);
13063         jboolean lazy_conv = lazy;
13064         uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 60, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
13065         void* ret_ptr = untag_ptr(ret);
13066         CHECK_ACCESS(ret_ptr);
13067         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13068         FREE(untag_ptr(ret));
13069         return ret_conv;
13070 }
13071 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
13072         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
13073         LDKStr primary_namespace_str = primary_namespace;
13074         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
13075         Str_free(primary_namespace_str);
13076         LDKStr secondary_namespace_str = secondary_namespace;
13077         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
13078         Str_free(secondary_namespace_str);
13079         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 61, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
13080         void* ret_ptr = untag_ptr(ret);
13081         CHECK_ACCESS(ret_ptr);
13082         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
13083         FREE(untag_ptr(ret));
13084         return ret_conv;
13085 }
13086 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
13087         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
13088         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13089 }
13090 static inline LDKKVStore LDKKVStore_init (int64_t o) {
13091         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
13092         atomic_init(&calls->refcnt, 1);
13093         calls->instance_ptr = o;
13094
13095         LDKKVStore ret = {
13096                 .this_arg = (void*) calls,
13097                 .read = read_LDKKVStore_jcall,
13098                 .write = write_LDKKVStore_jcall,
13099                 .remove = remove_LDKKVStore_jcall,
13100                 .list = list_LDKKVStore_jcall,
13101                 .free = LDKKVStore_JCalls_free,
13102         };
13103         return ret;
13104 }
13105 uint64_t  CS_LDK_LDKKVStore_new(int32_t o) {
13106         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
13107         *res_ptr = LDKKVStore_init(o);
13108         return tag_ptr(res_ptr, true);
13109 }
13110 int64_t  CS_LDK_KVStore_read(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
13111         void* this_arg_ptr = untag_ptr(this_arg);
13112         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13113         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13114         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13115         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13116         LDKStr key_conv = str_ref_to_owned_c(key);
13117         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
13118         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
13119         return tag_ptr(ret_conv, true);
13120 }
13121
13122 int64_t  CS_LDK_KVStore_write(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
13123         void* this_arg_ptr = untag_ptr(this_arg);
13124         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13125         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13126         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13127         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13128         LDKStr key_conv = str_ref_to_owned_c(key);
13129         LDKu8slice buf_ref;
13130         buf_ref.datalen = buf->arr_len;
13131         buf_ref.data = buf->elems;
13132         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13133         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
13134         FREE(buf);
13135         return tag_ptr(ret_conv, true);
13136 }
13137
13138 int64_t  CS_LDK_KVStore_remove(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
13139         void* this_arg_ptr = untag_ptr(this_arg);
13140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13141         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13142         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13143         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13144         LDKStr key_conv = str_ref_to_owned_c(key);
13145         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13146         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
13147         return tag_ptr(ret_conv, true);
13148 }
13149
13150 int64_t  CS_LDK_KVStore_list(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
13151         void* this_arg_ptr = untag_ptr(this_arg);
13152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13153         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
13154         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
13155         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
13156         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
13157         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
13158         return tag_ptr(ret_conv, true);
13159 }
13160
13161 typedef struct LDKPersister_JCalls {
13162         atomic_size_t refcnt;
13163         uint32_t instance_ptr;
13164 } LDKPersister_JCalls;
13165 static void LDKPersister_JCalls_free(void* this_arg) {
13166         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13167         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13168                 FREE(j_calls);
13169         }
13170 }
13171 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13172         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13173         LDKChannelManager channel_manager_var = *channel_manager;
13174         int64_t channel_manager_ref = 0;
13175         // WARNING: we may need a move here but no clone is available for LDKChannelManager
13176         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13177         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
13178         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 62, channel_manager_ref);
13179         void* ret_ptr = untag_ptr(ret);
13180         CHECK_ACCESS(ret_ptr);
13181         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13182         FREE(untag_ptr(ret));
13183         return ret_conv;
13184 }
13185 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13186         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13187         LDKNetworkGraph network_graph_var = *network_graph;
13188         int64_t network_graph_ref = 0;
13189         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
13190         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13191         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
13192         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 63, network_graph_ref);
13193         void* ret_ptr = untag_ptr(ret);
13194         CHECK_ACCESS(ret_ptr);
13195         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13196         FREE(untag_ptr(ret));
13197         return ret_conv;
13198 }
13199 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
13200         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13201         // WARNING: This object doesn't live past this scope, needs clone!
13202         int64_t ret_scorer = tag_ptr(scorer, false);
13203         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 64, ret_scorer);
13204         void* ret_ptr = untag_ptr(ret);
13205         CHECK_ACCESS(ret_ptr);
13206         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
13207         FREE(untag_ptr(ret));
13208         return ret_conv;
13209 }
13210 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13211         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13212         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13213 }
13214 static inline LDKPersister LDKPersister_init (int64_t o) {
13215         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13216         atomic_init(&calls->refcnt, 1);
13217         calls->instance_ptr = o;
13218
13219         LDKPersister ret = {
13220                 .this_arg = (void*) calls,
13221                 .persist_manager = persist_manager_LDKPersister_jcall,
13222                 .persist_graph = persist_graph_LDKPersister_jcall,
13223                 .persist_scorer = persist_scorer_LDKPersister_jcall,
13224                 .free = LDKPersister_JCalls_free,
13225         };
13226         return ret;
13227 }
13228 uint64_t  CS_LDK_LDKPersister_new(int32_t o) {
13229         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
13230         *res_ptr = LDKPersister_init(o);
13231         return tag_ptr(res_ptr, true);
13232 }
13233 int64_t  CS_LDK_Persister_persist_manager(int64_t this_arg, int64_t channel_manager) {
13234         void* this_arg_ptr = untag_ptr(this_arg);
13235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13236         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13237         LDKChannelManager channel_manager_conv;
13238         channel_manager_conv.inner = untag_ptr(channel_manager);
13239         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
13240         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13241         channel_manager_conv.is_owned = false;
13242         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13243         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13244         return tag_ptr(ret_conv, true);
13245 }
13246
13247 int64_t  CS_LDK_Persister_persist_graph(int64_t this_arg, int64_t network_graph) {
13248         void* this_arg_ptr = untag_ptr(this_arg);
13249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13250         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13251         LDKNetworkGraph network_graph_conv;
13252         network_graph_conv.inner = untag_ptr(network_graph);
13253         network_graph_conv.is_owned = ptr_is_owned(network_graph);
13254         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13255         network_graph_conv.is_owned = false;
13256         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13257         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13258         return tag_ptr(ret_conv, true);
13259 }
13260
13261 int64_t  CS_LDK_Persister_persist_scorer(int64_t this_arg, int64_t scorer) {
13262         void* this_arg_ptr = untag_ptr(this_arg);
13263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13264         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13265         void* scorer_ptr = untag_ptr(scorer);
13266         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13267         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
13268         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
13269         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
13270         return tag_ptr(ret_conv, true);
13271 }
13272
13273 typedef struct LDKPersist_JCalls {
13274         atomic_size_t refcnt;
13275         uint32_t instance_ptr;
13276 } LDKPersist_JCalls;
13277 static void LDKPersist_JCalls_free(void* this_arg) {
13278         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13279         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13280                 FREE(j_calls);
13281         }
13282 }
13283 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13284         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13285         LDKOutPoint channel_id_var = channel_id;
13286         int64_t channel_id_ref = 0;
13287         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13288         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13289         LDKChannelMonitor data_var = *data;
13290         int64_t data_ref = 0;
13291         data_var = ChannelMonitor_clone(&data_var);
13292         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13293         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13294         LDKMonitorUpdateId update_id_var = update_id;
13295         int64_t update_id_ref = 0;
13296         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13297         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13298         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_lll(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref);
13299         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
13300         return ret_conv;
13301 }
13302 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
13303         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
13304         LDKOutPoint channel_id_var = channel_id;
13305         int64_t channel_id_ref = 0;
13306         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
13307         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
13308         LDKChannelMonitorUpdate update_var = update;
13309         int64_t update_ref = 0;
13310         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
13311         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
13312         LDKChannelMonitor data_var = *data;
13313         int64_t data_ref = 0;
13314         data_var = ChannelMonitor_clone(&data_var);
13315         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
13316         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
13317         LDKMonitorUpdateId update_id_var = update_id;
13318         int64_t update_id_ref = 0;
13319         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
13320         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
13321         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_llll(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref);
13322         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
13323         return ret_conv;
13324 }
13325 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
13326         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
13327         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13328 }
13329 static inline LDKPersist LDKPersist_init (int64_t o) {
13330         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
13331         atomic_init(&calls->refcnt, 1);
13332         calls->instance_ptr = o;
13333
13334         LDKPersist ret = {
13335                 .this_arg = (void*) calls,
13336                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
13337                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
13338                 .free = LDKPersist_JCalls_free,
13339         };
13340         return ret;
13341 }
13342 uint64_t  CS_LDK_LDKPersist_new(int32_t o) {
13343         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
13344         *res_ptr = LDKPersist_init(o);
13345         return tag_ptr(res_ptr, true);
13346 }
13347 int32_t  CS_LDK_Persist_persist_new_channel(int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
13348         void* this_arg_ptr = untag_ptr(this_arg);
13349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13350         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13351         LDKOutPoint channel_id_conv;
13352         channel_id_conv.inner = untag_ptr(channel_id);
13353         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13354         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13355         channel_id_conv = OutPoint_clone(&channel_id_conv);
13356         LDKChannelMonitor data_conv;
13357         data_conv.inner = untag_ptr(data);
13358         data_conv.is_owned = ptr_is_owned(data);
13359         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13360         data_conv.is_owned = false;
13361         LDKMonitorUpdateId update_id_conv;
13362         update_id_conv.inner = untag_ptr(update_id);
13363         update_id_conv.is_owned = ptr_is_owned(update_id);
13364         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13365         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13366         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
13367         return ret_conv;
13368 }
13369
13370 int32_t  CS_LDK_Persist_update_persisted_channel(int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
13371         void* this_arg_ptr = untag_ptr(this_arg);
13372         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13373         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
13374         LDKOutPoint channel_id_conv;
13375         channel_id_conv.inner = untag_ptr(channel_id);
13376         channel_id_conv.is_owned = ptr_is_owned(channel_id);
13377         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
13378         channel_id_conv = OutPoint_clone(&channel_id_conv);
13379         LDKChannelMonitorUpdate update_conv;
13380         update_conv.inner = untag_ptr(update);
13381         update_conv.is_owned = ptr_is_owned(update);
13382         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
13383         update_conv = ChannelMonitorUpdate_clone(&update_conv);
13384         LDKChannelMonitor data_conv;
13385         data_conv.inner = untag_ptr(data);
13386         data_conv.is_owned = ptr_is_owned(data);
13387         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
13388         data_conv.is_owned = false;
13389         LDKMonitorUpdateId update_id_conv;
13390         update_id_conv.inner = untag_ptr(update_id);
13391         update_id_conv.is_owned = ptr_is_owned(update_id);
13392         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
13393         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
13394         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
13395         return ret_conv;
13396 }
13397
13398 typedef struct LDKFutureCallback_JCalls {
13399         atomic_size_t refcnt;
13400         uint32_t instance_ptr;
13401 } LDKFutureCallback_JCalls;
13402 static void LDKFutureCallback_JCalls_free(void* this_arg) {
13403         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13404         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13405                 FREE(j_calls);
13406         }
13407 }
13408 void call_LDKFutureCallback_jcall(const void* this_arg) {
13409         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
13410         js_invoke_function_void_(j_calls->instance_ptr, 67);
13411 }
13412 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
13413         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
13414         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13415 }
13416 static inline LDKFutureCallback LDKFutureCallback_init (int64_t o) {
13417         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
13418         atomic_init(&calls->refcnt, 1);
13419         calls->instance_ptr = o;
13420
13421         LDKFutureCallback ret = {
13422                 .this_arg = (void*) calls,
13423                 .call = call_LDKFutureCallback_jcall,
13424                 .free = LDKFutureCallback_JCalls_free,
13425         };
13426         return ret;
13427 }
13428 uint64_t  CS_LDK_LDKFutureCallback_new(int32_t o) {
13429         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
13430         *res_ptr = LDKFutureCallback_init(o);
13431         return tag_ptr(res_ptr, true);
13432 }
13433 void  CS_LDK_FutureCallback_call(int64_t this_arg) {
13434         void* this_arg_ptr = untag_ptr(this_arg);
13435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13436         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
13437         (this_arg_conv->call)(this_arg_conv->this_arg);
13438 }
13439
13440 typedef struct LDKListen_JCalls {
13441         atomic_size_t refcnt;
13442         uint32_t instance_ptr;
13443 } LDKListen_JCalls;
13444 static void LDKListen_JCalls_free(void* this_arg) {
13445         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13446         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13447                 FREE(j_calls);
13448         }
13449 }
13450 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13451         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13452         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13453         memcpy(header_arr->elems, *header, 80);
13454         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13455         int64_tArray txdata_arr = NULL;
13456         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
13457         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
13458         for (size_t c = 0; c < txdata_var.datalen; c++) {
13459                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13460                 *txdata_conv_28_conv = txdata_var.data[c];
13461                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13462         }
13463         
13464         FREE(txdata_var.data);
13465         int32_t height_conv = height;
13466         js_invoke_function_void_lli(j_calls->instance_ptr, 68, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
13467 }
13468 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
13469         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13470         LDKu8slice block_var = block;
13471         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
13472         memcpy(block_arr->elems, block_var.data, block_var.datalen);
13473         int32_t height_conv = height;
13474         js_invoke_function_void_li(j_calls->instance_ptr, 69, (int64_t)block_arr, height_conv);
13475 }
13476 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13477         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
13478         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13479         memcpy(header_arr->elems, *header, 80);
13480         int32_t height_conv = height;
13481         js_invoke_function_void_li(j_calls->instance_ptr, 70, (int64_t)header_arr, height_conv);
13482 }
13483 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
13484         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
13485         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13486 }
13487 static inline LDKListen LDKListen_init (int64_t o) {
13488         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
13489         atomic_init(&calls->refcnt, 1);
13490         calls->instance_ptr = o;
13491
13492         LDKListen ret = {
13493                 .this_arg = (void*) calls,
13494                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
13495                 .block_connected = block_connected_LDKListen_jcall,
13496                 .block_disconnected = block_disconnected_LDKListen_jcall,
13497                 .free = LDKListen_JCalls_free,
13498         };
13499         return ret;
13500 }
13501 uint64_t  CS_LDK_LDKListen_new(int32_t o) {
13502         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
13503         *res_ptr = LDKListen_init(o);
13504         return tag_ptr(res_ptr, true);
13505 }
13506 void  CS_LDK_Listen_filtered_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
13507         void* this_arg_ptr = untag_ptr(this_arg);
13508         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13509         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13510         uint8_t header_arr[80];
13511         CHECK(header->arr_len == 80);
13512         memcpy(header_arr, header->elems, 80); FREE(header);
13513         uint8_t (*header_ref)[80] = &header_arr;
13514         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13515         txdata_constr.datalen = txdata->arr_len;
13516         if (txdata_constr.datalen > 0)
13517                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13518         else
13519                 txdata_constr.data = NULL;
13520         int64_t* txdata_vals = txdata->elems;
13521         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13522                 int64_t txdata_conv_28 = txdata_vals[c];
13523                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13524                 CHECK_ACCESS(txdata_conv_28_ptr);
13525                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13526                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13527                 txdata_constr.data[c] = txdata_conv_28_conv;
13528         }
13529         FREE(txdata);
13530         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13531 }
13532
13533 void  CS_LDK_Listen_block_connected(int64_t this_arg, int8_tArray block, int32_t height) {
13534         void* this_arg_ptr = untag_ptr(this_arg);
13535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13536         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13537         LDKu8slice block_ref;
13538         block_ref.datalen = block->arr_len;
13539         block_ref.data = block->elems;
13540         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
13541         FREE(block);
13542 }
13543
13544 void  CS_LDK_Listen_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height) {
13545         void* this_arg_ptr = untag_ptr(this_arg);
13546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13547         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
13548         uint8_t header_arr[80];
13549         CHECK(header->arr_len == 80);
13550         memcpy(header_arr, header->elems, 80); FREE(header);
13551         uint8_t (*header_ref)[80] = &header_arr;
13552         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
13553 }
13554
13555 typedef struct LDKConfirm_JCalls {
13556         atomic_size_t refcnt;
13557         uint32_t instance_ptr;
13558 } LDKConfirm_JCalls;
13559 static void LDKConfirm_JCalls_free(void* this_arg) {
13560         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13561         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13562                 FREE(j_calls);
13563         }
13564 }
13565 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
13566         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13567         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13568         memcpy(header_arr->elems, *header, 80);
13569         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
13570         int64_tArray txdata_arr = NULL;
13571         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
13572         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
13573         for (size_t c = 0; c < txdata_var.datalen; c++) {
13574                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13575                 *txdata_conv_28_conv = txdata_var.data[c];
13576                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
13577         }
13578         
13579         FREE(txdata_var.data);
13580         int32_t height_conv = height;
13581         js_invoke_function_void_lli(j_calls->instance_ptr, 71, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
13582 }
13583 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
13584         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13585         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13586         memcpy(txid_arr->elems, *txid, 32);
13587         js_invoke_function_void_l(j_calls->instance_ptr, 72, (int64_t)txid_arr);
13588 }
13589 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
13590         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13591         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
13592         memcpy(header_arr->elems, *header, 80);
13593         int32_t height_conv = height;
13594         js_invoke_function_void_li(j_calls->instance_ptr, 73, (int64_t)header_arr, height_conv);
13595 }
13596 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
13597         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
13598         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 74);
13599         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
13600         ret_constr.datalen = ret->arr_len;
13601         if (ret_constr.datalen > 0)
13602                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
13603         else
13604                 ret_constr.data = NULL;
13605         int64_t* ret_vals = ret->elems;
13606         for (size_t c = 0; c < ret_constr.datalen; c++) {
13607                 int64_t ret_conv_54 = ret_vals[c];
13608                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
13609                 CHECK_ACCESS(ret_conv_54_ptr);
13610                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
13611                 FREE(untag_ptr(ret_conv_54));
13612                 ret_constr.data[c] = ret_conv_54_conv;
13613         }
13614         FREE(ret);
13615         return ret_constr;
13616 }
13617 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
13618         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
13619         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13620 }
13621 static inline LDKConfirm LDKConfirm_init (int64_t o) {
13622         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
13623         atomic_init(&calls->refcnt, 1);
13624         calls->instance_ptr = o;
13625
13626         LDKConfirm ret = {
13627                 .this_arg = (void*) calls,
13628                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
13629                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
13630                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
13631                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
13632                 .free = LDKConfirm_JCalls_free,
13633         };
13634         return ret;
13635 }
13636 uint64_t  CS_LDK_LDKConfirm_new(int32_t o) {
13637         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13638         *res_ptr = LDKConfirm_init(o);
13639         return tag_ptr(res_ptr, true);
13640 }
13641 void  CS_LDK_Confirm_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
13642         void* this_arg_ptr = untag_ptr(this_arg);
13643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13644         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13645         uint8_t header_arr[80];
13646         CHECK(header->arr_len == 80);
13647         memcpy(header_arr, header->elems, 80); FREE(header);
13648         uint8_t (*header_ref)[80] = &header_arr;
13649         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
13650         txdata_constr.datalen = txdata->arr_len;
13651         if (txdata_constr.datalen > 0)
13652                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13653         else
13654                 txdata_constr.data = NULL;
13655         int64_t* txdata_vals = txdata->elems;
13656         for (size_t c = 0; c < txdata_constr.datalen; c++) {
13657                 int64_t txdata_conv_28 = txdata_vals[c];
13658                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
13659                 CHECK_ACCESS(txdata_conv_28_ptr);
13660                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
13661                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
13662                 txdata_constr.data[c] = txdata_conv_28_conv;
13663         }
13664         FREE(txdata);
13665         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
13666 }
13667
13668 void  CS_LDK_Confirm_transaction_unconfirmed(int64_t this_arg, int8_tArray txid) {
13669         void* this_arg_ptr = untag_ptr(this_arg);
13670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13671         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13672         uint8_t txid_arr[32];
13673         CHECK(txid->arr_len == 32);
13674         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13675         uint8_t (*txid_ref)[32] = &txid_arr;
13676         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
13677 }
13678
13679 void  CS_LDK_Confirm_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height) {
13680         void* this_arg_ptr = untag_ptr(this_arg);
13681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13682         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13683         uint8_t header_arr[80];
13684         CHECK(header->arr_len == 80);
13685         memcpy(header_arr, header->elems, 80); FREE(header);
13686         uint8_t (*header_ref)[80] = &header_arr;
13687         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
13688 }
13689
13690 int64_tArray  CS_LDK_Confirm_get_relevant_txids(int64_t this_arg) {
13691         void* this_arg_ptr = untag_ptr(this_arg);
13692         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13693         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
13694         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
13695         int64_tArray ret_arr = NULL;
13696         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
13697         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
13698         for (size_t c = 0; c < ret_var.datalen; c++) {
13699                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
13700                 *ret_conv_54_conv = ret_var.data[c];
13701                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
13702         }
13703         
13704         FREE(ret_var.data);
13705         return ret_arr;
13706 }
13707
13708 typedef struct LDKEventHandler_JCalls {
13709         atomic_size_t refcnt;
13710         uint32_t instance_ptr;
13711 } LDKEventHandler_JCalls;
13712 static void LDKEventHandler_JCalls_free(void* this_arg) {
13713         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13714         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13715                 FREE(j_calls);
13716         }
13717 }
13718 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
13719         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
13720         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13721         *event_copy = event;
13722         int64_t event_ref = tag_ptr(event_copy, true);
13723         js_invoke_function_void_l(j_calls->instance_ptr, 75, event_ref);
13724 }
13725 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
13726         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
13727         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13728 }
13729 static inline LDKEventHandler LDKEventHandler_init (int64_t o) {
13730         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
13731         atomic_init(&calls->refcnt, 1);
13732         calls->instance_ptr = o;
13733
13734         LDKEventHandler ret = {
13735                 .this_arg = (void*) calls,
13736                 .handle_event = handle_event_LDKEventHandler_jcall,
13737                 .free = LDKEventHandler_JCalls_free,
13738         };
13739         return ret;
13740 }
13741 uint64_t  CS_LDK_LDKEventHandler_new(int32_t o) {
13742         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13743         *res_ptr = LDKEventHandler_init(o);
13744         return tag_ptr(res_ptr, true);
13745 }
13746 void  CS_LDK_EventHandler_handle_event(int64_t this_arg, int64_t event) {
13747         void* this_arg_ptr = untag_ptr(this_arg);
13748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13749         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
13750         void* event_ptr = untag_ptr(event);
13751         CHECK_ACCESS(event_ptr);
13752         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
13753         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
13754         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
13755 }
13756
13757 typedef struct LDKEventsProvider_JCalls {
13758         atomic_size_t refcnt;
13759         uint32_t instance_ptr;
13760 } LDKEventsProvider_JCalls;
13761 static void LDKEventsProvider_JCalls_free(void* this_arg) {
13762         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13763         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13764                 FREE(j_calls);
13765         }
13766 }
13767 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
13768         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
13769         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
13770         *handler_ret = handler;
13771         js_invoke_function_void_l(j_calls->instance_ptr, 76, tag_ptr(handler_ret, true));
13772 }
13773 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
13774         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
13775         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13776 }
13777 static inline LDKEventsProvider LDKEventsProvider_init (int64_t o) {
13778         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
13779         atomic_init(&calls->refcnt, 1);
13780         calls->instance_ptr = o;
13781
13782         LDKEventsProvider ret = {
13783                 .this_arg = (void*) calls,
13784                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
13785                 .free = LDKEventsProvider_JCalls_free,
13786         };
13787         return ret;
13788 }
13789 uint64_t  CS_LDK_LDKEventsProvider_new(int32_t o) {
13790         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13791         *res_ptr = LDKEventsProvider_init(o);
13792         return tag_ptr(res_ptr, true);
13793 }
13794 void  CS_LDK_EventsProvider_process_pending_events(int64_t this_arg, int64_t handler) {
13795         void* this_arg_ptr = untag_ptr(this_arg);
13796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13797         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
13798         void* handler_ptr = untag_ptr(handler);
13799         CHECK_ACCESS(handler_ptr);
13800         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
13801         if (handler_conv.free == LDKEventHandler_JCalls_free) {
13802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13803                 LDKEventHandler_JCalls_cloned(&handler_conv);
13804         }
13805         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
13806 }
13807
13808 uint32_t CS_LDK_LDKFailureCode_ty_from_ptr(int64_t ptr) {
13809         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13810         switch(obj->tag) {
13811                 case LDKFailureCode_TemporaryNodeFailure: return 0;
13812                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
13813                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
13814                 case LDKFailureCode_InvalidOnionPayload: return 3;
13815                 default: abort();
13816         }
13817 }
13818 int64_t CS_LDK_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(int64_t ptr) {
13819         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
13820         CHECK(obj->tag == LDKFailureCode_InvalidOnionPayload);
13821         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
13822         return invalid_onion_payload_ref;
13823 }
13824 typedef struct LDKMessageSendEventsProvider_JCalls {
13825         atomic_size_t refcnt;
13826         uint32_t instance_ptr;
13827 } LDKMessageSendEventsProvider_JCalls;
13828 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
13829         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13830         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13831                 FREE(j_calls);
13832         }
13833 }
13834 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
13835         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
13836         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 77);
13837         LDKCVec_MessageSendEventZ ret_constr;
13838         ret_constr.datalen = ret->arr_len;
13839         if (ret_constr.datalen > 0)
13840                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13841         else
13842                 ret_constr.data = NULL;
13843         int64_t* ret_vals = ret->elems;
13844         for (size_t s = 0; s < ret_constr.datalen; s++) {
13845                 int64_t ret_conv_18 = ret_vals[s];
13846                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
13847                 CHECK_ACCESS(ret_conv_18_ptr);
13848                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
13849                 FREE(untag_ptr(ret_conv_18));
13850                 ret_constr.data[s] = ret_conv_18_conv;
13851         }
13852         FREE(ret);
13853         return ret_constr;
13854 }
13855 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
13856         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
13857         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13858 }
13859 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (int64_t o) {
13860         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
13861         atomic_init(&calls->refcnt, 1);
13862         calls->instance_ptr = o;
13863
13864         LDKMessageSendEventsProvider ret = {
13865                 .this_arg = (void*) calls,
13866                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
13867                 .free = LDKMessageSendEventsProvider_JCalls_free,
13868         };
13869         return ret;
13870 }
13871 uint64_t  CS_LDK_LDKMessageSendEventsProvider_new(int32_t o) {
13872         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
13873         *res_ptr = LDKMessageSendEventsProvider_init(o);
13874         return tag_ptr(res_ptr, true);
13875 }
13876 int64_tArray  CS_LDK_MessageSendEventsProvider_get_and_clear_pending_msg_events(int64_t this_arg) {
13877         void* this_arg_ptr = untag_ptr(this_arg);
13878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13879         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
13880         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
13881         int64_tArray ret_arr = NULL;
13882         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
13883         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
13884         for (size_t s = 0; s < ret_var.datalen; s++) {
13885                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13886                 *ret_conv_18_copy = ret_var.data[s];
13887                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
13888                 ret_arr_ptr[s] = ret_conv_18_ref;
13889         }
13890         
13891         FREE(ret_var.data);
13892         return ret_arr;
13893 }
13894
13895 typedef struct LDKChannelMessageHandler_JCalls {
13896         atomic_size_t refcnt;
13897         uint32_t instance_ptr;
13898         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
13899 } LDKChannelMessageHandler_JCalls;
13900 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
13901         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13902         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13903                 FREE(j_calls);
13904         }
13905 }
13906 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
13907         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13908         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13909         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13910         LDKOpenChannel msg_var = *msg;
13911         int64_t msg_ref = 0;
13912         msg_var = OpenChannel_clone(&msg_var);
13913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13914         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13915         js_invoke_function_void_ll(j_calls->instance_ptr, 78, (int64_t)their_node_id_arr, msg_ref);
13916 }
13917 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
13918         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13919         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13920         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13921         LDKOpenChannelV2 msg_var = *msg;
13922         int64_t msg_ref = 0;
13923         msg_var = OpenChannelV2_clone(&msg_var);
13924         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13925         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13926         js_invoke_function_void_ll(j_calls->instance_ptr, 79, (int64_t)their_node_id_arr, msg_ref);
13927 }
13928 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
13929         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13930         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13931         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13932         LDKAcceptChannel msg_var = *msg;
13933         int64_t msg_ref = 0;
13934         msg_var = AcceptChannel_clone(&msg_var);
13935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13936         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13937         js_invoke_function_void_ll(j_calls->instance_ptr, 80, (int64_t)their_node_id_arr, msg_ref);
13938 }
13939 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
13940         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13941         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13942         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13943         LDKAcceptChannelV2 msg_var = *msg;
13944         int64_t msg_ref = 0;
13945         msg_var = AcceptChannelV2_clone(&msg_var);
13946         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13947         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13948         js_invoke_function_void_ll(j_calls->instance_ptr, 81, (int64_t)their_node_id_arr, msg_ref);
13949 }
13950 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
13951         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13952         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13953         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13954         LDKFundingCreated msg_var = *msg;
13955         int64_t msg_ref = 0;
13956         msg_var = FundingCreated_clone(&msg_var);
13957         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13958         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13959         js_invoke_function_void_ll(j_calls->instance_ptr, 82, (int64_t)their_node_id_arr, msg_ref);
13960 }
13961 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
13962         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13963         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13964         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13965         LDKFundingSigned msg_var = *msg;
13966         int64_t msg_ref = 0;
13967         msg_var = FundingSigned_clone(&msg_var);
13968         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13969         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13970         js_invoke_function_void_ll(j_calls->instance_ptr, 83, (int64_t)their_node_id_arr, msg_ref);
13971 }
13972 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
13973         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13974         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13975         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13976         LDKChannelReady msg_var = *msg;
13977         int64_t msg_ref = 0;
13978         msg_var = ChannelReady_clone(&msg_var);
13979         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13980         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13981         js_invoke_function_void_ll(j_calls->instance_ptr, 84, (int64_t)their_node_id_arr, msg_ref);
13982 }
13983 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
13984         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13985         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13986         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13987         LDKShutdown msg_var = *msg;
13988         int64_t msg_ref = 0;
13989         msg_var = Shutdown_clone(&msg_var);
13990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13991         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13992         js_invoke_function_void_ll(j_calls->instance_ptr, 85, (int64_t)their_node_id_arr, msg_ref);
13993 }
13994 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
13995         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
13996         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13997         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13998         LDKClosingSigned msg_var = *msg;
13999         int64_t msg_ref = 0;
14000         msg_var = ClosingSigned_clone(&msg_var);
14001         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14002         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14003         js_invoke_function_void_ll(j_calls->instance_ptr, 86, (int64_t)their_node_id_arr, msg_ref);
14004 }
14005 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
14006         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14007         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14008         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14009         LDKStfu msg_var = *msg;
14010         int64_t msg_ref = 0;
14011         msg_var = Stfu_clone(&msg_var);
14012         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14013         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14014         js_invoke_function_void_ll(j_calls->instance_ptr, 87, (int64_t)their_node_id_arr, msg_ref);
14015 }
14016 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
14017         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14018         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14019         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14020         LDKSplice msg_var = *msg;
14021         int64_t msg_ref = 0;
14022         msg_var = Splice_clone(&msg_var);
14023         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14024         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14025         js_invoke_function_void_ll(j_calls->instance_ptr, 88, (int64_t)their_node_id_arr, msg_ref);
14026 }
14027 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
14028         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14029         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14030         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14031         LDKSpliceAck msg_var = *msg;
14032         int64_t msg_ref = 0;
14033         msg_var = SpliceAck_clone(&msg_var);
14034         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14035         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14036         js_invoke_function_void_ll(j_calls->instance_ptr, 89, (int64_t)their_node_id_arr, msg_ref);
14037 }
14038 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
14039         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14040         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14041         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14042         LDKSpliceLocked msg_var = *msg;
14043         int64_t msg_ref = 0;
14044         msg_var = SpliceLocked_clone(&msg_var);
14045         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14046         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14047         js_invoke_function_void_ll(j_calls->instance_ptr, 90, (int64_t)their_node_id_arr, msg_ref);
14048 }
14049 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
14050         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14051         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14052         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14053         LDKTxAddInput msg_var = *msg;
14054         int64_t msg_ref = 0;
14055         msg_var = TxAddInput_clone(&msg_var);
14056         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14057         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14058         js_invoke_function_void_ll(j_calls->instance_ptr, 91, (int64_t)their_node_id_arr, msg_ref);
14059 }
14060 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
14061         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14062         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14063         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14064         LDKTxAddOutput msg_var = *msg;
14065         int64_t msg_ref = 0;
14066         msg_var = TxAddOutput_clone(&msg_var);
14067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14068         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14069         js_invoke_function_void_ll(j_calls->instance_ptr, 92, (int64_t)their_node_id_arr, msg_ref);
14070 }
14071 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
14072         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14073         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14074         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14075         LDKTxRemoveInput msg_var = *msg;
14076         int64_t msg_ref = 0;
14077         msg_var = TxRemoveInput_clone(&msg_var);
14078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14079         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14080         js_invoke_function_void_ll(j_calls->instance_ptr, 93, (int64_t)their_node_id_arr, msg_ref);
14081 }
14082 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
14083         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14084         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14085         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14086         LDKTxRemoveOutput msg_var = *msg;
14087         int64_t msg_ref = 0;
14088         msg_var = TxRemoveOutput_clone(&msg_var);
14089         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14090         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14091         js_invoke_function_void_ll(j_calls->instance_ptr, 94, (int64_t)their_node_id_arr, msg_ref);
14092 }
14093 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
14094         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14095         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14096         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14097         LDKTxComplete msg_var = *msg;
14098         int64_t msg_ref = 0;
14099         msg_var = TxComplete_clone(&msg_var);
14100         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14101         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14102         js_invoke_function_void_ll(j_calls->instance_ptr, 95, (int64_t)their_node_id_arr, msg_ref);
14103 }
14104 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
14105         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14106         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14107         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14108         LDKTxSignatures msg_var = *msg;
14109         int64_t msg_ref = 0;
14110         msg_var = TxSignatures_clone(&msg_var);
14111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14112         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14113         js_invoke_function_void_ll(j_calls->instance_ptr, 96, (int64_t)their_node_id_arr, msg_ref);
14114 }
14115 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
14116         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14117         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14118         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14119         LDKTxInitRbf msg_var = *msg;
14120         int64_t msg_ref = 0;
14121         msg_var = TxInitRbf_clone(&msg_var);
14122         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14123         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14124         js_invoke_function_void_ll(j_calls->instance_ptr, 97, (int64_t)their_node_id_arr, msg_ref);
14125 }
14126 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
14127         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14128         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14129         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14130         LDKTxAckRbf msg_var = *msg;
14131         int64_t msg_ref = 0;
14132         msg_var = TxAckRbf_clone(&msg_var);
14133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14134         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14135         js_invoke_function_void_ll(j_calls->instance_ptr, 98, (int64_t)their_node_id_arr, msg_ref);
14136 }
14137 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
14138         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14139         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14140         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14141         LDKTxAbort msg_var = *msg;
14142         int64_t msg_ref = 0;
14143         msg_var = TxAbort_clone(&msg_var);
14144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14145         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14146         js_invoke_function_void_ll(j_calls->instance_ptr, 99, (int64_t)their_node_id_arr, msg_ref);
14147 }
14148 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
14149         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14150         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14151         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14152         LDKUpdateAddHTLC msg_var = *msg;
14153         int64_t msg_ref = 0;
14154         msg_var = UpdateAddHTLC_clone(&msg_var);
14155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14156         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14157         js_invoke_function_void_ll(j_calls->instance_ptr, 100, (int64_t)their_node_id_arr, msg_ref);
14158 }
14159 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
14160         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14161         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14162         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14163         LDKUpdateFulfillHTLC msg_var = *msg;
14164         int64_t msg_ref = 0;
14165         msg_var = UpdateFulfillHTLC_clone(&msg_var);
14166         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14167         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14168         js_invoke_function_void_ll(j_calls->instance_ptr, 101, (int64_t)their_node_id_arr, msg_ref);
14169 }
14170 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
14171         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14172         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14173         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14174         LDKUpdateFailHTLC msg_var = *msg;
14175         int64_t msg_ref = 0;
14176         msg_var = UpdateFailHTLC_clone(&msg_var);
14177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14178         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14179         js_invoke_function_void_ll(j_calls->instance_ptr, 102, (int64_t)their_node_id_arr, msg_ref);
14180 }
14181 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
14182         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14183         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14184         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14185         LDKUpdateFailMalformedHTLC msg_var = *msg;
14186         int64_t msg_ref = 0;
14187         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
14188         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14189         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14190         js_invoke_function_void_ll(j_calls->instance_ptr, 103, (int64_t)their_node_id_arr, msg_ref);
14191 }
14192 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
14193         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14194         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14195         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14196         LDKCommitmentSigned msg_var = *msg;
14197         int64_t msg_ref = 0;
14198         msg_var = CommitmentSigned_clone(&msg_var);
14199         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14200         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14201         js_invoke_function_void_ll(j_calls->instance_ptr, 104, (int64_t)their_node_id_arr, msg_ref);
14202 }
14203 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
14204         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14205         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14206         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14207         LDKRevokeAndACK msg_var = *msg;
14208         int64_t msg_ref = 0;
14209         msg_var = RevokeAndACK_clone(&msg_var);
14210         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14211         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14212         js_invoke_function_void_ll(j_calls->instance_ptr, 105, (int64_t)their_node_id_arr, msg_ref);
14213 }
14214 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
14215         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14216         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14217         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14218         LDKUpdateFee msg_var = *msg;
14219         int64_t msg_ref = 0;
14220         msg_var = UpdateFee_clone(&msg_var);
14221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14222         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14223         js_invoke_function_void_ll(j_calls->instance_ptr, 106, (int64_t)their_node_id_arr, msg_ref);
14224 }
14225 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
14226         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14227         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14228         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14229         LDKAnnouncementSignatures msg_var = *msg;
14230         int64_t msg_ref = 0;
14231         msg_var = AnnouncementSignatures_clone(&msg_var);
14232         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14233         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14234         js_invoke_function_void_ll(j_calls->instance_ptr, 107, (int64_t)their_node_id_arr, msg_ref);
14235 }
14236 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14237         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14238         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14239         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14240         js_invoke_function_void_l(j_calls->instance_ptr, 108, (int64_t)their_node_id_arr);
14241 }
14242 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
14243         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14244         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14245         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14246         LDKInit msg_var = *msg;
14247         int64_t msg_ref = 0;
14248         msg_var = Init_clone(&msg_var);
14249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14250         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14251         jboolean inbound_conv = inbound;
14252         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 109, (int64_t)their_node_id_arr, msg_ref, inbound_conv);
14253         void* ret_ptr = untag_ptr(ret);
14254         CHECK_ACCESS(ret_ptr);
14255         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
14256         FREE(untag_ptr(ret));
14257         return ret_conv;
14258 }
14259 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
14260         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14261         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14262         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14263         LDKChannelReestablish msg_var = *msg;
14264         int64_t msg_ref = 0;
14265         msg_var = ChannelReestablish_clone(&msg_var);
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14267         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14268         js_invoke_function_void_ll(j_calls->instance_ptr, 110, (int64_t)their_node_id_arr, msg_ref);
14269 }
14270 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
14271         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14272         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14273         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14274         LDKChannelUpdate msg_var = *msg;
14275         int64_t msg_ref = 0;
14276         msg_var = ChannelUpdate_clone(&msg_var);
14277         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14278         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14279         js_invoke_function_void_ll(j_calls->instance_ptr, 111, (int64_t)their_node_id_arr, msg_ref);
14280 }
14281 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
14282         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14283         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14284         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14285         LDKErrorMessage msg_var = *msg;
14286         int64_t msg_ref = 0;
14287         msg_var = ErrorMessage_clone(&msg_var);
14288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
14289         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
14290         js_invoke_function_void_ll(j_calls->instance_ptr, 112, (int64_t)their_node_id_arr, msg_ref);
14291 }
14292 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
14293         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14294         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 113);
14295         LDKNodeFeatures ret_conv;
14296         ret_conv.inner = untag_ptr(ret);
14297         ret_conv.is_owned = ptr_is_owned(ret);
14298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14299         return ret_conv;
14300 }
14301 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
14302         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14303         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
14304         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
14305         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 114, (int64_t)their_node_id_arr);
14306         LDKInitFeatures ret_conv;
14307         ret_conv.inner = untag_ptr(ret);
14308         ret_conv.is_owned = ptr_is_owned(ret);
14309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
14310         return ret_conv;
14311 }
14312 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
14313         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
14314         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 115);
14315         void* ret_ptr = untag_ptr(ret);
14316         CHECK_ACCESS(ret_ptr);
14317         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
14318         FREE(untag_ptr(ret));
14319         return ret_conv;
14320 }
14321 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
14322         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
14323         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14324         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
14325 }
14326 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
14327         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
14328         atomic_init(&calls->refcnt, 1);
14329         calls->instance_ptr = o;
14330
14331         LDKChannelMessageHandler ret = {
14332                 .this_arg = (void*) calls,
14333                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
14334                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
14335                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
14336                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
14337                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
14338                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
14339                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
14340                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
14341                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
14342                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
14343                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
14344                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
14345                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
14346                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
14347                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
14348                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
14349                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
14350                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
14351                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
14352                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
14353                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
14354                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
14355                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
14356                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
14357                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
14358                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
14359                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
14360                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
14361                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
14362                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
14363                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
14364                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
14365                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
14366                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
14367                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
14368                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
14369                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
14370                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
14371                 .free = LDKChannelMessageHandler_JCalls_free,
14372                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
14373         };
14374         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
14375         return ret;
14376 }
14377 uint64_t  CS_LDK_LDKChannelMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
14378         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
14379         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
14380         return tag_ptr(res_ptr, true);
14381 }
14382 void  CS_LDK_ChannelMessageHandler_handle_open_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14383         void* this_arg_ptr = untag_ptr(this_arg);
14384         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14385         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14386         LDKPublicKey their_node_id_ref;
14387         CHECK(their_node_id->arr_len == 33);
14388         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14389         LDKOpenChannel msg_conv;
14390         msg_conv.inner = untag_ptr(msg);
14391         msg_conv.is_owned = ptr_is_owned(msg);
14392         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14393         msg_conv.is_owned = false;
14394         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14395 }
14396
14397 void  CS_LDK_ChannelMessageHandler_handle_open_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14398         void* this_arg_ptr = untag_ptr(this_arg);
14399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14400         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14401         LDKPublicKey their_node_id_ref;
14402         CHECK(their_node_id->arr_len == 33);
14403         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14404         LDKOpenChannelV2 msg_conv;
14405         msg_conv.inner = untag_ptr(msg);
14406         msg_conv.is_owned = ptr_is_owned(msg);
14407         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14408         msg_conv.is_owned = false;
14409         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14410 }
14411
14412 void  CS_LDK_ChannelMessageHandler_handle_accept_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14413         void* this_arg_ptr = untag_ptr(this_arg);
14414         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14415         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14416         LDKPublicKey their_node_id_ref;
14417         CHECK(their_node_id->arr_len == 33);
14418         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14419         LDKAcceptChannel msg_conv;
14420         msg_conv.inner = untag_ptr(msg);
14421         msg_conv.is_owned = ptr_is_owned(msg);
14422         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14423         msg_conv.is_owned = false;
14424         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14425 }
14426
14427 void  CS_LDK_ChannelMessageHandler_handle_accept_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14428         void* this_arg_ptr = untag_ptr(this_arg);
14429         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14430         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14431         LDKPublicKey their_node_id_ref;
14432         CHECK(their_node_id->arr_len == 33);
14433         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14434         LDKAcceptChannelV2 msg_conv;
14435         msg_conv.inner = untag_ptr(msg);
14436         msg_conv.is_owned = ptr_is_owned(msg);
14437         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14438         msg_conv.is_owned = false;
14439         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14440 }
14441
14442 void  CS_LDK_ChannelMessageHandler_handle_funding_created(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14443         void* this_arg_ptr = untag_ptr(this_arg);
14444         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14445         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14446         LDKPublicKey their_node_id_ref;
14447         CHECK(their_node_id->arr_len == 33);
14448         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14449         LDKFundingCreated msg_conv;
14450         msg_conv.inner = untag_ptr(msg);
14451         msg_conv.is_owned = ptr_is_owned(msg);
14452         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14453         msg_conv.is_owned = false;
14454         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14455 }
14456
14457 void  CS_LDK_ChannelMessageHandler_handle_funding_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14458         void* this_arg_ptr = untag_ptr(this_arg);
14459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14460         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14461         LDKPublicKey their_node_id_ref;
14462         CHECK(their_node_id->arr_len == 33);
14463         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14464         LDKFundingSigned msg_conv;
14465         msg_conv.inner = untag_ptr(msg);
14466         msg_conv.is_owned = ptr_is_owned(msg);
14467         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14468         msg_conv.is_owned = false;
14469         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14470 }
14471
14472 void  CS_LDK_ChannelMessageHandler_handle_channel_ready(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14473         void* this_arg_ptr = untag_ptr(this_arg);
14474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14475         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14476         LDKPublicKey their_node_id_ref;
14477         CHECK(their_node_id->arr_len == 33);
14478         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14479         LDKChannelReady msg_conv;
14480         msg_conv.inner = untag_ptr(msg);
14481         msg_conv.is_owned = ptr_is_owned(msg);
14482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14483         msg_conv.is_owned = false;
14484         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14485 }
14486
14487 void  CS_LDK_ChannelMessageHandler_handle_shutdown(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14488         void* this_arg_ptr = untag_ptr(this_arg);
14489         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14490         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14491         LDKPublicKey their_node_id_ref;
14492         CHECK(their_node_id->arr_len == 33);
14493         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14494         LDKShutdown msg_conv;
14495         msg_conv.inner = untag_ptr(msg);
14496         msg_conv.is_owned = ptr_is_owned(msg);
14497         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14498         msg_conv.is_owned = false;
14499         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14500 }
14501
14502 void  CS_LDK_ChannelMessageHandler_handle_closing_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14503         void* this_arg_ptr = untag_ptr(this_arg);
14504         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14505         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14506         LDKPublicKey their_node_id_ref;
14507         CHECK(their_node_id->arr_len == 33);
14508         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14509         LDKClosingSigned msg_conv;
14510         msg_conv.inner = untag_ptr(msg);
14511         msg_conv.is_owned = ptr_is_owned(msg);
14512         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14513         msg_conv.is_owned = false;
14514         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14515 }
14516
14517 void  CS_LDK_ChannelMessageHandler_handle_stfu(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14518         void* this_arg_ptr = untag_ptr(this_arg);
14519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14520         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14521         LDKPublicKey their_node_id_ref;
14522         CHECK(their_node_id->arr_len == 33);
14523         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14524         LDKStfu msg_conv;
14525         msg_conv.inner = untag_ptr(msg);
14526         msg_conv.is_owned = ptr_is_owned(msg);
14527         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14528         msg_conv.is_owned = false;
14529         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14530 }
14531
14532 void  CS_LDK_ChannelMessageHandler_handle_splice(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14533         void* this_arg_ptr = untag_ptr(this_arg);
14534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14535         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14536         LDKPublicKey their_node_id_ref;
14537         CHECK(their_node_id->arr_len == 33);
14538         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14539         LDKSplice msg_conv;
14540         msg_conv.inner = untag_ptr(msg);
14541         msg_conv.is_owned = ptr_is_owned(msg);
14542         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14543         msg_conv.is_owned = false;
14544         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14545 }
14546
14547 void  CS_LDK_ChannelMessageHandler_handle_splice_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14548         void* this_arg_ptr = untag_ptr(this_arg);
14549         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14550         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14551         LDKPublicKey their_node_id_ref;
14552         CHECK(their_node_id->arr_len == 33);
14553         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14554         LDKSpliceAck msg_conv;
14555         msg_conv.inner = untag_ptr(msg);
14556         msg_conv.is_owned = ptr_is_owned(msg);
14557         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14558         msg_conv.is_owned = false;
14559         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14560 }
14561
14562 void  CS_LDK_ChannelMessageHandler_handle_splice_locked(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14563         void* this_arg_ptr = untag_ptr(this_arg);
14564         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14565         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14566         LDKPublicKey their_node_id_ref;
14567         CHECK(their_node_id->arr_len == 33);
14568         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14569         LDKSpliceLocked msg_conv;
14570         msg_conv.inner = untag_ptr(msg);
14571         msg_conv.is_owned = ptr_is_owned(msg);
14572         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14573         msg_conv.is_owned = false;
14574         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14575 }
14576
14577 void  CS_LDK_ChannelMessageHandler_handle_tx_add_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14578         void* this_arg_ptr = untag_ptr(this_arg);
14579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14580         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14581         LDKPublicKey their_node_id_ref;
14582         CHECK(their_node_id->arr_len == 33);
14583         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14584         LDKTxAddInput msg_conv;
14585         msg_conv.inner = untag_ptr(msg);
14586         msg_conv.is_owned = ptr_is_owned(msg);
14587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14588         msg_conv.is_owned = false;
14589         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14590 }
14591
14592 void  CS_LDK_ChannelMessageHandler_handle_tx_add_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14593         void* this_arg_ptr = untag_ptr(this_arg);
14594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14595         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14596         LDKPublicKey their_node_id_ref;
14597         CHECK(their_node_id->arr_len == 33);
14598         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14599         LDKTxAddOutput msg_conv;
14600         msg_conv.inner = untag_ptr(msg);
14601         msg_conv.is_owned = ptr_is_owned(msg);
14602         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14603         msg_conv.is_owned = false;
14604         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14605 }
14606
14607 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14608         void* this_arg_ptr = untag_ptr(this_arg);
14609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14610         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14611         LDKPublicKey their_node_id_ref;
14612         CHECK(their_node_id->arr_len == 33);
14613         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14614         LDKTxRemoveInput msg_conv;
14615         msg_conv.inner = untag_ptr(msg);
14616         msg_conv.is_owned = ptr_is_owned(msg);
14617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14618         msg_conv.is_owned = false;
14619         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14620 }
14621
14622 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14623         void* this_arg_ptr = untag_ptr(this_arg);
14624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14625         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14626         LDKPublicKey their_node_id_ref;
14627         CHECK(their_node_id->arr_len == 33);
14628         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14629         LDKTxRemoveOutput msg_conv;
14630         msg_conv.inner = untag_ptr(msg);
14631         msg_conv.is_owned = ptr_is_owned(msg);
14632         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14633         msg_conv.is_owned = false;
14634         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14635 }
14636
14637 void  CS_LDK_ChannelMessageHandler_handle_tx_complete(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14638         void* this_arg_ptr = untag_ptr(this_arg);
14639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14640         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14641         LDKPublicKey their_node_id_ref;
14642         CHECK(their_node_id->arr_len == 33);
14643         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14644         LDKTxComplete msg_conv;
14645         msg_conv.inner = untag_ptr(msg);
14646         msg_conv.is_owned = ptr_is_owned(msg);
14647         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14648         msg_conv.is_owned = false;
14649         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14650 }
14651
14652 void  CS_LDK_ChannelMessageHandler_handle_tx_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14653         void* this_arg_ptr = untag_ptr(this_arg);
14654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14655         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14656         LDKPublicKey their_node_id_ref;
14657         CHECK(their_node_id->arr_len == 33);
14658         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14659         LDKTxSignatures msg_conv;
14660         msg_conv.inner = untag_ptr(msg);
14661         msg_conv.is_owned = ptr_is_owned(msg);
14662         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14663         msg_conv.is_owned = false;
14664         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14665 }
14666
14667 void  CS_LDK_ChannelMessageHandler_handle_tx_init_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14668         void* this_arg_ptr = untag_ptr(this_arg);
14669         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14670         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14671         LDKPublicKey their_node_id_ref;
14672         CHECK(their_node_id->arr_len == 33);
14673         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14674         LDKTxInitRbf msg_conv;
14675         msg_conv.inner = untag_ptr(msg);
14676         msg_conv.is_owned = ptr_is_owned(msg);
14677         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14678         msg_conv.is_owned = false;
14679         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14680 }
14681
14682 void  CS_LDK_ChannelMessageHandler_handle_tx_ack_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14683         void* this_arg_ptr = untag_ptr(this_arg);
14684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14685         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14686         LDKPublicKey their_node_id_ref;
14687         CHECK(their_node_id->arr_len == 33);
14688         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14689         LDKTxAckRbf msg_conv;
14690         msg_conv.inner = untag_ptr(msg);
14691         msg_conv.is_owned = ptr_is_owned(msg);
14692         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14693         msg_conv.is_owned = false;
14694         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14695 }
14696
14697 void  CS_LDK_ChannelMessageHandler_handle_tx_abort(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14698         void* this_arg_ptr = untag_ptr(this_arg);
14699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14700         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14701         LDKPublicKey their_node_id_ref;
14702         CHECK(their_node_id->arr_len == 33);
14703         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14704         LDKTxAbort msg_conv;
14705         msg_conv.inner = untag_ptr(msg);
14706         msg_conv.is_owned = ptr_is_owned(msg);
14707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14708         msg_conv.is_owned = false;
14709         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14710 }
14711
14712 void  CS_LDK_ChannelMessageHandler_handle_update_add_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14713         void* this_arg_ptr = untag_ptr(this_arg);
14714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14715         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14716         LDKPublicKey their_node_id_ref;
14717         CHECK(their_node_id->arr_len == 33);
14718         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14719         LDKUpdateAddHTLC msg_conv;
14720         msg_conv.inner = untag_ptr(msg);
14721         msg_conv.is_owned = ptr_is_owned(msg);
14722         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14723         msg_conv.is_owned = false;
14724         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14725 }
14726
14727 void  CS_LDK_ChannelMessageHandler_handle_update_fulfill_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14728         void* this_arg_ptr = untag_ptr(this_arg);
14729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14730         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14731         LDKPublicKey their_node_id_ref;
14732         CHECK(their_node_id->arr_len == 33);
14733         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14734         LDKUpdateFulfillHTLC msg_conv;
14735         msg_conv.inner = untag_ptr(msg);
14736         msg_conv.is_owned = ptr_is_owned(msg);
14737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14738         msg_conv.is_owned = false;
14739         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14740 }
14741
14742 void  CS_LDK_ChannelMessageHandler_handle_update_fail_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14743         void* this_arg_ptr = untag_ptr(this_arg);
14744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14745         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14746         LDKPublicKey their_node_id_ref;
14747         CHECK(their_node_id->arr_len == 33);
14748         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14749         LDKUpdateFailHTLC msg_conv;
14750         msg_conv.inner = untag_ptr(msg);
14751         msg_conv.is_owned = ptr_is_owned(msg);
14752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14753         msg_conv.is_owned = false;
14754         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14755 }
14756
14757 void  CS_LDK_ChannelMessageHandler_handle_update_fail_malformed_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14758         void* this_arg_ptr = untag_ptr(this_arg);
14759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14760         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14761         LDKPublicKey their_node_id_ref;
14762         CHECK(their_node_id->arr_len == 33);
14763         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14764         LDKUpdateFailMalformedHTLC msg_conv;
14765         msg_conv.inner = untag_ptr(msg);
14766         msg_conv.is_owned = ptr_is_owned(msg);
14767         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14768         msg_conv.is_owned = false;
14769         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14770 }
14771
14772 void  CS_LDK_ChannelMessageHandler_handle_commitment_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14773         void* this_arg_ptr = untag_ptr(this_arg);
14774         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14775         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14776         LDKPublicKey their_node_id_ref;
14777         CHECK(their_node_id->arr_len == 33);
14778         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14779         LDKCommitmentSigned msg_conv;
14780         msg_conv.inner = untag_ptr(msg);
14781         msg_conv.is_owned = ptr_is_owned(msg);
14782         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14783         msg_conv.is_owned = false;
14784         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14785 }
14786
14787 void  CS_LDK_ChannelMessageHandler_handle_revoke_and_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14788         void* this_arg_ptr = untag_ptr(this_arg);
14789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14790         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14791         LDKPublicKey their_node_id_ref;
14792         CHECK(their_node_id->arr_len == 33);
14793         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14794         LDKRevokeAndACK msg_conv;
14795         msg_conv.inner = untag_ptr(msg);
14796         msg_conv.is_owned = ptr_is_owned(msg);
14797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14798         msg_conv.is_owned = false;
14799         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14800 }
14801
14802 void  CS_LDK_ChannelMessageHandler_handle_update_fee(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14803         void* this_arg_ptr = untag_ptr(this_arg);
14804         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14805         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14806         LDKPublicKey their_node_id_ref;
14807         CHECK(their_node_id->arr_len == 33);
14808         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14809         LDKUpdateFee msg_conv;
14810         msg_conv.inner = untag_ptr(msg);
14811         msg_conv.is_owned = ptr_is_owned(msg);
14812         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14813         msg_conv.is_owned = false;
14814         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14815 }
14816
14817 void  CS_LDK_ChannelMessageHandler_handle_announcement_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14818         void* this_arg_ptr = untag_ptr(this_arg);
14819         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14820         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14821         LDKPublicKey their_node_id_ref;
14822         CHECK(their_node_id->arr_len == 33);
14823         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14824         LDKAnnouncementSignatures msg_conv;
14825         msg_conv.inner = untag_ptr(msg);
14826         msg_conv.is_owned = ptr_is_owned(msg);
14827         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14828         msg_conv.is_owned = false;
14829         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14830 }
14831
14832 void  CS_LDK_ChannelMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
14833         void* this_arg_ptr = untag_ptr(this_arg);
14834         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14835         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14836         LDKPublicKey their_node_id_ref;
14837         CHECK(their_node_id->arr_len == 33);
14838         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14839         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
14840 }
14841
14842 int64_t  CS_LDK_ChannelMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) {
14843         void* this_arg_ptr = untag_ptr(this_arg);
14844         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14845         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14846         LDKPublicKey their_node_id_ref;
14847         CHECK(their_node_id->arr_len == 33);
14848         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14849         LDKInit msg_conv;
14850         msg_conv.inner = untag_ptr(msg);
14851         msg_conv.is_owned = ptr_is_owned(msg);
14852         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14853         msg_conv.is_owned = false;
14854         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14855         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
14856         return tag_ptr(ret_conv, true);
14857 }
14858
14859 void  CS_LDK_ChannelMessageHandler_handle_channel_reestablish(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14860         void* this_arg_ptr = untag_ptr(this_arg);
14861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14862         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14863         LDKPublicKey their_node_id_ref;
14864         CHECK(their_node_id->arr_len == 33);
14865         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14866         LDKChannelReestablish msg_conv;
14867         msg_conv.inner = untag_ptr(msg);
14868         msg_conv.is_owned = ptr_is_owned(msg);
14869         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14870         msg_conv.is_owned = false;
14871         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14872 }
14873
14874 void  CS_LDK_ChannelMessageHandler_handle_channel_update(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14875         void* this_arg_ptr = untag_ptr(this_arg);
14876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14877         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14878         LDKPublicKey their_node_id_ref;
14879         CHECK(their_node_id->arr_len == 33);
14880         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14881         LDKChannelUpdate msg_conv;
14882         msg_conv.inner = untag_ptr(msg);
14883         msg_conv.is_owned = ptr_is_owned(msg);
14884         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14885         msg_conv.is_owned = false;
14886         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14887 }
14888
14889 void  CS_LDK_ChannelMessageHandler_handle_error(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
14890         void* this_arg_ptr = untag_ptr(this_arg);
14891         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14892         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14893         LDKPublicKey their_node_id_ref;
14894         CHECK(their_node_id->arr_len == 33);
14895         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14896         LDKErrorMessage msg_conv;
14897         msg_conv.inner = untag_ptr(msg);
14898         msg_conv.is_owned = ptr_is_owned(msg);
14899         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
14900         msg_conv.is_owned = false;
14901         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
14902 }
14903
14904 int64_t  CS_LDK_ChannelMessageHandler_provided_node_features(int64_t this_arg) {
14905         void* this_arg_ptr = untag_ptr(this_arg);
14906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14907         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14908         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
14909         int64_t ret_ref = 0;
14910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14912         return ret_ref;
14913 }
14914
14915 int64_t  CS_LDK_ChannelMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
14916         void* this_arg_ptr = untag_ptr(this_arg);
14917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14918         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14919         LDKPublicKey their_node_id_ref;
14920         CHECK(their_node_id->arr_len == 33);
14921         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
14922         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
14923         int64_t ret_ref = 0;
14924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14926         return ret_ref;
14927 }
14928
14929 int64_t  CS_LDK_ChannelMessageHandler_get_chain_hashes(int64_t this_arg) {
14930         void* this_arg_ptr = untag_ptr(this_arg);
14931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14932         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
14933         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
14934         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
14935         int64_t ret_ref = tag_ptr(ret_copy, true);
14936         return ret_ref;
14937 }
14938
14939 typedef struct LDKOffersMessageHandler_JCalls {
14940         atomic_size_t refcnt;
14941         uint32_t instance_ptr;
14942 } LDKOffersMessageHandler_JCalls;
14943 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
14944         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14945         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14946                 FREE(j_calls);
14947         }
14948 }
14949 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
14950         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14951         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
14952         *message_copy = message;
14953         int64_t message_ref = tag_ptr(message_copy, true);
14954         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 116, message_ref);
14955         void* ret_ptr = untag_ptr(ret);
14956         CHECK_ACCESS(ret_ptr);
14957         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
14958         FREE(untag_ptr(ret));
14959         return ret_conv;
14960 }
14961 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
14962         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
14963         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 117);
14964         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
14965         ret_constr.datalen = ret->arr_len;
14966         if (ret_constr.datalen > 0)
14967                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
14968         else
14969                 ret_constr.data = NULL;
14970         int64_t* ret_vals = ret->elems;
14971         for (size_t x = 0; x < ret_constr.datalen; x++) {
14972                 int64_t ret_conv_49 = ret_vals[x];
14973                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
14974                 CHECK_ACCESS(ret_conv_49_ptr);
14975                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
14976                 FREE(untag_ptr(ret_conv_49));
14977                 ret_constr.data[x] = ret_conv_49_conv;
14978         }
14979         FREE(ret);
14980         return ret_constr;
14981 }
14982 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
14983         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
14984         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14985 }
14986 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (int64_t o) {
14987         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
14988         atomic_init(&calls->refcnt, 1);
14989         calls->instance_ptr = o;
14990
14991         LDKOffersMessageHandler ret = {
14992                 .this_arg = (void*) calls,
14993                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
14994                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
14995                 .free = LDKOffersMessageHandler_JCalls_free,
14996         };
14997         return ret;
14998 }
14999 uint64_t  CS_LDK_LDKOffersMessageHandler_new(int32_t o) {
15000         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
15001         *res_ptr = LDKOffersMessageHandler_init(o);
15002         return tag_ptr(res_ptr, true);
15003 }
15004 int64_t  CS_LDK_OffersMessageHandler_handle_message(int64_t this_arg, int64_t message) {
15005         void* this_arg_ptr = untag_ptr(this_arg);
15006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15007         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
15008         void* message_ptr = untag_ptr(message);
15009         CHECK_ACCESS(message_ptr);
15010         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
15011         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
15012         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
15013         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
15014         int64_t ret_ref = tag_ptr(ret_copy, true);
15015         return ret_ref;
15016 }
15017
15018 int64_tArray  CS_LDK_OffersMessageHandler_release_pending_messages(int64_t this_arg) {
15019         void* this_arg_ptr = untag_ptr(this_arg);
15020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15021         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
15022         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
15023         int64_tArray ret_arr = NULL;
15024         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15025         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15026         for (size_t x = 0; x < ret_var.datalen; x++) {
15027                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
15028                 *ret_conv_49_conv = ret_var.data[x];
15029                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
15030         }
15031         
15032         FREE(ret_var.data);
15033         return ret_arr;
15034 }
15035
15036 typedef struct LDKRoutingMessageHandler_JCalls {
15037         atomic_size_t refcnt;
15038         uint32_t instance_ptr;
15039         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15040 } LDKRoutingMessageHandler_JCalls;
15041 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
15042         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15043         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15044                 FREE(j_calls);
15045         }
15046 }
15047 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
15048         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15049         LDKNodeAnnouncement msg_var = *msg;
15050         int64_t msg_ref = 0;
15051         msg_var = NodeAnnouncement_clone(&msg_var);
15052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15053         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15054         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 118, msg_ref);
15055         void* ret_ptr = untag_ptr(ret);
15056         CHECK_ACCESS(ret_ptr);
15057         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15058         FREE(untag_ptr(ret));
15059         return ret_conv;
15060 }
15061 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
15062         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15063         LDKChannelAnnouncement msg_var = *msg;
15064         int64_t msg_ref = 0;
15065         msg_var = ChannelAnnouncement_clone(&msg_var);
15066         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15067         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15068         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 119, msg_ref);
15069         void* ret_ptr = untag_ptr(ret);
15070         CHECK_ACCESS(ret_ptr);
15071         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15072         FREE(untag_ptr(ret));
15073         return ret_conv;
15074 }
15075 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
15076         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15077         LDKChannelUpdate msg_var = *msg;
15078         int64_t msg_ref = 0;
15079         msg_var = ChannelUpdate_clone(&msg_var);
15080         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15081         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15082         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 120, msg_ref);
15083         void* ret_ptr = untag_ptr(ret);
15084         CHECK_ACCESS(ret_ptr);
15085         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
15086         FREE(untag_ptr(ret));
15087         return ret_conv;
15088 }
15089 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
15090         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15091         int64_t starting_point_conv = starting_point;
15092         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 121, starting_point_conv);
15093         void* ret_ptr = untag_ptr(ret);
15094         CHECK_ACCESS(ret_ptr);
15095         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
15096         FREE(untag_ptr(ret));
15097         return ret_conv;
15098 }
15099 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
15100         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15101         LDKNodeId starting_point_var = starting_point;
15102         int64_t starting_point_ref = 0;
15103         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
15104         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
15105         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 122, starting_point_ref);
15106         LDKNodeAnnouncement ret_conv;
15107         ret_conv.inner = untag_ptr(ret);
15108         ret_conv.is_owned = ptr_is_owned(ret);
15109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15110         return ret_conv;
15111 }
15112 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15113         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15114         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15115         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15116         LDKInit init_var = *init;
15117         int64_t init_ref = 0;
15118         init_var = Init_clone(&init_var);
15119         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15120         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15121         jboolean inbound_conv = inbound;
15122         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 123, (int64_t)their_node_id_arr, init_ref, inbound_conv);
15123         void* ret_ptr = untag_ptr(ret);
15124         CHECK_ACCESS(ret_ptr);
15125         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15126         FREE(untag_ptr(ret));
15127         return ret_conv;
15128 }
15129 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
15130         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15131         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15132         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15133         LDKReplyChannelRange msg_var = msg;
15134         int64_t msg_ref = 0;
15135         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15136         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15137         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 124, (int64_t)their_node_id_arr, msg_ref);
15138         void* ret_ptr = untag_ptr(ret);
15139         CHECK_ACCESS(ret_ptr);
15140         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15141         FREE(untag_ptr(ret));
15142         return ret_conv;
15143 }
15144 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
15145         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15146         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15147         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15148         LDKReplyShortChannelIdsEnd msg_var = msg;
15149         int64_t msg_ref = 0;
15150         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15151         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15152         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 125, (int64_t)their_node_id_arr, msg_ref);
15153         void* ret_ptr = untag_ptr(ret);
15154         CHECK_ACCESS(ret_ptr);
15155         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15156         FREE(untag_ptr(ret));
15157         return ret_conv;
15158 }
15159 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
15160         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15161         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15162         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15163         LDKQueryChannelRange msg_var = msg;
15164         int64_t msg_ref = 0;
15165         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15166         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15167         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 126, (int64_t)their_node_id_arr, msg_ref);
15168         void* ret_ptr = untag_ptr(ret);
15169         CHECK_ACCESS(ret_ptr);
15170         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15171         FREE(untag_ptr(ret));
15172         return ret_conv;
15173 }
15174 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
15175         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15176         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15177         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15178         LDKQueryShortChannelIds msg_var = msg;
15179         int64_t msg_ref = 0;
15180         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15181         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15182         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 127, (int64_t)their_node_id_arr, msg_ref);
15183         void* ret_ptr = untag_ptr(ret);
15184         CHECK_ACCESS(ret_ptr);
15185         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15186         FREE(untag_ptr(ret));
15187         return ret_conv;
15188 }
15189 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
15190         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15191         return js_invoke_function_b_(j_calls->instance_ptr, 128);
15192 }
15193 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
15194         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15195         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 129);
15196         LDKNodeFeatures ret_conv;
15197         ret_conv.inner = untag_ptr(ret);
15198         ret_conv.is_owned = ptr_is_owned(ret);
15199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15200         return ret_conv;
15201 }
15202 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15203         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
15204         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15205         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15206         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 130, (int64_t)their_node_id_arr);
15207         LDKInitFeatures ret_conv;
15208         ret_conv.inner = untag_ptr(ret);
15209         ret_conv.is_owned = ptr_is_owned(ret);
15210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15211         return ret_conv;
15212 }
15213 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
15214         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
15215         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15216         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15217 }
15218 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
15219         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
15220         atomic_init(&calls->refcnt, 1);
15221         calls->instance_ptr = o;
15222
15223         LDKRoutingMessageHandler ret = {
15224                 .this_arg = (void*) calls,
15225                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
15226                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
15227                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
15228                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
15229                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
15230                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
15231                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
15232                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
15233                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
15234                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
15235                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
15236                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
15237                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
15238                 .free = LDKRoutingMessageHandler_JCalls_free,
15239                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15240         };
15241         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15242         return ret;
15243 }
15244 uint64_t  CS_LDK_LDKRoutingMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
15245         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
15246         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
15247         return tag_ptr(res_ptr, true);
15248 }
15249 int64_t  CS_LDK_RoutingMessageHandler_handle_node_announcement(int64_t this_arg, int64_t msg) {
15250         void* this_arg_ptr = untag_ptr(this_arg);
15251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15252         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15253         LDKNodeAnnouncement msg_conv;
15254         msg_conv.inner = untag_ptr(msg);
15255         msg_conv.is_owned = ptr_is_owned(msg);
15256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15257         msg_conv.is_owned = false;
15258         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15259         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
15260         return tag_ptr(ret_conv, true);
15261 }
15262
15263 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_announcement(int64_t this_arg, int64_t msg) {
15264         void* this_arg_ptr = untag_ptr(this_arg);
15265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15266         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15267         LDKChannelAnnouncement msg_conv;
15268         msg_conv.inner = untag_ptr(msg);
15269         msg_conv.is_owned = ptr_is_owned(msg);
15270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15271         msg_conv.is_owned = false;
15272         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15273         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
15274         return tag_ptr(ret_conv, true);
15275 }
15276
15277 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_update(int64_t this_arg, int64_t msg) {
15278         void* this_arg_ptr = untag_ptr(this_arg);
15279         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15280         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15281         LDKChannelUpdate msg_conv;
15282         msg_conv.inner = untag_ptr(msg);
15283         msg_conv.is_owned = ptr_is_owned(msg);
15284         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15285         msg_conv.is_owned = false;
15286         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
15287         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
15288         return tag_ptr(ret_conv, true);
15289 }
15290
15291 int64_t  CS_LDK_RoutingMessageHandler_get_next_channel_announcement(int64_t this_arg, int64_t starting_point) {
15292         void* this_arg_ptr = untag_ptr(this_arg);
15293         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15294         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15295         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
15296         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
15297         int64_t ret_ref = tag_ptr(ret_copy, true);
15298         return ret_ref;
15299 }
15300
15301 int64_t  CS_LDK_RoutingMessageHandler_get_next_node_announcement(int64_t this_arg, int64_t starting_point) {
15302         void* this_arg_ptr = untag_ptr(this_arg);
15303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15304         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15305         LDKNodeId starting_point_conv;
15306         starting_point_conv.inner = untag_ptr(starting_point);
15307         starting_point_conv.is_owned = ptr_is_owned(starting_point);
15308         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
15309         starting_point_conv = NodeId_clone(&starting_point_conv);
15310         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
15311         int64_t ret_ref = 0;
15312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15314         return ret_ref;
15315 }
15316
15317 int64_t  CS_LDK_RoutingMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
15318         void* this_arg_ptr = untag_ptr(this_arg);
15319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15320         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15321         LDKPublicKey their_node_id_ref;
15322         CHECK(their_node_id->arr_len == 33);
15323         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15324         LDKInit init_conv;
15325         init_conv.inner = untag_ptr(init);
15326         init_conv.is_owned = ptr_is_owned(init);
15327         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15328         init_conv.is_owned = false;
15329         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15330         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15335         void* this_arg_ptr = untag_ptr(this_arg);
15336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15337         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15338         LDKPublicKey their_node_id_ref;
15339         CHECK(their_node_id->arr_len == 33);
15340         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15341         LDKReplyChannelRange msg_conv;
15342         msg_conv.inner = untag_ptr(msg);
15343         msg_conv.is_owned = ptr_is_owned(msg);
15344         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15345         msg_conv = ReplyChannelRange_clone(&msg_conv);
15346         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15347         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15348         return tag_ptr(ret_conv, true);
15349 }
15350
15351 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_short_channel_ids_end(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15352         void* this_arg_ptr = untag_ptr(this_arg);
15353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15354         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15355         LDKPublicKey their_node_id_ref;
15356         CHECK(their_node_id->arr_len == 33);
15357         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15358         LDKReplyShortChannelIdsEnd msg_conv;
15359         msg_conv.inner = untag_ptr(msg);
15360         msg_conv.is_owned = ptr_is_owned(msg);
15361         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15362         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
15363         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15364         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15365         return tag_ptr(ret_conv, true);
15366 }
15367
15368 int64_t  CS_LDK_RoutingMessageHandler_handle_query_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15369         void* this_arg_ptr = untag_ptr(this_arg);
15370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15371         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15372         LDKPublicKey their_node_id_ref;
15373         CHECK(their_node_id->arr_len == 33);
15374         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15375         LDKQueryChannelRange msg_conv;
15376         msg_conv.inner = untag_ptr(msg);
15377         msg_conv.is_owned = ptr_is_owned(msg);
15378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15379         msg_conv = QueryChannelRange_clone(&msg_conv);
15380         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15381         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15382         return tag_ptr(ret_conv, true);
15383 }
15384
15385 int64_t  CS_LDK_RoutingMessageHandler_handle_query_short_channel_ids(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15386         void* this_arg_ptr = untag_ptr(this_arg);
15387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15388         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15389         LDKPublicKey their_node_id_ref;
15390         CHECK(their_node_id->arr_len == 33);
15391         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15392         LDKQueryShortChannelIds msg_conv;
15393         msg_conv.inner = untag_ptr(msg);
15394         msg_conv.is_owned = ptr_is_owned(msg);
15395         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15396         msg_conv = QueryShortChannelIds_clone(&msg_conv);
15397         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15398         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
15399         return tag_ptr(ret_conv, true);
15400 }
15401
15402 jboolean  CS_LDK_RoutingMessageHandler_processing_queue_high(int64_t this_arg) {
15403         void* this_arg_ptr = untag_ptr(this_arg);
15404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15405         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15406         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
15407         return ret_conv;
15408 }
15409
15410 int64_t  CS_LDK_RoutingMessageHandler_provided_node_features(int64_t this_arg) {
15411         void* this_arg_ptr = untag_ptr(this_arg);
15412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15413         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15414         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15415         int64_t ret_ref = 0;
15416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15418         return ret_ref;
15419 }
15420
15421 int64_t  CS_LDK_RoutingMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15422         void* this_arg_ptr = untag_ptr(this_arg);
15423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15424         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
15425         LDKPublicKey their_node_id_ref;
15426         CHECK(their_node_id->arr_len == 33);
15427         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15428         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15429         int64_t ret_ref = 0;
15430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15432         return ret_ref;
15433 }
15434
15435 typedef struct LDKOnionMessageHandler_JCalls {
15436         atomic_size_t refcnt;
15437         uint32_t instance_ptr;
15438 } LDKOnionMessageHandler_JCalls;
15439 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
15440         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15441         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15442                 FREE(j_calls);
15443         }
15444 }
15445 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
15446         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15447         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 131);
15448         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
15449         ret_constr.datalen = ret->arr_len;
15450         if (ret_constr.datalen > 0)
15451                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
15452         else
15453                 ret_constr.data = NULL;
15454         int64_t* ret_vals = ret->elems;
15455         for (size_t o = 0; o < ret_constr.datalen; o++) {
15456                 int64_t ret_conv_40 = ret_vals[o];
15457                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
15458                 CHECK_ACCESS(ret_conv_40_ptr);
15459                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
15460                 FREE(untag_ptr(ret_conv_40));
15461                 ret_constr.data[o] = ret_conv_40_conv;
15462         }
15463         FREE(ret);
15464         return ret_constr;
15465 }
15466 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
15467         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15468         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15469         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15470         LDKOnionMessage msg_var = *msg;
15471         int64_t msg_ref = 0;
15472         msg_var = OnionMessage_clone(&msg_var);
15473         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15474         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15475         js_invoke_function_void_ll(j_calls->instance_ptr, 132, (int64_t)peer_node_id_arr, msg_ref);
15476 }
15477 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
15478         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15479         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
15480         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
15481         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 133, (int64_t)peer_node_id_arr);
15482         LDKOnionMessage ret_conv;
15483         ret_conv.inner = untag_ptr(ret);
15484         ret_conv.is_owned = ptr_is_owned(ret);
15485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15486         return ret_conv;
15487 }
15488 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
15489         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15490         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15491         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15492         LDKInit init_var = *init;
15493         int64_t init_ref = 0;
15494         init_var = Init_clone(&init_var);
15495         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
15496         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
15497         jboolean inbound_conv = inbound;
15498         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 134, (int64_t)their_node_id_arr, init_ref, inbound_conv);
15499         void* ret_ptr = untag_ptr(ret);
15500         CHECK_ACCESS(ret_ptr);
15501         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15502         FREE(untag_ptr(ret));
15503         return ret_conv;
15504 }
15505 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15506         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15507         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15508         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15509         js_invoke_function_void_l(j_calls->instance_ptr, 135, (int64_t)their_node_id_arr);
15510 }
15511 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
15512         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15513         js_invoke_function_void_(j_calls->instance_ptr, 136);
15514 }
15515 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
15516         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15517         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 137);
15518         LDKNodeFeatures ret_conv;
15519         ret_conv.inner = untag_ptr(ret);
15520         ret_conv.is_owned = ptr_is_owned(ret);
15521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15522         return ret_conv;
15523 }
15524 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15525         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
15526         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15527         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15528         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 138, (int64_t)their_node_id_arr);
15529         LDKInitFeatures ret_conv;
15530         ret_conv.inner = untag_ptr(ret);
15531         ret_conv.is_owned = ptr_is_owned(ret);
15532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15533         return ret_conv;
15534 }
15535 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
15536         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
15537         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15538 }
15539 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (int64_t o) {
15540         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
15541         atomic_init(&calls->refcnt, 1);
15542         calls->instance_ptr = o;
15543
15544         LDKOnionMessageHandler ret = {
15545                 .this_arg = (void*) calls,
15546                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
15547                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
15548                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
15549                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
15550                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
15551                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
15552                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
15553                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
15554                 .free = LDKOnionMessageHandler_JCalls_free,
15555         };
15556         return ret;
15557 }
15558 uint64_t  CS_LDK_LDKOnionMessageHandler_new(int32_t o) {
15559         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
15560         *res_ptr = LDKOnionMessageHandler_init(o);
15561         return tag_ptr(res_ptr, true);
15562 }
15563 int64_tArray  CS_LDK_OnionMessageHandler_get_and_clear_connections_needed(int64_t this_arg) {
15564         void* this_arg_ptr = untag_ptr(this_arg);
15565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15566         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15567         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
15568         int64_tArray ret_arr = NULL;
15569         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15570         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15571         for (size_t o = 0; o < ret_var.datalen; o++) {
15572                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
15573                 *ret_conv_40_conv = ret_var.data[o];
15574                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
15575         }
15576         
15577         FREE(ret_var.data);
15578         return ret_arr;
15579 }
15580
15581 void  CS_LDK_OnionMessageHandler_handle_onion_message(int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
15582         void* this_arg_ptr = untag_ptr(this_arg);
15583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15584         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15585         LDKPublicKey peer_node_id_ref;
15586         CHECK(peer_node_id->arr_len == 33);
15587         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15588         LDKOnionMessage msg_conv;
15589         msg_conv.inner = untag_ptr(msg);
15590         msg_conv.is_owned = ptr_is_owned(msg);
15591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15592         msg_conv.is_owned = false;
15593         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
15594 }
15595
15596 int64_t  CS_LDK_OnionMessageHandler_next_onion_message_for_peer(int64_t this_arg, int8_tArray peer_node_id) {
15597         void* this_arg_ptr = untag_ptr(this_arg);
15598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15599         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15600         LDKPublicKey peer_node_id_ref;
15601         CHECK(peer_node_id->arr_len == 33);
15602         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
15603         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
15604         int64_t ret_ref = 0;
15605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15607         return ret_ref;
15608 }
15609
15610 int64_t  CS_LDK_OnionMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
15611         void* this_arg_ptr = untag_ptr(this_arg);
15612         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15613         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15614         LDKPublicKey their_node_id_ref;
15615         CHECK(their_node_id->arr_len == 33);
15616         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15617         LDKInit init_conv;
15618         init_conv.inner = untag_ptr(init);
15619         init_conv.is_owned = ptr_is_owned(init);
15620         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
15621         init_conv.is_owned = false;
15622         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15623         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
15624         return tag_ptr(ret_conv, true);
15625 }
15626
15627 void  CS_LDK_OnionMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
15628         void* this_arg_ptr = untag_ptr(this_arg);
15629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15630         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15631         LDKPublicKey their_node_id_ref;
15632         CHECK(their_node_id->arr_len == 33);
15633         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15634         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
15635 }
15636
15637 void  CS_LDK_OnionMessageHandler_timer_tick_occurred(int64_t this_arg) {
15638         void* this_arg_ptr = untag_ptr(this_arg);
15639         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15640         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15641         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
15642 }
15643
15644 int64_t  CS_LDK_OnionMessageHandler_provided_node_features(int64_t this_arg) {
15645         void* this_arg_ptr = untag_ptr(this_arg);
15646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15647         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15648         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15649         int64_t ret_ref = 0;
15650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15652         return ret_ref;
15653 }
15654
15655 int64_t  CS_LDK_OnionMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15656         void* this_arg_ptr = untag_ptr(this_arg);
15657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15658         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
15659         LDKPublicKey their_node_id_ref;
15660         CHECK(their_node_id->arr_len == 33);
15661         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15662         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15663         int64_t ret_ref = 0;
15664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15666         return ret_ref;
15667 }
15668
15669 typedef struct LDKCustomMessageReader_JCalls {
15670         atomic_size_t refcnt;
15671         uint32_t instance_ptr;
15672 } LDKCustomMessageReader_JCalls;
15673 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
15674         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15675         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15676                 FREE(j_calls);
15677         }
15678 }
15679 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
15680         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
15681         int16_t message_type_conv = message_type;
15682         LDKu8slice buffer_var = buffer;
15683         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15684         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15685         uint64_t ret = js_invoke_function_l_sl(j_calls->instance_ptr, 139, message_type_conv, (int64_t)buffer_arr);
15686         void* ret_ptr = untag_ptr(ret);
15687         CHECK_ACCESS(ret_ptr);
15688         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
15689         FREE(untag_ptr(ret));
15690         return ret_conv;
15691 }
15692 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
15693         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
15694         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15695 }
15696 static inline LDKCustomMessageReader LDKCustomMessageReader_init (int64_t o) {
15697         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
15698         atomic_init(&calls->refcnt, 1);
15699         calls->instance_ptr = o;
15700
15701         LDKCustomMessageReader ret = {
15702                 .this_arg = (void*) calls,
15703                 .read = read_LDKCustomMessageReader_jcall,
15704                 .free = LDKCustomMessageReader_JCalls_free,
15705         };
15706         return ret;
15707 }
15708 uint64_t  CS_LDK_LDKCustomMessageReader_new(int32_t o) {
15709         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
15710         *res_ptr = LDKCustomMessageReader_init(o);
15711         return tag_ptr(res_ptr, true);
15712 }
15713 int64_t  CS_LDK_CustomMessageReader_read(int64_t this_arg, int16_t message_type, int8_tArray buffer) {
15714         void* this_arg_ptr = untag_ptr(this_arg);
15715         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15716         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
15717         LDKu8slice buffer_ref;
15718         buffer_ref.datalen = buffer->arr_len;
15719         buffer_ref.data = buffer->elems;
15720         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
15721         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
15722         FREE(buffer);
15723         return tag_ptr(ret_conv, true);
15724 }
15725
15726 typedef struct LDKCustomMessageHandler_JCalls {
15727         atomic_size_t refcnt;
15728         uint32_t instance_ptr;
15729         LDKCustomMessageReader_JCalls* CustomMessageReader;
15730 } LDKCustomMessageHandler_JCalls;
15731 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
15732         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15733         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15734                 FREE(j_calls);
15735         }
15736 }
15737 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
15738         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15739         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
15740         *msg_ret = msg;
15741         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
15742         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
15743         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 140, tag_ptr(msg_ret, true), (int64_t)sender_node_id_arr);
15744         void* ret_ptr = untag_ptr(ret);
15745         CHECK_ACCESS(ret_ptr);
15746         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
15747         FREE(untag_ptr(ret));
15748         return ret_conv;
15749 }
15750 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
15751         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15752         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 141);
15753         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
15754         ret_constr.datalen = ret->arr_len;
15755         if (ret_constr.datalen > 0)
15756                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
15757         else
15758                 ret_constr.data = NULL;
15759         int64_t* ret_vals = ret->elems;
15760         for (size_t z = 0; z < ret_constr.datalen; z++) {
15761                 int64_t ret_conv_25 = ret_vals[z];
15762                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
15763                 CHECK_ACCESS(ret_conv_25_ptr);
15764                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
15765                 FREE(untag_ptr(ret_conv_25));
15766                 ret_constr.data[z] = ret_conv_25_conv;
15767         }
15768         FREE(ret);
15769         return ret_constr;
15770 }
15771 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
15772         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15773         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 142);
15774         LDKNodeFeatures ret_conv;
15775         ret_conv.inner = untag_ptr(ret);
15776         ret_conv.is_owned = ptr_is_owned(ret);
15777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15778         return ret_conv;
15779 }
15780 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15781         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
15782         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15783         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15784         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 143, (int64_t)their_node_id_arr);
15785         LDKInitFeatures ret_conv;
15786         ret_conv.inner = untag_ptr(ret);
15787         ret_conv.is_owned = ptr_is_owned(ret);
15788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15789         return ret_conv;
15790 }
15791 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
15792         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
15793         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15794         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
15795 }
15796 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (int64_t o, int64_t CustomMessageReader) {
15797         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
15798         atomic_init(&calls->refcnt, 1);
15799         calls->instance_ptr = o;
15800
15801         LDKCustomMessageHandler ret = {
15802                 .this_arg = (void*) calls,
15803                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
15804                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
15805                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
15806                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
15807                 .free = LDKCustomMessageHandler_JCalls_free,
15808                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
15809         };
15810         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
15811         return ret;
15812 }
15813 uint64_t  CS_LDK_LDKCustomMessageHandler_new(int32_t o, int32_t CustomMessageReader) {
15814         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
15815         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
15816         return tag_ptr(res_ptr, true);
15817 }
15818 int64_t  CS_LDK_CustomMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
15819         void* this_arg_ptr = untag_ptr(this_arg);
15820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15821         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15822         void* msg_ptr = untag_ptr(msg);
15823         CHECK_ACCESS(msg_ptr);
15824         LDKType msg_conv = *(LDKType*)(msg_ptr);
15825         if (msg_conv.free == LDKType_JCalls_free) {
15826                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15827                 LDKType_JCalls_cloned(&msg_conv);
15828         }
15829         LDKPublicKey sender_node_id_ref;
15830         CHECK(sender_node_id->arr_len == 33);
15831         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
15832         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
15833         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
15834         return tag_ptr(ret_conv, true);
15835 }
15836
15837 int64_tArray  CS_LDK_CustomMessageHandler_get_and_clear_pending_msg(int64_t this_arg) {
15838         void* this_arg_ptr = untag_ptr(this_arg);
15839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15840         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15841         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
15842         int64_tArray ret_arr = NULL;
15843         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15844         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15845         for (size_t z = 0; z < ret_var.datalen; z++) {
15846                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
15847                 *ret_conv_25_conv = ret_var.data[z];
15848                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
15849         }
15850         
15851         FREE(ret_var.data);
15852         return ret_arr;
15853 }
15854
15855 int64_t  CS_LDK_CustomMessageHandler_provided_node_features(int64_t this_arg) {
15856         void* this_arg_ptr = untag_ptr(this_arg);
15857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15858         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15859         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
15860         int64_t ret_ref = 0;
15861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15863         return ret_ref;
15864 }
15865
15866 int64_t  CS_LDK_CustomMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
15867         void* this_arg_ptr = untag_ptr(this_arg);
15868         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15869         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
15870         LDKPublicKey their_node_id_ref;
15871         CHECK(their_node_id->arr_len == 33);
15872         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15873         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
15874         int64_t ret_ref = 0;
15875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15877         return ret_ref;
15878 }
15879
15880 typedef struct LDKCustomOnionMessageHandler_JCalls {
15881         atomic_size_t refcnt;
15882         uint32_t instance_ptr;
15883 } LDKCustomOnionMessageHandler_JCalls;
15884 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
15885         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15886         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15887                 FREE(j_calls);
15888         }
15889 }
15890 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
15891         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15892         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15893         *msg_ret = msg;
15894         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 144, tag_ptr(msg_ret, true));
15895         void* ret_ptr = untag_ptr(ret);
15896         CHECK_ACCESS(ret_ptr);
15897         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
15898         FREE(untag_ptr(ret));
15899         return ret_conv;
15900 }
15901 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
15902         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15903         int64_t message_type_conv = message_type;
15904         LDKu8slice buffer_var = buffer;
15905         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
15906         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
15907         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 145, message_type_conv, (int64_t)buffer_arr);
15908         void* ret_ptr = untag_ptr(ret);
15909         CHECK_ACCESS(ret_ptr);
15910         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
15911         FREE(untag_ptr(ret));
15912         return ret_conv;
15913 }
15914 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
15915         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
15916         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 146);
15917         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
15918         ret_constr.datalen = ret->arr_len;
15919         if (ret_constr.datalen > 0)
15920                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
15921         else
15922                 ret_constr.data = NULL;
15923         int64_t* ret_vals = ret->elems;
15924         for (size_t e = 0; e < ret_constr.datalen; e++) {
15925                 int64_t ret_conv_56 = ret_vals[e];
15926                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
15927                 CHECK_ACCESS(ret_conv_56_ptr);
15928                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
15929                 FREE(untag_ptr(ret_conv_56));
15930                 ret_constr.data[e] = ret_conv_56_conv;
15931         }
15932         FREE(ret);
15933         return ret_constr;
15934 }
15935 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
15936         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
15937         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15938 }
15939 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (int64_t o) {
15940         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
15941         atomic_init(&calls->refcnt, 1);
15942         calls->instance_ptr = o;
15943
15944         LDKCustomOnionMessageHandler ret = {
15945                 .this_arg = (void*) calls,
15946                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
15947                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
15948                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
15949                 .free = LDKCustomOnionMessageHandler_JCalls_free,
15950         };
15951         return ret;
15952 }
15953 uint64_t  CS_LDK_LDKCustomOnionMessageHandler_new(int32_t o) {
15954         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
15955         *res_ptr = LDKCustomOnionMessageHandler_init(o);
15956         return tag_ptr(res_ptr, true);
15957 }
15958 int64_t  CS_LDK_CustomOnionMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg) {
15959         void* this_arg_ptr = untag_ptr(this_arg);
15960         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15961         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15962         void* msg_ptr = untag_ptr(msg);
15963         CHECK_ACCESS(msg_ptr);
15964         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
15965         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
15966                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15967                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
15968         }
15969         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
15970         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
15971         int64_t ret_ref = tag_ptr(ret_copy, true);
15972         return ret_ref;
15973 }
15974
15975 int64_t  CS_LDK_CustomOnionMessageHandler_read_custom_message(int64_t this_arg, int64_t message_type, int8_tArray buffer) {
15976         void* this_arg_ptr = untag_ptr(this_arg);
15977         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15978         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15979         LDKu8slice buffer_ref;
15980         buffer_ref.datalen = buffer->arr_len;
15981         buffer_ref.data = buffer->elems;
15982         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
15983         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
15984         FREE(buffer);
15985         return tag_ptr(ret_conv, true);
15986 }
15987
15988 int64_tArray  CS_LDK_CustomOnionMessageHandler_release_pending_custom_messages(int64_t this_arg) {
15989         void* this_arg_ptr = untag_ptr(this_arg);
15990         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15991         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
15992         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
15993         int64_tArray ret_arr = NULL;
15994         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15995         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15996         for (size_t e = 0; e < ret_var.datalen; e++) {
15997                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
15998                 *ret_conv_56_conv = ret_var.data[e];
15999                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
16000         }
16001         
16002         FREE(ret_var.data);
16003         return ret_arr;
16004 }
16005
16006 typedef struct LDKSocketDescriptor_JCalls {
16007         atomic_size_t refcnt;
16008         uint32_t instance_ptr;
16009 } LDKSocketDescriptor_JCalls;
16010 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
16011         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16012         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16013                 FREE(j_calls);
16014         }
16015 }
16016 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
16017         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16018         LDKu8slice data_var = data;
16019         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
16020         memcpy(data_arr->elems, data_var.data, data_var.datalen);
16021         jboolean resume_read_conv = resume_read;
16022         return js_invoke_function_l_lb(j_calls->instance_ptr, 147, (int64_t)data_arr, resume_read_conv);
16023 }
16024 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
16025         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16026         js_invoke_function_void_(j_calls->instance_ptr, 148);
16027 }
16028 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
16029         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16030         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16031         *other_arg_clone = SocketDescriptor_clone(other_arg);
16032         return js_invoke_function_b_l(j_calls->instance_ptr, 149, tag_ptr(other_arg_clone, true));
16033 }
16034 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
16035         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
16036         return js_invoke_function_l_(j_calls->instance_ptr, 150);
16037 }
16038 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
16039         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
16040         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16041 }
16042 static inline LDKSocketDescriptor LDKSocketDescriptor_init (int64_t o) {
16043         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
16044         atomic_init(&calls->refcnt, 1);
16045         calls->instance_ptr = o;
16046
16047         LDKSocketDescriptor ret = {
16048                 .this_arg = (void*) calls,
16049                 .send_data = send_data_LDKSocketDescriptor_jcall,
16050                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
16051                 .eq = eq_LDKSocketDescriptor_jcall,
16052                 .hash = hash_LDKSocketDescriptor_jcall,
16053                 .cloned = LDKSocketDescriptor_JCalls_cloned,
16054                 .free = LDKSocketDescriptor_JCalls_free,
16055         };
16056         return ret;
16057 }
16058 uint64_t  CS_LDK_LDKSocketDescriptor_new(int32_t o) {
16059         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16060         *res_ptr = LDKSocketDescriptor_init(o);
16061         return tag_ptr(res_ptr, true);
16062 }
16063 int64_t  CS_LDK_SocketDescriptor_send_data(int64_t this_arg, int8_tArray data, jboolean resume_read) {
16064         void* this_arg_ptr = untag_ptr(this_arg);
16065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16066         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16067         LDKu8slice data_ref;
16068         data_ref.datalen = data->arr_len;
16069         data_ref.data = data->elems;
16070         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
16071         FREE(data);
16072         return ret_conv;
16073 }
16074
16075 void  CS_LDK_SocketDescriptor_disconnect_socket(int64_t this_arg) {
16076         void* this_arg_ptr = untag_ptr(this_arg);
16077         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16078         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16079         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
16080 }
16081
16082 int64_t  CS_LDK_SocketDescriptor_hash(int64_t this_arg) {
16083         void* this_arg_ptr = untag_ptr(this_arg);
16084         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16085         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
16086         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
16087         return ret_conv;
16088 }
16089
16090 uint32_t CS_LDK_LDKEffectiveCapacity_ty_from_ptr(int64_t ptr) {
16091         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16092         switch(obj->tag) {
16093                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
16094                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
16095                 case LDKEffectiveCapacity_Total: return 2;
16096                 case LDKEffectiveCapacity_Infinite: return 3;
16097                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
16098                 case LDKEffectiveCapacity_Unknown: return 5;
16099                 default: abort();
16100         }
16101 }
16102 int64_t CS_LDK_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(int64_t ptr) {
16103         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16104         CHECK(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
16105         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
16106         return liquidity_msat_conv;
16107 }
16108 int64_t CS_LDK_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(int64_t ptr) {
16109         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16110         CHECK(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
16111         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
16112         return amount_msat_conv;
16113 }
16114 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_capacity_msat(int64_t ptr) {
16115         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16116         CHECK(obj->tag == LDKEffectiveCapacity_Total);
16117         int64_t capacity_msat_conv = obj->total.capacity_msat;
16118         return capacity_msat_conv;
16119 }
16120 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(int64_t ptr) {
16121         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16122         CHECK(obj->tag == LDKEffectiveCapacity_Total);
16123         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
16124         return htlc_maximum_msat_conv;
16125 }
16126 int64_t CS_LDK_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(int64_t ptr) {
16127         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
16128         CHECK(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
16129         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
16130         return amount_msat_conv;
16131 }
16132 uint32_t CS_LDK_LDKPayee_ty_from_ptr(int64_t ptr) {
16133         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16134         switch(obj->tag) {
16135                 case LDKPayee_Blinded: return 0;
16136                 case LDKPayee_Clear: return 1;
16137                 default: abort();
16138         }
16139 }
16140 int64_tArray CS_LDK_LDKPayee_Blinded_get_route_hints(int64_t ptr) {
16141         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16142         CHECK(obj->tag == LDKPayee_Blinded);
16143         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
16144                         int64_tArray route_hints_arr = NULL;
16145                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
16146                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
16147                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
16148                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
16149                                 *route_hints_conv_37_conv = route_hints_var.data[l];
16150                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
16151                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
16152                         }
16153                         
16154         return route_hints_arr;
16155 }
16156 int64_t CS_LDK_LDKPayee_Blinded_get_features(int64_t ptr) {
16157         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16158         CHECK(obj->tag == LDKPayee_Blinded);
16159         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
16160                         int64_t features_ref = 0;
16161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
16162                         features_ref = tag_ptr(features_var.inner, false);
16163         return features_ref;
16164 }
16165 int8_tArray CS_LDK_LDKPayee_Clear_get_node_id(int64_t ptr) {
16166         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16167         CHECK(obj->tag == LDKPayee_Clear);
16168         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
16169         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
16170         return node_id_arr;
16171 }
16172 int64_tArray CS_LDK_LDKPayee_Clear_get_route_hints(int64_t ptr) {
16173         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16174         CHECK(obj->tag == LDKPayee_Clear);
16175         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
16176                         int64_tArray route_hints_arr = NULL;
16177                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
16178                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
16179                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
16180                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
16181                                 int64_t route_hints_conv_11_ref = 0;
16182                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
16183                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
16184                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
16185                         }
16186                         
16187         return route_hints_arr;
16188 }
16189 int64_t CS_LDK_LDKPayee_Clear_get_features(int64_t ptr) {
16190         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16191         CHECK(obj->tag == LDKPayee_Clear);
16192         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
16193                         int64_t features_ref = 0;
16194                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
16195                         features_ref = tag_ptr(features_var.inner, false);
16196         return features_ref;
16197 }
16198 int32_t CS_LDK_LDKPayee_Clear_get_final_cltv_expiry_delta(int64_t ptr) {
16199         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
16200         CHECK(obj->tag == LDKPayee_Clear);
16201         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
16202         return final_cltv_expiry_delta_conv;
16203 }
16204 typedef struct LDKScore_JCalls {
16205         atomic_size_t refcnt;
16206         uint32_t instance_ptr;
16207         LDKScoreLookUp_JCalls* ScoreLookUp;
16208         LDKScoreUpdate_JCalls* ScoreUpdate;
16209 } LDKScore_JCalls;
16210 static void LDKScore_JCalls_free(void* this_arg) {
16211         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
16212         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16213                 FREE(j_calls);
16214         }
16215 }
16216 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
16217         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
16218         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 151);
16219         LDKCVec_u8Z ret_ref;
16220         ret_ref.datalen = ret->arr_len;
16221         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
16222         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
16223         return ret_ref;
16224 }
16225 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
16226         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
16227         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16228         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
16229         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
16230 }
16231 static inline LDKScore LDKScore_init (int64_t o, int64_t ScoreLookUp, int64_t ScoreUpdate) {
16232         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
16233         atomic_init(&calls->refcnt, 1);
16234         calls->instance_ptr = o;
16235
16236         LDKScore ret = {
16237                 .this_arg = (void*) calls,
16238                 .write = write_LDKScore_jcall,
16239                 .free = LDKScore_JCalls_free,
16240                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
16241                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
16242         };
16243         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
16244         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
16245         return ret;
16246 }
16247 uint64_t  CS_LDK_LDKScore_new(int32_t o, int32_t ScoreLookUp, int32_t ScoreUpdate) {
16248         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
16249         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
16250         return tag_ptr(res_ptr, true);
16251 }
16252 int8_tArray  CS_LDK_Score_write(int64_t this_arg) {
16253         void* this_arg_ptr = untag_ptr(this_arg);
16254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16255         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
16256         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
16257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16259         CVec_u8Z_free(ret_var);
16260         return ret_arr;
16261 }
16262
16263 typedef struct LDKCoinSelectionSource_JCalls {
16264         atomic_size_t refcnt;
16265         uint32_t instance_ptr;
16266 } LDKCoinSelectionSource_JCalls;
16267 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
16268         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16269         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16270                 FREE(j_calls);
16271         }
16272 }
16273 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) {
16274         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16275         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
16276         memcpy(claim_id_arr->elems, claim_id.data, 32);
16277         LDKCVec_InputZ must_spend_var = must_spend;
16278         int64_tArray must_spend_arr = NULL;
16279         must_spend_arr = init_int64_tArray(must_spend_var.datalen, __LINE__);
16280         int64_t *must_spend_arr_ptr = (int64_t*)(((uint8_t*)must_spend_arr) + 8);
16281         for (size_t h = 0; h < must_spend_var.datalen; h++) {
16282                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
16283                 int64_t must_spend_conv_7_ref = 0;
16284                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
16285                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
16286                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
16287         }
16288         
16289         FREE(must_spend_var.data);
16290         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
16291         int64_tArray must_pay_to_arr = NULL;
16292         must_pay_to_arr = init_int64_tArray(must_pay_to_var.datalen, __LINE__);
16293         int64_t *must_pay_to_arr_ptr = (int64_t*)(((uint8_t*)must_pay_to_arr) + 8);
16294         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
16295                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16296                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
16297                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
16298         }
16299         
16300         FREE(must_pay_to_var.data);
16301         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
16302         uint64_t ret = js_invoke_function_l_llli(j_calls->instance_ptr, 152, (int64_t)claim_id_arr, (int64_t)must_spend_arr, (int64_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
16303         void* ret_ptr = untag_ptr(ret);
16304         CHECK_ACCESS(ret_ptr);
16305         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
16306         FREE(untag_ptr(ret));
16307         return ret_conv;
16308 }
16309 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16310         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
16311         LDKCVec_u8Z psbt_var = psbt;
16312         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16313         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16314         CVec_u8Z_free(psbt_var);
16315         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 153, (int64_t)psbt_arr);
16316         void* ret_ptr = untag_ptr(ret);
16317         CHECK_ACCESS(ret_ptr);
16318         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16319         FREE(untag_ptr(ret));
16320         return ret_conv;
16321 }
16322 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
16323         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
16324         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16325 }
16326 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (int64_t o) {
16327         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
16328         atomic_init(&calls->refcnt, 1);
16329         calls->instance_ptr = o;
16330
16331         LDKCoinSelectionSource ret = {
16332                 .this_arg = (void*) calls,
16333                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
16334                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
16335                 .free = LDKCoinSelectionSource_JCalls_free,
16336         };
16337         return ret;
16338 }
16339 uint64_t  CS_LDK_LDKCoinSelectionSource_new(int32_t o) {
16340         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
16341         *res_ptr = LDKCoinSelectionSource_init(o);
16342         return tag_ptr(res_ptr, true);
16343 }
16344 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) {
16345         void* this_arg_ptr = untag_ptr(this_arg);
16346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16347         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16348         LDKThirtyTwoBytes claim_id_ref;
16349         CHECK(claim_id->arr_len == 32);
16350         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
16351         LDKCVec_InputZ must_spend_constr;
16352         must_spend_constr.datalen = must_spend->arr_len;
16353         if (must_spend_constr.datalen > 0)
16354                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
16355         else
16356                 must_spend_constr.data = NULL;
16357         int64_t* must_spend_vals = must_spend->elems;
16358         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
16359                 int64_t must_spend_conv_7 = must_spend_vals[h];
16360                 LDKInput must_spend_conv_7_conv;
16361                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
16362                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
16363                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
16364                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
16365                 must_spend_constr.data[h] = must_spend_conv_7_conv;
16366         }
16367         FREE(must_spend);
16368         LDKCVec_TxOutZ must_pay_to_constr;
16369         must_pay_to_constr.datalen = must_pay_to->arr_len;
16370         if (must_pay_to_constr.datalen > 0)
16371                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16372         else
16373                 must_pay_to_constr.data = NULL;
16374         int64_t* must_pay_to_vals = must_pay_to->elems;
16375         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
16376                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
16377                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
16378                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
16379                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
16380                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
16381                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
16382         }
16383         FREE(must_pay_to);
16384         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
16385         *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);
16386         return tag_ptr(ret_conv, true);
16387 }
16388
16389 int64_t  CS_LDK_CoinSelectionSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
16390         void* this_arg_ptr = untag_ptr(this_arg);
16391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16392         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
16393         LDKCVec_u8Z psbt_ref;
16394         psbt_ref.datalen = psbt->arr_len;
16395         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16396         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16397         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16398         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16399         return tag_ptr(ret_conv, true);
16400 }
16401
16402 typedef struct LDKWalletSource_JCalls {
16403         atomic_size_t refcnt;
16404         uint32_t instance_ptr;
16405 } LDKWalletSource_JCalls;
16406 static void LDKWalletSource_JCalls_free(void* this_arg) {
16407         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16408         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16409                 FREE(j_calls);
16410         }
16411 }
16412 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
16413         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16414         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 154);
16415         void* ret_ptr = untag_ptr(ret);
16416         CHECK_ACCESS(ret_ptr);
16417         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
16418         FREE(untag_ptr(ret));
16419         return ret_conv;
16420 }
16421 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
16422         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16423         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 155);
16424         void* ret_ptr = untag_ptr(ret);
16425         CHECK_ACCESS(ret_ptr);
16426         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16427         FREE(untag_ptr(ret));
16428         return ret_conv;
16429 }
16430 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
16431         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
16432         LDKCVec_u8Z psbt_var = psbt;
16433         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
16434         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
16435         CVec_u8Z_free(psbt_var);
16436         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 156, (int64_t)psbt_arr);
16437         void* ret_ptr = untag_ptr(ret);
16438         CHECK_ACCESS(ret_ptr);
16439         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
16440         FREE(untag_ptr(ret));
16441         return ret_conv;
16442 }
16443 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
16444         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
16445         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16446 }
16447 static inline LDKWalletSource LDKWalletSource_init (int64_t o) {
16448         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
16449         atomic_init(&calls->refcnt, 1);
16450         calls->instance_ptr = o;
16451
16452         LDKWalletSource ret = {
16453                 .this_arg = (void*) calls,
16454                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
16455                 .get_change_script = get_change_script_LDKWalletSource_jcall,
16456                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
16457                 .free = LDKWalletSource_JCalls_free,
16458         };
16459         return ret;
16460 }
16461 uint64_t  CS_LDK_LDKWalletSource_new(int32_t o) {
16462         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
16463         *res_ptr = LDKWalletSource_init(o);
16464         return tag_ptr(res_ptr, true);
16465 }
16466 int64_t  CS_LDK_WalletSource_list_confirmed_utxos(int64_t this_arg) {
16467         void* this_arg_ptr = untag_ptr(this_arg);
16468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16469         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16470         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
16471         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
16472         return tag_ptr(ret_conv, true);
16473 }
16474
16475 int64_t  CS_LDK_WalletSource_get_change_script(int64_t this_arg) {
16476         void* this_arg_ptr = untag_ptr(this_arg);
16477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16478         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16479         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16480         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
16481         return tag_ptr(ret_conv, true);
16482 }
16483
16484 int64_t  CS_LDK_WalletSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
16485         void* this_arg_ptr = untag_ptr(this_arg);
16486         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16487         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
16488         LDKCVec_u8Z psbt_ref;
16489         psbt_ref.datalen = psbt->arr_len;
16490         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
16491         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
16492         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16493         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
16494         return tag_ptr(ret_conv, true);
16495 }
16496
16497 uint32_t CS_LDK_LDKGossipSync_ty_from_ptr(int64_t ptr) {
16498         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16499         switch(obj->tag) {
16500                 case LDKGossipSync_P2P: return 0;
16501                 case LDKGossipSync_Rapid: return 1;
16502                 case LDKGossipSync_None: return 2;
16503                 default: abort();
16504         }
16505 }
16506 int64_t CS_LDK_LDKGossipSync_P2P_get_p2p(int64_t ptr) {
16507         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16508         CHECK(obj->tag == LDKGossipSync_P2P);
16509         LDKP2PGossipSync p2p_var = obj->p2p;
16510                         int64_t p2p_ref = 0;
16511                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
16512                         p2p_ref = tag_ptr(p2p_var.inner, false);
16513         return p2p_ref;
16514 }
16515 int64_t CS_LDK_LDKGossipSync_Rapid_get_rapid(int64_t ptr) {
16516         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
16517         CHECK(obj->tag == LDKGossipSync_Rapid);
16518         LDKRapidGossipSync rapid_var = obj->rapid;
16519                         int64_t rapid_ref = 0;
16520                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
16521                         rapid_ref = tag_ptr(rapid_var.inner, false);
16522         return rapid_ref;
16523 }
16524 uint32_t CS_LDK_LDKFallback_ty_from_ptr(int64_t ptr) {
16525         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16526         switch(obj->tag) {
16527                 case LDKFallback_SegWitProgram: return 0;
16528                 case LDKFallback_PubKeyHash: return 1;
16529                 case LDKFallback_ScriptHash: return 2;
16530                 default: abort();
16531         }
16532 }
16533 int8_t CS_LDK_LDKFallback_SegWitProgram_get_version(int64_t ptr) {
16534         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16535         CHECK(obj->tag == LDKFallback_SegWitProgram);
16536         uint8_t version_val = obj->seg_wit_program.version._0;
16537         return version_val;
16538 }
16539 int8_tArray CS_LDK_LDKFallback_SegWitProgram_get_program(int64_t ptr) {
16540         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16541         CHECK(obj->tag == LDKFallback_SegWitProgram);
16542         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
16543                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
16544                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
16545         return program_arr;
16546 }
16547 int8_tArray CS_LDK_LDKFallback_PubKeyHash_get_pub_key_hash(int64_t ptr) {
16548         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16549         CHECK(obj->tag == LDKFallback_PubKeyHash);
16550         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
16551         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
16552         return pub_key_hash_arr;
16553 }
16554 int8_tArray CS_LDK_LDKFallback_ScriptHash_get_script_hash(int64_t ptr) {
16555         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
16556         CHECK(obj->tag == LDKFallback_ScriptHash);
16557         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
16558         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
16559         return script_hash_arr;
16560 }
16561 jstring  CS_LDK__ldk_get_compiled_version() {
16562         LDKStr ret_str = _ldk_get_compiled_version();
16563         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
16564         Str_free(ret_str);
16565         return ret_conv;
16566 }
16567
16568 jstring  CS_LDK__ldk_c_bindings_get_compiled_version() {
16569         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
16570         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
16571         Str_free(ret_str);
16572         return ret_conv;
16573 }
16574
16575 int8_tArray  CS_LDK_U128_le_bytes(int8_tArray val) {
16576         LDKU128 val_ref;
16577         CHECK(val->arr_len == 16);
16578         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
16579         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16580         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
16581         return ret_arr;
16582 }
16583
16584 int8_tArray  CS_LDK_U128_new(int8_tArray le_bytes) {
16585         LDKSixteenBytes le_bytes_ref;
16586         CHECK(le_bytes->arr_len == 16);
16587         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
16588         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
16589         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
16590         return ret_arr;
16591 }
16592
16593 int64_t  CS_LDK_WitnessProgram_new(int8_t version, int8_tArray program) {
16594         
16595         LDKCVec_u8Z program_ref;
16596         program_ref.datalen = program->arr_len;
16597         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
16598         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
16599         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16600         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
16601         return tag_ptr(ret_ref, true);
16602 }
16603
16604 int8_t  CS_LDK_WitnessProgram_get_version(int64_t prog) {
16605         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16606         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
16607         return ret_val;
16608 }
16609
16610 int8_tArray  CS_LDK_WitnessProgram_get_program(int64_t prog) {
16611         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
16612         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
16613         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16614         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16615         return ret_arr;
16616 }
16617
16618 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
16619         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16620         *ret_ref = WitnessProgram_clone(arg);
16621         return tag_ptr(ret_ref, true);
16622 }
16623 int64_t  CS_LDK_WitnessProgram_clone_ptr(int64_t arg) {
16624         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
16625         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
16626         return ret_conv;
16627 }
16628
16629 int64_t  CS_LDK_WitnessProgram_clone(int64_t orig) {
16630         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
16631         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
16632         *ret_ref = WitnessProgram_clone(orig_conv);
16633         return tag_ptr(ret_ref, true);
16634 }
16635
16636 void  CS_LDK_WitnessProgram_free(int64_t o) {
16637         if (!ptr_is_owned(o)) return;
16638         void* o_ptr = untag_ptr(o);
16639         CHECK_ACCESS(o_ptr);
16640         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
16641         FREE(untag_ptr(o));
16642         WitnessProgram_free(o_conv);
16643 }
16644
16645 int64_t  CS_LDK_BigEndianScalar_new(int8_tArray big_endian_bytes) {
16646         LDKThirtyTwoBytes big_endian_bytes_ref;
16647         CHECK(big_endian_bytes->arr_len == 32);
16648         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
16649         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
16650         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
16651         return tag_ptr(ret_ref, true);
16652 }
16653
16654 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
16655         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16656         *ret_copy = Bech32Error_clone(arg);
16657         int64_t ret_ref = tag_ptr(ret_copy, true);
16658         return ret_ref;
16659 }
16660 int64_t  CS_LDK_Bech32Error_clone_ptr(int64_t arg) {
16661         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
16662         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
16663         return ret_conv;
16664 }
16665
16666 int64_t  CS_LDK_Bech32Error_clone(int64_t orig) {
16667         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
16668         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
16669         *ret_copy = Bech32Error_clone(orig_conv);
16670         int64_t ret_ref = tag_ptr(ret_copy, true);
16671         return ret_ref;
16672 }
16673
16674 void  CS_LDK_Bech32Error_free(int64_t o) {
16675         if (!ptr_is_owned(o)) return;
16676         void* o_ptr = untag_ptr(o);
16677         CHECK_ACCESS(o_ptr);
16678         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
16679         FREE(untag_ptr(o));
16680         Bech32Error_free(o_conv);
16681 }
16682
16683 void  CS_LDK_Transaction_free(int8_tArray _res) {
16684         LDKTransaction _res_ref;
16685         _res_ref.datalen = _res->arr_len;
16686         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
16687         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16688         _res_ref.data_is_owned = true;
16689         Transaction_free(_res_ref);
16690 }
16691
16692 void  CS_LDK_Witness_free(int8_tArray _res) {
16693         LDKWitness _res_ref;
16694         _res_ref.datalen = _res->arr_len;
16695         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
16696         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16697         _res_ref.data_is_owned = true;
16698         Witness_free(_res_ref);
16699 }
16700
16701 int64_t  CS_LDK_TxIn_new(int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
16702         LDKWitness witness_ref;
16703         witness_ref.datalen = witness->arr_len;
16704         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
16705         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
16706         witness_ref.data_is_owned = true;
16707         LDKCVec_u8Z script_sig_ref;
16708         script_sig_ref.datalen = script_sig->arr_len;
16709         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
16710         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
16711         LDKThirtyTwoBytes previous_txid_ref;
16712         CHECK(previous_txid->arr_len == 32);
16713         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
16714         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
16715         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
16716         return tag_ptr(ret_ref, true);
16717 }
16718
16719 int8_tArray  CS_LDK_TxIn_get_witness(int64_t txin) {
16720         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16721         LDKWitness ret_var = TxIn_get_witness(txin_conv);
16722         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16723         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16724         Witness_free(ret_var);
16725         return ret_arr;
16726 }
16727
16728 int8_tArray  CS_LDK_TxIn_get_script_sig(int64_t txin) {
16729         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16730         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
16731         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16732         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16733         return ret_arr;
16734 }
16735
16736 int32_t  CS_LDK_TxIn_get_sequence(int64_t txin) {
16737         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16738         int32_t ret_conv = TxIn_get_sequence(txin_conv);
16739         return ret_conv;
16740 }
16741
16742 int8_tArray  CS_LDK_TxIn_get_previous_txid(int64_t txin) {
16743         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16744         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
16745         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
16746         return ret_arr;
16747 }
16748
16749 int32_t  CS_LDK_TxIn_get_previous_vout(int64_t txin) {
16750         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
16751         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
16752         return ret_conv;
16753 }
16754
16755 void  CS_LDK_TxIn_free(int64_t _res) {
16756         if (!ptr_is_owned(_res)) return;
16757         void* _res_ptr = untag_ptr(_res);
16758         CHECK_ACCESS(_res_ptr);
16759         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
16760         FREE(untag_ptr(_res));
16761         TxIn_free(_res_conv);
16762 }
16763
16764 int64_t  CS_LDK_TxOut_new(int8_tArray script_pubkey, int64_t value) {
16765         LDKCVec_u8Z script_pubkey_ref;
16766         script_pubkey_ref.datalen = script_pubkey->arr_len;
16767         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
16768         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
16769         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16770         *ret_ref = TxOut_new(script_pubkey_ref, value);
16771         return tag_ptr(ret_ref, true);
16772 }
16773
16774 int8_tArray  CS_LDK_TxOut_get_script_pubkey(int64_t txout) {
16775         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16776         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
16777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
16778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16779         return ret_arr;
16780 }
16781
16782 int64_t  CS_LDK_TxOut_get_value(int64_t txout) {
16783         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
16784         int64_t ret_conv = TxOut_get_value(txout_conv);
16785         return ret_conv;
16786 }
16787
16788 void  CS_LDK_TxOut_free(int64_t _res) {
16789         if (!ptr_is_owned(_res)) return;
16790         void* _res_ptr = untag_ptr(_res);
16791         CHECK_ACCESS(_res_ptr);
16792         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
16793         FREE(untag_ptr(_res));
16794         TxOut_free(_res_conv);
16795 }
16796
16797 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
16798         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16799         *ret_ref = TxOut_clone(arg);
16800         return tag_ptr(ret_ref, true);
16801 }
16802 int64_t  CS_LDK_TxOut_clone_ptr(int64_t arg) {
16803         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
16804         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
16805         return ret_conv;
16806 }
16807
16808 int64_t  CS_LDK_TxOut_clone(int64_t orig) {
16809         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
16810         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
16811         *ret_ref = TxOut_clone(orig_conv);
16812         return tag_ptr(ret_ref, true);
16813 }
16814
16815 void  CS_LDK_Str_free(jstring _res) {
16816         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
16817         Str_free(dummy);
16818 }
16819
16820 int64_t  CS_LDK_COption_u64Z_some(int64_t o) {
16821         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16822         *ret_copy = COption_u64Z_some(o);
16823         int64_t ret_ref = tag_ptr(ret_copy, true);
16824         return ret_ref;
16825 }
16826
16827 int64_t  CS_LDK_COption_u64Z_none() {
16828         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16829         *ret_copy = COption_u64Z_none();
16830         int64_t ret_ref = tag_ptr(ret_copy, true);
16831         return ret_ref;
16832 }
16833
16834 void  CS_LDK_COption_u64Z_free(int64_t _res) {
16835         if (!ptr_is_owned(_res)) return;
16836         void* _res_ptr = untag_ptr(_res);
16837         CHECK_ACCESS(_res_ptr);
16838         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16839         FREE(untag_ptr(_res));
16840         COption_u64Z_free(_res_conv);
16841 }
16842
16843 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16844         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16845         *ret_copy = COption_u64Z_clone(arg);
16846         int64_t ret_ref = tag_ptr(ret_copy, true);
16847         return ret_ref;
16848 }
16849 int64_t  CS_LDK_COption_u64Z_clone_ptr(int64_t arg) {
16850         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
16851         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16852         return ret_conv;
16853 }
16854
16855 int64_t  CS_LDK_COption_u64Z_clone(int64_t orig) {
16856         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
16857         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16858         *ret_copy = COption_u64Z_clone(orig_conv);
16859         int64_t ret_ref = tag_ptr(ret_copy, true);
16860         return ret_ref;
16861 }
16862
16863 void  CS_LDK_CVec_BlindedPathZ_free(int64_tArray _res) {
16864         LDKCVec_BlindedPathZ _res_constr;
16865         _res_constr.datalen = _res->arr_len;
16866         if (_res_constr.datalen > 0)
16867                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
16868         else
16869                 _res_constr.data = NULL;
16870         int64_t* _res_vals = _res->elems;
16871         for (size_t n = 0; n < _res_constr.datalen; n++) {
16872                 int64_t _res_conv_13 = _res_vals[n];
16873                 LDKBlindedPath _res_conv_13_conv;
16874                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
16875                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
16876                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
16877                 _res_constr.data[n] = _res_conv_13_conv;
16878         }
16879         FREE(_res);
16880         CVec_BlindedPathZ_free(_res_constr);
16881 }
16882
16883 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_ok(int64_t o) {
16884         LDKRefund o_conv;
16885         o_conv.inner = untag_ptr(o);
16886         o_conv.is_owned = ptr_is_owned(o);
16887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16888         o_conv = Refund_clone(&o_conv);
16889         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16890         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
16891         return tag_ptr(ret_conv, true);
16892 }
16893
16894 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_err(int64_t e) {
16895         LDKBolt12ParseError e_conv;
16896         e_conv.inner = untag_ptr(e);
16897         e_conv.is_owned = ptr_is_owned(e);
16898         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16899         e_conv = Bolt12ParseError_clone(&e_conv);
16900         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16901         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
16902         return tag_ptr(ret_conv, true);
16903 }
16904
16905 jboolean  CS_LDK_CResult_RefundBolt12ParseErrorZ_is_ok(int64_t o) {
16906         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
16907         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
16908         return ret_conv;
16909 }
16910
16911 void  CS_LDK_CResult_RefundBolt12ParseErrorZ_free(int64_t _res) {
16912         if (!ptr_is_owned(_res)) return;
16913         void* _res_ptr = untag_ptr(_res);
16914         CHECK_ACCESS(_res_ptr);
16915         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
16916         FREE(untag_ptr(_res));
16917         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
16918 }
16919
16920 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
16921         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16922         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
16923         return tag_ptr(ret_conv, true);
16924 }
16925 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone_ptr(int64_t arg) {
16926         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
16927         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
16928         return ret_conv;
16929 }
16930
16931 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone(int64_t orig) {
16932         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
16933         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
16934         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
16935         return tag_ptr(ret_conv, true);
16936 }
16937
16938 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_ok(int64_t o) {
16939         void* o_ptr = untag_ptr(o);
16940         CHECK_ACCESS(o_ptr);
16941         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
16942         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
16943         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16944         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
16945         return tag_ptr(ret_conv, true);
16946 }
16947
16948 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_err(int64_t e) {
16949         void* e_ptr = untag_ptr(e);
16950         CHECK_ACCESS(e_ptr);
16951         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16952         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16953         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16954         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
16955         return tag_ptr(ret_conv, true);
16956 }
16957
16958 jboolean  CS_LDK_CResult_RetryDecodeErrorZ_is_ok(int64_t o) {
16959         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
16960         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
16961         return ret_conv;
16962 }
16963
16964 void  CS_LDK_CResult_RetryDecodeErrorZ_free(int64_t _res) {
16965         if (!ptr_is_owned(_res)) return;
16966         void* _res_ptr = untag_ptr(_res);
16967         CHECK_ACCESS(_res_ptr);
16968         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
16969         FREE(untag_ptr(_res));
16970         CResult_RetryDecodeErrorZ_free(_res_conv);
16971 }
16972
16973 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
16974         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16975         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
16976         return tag_ptr(ret_conv, true);
16977 }
16978 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone_ptr(int64_t arg) {
16979         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
16980         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
16981         return ret_conv;
16982 }
16983
16984 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone(int64_t orig) {
16985         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
16986         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
16987         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
16988         return tag_ptr(ret_conv, true);
16989 }
16990
16991 int64_t  CS_LDK_CResult_NoneAPIErrorZ_ok() {
16992         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16993         *ret_conv = CResult_NoneAPIErrorZ_ok();
16994         return tag_ptr(ret_conv, true);
16995 }
16996
16997 int64_t  CS_LDK_CResult_NoneAPIErrorZ_err(int64_t e) {
16998         void* e_ptr = untag_ptr(e);
16999         CHECK_ACCESS(e_ptr);
17000         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17001         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17002         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17003         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17004         return tag_ptr(ret_conv, true);
17005 }
17006
17007 jboolean  CS_LDK_CResult_NoneAPIErrorZ_is_ok(int64_t o) {
17008         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
17009         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
17010         return ret_conv;
17011 }
17012
17013 void  CS_LDK_CResult_NoneAPIErrorZ_free(int64_t _res) {
17014         if (!ptr_is_owned(_res)) return;
17015         void* _res_ptr = untag_ptr(_res);
17016         CHECK_ACCESS(_res_ptr);
17017         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17018         FREE(untag_ptr(_res));
17019         CResult_NoneAPIErrorZ_free(_res_conv);
17020 }
17021
17022 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17023         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17024         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17025         return tag_ptr(ret_conv, true);
17026 }
17027 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone_ptr(int64_t arg) {
17028         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
17029         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17030         return ret_conv;
17031 }
17032
17033 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone(int64_t orig) {
17034         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
17035         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17036         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17037         return tag_ptr(ret_conv, true);
17038 }
17039
17040 void  CS_LDK_CVec_CResult_NoneAPIErrorZZ_free(int64_tArray _res) {
17041         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17042         _res_constr.datalen = _res->arr_len;
17043         if (_res_constr.datalen > 0)
17044                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17045         else
17046                 _res_constr.data = NULL;
17047         int64_t* _res_vals = _res->elems;
17048         for (size_t w = 0; w < _res_constr.datalen; w++) {
17049                 int64_t _res_conv_22 = _res_vals[w];
17050                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
17051                 CHECK_ACCESS(_res_conv_22_ptr);
17052                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17053                 FREE(untag_ptr(_res_conv_22));
17054                 _res_constr.data[w] = _res_conv_22_conv;
17055         }
17056         FREE(_res);
17057         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17058 }
17059
17060 void  CS_LDK_CVec_APIErrorZ_free(int64_tArray _res) {
17061         LDKCVec_APIErrorZ _res_constr;
17062         _res_constr.datalen = _res->arr_len;
17063         if (_res_constr.datalen > 0)
17064                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17065         else
17066                 _res_constr.data = NULL;
17067         int64_t* _res_vals = _res->elems;
17068         for (size_t k = 0; k < _res_constr.datalen; k++) {
17069                 int64_t _res_conv_10 = _res_vals[k];
17070                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
17071                 CHECK_ACCESS(_res_conv_10_ptr);
17072                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17073                 FREE(untag_ptr(_res_conv_10));
17074                 _res_constr.data[k] = _res_conv_10_conv;
17075         }
17076         FREE(_res);
17077         CVec_APIErrorZ_free(_res_constr);
17078 }
17079
17080 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
17081         LDKThirtyTwoBytes o_ref;
17082         CHECK(o->arr_len == 32);
17083         memcpy(o_ref.data, o->elems, 32); FREE(o);
17084         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17085         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
17086         int64_t ret_ref = tag_ptr(ret_copy, true);
17087         return ret_ref;
17088 }
17089
17090 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_none() {
17091         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17092         *ret_copy = COption_ThirtyTwoBytesZ_none();
17093         int64_t ret_ref = tag_ptr(ret_copy, true);
17094         return ret_ref;
17095 }
17096
17097 void  CS_LDK_COption_ThirtyTwoBytesZ_free(int64_t _res) {
17098         if (!ptr_is_owned(_res)) return;
17099         void* _res_ptr = untag_ptr(_res);
17100         CHECK_ACCESS(_res_ptr);
17101         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
17102         FREE(untag_ptr(_res));
17103         COption_ThirtyTwoBytesZ_free(_res_conv);
17104 }
17105
17106 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
17107         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17108         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
17109         int64_t ret_ref = tag_ptr(ret_copy, true);
17110         return ret_ref;
17111 }
17112 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone_ptr(int64_t arg) {
17113         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
17114         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
17115         return ret_conv;
17116 }
17117
17118 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone(int64_t orig) {
17119         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
17120         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
17121         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
17122         int64_t ret_ref = tag_ptr(ret_copy, true);
17123         return ret_ref;
17124 }
17125
17126 void  CS_LDK_CVec_u8Z_free(int8_tArray _res) {
17127         LDKCVec_u8Z _res_ref;
17128         _res_ref.datalen = _res->arr_len;
17129         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
17130         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
17131         CVec_u8Z_free(_res_ref);
17132 }
17133
17134 int64_t  CS_LDK_COption_CVec_u8ZZ_some(int8_tArray o) {
17135         LDKCVec_u8Z o_ref;
17136         o_ref.datalen = o->arr_len;
17137         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
17138         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
17139         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17140         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
17141         int64_t ret_ref = tag_ptr(ret_copy, true);
17142         return ret_ref;
17143 }
17144
17145 int64_t  CS_LDK_COption_CVec_u8ZZ_none() {
17146         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17147         *ret_copy = COption_CVec_u8ZZ_none();
17148         int64_t ret_ref = tag_ptr(ret_copy, true);
17149         return ret_ref;
17150 }
17151
17152 void  CS_LDK_COption_CVec_u8ZZ_free(int64_t _res) {
17153         if (!ptr_is_owned(_res)) return;
17154         void* _res_ptr = untag_ptr(_res);
17155         CHECK_ACCESS(_res_ptr);
17156         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
17157         FREE(untag_ptr(_res));
17158         COption_CVec_u8ZZ_free(_res_conv);
17159 }
17160
17161 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
17162         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17163         *ret_copy = COption_CVec_u8ZZ_clone(arg);
17164         int64_t ret_ref = tag_ptr(ret_copy, true);
17165         return ret_ref;
17166 }
17167 int64_t  CS_LDK_COption_CVec_u8ZZ_clone_ptr(int64_t arg) {
17168         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
17169         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
17170         return ret_conv;
17171 }
17172
17173 int64_t  CS_LDK_COption_CVec_u8ZZ_clone(int64_t orig) {
17174         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
17175         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
17176         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
17177         int64_t ret_ref = tag_ptr(ret_copy, true);
17178         return ret_ref;
17179 }
17180
17181 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_ok(int64_t o) {
17182         LDKRecipientOnionFields o_conv;
17183         o_conv.inner = untag_ptr(o);
17184         o_conv.is_owned = ptr_is_owned(o);
17185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17186         o_conv = RecipientOnionFields_clone(&o_conv);
17187         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17188         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
17189         return tag_ptr(ret_conv, true);
17190 }
17191
17192 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_err(int64_t e) {
17193         void* e_ptr = untag_ptr(e);
17194         CHECK_ACCESS(e_ptr);
17195         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17196         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17197         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17198         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
17199         return tag_ptr(ret_conv, true);
17200 }
17201
17202 jboolean  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(int64_t o) {
17203         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
17204         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
17205         return ret_conv;
17206 }
17207
17208 void  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_free(int64_t _res) {
17209         if (!ptr_is_owned(_res)) return;
17210         void* _res_ptr = untag_ptr(_res);
17211         CHECK_ACCESS(_res_ptr);
17212         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
17213         FREE(untag_ptr(_res));
17214         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
17215 }
17216
17217 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
17218         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17219         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
17220         return tag_ptr(ret_conv, true);
17221 }
17222 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
17223         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
17224         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
17225         return ret_conv;
17226 }
17227
17228 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone(int64_t orig) {
17229         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
17230         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
17231         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
17232         return tag_ptr(ret_conv, true);
17233 }
17234
17235 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
17236         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17237         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
17238         return tag_ptr(ret_conv, true);
17239 }
17240 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone_ptr(int64_t arg) {
17241         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
17242         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
17243         return ret_conv;
17244 }
17245
17246 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone(int64_t orig) {
17247         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
17248         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17249         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
17250         return tag_ptr(ret_conv, true);
17251 }
17252
17253 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
17254         LDKCVec_u8Z b_ref;
17255         b_ref.datalen = b->arr_len;
17256         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17257         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17258         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
17259         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
17260         return tag_ptr(ret_conv, true);
17261 }
17262
17263 void  CS_LDK_C2Tuple_u64CVec_u8ZZ_free(int64_t _res) {
17264         if (!ptr_is_owned(_res)) return;
17265         void* _res_ptr = untag_ptr(_res);
17266         CHECK_ACCESS(_res_ptr);
17267         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
17268         FREE(untag_ptr(_res));
17269         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
17270 }
17271
17272 void  CS_LDK_CVec_C2Tuple_u64CVec_u8ZZZ_free(int64_tArray _res) {
17273         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
17274         _res_constr.datalen = _res->arr_len;
17275         if (_res_constr.datalen > 0)
17276                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
17277         else
17278                 _res_constr.data = NULL;
17279         int64_t* _res_vals = _res->elems;
17280         for (size_t x = 0; x < _res_constr.datalen; x++) {
17281                 int64_t _res_conv_23 = _res_vals[x];
17282                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
17283                 CHECK_ACCESS(_res_conv_23_ptr);
17284                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
17285                 FREE(untag_ptr(_res_conv_23));
17286                 _res_constr.data[x] = _res_conv_23_conv;
17287         }
17288         FREE(_res);
17289         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
17290 }
17291
17292 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_ok(int64_t o) {
17293         LDKRecipientOnionFields o_conv;
17294         o_conv.inner = untag_ptr(o);
17295         o_conv.is_owned = ptr_is_owned(o);
17296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17297         o_conv = RecipientOnionFields_clone(&o_conv);
17298         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17299         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
17300         return tag_ptr(ret_conv, true);
17301 }
17302
17303 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_err() {
17304         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17305         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
17306         return tag_ptr(ret_conv, true);
17307 }
17308
17309 jboolean  CS_LDK_CResult_RecipientOnionFieldsNoneZ_is_ok(int64_t o) {
17310         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
17311         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
17312         return ret_conv;
17313 }
17314
17315 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_free(int64_t _res) {
17316         if (!ptr_is_owned(_res)) return;
17317         void* _res_ptr = untag_ptr(_res);
17318         CHECK_ACCESS(_res_ptr);
17319         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
17320         FREE(untag_ptr(_res));
17321         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
17322 }
17323
17324 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
17325         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17326         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
17327         return tag_ptr(ret_conv, true);
17328 }
17329 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone_ptr(int64_t arg) {
17330         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
17331         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
17332         return ret_conv;
17333 }
17334
17335 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone(int64_t orig) {
17336         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
17337         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
17338         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
17339         return tag_ptr(ret_conv, true);
17340 }
17341
17342 void  CS_LDK_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
17343         LDKCVec_ThirtyTwoBytesZ _res_constr;
17344         _res_constr.datalen = _res->arr_len;
17345         if (_res_constr.datalen > 0)
17346                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17347         else
17348                 _res_constr.data = NULL;
17349         int8_tArray* _res_vals = (void*) _res->elems;
17350         for (size_t i = 0; i < _res_constr.datalen; i++) {
17351                 int8_tArray _res_conv_8 = _res_vals[i];
17352                 LDKThirtyTwoBytes _res_conv_8_ref;
17353                 CHECK(_res_conv_8->arr_len == 32);
17354                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, 32); FREE(_res_conv_8);
17355                 _res_constr.data[i] = _res_conv_8_ref;
17356         }
17357         FREE(_res);
17358         CVec_ThirtyTwoBytesZ_free(_res_constr);
17359 }
17360
17361 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
17362         LDKCVec_ThirtyTwoBytesZ o_constr;
17363         o_constr.datalen = o->arr_len;
17364         if (o_constr.datalen > 0)
17365                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
17366         else
17367                 o_constr.data = NULL;
17368         int8_tArray* o_vals = (void*) o->elems;
17369         for (size_t i = 0; i < o_constr.datalen; i++) {
17370                 int8_tArray o_conv_8 = o_vals[i];
17371                 LDKThirtyTwoBytes o_conv_8_ref;
17372                 CHECK(o_conv_8->arr_len == 32);
17373                 memcpy(o_conv_8_ref.data, o_conv_8->elems, 32); FREE(o_conv_8);
17374                 o_constr.data[i] = o_conv_8_ref;
17375         }
17376         FREE(o);
17377         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17378         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
17379         int64_t ret_ref = tag_ptr(ret_copy, true);
17380         return ret_ref;
17381 }
17382
17383 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_none() {
17384         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17385         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
17386         int64_t ret_ref = tag_ptr(ret_copy, true);
17387         return ret_ref;
17388 }
17389
17390 void  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_free(int64_t _res) {
17391         if (!ptr_is_owned(_res)) return;
17392         void* _res_ptr = untag_ptr(_res);
17393         CHECK_ACCESS(_res_ptr);
17394         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
17395         FREE(untag_ptr(_res));
17396         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
17397 }
17398
17399 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
17400         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17401         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
17402         int64_t ret_ref = tag_ptr(ret_copy, true);
17403         return ret_ref;
17404 }
17405 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
17406         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
17407         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
17408         return ret_conv;
17409 }
17410
17411 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone(int64_t orig) {
17412         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
17413         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
17414         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
17415         int64_t ret_ref = tag_ptr(ret_copy, true);
17416         return ret_ref;
17417 }
17418
17419 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
17420         LDKThirtyTwoBytes o_ref;
17421         CHECK(o->arr_len == 32);
17422         memcpy(o_ref.data, o->elems, 32); FREE(o);
17423         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17424         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
17425         return tag_ptr(ret_conv, true);
17426 }
17427
17428 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_err() {
17429         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17430         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
17431         return tag_ptr(ret_conv, true);
17432 }
17433
17434 jboolean  CS_LDK_CResult_ThirtyTwoBytesNoneZ_is_ok(int64_t o) {
17435         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
17436         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
17437         return ret_conv;
17438 }
17439
17440 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_free(int64_t _res) {
17441         if (!ptr_is_owned(_res)) return;
17442         void* _res_ptr = untag_ptr(_res);
17443         CHECK_ACCESS(_res_ptr);
17444         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
17445         FREE(untag_ptr(_res));
17446         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
17447 }
17448
17449 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
17450         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17451         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
17452         return tag_ptr(ret_conv, true);
17453 }
17454 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone_ptr(int64_t arg) {
17455         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
17456         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
17457         return ret_conv;
17458 }
17459
17460 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone(int64_t orig) {
17461         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
17462         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
17463         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
17464         return tag_ptr(ret_conv, true);
17465 }
17466
17467 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_ok(int64_t o) {
17468         LDKBlindedPayInfo o_conv;
17469         o_conv.inner = untag_ptr(o);
17470         o_conv.is_owned = ptr_is_owned(o);
17471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17472         o_conv = BlindedPayInfo_clone(&o_conv);
17473         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17474         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
17475         return tag_ptr(ret_conv, true);
17476 }
17477
17478 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_err(int64_t e) {
17479         void* e_ptr = untag_ptr(e);
17480         CHECK_ACCESS(e_ptr);
17481         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17482         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17483         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17484         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
17485         return tag_ptr(ret_conv, true);
17486 }
17487
17488 jboolean  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_is_ok(int64_t o) {
17489         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
17490         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
17491         return ret_conv;
17492 }
17493
17494 void  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_free(int64_t _res) {
17495         if (!ptr_is_owned(_res)) return;
17496         void* _res_ptr = untag_ptr(_res);
17497         CHECK_ACCESS(_res_ptr);
17498         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
17499         FREE(untag_ptr(_res));
17500         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
17501 }
17502
17503 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
17504         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17505         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
17506         return tag_ptr(ret_conv, true);
17507 }
17508 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(int64_t arg) {
17509         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
17510         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
17511         return ret_conv;
17512 }
17513
17514 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone(int64_t orig) {
17515         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
17516         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
17517         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
17518         return tag_ptr(ret_conv, true);
17519 }
17520
17521 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17522         LDKDelayedPaymentOutputDescriptor o_conv;
17523         o_conv.inner = untag_ptr(o);
17524         o_conv.is_owned = ptr_is_owned(o);
17525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17526         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17527         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17528         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17529         return tag_ptr(ret_conv, true);
17530 }
17531
17532 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
17533         void* e_ptr = untag_ptr(e);
17534         CHECK_ACCESS(e_ptr);
17535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17537         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17538         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17539         return tag_ptr(ret_conv, true);
17540 }
17541
17542 jboolean  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17543         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17544         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17545         return ret_conv;
17546 }
17547
17548 void  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17549         if (!ptr_is_owned(_res)) return;
17550         void* _res_ptr = untag_ptr(_res);
17551         CHECK_ACCESS(_res_ptr);
17552         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17553         FREE(untag_ptr(_res));
17554         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17555 }
17556
17557 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17558         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17559         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17560         return tag_ptr(ret_conv, true);
17561 }
17562 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17563         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17564         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17565         return ret_conv;
17566 }
17567
17568 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17569         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17570         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17571         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17572         return tag_ptr(ret_conv, true);
17573 }
17574
17575 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17576         LDKStaticPaymentOutputDescriptor o_conv;
17577         o_conv.inner = untag_ptr(o);
17578         o_conv.is_owned = ptr_is_owned(o);
17579         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17580         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17581         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17582         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17583         return tag_ptr(ret_conv, true);
17584 }
17585
17586 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
17587         void* e_ptr = untag_ptr(e);
17588         CHECK_ACCESS(e_ptr);
17589         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17590         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17591         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17592         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17593         return tag_ptr(ret_conv, true);
17594 }
17595
17596 jboolean  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17597         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17598         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17599         return ret_conv;
17600 }
17601
17602 void  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17603         if (!ptr_is_owned(_res)) return;
17604         void* _res_ptr = untag_ptr(_res);
17605         CHECK_ACCESS(_res_ptr);
17606         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17607         FREE(untag_ptr(_res));
17608         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17609 }
17610
17611 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17612         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17613         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17614         return tag_ptr(ret_conv, true);
17615 }
17616 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17617         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17618         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17619         return ret_conv;
17620 }
17621
17622 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17623         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17624         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17625         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17626         return tag_ptr(ret_conv, true);
17627 }
17628
17629 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(int64_t o) {
17630         void* o_ptr = untag_ptr(o);
17631         CHECK_ACCESS(o_ptr);
17632         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17633         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17634         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17635         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17636         return tag_ptr(ret_conv, true);
17637 }
17638
17639 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_err(int64_t e) {
17640         void* e_ptr = untag_ptr(e);
17641         CHECK_ACCESS(e_ptr);
17642         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17643         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17644         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17645         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17646         return tag_ptr(ret_conv, true);
17647 }
17648
17649 jboolean  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
17650         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17651         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17652         return ret_conv;
17653 }
17654
17655 void  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_free(int64_t _res) {
17656         if (!ptr_is_owned(_res)) return;
17657         void* _res_ptr = untag_ptr(_res);
17658         CHECK_ACCESS(_res_ptr);
17659         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17660         FREE(untag_ptr(_res));
17661         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17662 }
17663
17664 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17665         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17666         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17667         return tag_ptr(ret_conv, true);
17668 }
17669 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17670         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17671         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17672         return ret_conv;
17673 }
17674
17675 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
17676         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17677         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17678         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17679         return tag_ptr(ret_conv, true);
17680 }
17681
17682 void  CS_LDK_CVec_SpendableOutputDescriptorZ_free(int64_tArray _res) {
17683         LDKCVec_SpendableOutputDescriptorZ _res_constr;
17684         _res_constr.datalen = _res->arr_len;
17685         if (_res_constr.datalen > 0)
17686                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17687         else
17688                 _res_constr.data = NULL;
17689         int64_t* _res_vals = _res->elems;
17690         for (size_t b = 0; b < _res_constr.datalen; b++) {
17691                 int64_t _res_conv_27 = _res_vals[b];
17692                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
17693                 CHECK_ACCESS(_res_conv_27_ptr);
17694                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
17695                 FREE(untag_ptr(_res_conv_27));
17696                 _res_constr.data[b] = _res_conv_27_conv;
17697         }
17698         FREE(_res);
17699         CVec_SpendableOutputDescriptorZ_free(_res_constr);
17700 }
17701
17702 void  CS_LDK_CVec_TxOutZ_free(int64_tArray _res) {
17703         LDKCVec_TxOutZ _res_constr;
17704         _res_constr.datalen = _res->arr_len;
17705         if (_res_constr.datalen > 0)
17706                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17707         else
17708                 _res_constr.data = NULL;
17709         int64_t* _res_vals = _res->elems;
17710         for (size_t h = 0; h < _res_constr.datalen; h++) {
17711                 int64_t _res_conv_7 = _res_vals[h];
17712                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17713                 CHECK_ACCESS(_res_conv_7_ptr);
17714                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17715                 FREE(untag_ptr(_res_conv_7));
17716                 _res_constr.data[h] = _res_conv_7_conv;
17717         }
17718         FREE(_res);
17719         CVec_TxOutZ_free(_res_constr);
17720 }
17721
17722 int64_t  CS_LDK_COption_u32Z_some(int32_t o) {
17723         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17724         *ret_copy = COption_u32Z_some(o);
17725         int64_t ret_ref = tag_ptr(ret_copy, true);
17726         return ret_ref;
17727 }
17728
17729 int64_t  CS_LDK_COption_u32Z_none() {
17730         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17731         *ret_copy = COption_u32Z_none();
17732         int64_t ret_ref = tag_ptr(ret_copy, true);
17733         return ret_ref;
17734 }
17735
17736 void  CS_LDK_COption_u32Z_free(int64_t _res) {
17737         if (!ptr_is_owned(_res)) return;
17738         void* _res_ptr = untag_ptr(_res);
17739         CHECK_ACCESS(_res_ptr);
17740         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
17741         FREE(untag_ptr(_res));
17742         COption_u32Z_free(_res_conv);
17743 }
17744
17745 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
17746         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17747         *ret_copy = COption_u32Z_clone(arg);
17748         int64_t ret_ref = tag_ptr(ret_copy, true);
17749         return ret_ref;
17750 }
17751 int64_t  CS_LDK_COption_u32Z_clone_ptr(int64_t arg) {
17752         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
17753         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
17754         return ret_conv;
17755 }
17756
17757 int64_t  CS_LDK_COption_u32Z_clone(int64_t orig) {
17758         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
17759         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17760         *ret_copy = COption_u32Z_clone(orig_conv);
17761         int64_t ret_ref = tag_ptr(ret_copy, true);
17762         return ret_ref;
17763 }
17764
17765 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
17766         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17767         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
17768         return tag_ptr(ret_conv, true);
17769 }
17770 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone_ptr(int64_t arg) {
17771         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
17772         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
17773         return ret_conv;
17774 }
17775
17776 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone(int64_t orig) {
17777         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
17778         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17779         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
17780         return tag_ptr(ret_conv, true);
17781 }
17782
17783 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
17784         LDKCVec_u8Z a_ref;
17785         a_ref.datalen = a->arr_len;
17786         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
17787         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
17788         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
17789         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
17790         return tag_ptr(ret_conv, true);
17791 }
17792
17793 void  CS_LDK_C2Tuple_CVec_u8Zu64Z_free(int64_t _res) {
17794         if (!ptr_is_owned(_res)) return;
17795         void* _res_ptr = untag_ptr(_res);
17796         CHECK_ACCESS(_res_ptr);
17797         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
17798         FREE(untag_ptr(_res));
17799         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
17800 }
17801
17802 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(int64_t o) {
17803         void* o_ptr = untag_ptr(o);
17804         CHECK_ACCESS(o_ptr);
17805         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
17806         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
17807         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17808         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
17809         return tag_ptr(ret_conv, true);
17810 }
17811
17812 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
17813         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17814         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
17815         return tag_ptr(ret_conv, true);
17816 }
17817
17818 jboolean  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(int64_t o) {
17819         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
17820         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
17821         return ret_conv;
17822 }
17823
17824 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(int64_t _res) {
17825         if (!ptr_is_owned(_res)) return;
17826         void* _res_ptr = untag_ptr(_res);
17827         CHECK_ACCESS(_res_ptr);
17828         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
17829         FREE(untag_ptr(_res));
17830         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
17831 }
17832
17833 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
17834         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17835         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
17836         return tag_ptr(ret_conv, true);
17837 }
17838 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(int64_t arg) {
17839         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
17840         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
17841         return ret_conv;
17842 }
17843
17844 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(int64_t orig) {
17845         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
17846         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
17847         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
17848         return tag_ptr(ret_conv, true);
17849 }
17850
17851 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_ok(int64_t o) {
17852         LDKChannelDerivationParameters o_conv;
17853         o_conv.inner = untag_ptr(o);
17854         o_conv.is_owned = ptr_is_owned(o);
17855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17856         o_conv = ChannelDerivationParameters_clone(&o_conv);
17857         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17858         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
17859         return tag_ptr(ret_conv, true);
17860 }
17861
17862 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_err(int64_t e) {
17863         void* e_ptr = untag_ptr(e);
17864         CHECK_ACCESS(e_ptr);
17865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17867         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17868         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
17869         return tag_ptr(ret_conv, true);
17870 }
17871
17872 jboolean  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(int64_t o) {
17873         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
17874         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
17875         return ret_conv;
17876 }
17877
17878 void  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_free(int64_t _res) {
17879         if (!ptr_is_owned(_res)) return;
17880         void* _res_ptr = untag_ptr(_res);
17881         CHECK_ACCESS(_res_ptr);
17882         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
17883         FREE(untag_ptr(_res));
17884         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
17885 }
17886
17887 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
17888         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17889         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
17890         return tag_ptr(ret_conv, true);
17891 }
17892 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(int64_t arg) {
17893         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
17894         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
17895         return ret_conv;
17896 }
17897
17898 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone(int64_t orig) {
17899         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
17900         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
17901         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
17902         return tag_ptr(ret_conv, true);
17903 }
17904
17905 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_ok(int64_t o) {
17906         LDKHTLCDescriptor o_conv;
17907         o_conv.inner = untag_ptr(o);
17908         o_conv.is_owned = ptr_is_owned(o);
17909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17910         o_conv = HTLCDescriptor_clone(&o_conv);
17911         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17912         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
17913         return tag_ptr(ret_conv, true);
17914 }
17915
17916 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_err(int64_t e) {
17917         void* e_ptr = untag_ptr(e);
17918         CHECK_ACCESS(e_ptr);
17919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17921         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17922         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
17923         return tag_ptr(ret_conv, true);
17924 }
17925
17926 jboolean  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_is_ok(int64_t o) {
17927         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
17928         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
17929         return ret_conv;
17930 }
17931
17932 void  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_free(int64_t _res) {
17933         if (!ptr_is_owned(_res)) return;
17934         void* _res_ptr = untag_ptr(_res);
17935         CHECK_ACCESS(_res_ptr);
17936         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
17937         FREE(untag_ptr(_res));
17938         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
17939 }
17940
17941 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17942         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17943         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
17944         return tag_ptr(ret_conv, true);
17945 }
17946 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
17947         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
17948         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17949         return ret_conv;
17950 }
17951
17952 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone(int64_t orig) {
17953         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
17954         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
17955         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
17956         return tag_ptr(ret_conv, true);
17957 }
17958
17959 int64_t  CS_LDK_CResult_NoneNoneZ_ok() {
17960         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17961         *ret_conv = CResult_NoneNoneZ_ok();
17962         return tag_ptr(ret_conv, true);
17963 }
17964
17965 int64_t  CS_LDK_CResult_NoneNoneZ_err() {
17966         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17967         *ret_conv = CResult_NoneNoneZ_err();
17968         return tag_ptr(ret_conv, true);
17969 }
17970
17971 jboolean  CS_LDK_CResult_NoneNoneZ_is_ok(int64_t o) {
17972         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
17973         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
17974         return ret_conv;
17975 }
17976
17977 void  CS_LDK_CResult_NoneNoneZ_free(int64_t _res) {
17978         if (!ptr_is_owned(_res)) return;
17979         void* _res_ptr = untag_ptr(_res);
17980         CHECK_ACCESS(_res_ptr);
17981         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
17982         FREE(untag_ptr(_res));
17983         CResult_NoneNoneZ_free(_res_conv);
17984 }
17985
17986 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
17987         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17988         *ret_conv = CResult_NoneNoneZ_clone(arg);
17989         return tag_ptr(ret_conv, true);
17990 }
17991 int64_t  CS_LDK_CResult_NoneNoneZ_clone_ptr(int64_t arg) {
17992         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
17993         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
17994         return ret_conv;
17995 }
17996
17997 int64_t  CS_LDK_CResult_NoneNoneZ_clone(int64_t orig) {
17998         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
17999         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18000         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
18001         return tag_ptr(ret_conv, true);
18002 }
18003
18004 int64_t  CS_LDK_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
18005         LDKPublicKey o_ref;
18006         CHECK(o->arr_len == 33);
18007         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
18008         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18009         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
18010         return tag_ptr(ret_conv, true);
18011 }
18012
18013 int64_t  CS_LDK_CResult_PublicKeyNoneZ_err() {
18014         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18015         *ret_conv = CResult_PublicKeyNoneZ_err();
18016         return tag_ptr(ret_conv, true);
18017 }
18018
18019 jboolean  CS_LDK_CResult_PublicKeyNoneZ_is_ok(int64_t o) {
18020         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
18021         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
18022         return ret_conv;
18023 }
18024
18025 void  CS_LDK_CResult_PublicKeyNoneZ_free(int64_t _res) {
18026         if (!ptr_is_owned(_res)) return;
18027         void* _res_ptr = untag_ptr(_res);
18028         CHECK_ACCESS(_res_ptr);
18029         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
18030         FREE(untag_ptr(_res));
18031         CResult_PublicKeyNoneZ_free(_res_conv);
18032 }
18033
18034 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
18035         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18036         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
18037         return tag_ptr(ret_conv, true);
18038 }
18039 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone_ptr(int64_t arg) {
18040         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
18041         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
18042         return ret_conv;
18043 }
18044
18045 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone(int64_t orig) {
18046         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
18047         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
18048         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
18049         return tag_ptr(ret_conv, true);
18050 }
18051
18052 int64_t  CS_LDK_COption_BigEndianScalarZ_some(int64_t o) {
18053         void* o_ptr = untag_ptr(o);
18054         CHECK_ACCESS(o_ptr);
18055         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
18056         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
18057         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18058         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
18059         int64_t ret_ref = tag_ptr(ret_copy, true);
18060         return ret_ref;
18061 }
18062
18063 int64_t  CS_LDK_COption_BigEndianScalarZ_none() {
18064         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18065         *ret_copy = COption_BigEndianScalarZ_none();
18066         int64_t ret_ref = tag_ptr(ret_copy, true);
18067         return ret_ref;
18068 }
18069
18070 void  CS_LDK_COption_BigEndianScalarZ_free(int64_t _res) {
18071         if (!ptr_is_owned(_res)) return;
18072         void* _res_ptr = untag_ptr(_res);
18073         CHECK_ACCESS(_res_ptr);
18074         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
18075         FREE(untag_ptr(_res));
18076         COption_BigEndianScalarZ_free(_res_conv);
18077 }
18078
18079 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
18080         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18081         *ret_copy = COption_BigEndianScalarZ_clone(arg);
18082         int64_t ret_ref = tag_ptr(ret_copy, true);
18083         return ret_ref;
18084 }
18085 int64_t  CS_LDK_COption_BigEndianScalarZ_clone_ptr(int64_t arg) {
18086         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
18087         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
18088         return ret_conv;
18089 }
18090
18091 int64_t  CS_LDK_COption_BigEndianScalarZ_clone(int64_t orig) {
18092         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
18093         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
18094         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
18095         int64_t ret_ref = tag_ptr(ret_copy, true);
18096         return ret_ref;
18097 }
18098
18099 void  CS_LDK_CVec_U5Z_free(ptrArray _res) {
18100         LDKCVec_U5Z _res_constr;
18101         _res_constr.datalen = _res->arr_len;
18102         if (_res_constr.datalen > 0)
18103                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
18104         else
18105                 _res_constr.data = NULL;
18106         int8_t* _res_vals = (void*) _res->elems;
18107         for (size_t h = 0; h < _res_constr.datalen; h++) {
18108                 int8_t _res_conv_7 = _res_vals[h];
18109                 
18110                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
18111         }
18112         FREE(_res);
18113         CVec_U5Z_free(_res_constr);
18114 }
18115
18116 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
18117         LDKRecoverableSignature o_ref;
18118         CHECK(o->arr_len == 68);
18119         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
18120         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18121         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
18122         return tag_ptr(ret_conv, true);
18123 }
18124
18125 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_err() {
18126         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18127         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
18128         return tag_ptr(ret_conv, true);
18129 }
18130
18131 jboolean  CS_LDK_CResult_RecoverableSignatureNoneZ_is_ok(int64_t o) {
18132         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
18133         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
18134         return ret_conv;
18135 }
18136
18137 void  CS_LDK_CResult_RecoverableSignatureNoneZ_free(int64_t _res) {
18138         if (!ptr_is_owned(_res)) return;
18139         void* _res_ptr = untag_ptr(_res);
18140         CHECK_ACCESS(_res_ptr);
18141         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
18142         FREE(untag_ptr(_res));
18143         CResult_RecoverableSignatureNoneZ_free(_res_conv);
18144 }
18145
18146 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
18147         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18148         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
18149         return tag_ptr(ret_conv, true);
18150 }
18151 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone_ptr(int64_t arg) {
18152         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
18153         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18154         return ret_conv;
18155 }
18156
18157 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone(int64_t orig) {
18158         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
18159         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18160         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18161         return tag_ptr(ret_conv, true);
18162 }
18163
18164 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
18165         LDKSchnorrSignature o_ref;
18166         CHECK(o->arr_len == 64);
18167         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18168         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18169         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
18170         return tag_ptr(ret_conv, true);
18171 }
18172
18173 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_err() {
18174         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18175         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
18176         return tag_ptr(ret_conv, true);
18177 }
18178
18179 jboolean  CS_LDK_CResult_SchnorrSignatureNoneZ_is_ok(int64_t o) {
18180         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
18181         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
18182         return ret_conv;
18183 }
18184
18185 void  CS_LDK_CResult_SchnorrSignatureNoneZ_free(int64_t _res) {
18186         if (!ptr_is_owned(_res)) return;
18187         void* _res_ptr = untag_ptr(_res);
18188         CHECK_ACCESS(_res_ptr);
18189         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
18190         FREE(untag_ptr(_res));
18191         CResult_SchnorrSignatureNoneZ_free(_res_conv);
18192 }
18193
18194 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
18195         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18196         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
18197         return tag_ptr(ret_conv, true);
18198 }
18199 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone_ptr(int64_t arg) {
18200         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
18201         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
18202         return ret_conv;
18203 }
18204
18205 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone(int64_t orig) {
18206         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
18207         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
18208         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
18209         return tag_ptr(ret_conv, true);
18210 }
18211
18212 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
18213         LDKECDSASignature o_ref;
18214         CHECK(o->arr_len == 64);
18215         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
18216         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18217         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
18218         return tag_ptr(ret_conv, true);
18219 }
18220
18221 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_err() {
18222         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18223         *ret_conv = CResult_ECDSASignatureNoneZ_err();
18224         return tag_ptr(ret_conv, true);
18225 }
18226
18227 jboolean  CS_LDK_CResult_ECDSASignatureNoneZ_is_ok(int64_t o) {
18228         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
18229         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
18230         return ret_conv;
18231 }
18232
18233 void  CS_LDK_CResult_ECDSASignatureNoneZ_free(int64_t _res) {
18234         if (!ptr_is_owned(_res)) return;
18235         void* _res_ptr = untag_ptr(_res);
18236         CHECK_ACCESS(_res_ptr);
18237         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
18238         FREE(untag_ptr(_res));
18239         CResult_ECDSASignatureNoneZ_free(_res_conv);
18240 }
18241
18242 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
18243         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18244         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
18245         return tag_ptr(ret_conv, true);
18246 }
18247 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone_ptr(int64_t arg) {
18248         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
18249         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
18250         return ret_conv;
18251 }
18252
18253 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone(int64_t orig) {
18254         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
18255         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
18256         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
18257         return tag_ptr(ret_conv, true);
18258 }
18259
18260 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(int64_t o) {
18261         void* o_ptr = untag_ptr(o);
18262         CHECK_ACCESS(o_ptr);
18263         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
18264         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
18265                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18266                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
18267         }
18268         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18269         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
18270         return tag_ptr(ret_conv, true);
18271 }
18272
18273 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(int64_t e) {
18274         void* e_ptr = untag_ptr(e);
18275         CHECK_ACCESS(e_ptr);
18276         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18277         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18278         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18279         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
18280         return tag_ptr(ret_conv, true);
18281 }
18282
18283 jboolean  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(int64_t o) {
18284         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
18285         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
18286         return ret_conv;
18287 }
18288
18289 void  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(int64_t _res) {
18290         if (!ptr_is_owned(_res)) return;
18291         void* _res_ptr = untag_ptr(_res);
18292         CHECK_ACCESS(_res_ptr);
18293         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
18294         FREE(untag_ptr(_res));
18295         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
18296 }
18297
18298 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
18299         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18300         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
18301         return tag_ptr(ret_conv, true);
18302 }
18303 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(int64_t arg) {
18304         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
18305         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
18306         return ret_conv;
18307 }
18308
18309 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(int64_t orig) {
18310         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
18311         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
18312         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
18313         return tag_ptr(ret_conv, true);
18314 }
18315
18316 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
18317         LDKCVec_u8Z o_ref;
18318         o_ref.datalen = o->arr_len;
18319         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18320         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18321         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18322         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
18323         return tag_ptr(ret_conv, true);
18324 }
18325
18326 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_err() {
18327         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18328         *ret_conv = CResult_CVec_u8ZNoneZ_err();
18329         return tag_ptr(ret_conv, true);
18330 }
18331
18332 jboolean  CS_LDK_CResult_CVec_u8ZNoneZ_is_ok(int64_t o) {
18333         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
18334         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
18335         return ret_conv;
18336 }
18337
18338 void  CS_LDK_CResult_CVec_u8ZNoneZ_free(int64_t _res) {
18339         if (!ptr_is_owned(_res)) return;
18340         void* _res_ptr = untag_ptr(_res);
18341         CHECK_ACCESS(_res_ptr);
18342         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
18343         FREE(untag_ptr(_res));
18344         CResult_CVec_u8ZNoneZ_free(_res_conv);
18345 }
18346
18347 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
18348         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18349         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
18350         return tag_ptr(ret_conv, true);
18351 }
18352 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone_ptr(int64_t arg) {
18353         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
18354         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
18355         return ret_conv;
18356 }
18357
18358 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone(int64_t orig) {
18359         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
18360         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18361         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
18362         return tag_ptr(ret_conv, true);
18363 }
18364
18365 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_ok(int64_t o) {
18366         LDKShutdownScript o_conv;
18367         o_conv.inner = untag_ptr(o);
18368         o_conv.is_owned = ptr_is_owned(o);
18369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18370         o_conv = ShutdownScript_clone(&o_conv);
18371         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18372         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_err() {
18377         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18378         *ret_conv = CResult_ShutdownScriptNoneZ_err();
18379         return tag_ptr(ret_conv, true);
18380 }
18381
18382 jboolean  CS_LDK_CResult_ShutdownScriptNoneZ_is_ok(int64_t o) {
18383         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
18384         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
18385         return ret_conv;
18386 }
18387
18388 void  CS_LDK_CResult_ShutdownScriptNoneZ_free(int64_t _res) {
18389         if (!ptr_is_owned(_res)) return;
18390         void* _res_ptr = untag_ptr(_res);
18391         CHECK_ACCESS(_res_ptr);
18392         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
18393         FREE(untag_ptr(_res));
18394         CResult_ShutdownScriptNoneZ_free(_res_conv);
18395 }
18396
18397 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
18398         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18399         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
18400         return tag_ptr(ret_conv, true);
18401 }
18402 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone_ptr(int64_t arg) {
18403         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
18404         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
18405         return ret_conv;
18406 }
18407
18408 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone(int64_t orig) {
18409         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
18410         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
18411         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
18412         return tag_ptr(ret_conv, true);
18413 }
18414
18415 int64_t  CS_LDK_COption_u16Z_some(int16_t o) {
18416         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18417         *ret_copy = COption_u16Z_some(o);
18418         int64_t ret_ref = tag_ptr(ret_copy, true);
18419         return ret_ref;
18420 }
18421
18422 int64_t  CS_LDK_COption_u16Z_none() {
18423         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18424         *ret_copy = COption_u16Z_none();
18425         int64_t ret_ref = tag_ptr(ret_copy, true);
18426         return ret_ref;
18427 }
18428
18429 void  CS_LDK_COption_u16Z_free(int64_t _res) {
18430         if (!ptr_is_owned(_res)) return;
18431         void* _res_ptr = untag_ptr(_res);
18432         CHECK_ACCESS(_res_ptr);
18433         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18434         FREE(untag_ptr(_res));
18435         COption_u16Z_free(_res_conv);
18436 }
18437
18438 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18439         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18440         *ret_copy = COption_u16Z_clone(arg);
18441         int64_t ret_ref = tag_ptr(ret_copy, true);
18442         return ret_ref;
18443 }
18444 int64_t  CS_LDK_COption_u16Z_clone_ptr(int64_t arg) {
18445         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18446         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18447         return ret_conv;
18448 }
18449
18450 int64_t  CS_LDK_COption_u16Z_clone(int64_t orig) {
18451         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18452         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18453         *ret_copy = COption_u16Z_clone(orig_conv);
18454         int64_t ret_ref = tag_ptr(ret_copy, true);
18455         return ret_ref;
18456 }
18457
18458 int64_t  CS_LDK_COption_boolZ_some(jboolean o) {
18459         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18460         *ret_copy = COption_boolZ_some(o);
18461         int64_t ret_ref = tag_ptr(ret_copy, true);
18462         return ret_ref;
18463 }
18464
18465 int64_t  CS_LDK_COption_boolZ_none() {
18466         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18467         *ret_copy = COption_boolZ_none();
18468         int64_t ret_ref = tag_ptr(ret_copy, true);
18469         return ret_ref;
18470 }
18471
18472 void  CS_LDK_COption_boolZ_free(int64_t _res) {
18473         if (!ptr_is_owned(_res)) return;
18474         void* _res_ptr = untag_ptr(_res);
18475         CHECK_ACCESS(_res_ptr);
18476         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
18477         FREE(untag_ptr(_res));
18478         COption_boolZ_free(_res_conv);
18479 }
18480
18481 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
18482         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18483         *ret_copy = COption_boolZ_clone(arg);
18484         int64_t ret_ref = tag_ptr(ret_copy, true);
18485         return ret_ref;
18486 }
18487 int64_t  CS_LDK_COption_boolZ_clone_ptr(int64_t arg) {
18488         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
18489         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
18490         return ret_conv;
18491 }
18492
18493 int64_t  CS_LDK_COption_boolZ_clone(int64_t orig) {
18494         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
18495         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
18496         *ret_copy = COption_boolZ_clone(orig_conv);
18497         int64_t ret_ref = tag_ptr(ret_copy, true);
18498         return ret_ref;
18499 }
18500
18501 int64_t  CS_LDK_CResult_WitnessNoneZ_ok(int8_tArray o) {
18502         LDKWitness o_ref;
18503         o_ref.datalen = o->arr_len;
18504         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
18505         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18506         o_ref.data_is_owned = true;
18507         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18508         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
18509         return tag_ptr(ret_conv, true);
18510 }
18511
18512 int64_t  CS_LDK_CResult_WitnessNoneZ_err() {
18513         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18514         *ret_conv = CResult_WitnessNoneZ_err();
18515         return tag_ptr(ret_conv, true);
18516 }
18517
18518 jboolean  CS_LDK_CResult_WitnessNoneZ_is_ok(int64_t o) {
18519         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
18520         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
18521         return ret_conv;
18522 }
18523
18524 void  CS_LDK_CResult_WitnessNoneZ_free(int64_t _res) {
18525         if (!ptr_is_owned(_res)) return;
18526         void* _res_ptr = untag_ptr(_res);
18527         CHECK_ACCESS(_res_ptr);
18528         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
18529         FREE(untag_ptr(_res));
18530         CResult_WitnessNoneZ_free(_res_conv);
18531 }
18532
18533 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
18534         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18535         *ret_conv = CResult_WitnessNoneZ_clone(arg);
18536         return tag_ptr(ret_conv, true);
18537 }
18538 int64_t  CS_LDK_CResult_WitnessNoneZ_clone_ptr(int64_t arg) {
18539         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
18540         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
18541         return ret_conv;
18542 }
18543
18544 int64_t  CS_LDK_CResult_WitnessNoneZ_clone(int64_t orig) {
18545         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
18546         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
18547         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
18548         return tag_ptr(ret_conv, true);
18549 }
18550
18551 void  CS_LDK_CVec_ECDSASignatureZ_free(ptrArray _res) {
18552         LDKCVec_ECDSASignatureZ _res_constr;
18553         _res_constr.datalen = _res->arr_len;
18554         if (_res_constr.datalen > 0)
18555                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18556         else
18557                 _res_constr.data = NULL;
18558         int8_tArray* _res_vals = (void*) _res->elems;
18559         for (size_t i = 0; i < _res_constr.datalen; i++) {
18560                 int8_tArray _res_conv_8 = _res_vals[i];
18561                 LDKECDSASignature _res_conv_8_ref;
18562                 CHECK(_res_conv_8->arr_len == 64);
18563                 memcpy(_res_conv_8_ref.compact_form, _res_conv_8->elems, 64); FREE(_res_conv_8);
18564                 _res_constr.data[i] = _res_conv_8_ref;
18565         }
18566         FREE(_res);
18567         CVec_ECDSASignatureZ_free(_res_constr);
18568 }
18569
18570 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
18571         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18572         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
18573         return tag_ptr(ret_conv, true);
18574 }
18575 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(int64_t arg) {
18576         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
18577         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
18578         return ret_conv;
18579 }
18580
18581 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(int64_t orig) {
18582         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
18583         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18584         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
18585         return tag_ptr(ret_conv, true);
18586 }
18587
18588 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
18589         LDKECDSASignature a_ref;
18590         CHECK(a->arr_len == 64);
18591         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
18592         LDKCVec_ECDSASignatureZ b_constr;
18593         b_constr.datalen = b->arr_len;
18594         if (b_constr.datalen > 0)
18595                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
18596         else
18597                 b_constr.data = NULL;
18598         int8_tArray* b_vals = (void*) b->elems;
18599         for (size_t i = 0; i < b_constr.datalen; i++) {
18600                 int8_tArray b_conv_8 = b_vals[i];
18601                 LDKECDSASignature b_conv_8_ref;
18602                 CHECK(b_conv_8->arr_len == 64);
18603                 memcpy(b_conv_8_ref.compact_form, b_conv_8->elems, 64); FREE(b_conv_8);
18604                 b_constr.data[i] = b_conv_8_ref;
18605         }
18606         FREE(b);
18607         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
18608         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
18609         return tag_ptr(ret_conv, true);
18610 }
18611
18612 void  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(int64_t _res) {
18613         if (!ptr_is_owned(_res)) return;
18614         void* _res_ptr = untag_ptr(_res);
18615         CHECK_ACCESS(_res_ptr);
18616         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
18617         FREE(untag_ptr(_res));
18618         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
18619 }
18620
18621 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(int64_t o) {
18622         void* o_ptr = untag_ptr(o);
18623         CHECK_ACCESS(o_ptr);
18624         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
18625         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
18626         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18627         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
18628         return tag_ptr(ret_conv, true);
18629 }
18630
18631 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
18632         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18633         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
18634         return tag_ptr(ret_conv, true);
18635 }
18636
18637 jboolean  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(int64_t o) {
18638         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
18639         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
18640         return ret_conv;
18641 }
18642
18643 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(int64_t _res) {
18644         if (!ptr_is_owned(_res)) return;
18645         void* _res_ptr = untag_ptr(_res);
18646         CHECK_ACCESS(_res_ptr);
18647         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
18648         FREE(untag_ptr(_res));
18649         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
18650 }
18651
18652 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
18653         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18654         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
18655         return tag_ptr(ret_conv, true);
18656 }
18657 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(int64_t arg) {
18658         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
18659         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
18660         return ret_conv;
18661 }
18662
18663 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(int64_t orig) {
18664         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
18665         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
18666         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
18667         return tag_ptr(ret_conv, true);
18668 }
18669
18670 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_ok(int64_t o) {
18671         LDKInMemorySigner o_conv;
18672         o_conv.inner = untag_ptr(o);
18673         o_conv.is_owned = ptr_is_owned(o);
18674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18675         o_conv = InMemorySigner_clone(&o_conv);
18676         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18677         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18678         return tag_ptr(ret_conv, true);
18679 }
18680
18681 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_err(int64_t e) {
18682         void* e_ptr = untag_ptr(e);
18683         CHECK_ACCESS(e_ptr);
18684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18686         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18687         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18688         return tag_ptr(ret_conv, true);
18689 }
18690
18691 jboolean  CS_LDK_CResult_InMemorySignerDecodeErrorZ_is_ok(int64_t o) {
18692         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18693         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18694         return ret_conv;
18695 }
18696
18697 void  CS_LDK_CResult_InMemorySignerDecodeErrorZ_free(int64_t _res) {
18698         if (!ptr_is_owned(_res)) return;
18699         void* _res_ptr = untag_ptr(_res);
18700         CHECK_ACCESS(_res_ptr);
18701         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18702         FREE(untag_ptr(_res));
18703         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18704 }
18705
18706 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18707         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18708         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18709         return tag_ptr(ret_conv, true);
18710 }
18711 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone_ptr(int64_t arg) {
18712         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18713         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18714         return ret_conv;
18715 }
18716
18717 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone(int64_t orig) {
18718         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18719         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18720         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18721         return tag_ptr(ret_conv, true);
18722 }
18723
18724 int64_t  CS_LDK_CResult_TransactionNoneZ_ok(int8_tArray o) {
18725         LDKTransaction o_ref;
18726         o_ref.datalen = o->arr_len;
18727         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18728         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18729         o_ref.data_is_owned = true;
18730         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18731         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18732         return tag_ptr(ret_conv, true);
18733 }
18734
18735 int64_t  CS_LDK_CResult_TransactionNoneZ_err() {
18736         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18737         *ret_conv = CResult_TransactionNoneZ_err();
18738         return tag_ptr(ret_conv, true);
18739 }
18740
18741 jboolean  CS_LDK_CResult_TransactionNoneZ_is_ok(int64_t o) {
18742         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18743         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18744         return ret_conv;
18745 }
18746
18747 void  CS_LDK_CResult_TransactionNoneZ_free(int64_t _res) {
18748         if (!ptr_is_owned(_res)) return;
18749         void* _res_ptr = untag_ptr(_res);
18750         CHECK_ACCESS(_res_ptr);
18751         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18752         FREE(untag_ptr(_res));
18753         CResult_TransactionNoneZ_free(_res_conv);
18754 }
18755
18756 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18757         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18758         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18759         return tag_ptr(ret_conv, true);
18760 }
18761 int64_t  CS_LDK_CResult_TransactionNoneZ_clone_ptr(int64_t arg) {
18762         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18763         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18764         return ret_conv;
18765 }
18766
18767 int64_t  CS_LDK_CResult_TransactionNoneZ_clone(int64_t orig) {
18768         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18769         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18770         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18771         return tag_ptr(ret_conv, true);
18772 }
18773
18774 int64_t  CS_LDK_COption_WriteableScoreZ_some(int64_t o) {
18775         void* o_ptr = untag_ptr(o);
18776         CHECK_ACCESS(o_ptr);
18777         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
18778         if (o_conv.free == LDKWriteableScore_JCalls_free) {
18779                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18780                 LDKWriteableScore_JCalls_cloned(&o_conv);
18781         }
18782         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
18783         *ret_copy = COption_WriteableScoreZ_some(o_conv);
18784         int64_t ret_ref = tag_ptr(ret_copy, true);
18785         return ret_ref;
18786 }
18787
18788 int64_t  CS_LDK_COption_WriteableScoreZ_none() {
18789         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
18790         *ret_copy = COption_WriteableScoreZ_none();
18791         int64_t ret_ref = tag_ptr(ret_copy, true);
18792         return ret_ref;
18793 }
18794
18795 void  CS_LDK_COption_WriteableScoreZ_free(int64_t _res) {
18796         if (!ptr_is_owned(_res)) return;
18797         void* _res_ptr = untag_ptr(_res);
18798         CHECK_ACCESS(_res_ptr);
18799         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
18800         FREE(untag_ptr(_res));
18801         COption_WriteableScoreZ_free(_res_conv);
18802 }
18803
18804 int64_t  CS_LDK_CResult_NoneIOErrorZ_ok() {
18805         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18806         *ret_conv = CResult_NoneIOErrorZ_ok();
18807         return tag_ptr(ret_conv, true);
18808 }
18809
18810 int64_t  CS_LDK_CResult_NoneIOErrorZ_err(int32_t e) {
18811         LDKIOError e_conv = LDKIOError_from_cs(e);
18812         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18813         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
18814         return tag_ptr(ret_conv, true);
18815 }
18816
18817 jboolean  CS_LDK_CResult_NoneIOErrorZ_is_ok(int64_t o) {
18818         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
18819         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
18820         return ret_conv;
18821 }
18822
18823 void  CS_LDK_CResult_NoneIOErrorZ_free(int64_t _res) {
18824         if (!ptr_is_owned(_res)) return;
18825         void* _res_ptr = untag_ptr(_res);
18826         CHECK_ACCESS(_res_ptr);
18827         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
18828         FREE(untag_ptr(_res));
18829         CResult_NoneIOErrorZ_free(_res_conv);
18830 }
18831
18832 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
18833         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18834         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
18835         return tag_ptr(ret_conv, true);
18836 }
18837 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone_ptr(int64_t arg) {
18838         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
18839         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
18840         return ret_conv;
18841 }
18842
18843 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone(int64_t orig) {
18844         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
18845         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
18846         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
18847         return tag_ptr(ret_conv, true);
18848 }
18849
18850 void  CS_LDK_CVec_ChannelDetailsZ_free(int64_tArray _res) {
18851         LDKCVec_ChannelDetailsZ _res_constr;
18852         _res_constr.datalen = _res->arr_len;
18853         if (_res_constr.datalen > 0)
18854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18855         else
18856                 _res_constr.data = NULL;
18857         int64_t* _res_vals = _res->elems;
18858         for (size_t q = 0; q < _res_constr.datalen; q++) {
18859                 int64_t _res_conv_16 = _res_vals[q];
18860                 LDKChannelDetails _res_conv_16_conv;
18861                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18862                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18864                 _res_constr.data[q] = _res_conv_16_conv;
18865         }
18866         FREE(_res);
18867         CVec_ChannelDetailsZ_free(_res_constr);
18868 }
18869
18870 int64_t  CS_LDK_CResult_RouteLightningErrorZ_ok(int64_t o) {
18871         LDKRoute o_conv;
18872         o_conv.inner = untag_ptr(o);
18873         o_conv.is_owned = ptr_is_owned(o);
18874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18875         o_conv = Route_clone(&o_conv);
18876         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18877         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
18878         return tag_ptr(ret_conv, true);
18879 }
18880
18881 int64_t  CS_LDK_CResult_RouteLightningErrorZ_err(int64_t e) {
18882         LDKLightningError e_conv;
18883         e_conv.inner = untag_ptr(e);
18884         e_conv.is_owned = ptr_is_owned(e);
18885         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18886         e_conv = LightningError_clone(&e_conv);
18887         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18888         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
18889         return tag_ptr(ret_conv, true);
18890 }
18891
18892 jboolean  CS_LDK_CResult_RouteLightningErrorZ_is_ok(int64_t o) {
18893         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
18894         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
18895         return ret_conv;
18896 }
18897
18898 void  CS_LDK_CResult_RouteLightningErrorZ_free(int64_t _res) {
18899         if (!ptr_is_owned(_res)) return;
18900         void* _res_ptr = untag_ptr(_res);
18901         CHECK_ACCESS(_res_ptr);
18902         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
18903         FREE(untag_ptr(_res));
18904         CResult_RouteLightningErrorZ_free(_res_conv);
18905 }
18906
18907 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
18908         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18909         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
18910         return tag_ptr(ret_conv, true);
18911 }
18912 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone_ptr(int64_t arg) {
18913         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
18914         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
18915         return ret_conv;
18916 }
18917
18918 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone(int64_t orig) {
18919         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
18920         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18921         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
18922         return tag_ptr(ret_conv, true);
18923 }
18924
18925 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
18926         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18927         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
18928         return tag_ptr(ret_conv, true);
18929 }
18930 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(int64_t arg) {
18931         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
18932         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
18933         return ret_conv;
18934 }
18935
18936 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone(int64_t orig) {
18937         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
18938         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18939         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
18940         return tag_ptr(ret_conv, true);
18941 }
18942
18943 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_new(int64_t a, int64_t b) {
18944         LDKBlindedPayInfo a_conv;
18945         a_conv.inner = untag_ptr(a);
18946         a_conv.is_owned = ptr_is_owned(a);
18947         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18948         a_conv = BlindedPayInfo_clone(&a_conv);
18949         LDKBlindedPath b_conv;
18950         b_conv.inner = untag_ptr(b);
18951         b_conv.is_owned = ptr_is_owned(b);
18952         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18953         b_conv = BlindedPath_clone(&b_conv);
18954         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18955         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
18956         return tag_ptr(ret_conv, true);
18957 }
18958
18959 void  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_free(int64_t _res) {
18960         if (!ptr_is_owned(_res)) return;
18961         void* _res_ptr = untag_ptr(_res);
18962         CHECK_ACCESS(_res_ptr);
18963         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
18964         FREE(untag_ptr(_res));
18965         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
18966 }
18967
18968 void  CS_LDK_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(int64_tArray _res) {
18969         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
18970         _res_constr.datalen = _res->arr_len;
18971         if (_res_constr.datalen > 0)
18972                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18973         else
18974                 _res_constr.data = NULL;
18975         int64_t* _res_vals = _res->elems;
18976         for (size_t l = 0; l < _res_constr.datalen; l++) {
18977                 int64_t _res_conv_37 = _res_vals[l];
18978                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
18979                 CHECK_ACCESS(_res_conv_37_ptr);
18980                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
18981                 FREE(untag_ptr(_res_conv_37));
18982                 _res_constr.data[l] = _res_conv_37_conv;
18983         }
18984         FREE(_res);
18985         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
18986 }
18987
18988 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(int64_tArray o) {
18989         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
18990         o_constr.datalen = o->arr_len;
18991         if (o_constr.datalen > 0)
18992                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
18993         else
18994                 o_constr.data = NULL;
18995         int64_t* o_vals = o->elems;
18996         for (size_t l = 0; l < o_constr.datalen; l++) {
18997                 int64_t o_conv_37 = o_vals[l];
18998                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
18999                 CHECK_ACCESS(o_conv_37_ptr);
19000                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
19001                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
19002                 o_constr.data[l] = o_conv_37_conv;
19003         }
19004         FREE(o);
19005         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19006         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
19007         return tag_ptr(ret_conv, true);
19008 }
19009
19010 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
19011         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19012         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
19013         return tag_ptr(ret_conv, true);
19014 }
19015
19016 jboolean  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(int64_t o) {
19017         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
19018         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
19019         return ret_conv;
19020 }
19021
19022 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(int64_t _res) {
19023         if (!ptr_is_owned(_res)) return;
19024         void* _res_ptr = untag_ptr(_res);
19025         CHECK_ACCESS(_res_ptr);
19026         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
19027         FREE(untag_ptr(_res));
19028         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
19029 }
19030
19031 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
19032         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19033         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
19034         return tag_ptr(ret_conv, true);
19035 }
19036 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(int64_t arg) {
19037         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
19038         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
19039         return ret_conv;
19040 }
19041
19042 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(int64_t orig) {
19043         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
19044         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
19045         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
19046         return tag_ptr(ret_conv, true);
19047 }
19048
19049 void  CS_LDK_CVec_PublicKeyZ_free(ptrArray _res) {
19050         LDKCVec_PublicKeyZ _res_constr;
19051         _res_constr.datalen = _res->arr_len;
19052         if (_res_constr.datalen > 0)
19053                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19054         else
19055                 _res_constr.data = NULL;
19056         int8_tArray* _res_vals = (void*) _res->elems;
19057         for (size_t i = 0; i < _res_constr.datalen; i++) {
19058                 int8_tArray _res_conv_8 = _res_vals[i];
19059                 LDKPublicKey _res_conv_8_ref;
19060                 CHECK(_res_conv_8->arr_len == 33);
19061                 memcpy(_res_conv_8_ref.compressed_form, _res_conv_8->elems, 33); FREE(_res_conv_8);
19062                 _res_constr.data[i] = _res_conv_8_ref;
19063         }
19064         FREE(_res);
19065         CVec_PublicKeyZ_free(_res_constr);
19066 }
19067
19068 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_ok(int64_t o) {
19069         LDKOnionMessagePath o_conv;
19070         o_conv.inner = untag_ptr(o);
19071         o_conv.is_owned = ptr_is_owned(o);
19072         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19073         o_conv = OnionMessagePath_clone(&o_conv);
19074         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19075         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
19076         return tag_ptr(ret_conv, true);
19077 }
19078
19079 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_err() {
19080         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19081         *ret_conv = CResult_OnionMessagePathNoneZ_err();
19082         return tag_ptr(ret_conv, true);
19083 }
19084
19085 jboolean  CS_LDK_CResult_OnionMessagePathNoneZ_is_ok(int64_t o) {
19086         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
19087         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
19088         return ret_conv;
19089 }
19090
19091 void  CS_LDK_CResult_OnionMessagePathNoneZ_free(int64_t _res) {
19092         if (!ptr_is_owned(_res)) return;
19093         void* _res_ptr = untag_ptr(_res);
19094         CHECK_ACCESS(_res_ptr);
19095         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
19096         FREE(untag_ptr(_res));
19097         CResult_OnionMessagePathNoneZ_free(_res_conv);
19098 }
19099
19100 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
19101         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19102         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
19103         return tag_ptr(ret_conv, true);
19104 }
19105 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone_ptr(int64_t arg) {
19106         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
19107         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
19108         return ret_conv;
19109 }
19110
19111 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone(int64_t orig) {
19112         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
19113         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
19114         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
19115         return tag_ptr(ret_conv, true);
19116 }
19117
19118 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_ok(int64_tArray o) {
19119         LDKCVec_BlindedPathZ o_constr;
19120         o_constr.datalen = o->arr_len;
19121         if (o_constr.datalen > 0)
19122                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
19123         else
19124                 o_constr.data = NULL;
19125         int64_t* o_vals = o->elems;
19126         for (size_t n = 0; n < o_constr.datalen; n++) {
19127                 int64_t o_conv_13 = o_vals[n];
19128                 LDKBlindedPath o_conv_13_conv;
19129                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
19130                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
19131                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
19132                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
19133                 o_constr.data[n] = o_conv_13_conv;
19134         }
19135         FREE(o);
19136         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19137         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
19138         return tag_ptr(ret_conv, true);
19139 }
19140
19141 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_err() {
19142         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19143         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
19144         return tag_ptr(ret_conv, true);
19145 }
19146
19147 jboolean  CS_LDK_CResult_CVec_BlindedPathZNoneZ_is_ok(int64_t o) {
19148         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
19149         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
19150         return ret_conv;
19151 }
19152
19153 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_free(int64_t _res) {
19154         if (!ptr_is_owned(_res)) return;
19155         void* _res_ptr = untag_ptr(_res);
19156         CHECK_ACCESS(_res_ptr);
19157         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
19158         FREE(untag_ptr(_res));
19159         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
19160 }
19161
19162 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
19163         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19164         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
19165         return tag_ptr(ret_conv, true);
19166 }
19167 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone_ptr(int64_t arg) {
19168         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
19169         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
19170         return ret_conv;
19171 }
19172
19173 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone(int64_t orig) {
19174         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
19175         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
19176         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
19177         return tag_ptr(ret_conv, true);
19178 }
19179
19180 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_ok(int64_t o) {
19181         LDKInFlightHtlcs o_conv;
19182         o_conv.inner = untag_ptr(o);
19183         o_conv.is_owned = ptr_is_owned(o);
19184         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19185         o_conv = InFlightHtlcs_clone(&o_conv);
19186         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19187         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
19188         return tag_ptr(ret_conv, true);
19189 }
19190
19191 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_err(int64_t e) {
19192         void* e_ptr = untag_ptr(e);
19193         CHECK_ACCESS(e_ptr);
19194         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19195         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19196         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19197         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
19198         return tag_ptr(ret_conv, true);
19199 }
19200
19201 jboolean  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_is_ok(int64_t o) {
19202         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
19203         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
19204         return ret_conv;
19205 }
19206
19207 void  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_free(int64_t _res) {
19208         if (!ptr_is_owned(_res)) return;
19209         void* _res_ptr = untag_ptr(_res);
19210         CHECK_ACCESS(_res_ptr);
19211         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
19212         FREE(untag_ptr(_res));
19213         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
19214 }
19215
19216 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
19217         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19218         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
19219         return tag_ptr(ret_conv, true);
19220 }
19221 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(int64_t arg) {
19222         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
19223         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
19224         return ret_conv;
19225 }
19226
19227 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone(int64_t orig) {
19228         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
19229         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
19230         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
19231         return tag_ptr(ret_conv, true);
19232 }
19233
19234 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_ok(int64_t o) {
19235         LDKRouteHop o_conv;
19236         o_conv.inner = untag_ptr(o);
19237         o_conv.is_owned = ptr_is_owned(o);
19238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19239         o_conv = RouteHop_clone(&o_conv);
19240         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19241         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
19242         return tag_ptr(ret_conv, true);
19243 }
19244
19245 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_err(int64_t e) {
19246         void* e_ptr = untag_ptr(e);
19247         CHECK_ACCESS(e_ptr);
19248         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19249         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19250         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19251         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
19252         return tag_ptr(ret_conv, true);
19253 }
19254
19255 jboolean  CS_LDK_CResult_RouteHopDecodeErrorZ_is_ok(int64_t o) {
19256         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
19257         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
19258         return ret_conv;
19259 }
19260
19261 void  CS_LDK_CResult_RouteHopDecodeErrorZ_free(int64_t _res) {
19262         if (!ptr_is_owned(_res)) return;
19263         void* _res_ptr = untag_ptr(_res);
19264         CHECK_ACCESS(_res_ptr);
19265         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
19266         FREE(untag_ptr(_res));
19267         CResult_RouteHopDecodeErrorZ_free(_res_conv);
19268 }
19269
19270 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
19271         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19272         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
19273         return tag_ptr(ret_conv, true);
19274 }
19275 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone_ptr(int64_t arg) {
19276         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
19277         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
19278         return ret_conv;
19279 }
19280
19281 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone(int64_t orig) {
19282         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
19283         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
19284         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
19285         return tag_ptr(ret_conv, true);
19286 }
19287
19288 void  CS_LDK_CVec_BlindedHopZ_free(int64_tArray _res) {
19289         LDKCVec_BlindedHopZ _res_constr;
19290         _res_constr.datalen = _res->arr_len;
19291         if (_res_constr.datalen > 0)
19292                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
19293         else
19294                 _res_constr.data = NULL;
19295         int64_t* _res_vals = _res->elems;
19296         for (size_t m = 0; m < _res_constr.datalen; m++) {
19297                 int64_t _res_conv_12 = _res_vals[m];
19298                 LDKBlindedHop _res_conv_12_conv;
19299                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
19300                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
19301                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
19302                 _res_constr.data[m] = _res_conv_12_conv;
19303         }
19304         FREE(_res);
19305         CVec_BlindedHopZ_free(_res_constr);
19306 }
19307
19308 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_ok(int64_t o) {
19309         LDKBlindedTail o_conv;
19310         o_conv.inner = untag_ptr(o);
19311         o_conv.is_owned = ptr_is_owned(o);
19312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19313         o_conv = BlindedTail_clone(&o_conv);
19314         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19315         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
19316         return tag_ptr(ret_conv, true);
19317 }
19318
19319 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_err(int64_t e) {
19320         void* e_ptr = untag_ptr(e);
19321         CHECK_ACCESS(e_ptr);
19322         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19323         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19324         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19325         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
19326         return tag_ptr(ret_conv, true);
19327 }
19328
19329 jboolean  CS_LDK_CResult_BlindedTailDecodeErrorZ_is_ok(int64_t o) {
19330         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
19331         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
19332         return ret_conv;
19333 }
19334
19335 void  CS_LDK_CResult_BlindedTailDecodeErrorZ_free(int64_t _res) {
19336         if (!ptr_is_owned(_res)) return;
19337         void* _res_ptr = untag_ptr(_res);
19338         CHECK_ACCESS(_res_ptr);
19339         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
19340         FREE(untag_ptr(_res));
19341         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
19342 }
19343
19344 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
19345         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19346         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
19347         return tag_ptr(ret_conv, true);
19348 }
19349 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone_ptr(int64_t arg) {
19350         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
19351         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
19352         return ret_conv;
19353 }
19354
19355 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone(int64_t orig) {
19356         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
19357         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
19358         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
19359         return tag_ptr(ret_conv, true);
19360 }
19361
19362 void  CS_LDK_CVec_RouteHopZ_free(int64_tArray _res) {
19363         LDKCVec_RouteHopZ _res_constr;
19364         _res_constr.datalen = _res->arr_len;
19365         if (_res_constr.datalen > 0)
19366                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19367         else
19368                 _res_constr.data = NULL;
19369         int64_t* _res_vals = _res->elems;
19370         for (size_t k = 0; k < _res_constr.datalen; k++) {
19371                 int64_t _res_conv_10 = _res_vals[k];
19372                 LDKRouteHop _res_conv_10_conv;
19373                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
19374                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
19375                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19376                 _res_constr.data[k] = _res_conv_10_conv;
19377         }
19378         FREE(_res);
19379         CVec_RouteHopZ_free(_res_constr);
19380 }
19381
19382 void  CS_LDK_CVec_PathZ_free(int64_tArray _res) {
19383         LDKCVec_PathZ _res_constr;
19384         _res_constr.datalen = _res->arr_len;
19385         if (_res_constr.datalen > 0)
19386                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
19387         else
19388                 _res_constr.data = NULL;
19389         int64_t* _res_vals = _res->elems;
19390         for (size_t g = 0; g < _res_constr.datalen; g++) {
19391                 int64_t _res_conv_6 = _res_vals[g];
19392                 LDKPath _res_conv_6_conv;
19393                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
19394                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
19395                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
19396                 _res_constr.data[g] = _res_conv_6_conv;
19397         }
19398         FREE(_res);
19399         CVec_PathZ_free(_res_constr);
19400 }
19401
19402 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_ok(int64_t o) {
19403         LDKRoute o_conv;
19404         o_conv.inner = untag_ptr(o);
19405         o_conv.is_owned = ptr_is_owned(o);
19406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19407         o_conv = Route_clone(&o_conv);
19408         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19409         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
19410         return tag_ptr(ret_conv, true);
19411 }
19412
19413 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_err(int64_t e) {
19414         void* e_ptr = untag_ptr(e);
19415         CHECK_ACCESS(e_ptr);
19416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19418         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19419         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
19420         return tag_ptr(ret_conv, true);
19421 }
19422
19423 jboolean  CS_LDK_CResult_RouteDecodeErrorZ_is_ok(int64_t o) {
19424         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
19425         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
19426         return ret_conv;
19427 }
19428
19429 void  CS_LDK_CResult_RouteDecodeErrorZ_free(int64_t _res) {
19430         if (!ptr_is_owned(_res)) return;
19431         void* _res_ptr = untag_ptr(_res);
19432         CHECK_ACCESS(_res_ptr);
19433         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
19434         FREE(untag_ptr(_res));
19435         CResult_RouteDecodeErrorZ_free(_res_conv);
19436 }
19437
19438 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
19439         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19440         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
19441         return tag_ptr(ret_conv, true);
19442 }
19443 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone_ptr(int64_t arg) {
19444         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
19445         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
19446         return ret_conv;
19447 }
19448
19449 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone(int64_t orig) {
19450         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
19451         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
19452         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
19453         return tag_ptr(ret_conv, true);
19454 }
19455
19456 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_ok(int64_t o) {
19457         LDKRouteParameters o_conv;
19458         o_conv.inner = untag_ptr(o);
19459         o_conv.is_owned = ptr_is_owned(o);
19460         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19461         o_conv = RouteParameters_clone(&o_conv);
19462         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19463         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
19464         return tag_ptr(ret_conv, true);
19465 }
19466
19467 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_err(int64_t e) {
19468         void* e_ptr = untag_ptr(e);
19469         CHECK_ACCESS(e_ptr);
19470         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19471         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19472         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19473         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
19474         return tag_ptr(ret_conv, true);
19475 }
19476
19477 jboolean  CS_LDK_CResult_RouteParametersDecodeErrorZ_is_ok(int64_t o) {
19478         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
19479         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
19480         return ret_conv;
19481 }
19482
19483 void  CS_LDK_CResult_RouteParametersDecodeErrorZ_free(int64_t _res) {
19484         if (!ptr_is_owned(_res)) return;
19485         void* _res_ptr = untag_ptr(_res);
19486         CHECK_ACCESS(_res_ptr);
19487         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
19488         FREE(untag_ptr(_res));
19489         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
19490 }
19491
19492 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
19493         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19494         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
19495         return tag_ptr(ret_conv, true);
19496 }
19497 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19498         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
19499         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
19500         return ret_conv;
19501 }
19502
19503 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone(int64_t orig) {
19504         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
19505         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
19506         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
19507         return tag_ptr(ret_conv, true);
19508 }
19509
19510 void  CS_LDK_CVec_u64Z_free(int64_tArray _res) {
19511         LDKCVec_u64Z _res_constr;
19512         _res_constr.datalen = _res->arr_len;
19513         if (_res_constr.datalen > 0)
19514                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19515         else
19516                 _res_constr.data = NULL;
19517         int64_t* _res_vals = _res->elems;
19518         for (size_t g = 0; g < _res_constr.datalen; g++) {
19519                 int64_t _res_conv_6 = _res_vals[g];
19520                 _res_constr.data[g] = _res_conv_6;
19521         }
19522         FREE(_res);
19523         CVec_u64Z_free(_res_constr);
19524 }
19525
19526 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_ok(int64_t o) {
19527         LDKPaymentParameters o_conv;
19528         o_conv.inner = untag_ptr(o);
19529         o_conv.is_owned = ptr_is_owned(o);
19530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19531         o_conv = PaymentParameters_clone(&o_conv);
19532         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19533         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
19534         return tag_ptr(ret_conv, true);
19535 }
19536
19537 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_err(int64_t e) {
19538         void* e_ptr = untag_ptr(e);
19539         CHECK_ACCESS(e_ptr);
19540         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19541         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19542         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19543         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
19544         return tag_ptr(ret_conv, true);
19545 }
19546
19547 jboolean  CS_LDK_CResult_PaymentParametersDecodeErrorZ_is_ok(int64_t o) {
19548         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
19549         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
19550         return ret_conv;
19551 }
19552
19553 void  CS_LDK_CResult_PaymentParametersDecodeErrorZ_free(int64_t _res) {
19554         if (!ptr_is_owned(_res)) return;
19555         void* _res_ptr = untag_ptr(_res);
19556         CHECK_ACCESS(_res_ptr);
19557         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
19558         FREE(untag_ptr(_res));
19559         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
19560 }
19561
19562 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
19563         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19564         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
19565         return tag_ptr(ret_conv, true);
19566 }
19567 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19568         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
19569         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
19570         return ret_conv;
19571 }
19572
19573 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone(int64_t orig) {
19574         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
19575         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
19576         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
19577         return tag_ptr(ret_conv, true);
19578 }
19579
19580 void  CS_LDK_CVec_RouteHintZ_free(int64_tArray _res) {
19581         LDKCVec_RouteHintZ _res_constr;
19582         _res_constr.datalen = _res->arr_len;
19583         if (_res_constr.datalen > 0)
19584                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
19585         else
19586                 _res_constr.data = NULL;
19587         int64_t* _res_vals = _res->elems;
19588         for (size_t l = 0; l < _res_constr.datalen; l++) {
19589                 int64_t _res_conv_11 = _res_vals[l];
19590                 LDKRouteHint _res_conv_11_conv;
19591                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
19592                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
19593                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
19594                 _res_constr.data[l] = _res_conv_11_conv;
19595         }
19596         FREE(_res);
19597         CVec_RouteHintZ_free(_res_constr);
19598 }
19599
19600 void  CS_LDK_CVec_RouteHintHopZ_free(int64_tArray _res) {
19601         LDKCVec_RouteHintHopZ _res_constr;
19602         _res_constr.datalen = _res->arr_len;
19603         if (_res_constr.datalen > 0)
19604                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
19605         else
19606                 _res_constr.data = NULL;
19607         int64_t* _res_vals = _res->elems;
19608         for (size_t o = 0; o < _res_constr.datalen; o++) {
19609                 int64_t _res_conv_14 = _res_vals[o];
19610                 LDKRouteHintHop _res_conv_14_conv;
19611                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19612                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19614                 _res_constr.data[o] = _res_conv_14_conv;
19615         }
19616         FREE(_res);
19617         CVec_RouteHintHopZ_free(_res_constr);
19618 }
19619
19620 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_ok(int64_t o) {
19621         LDKRouteHint o_conv;
19622         o_conv.inner = untag_ptr(o);
19623         o_conv.is_owned = ptr_is_owned(o);
19624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19625         o_conv = RouteHint_clone(&o_conv);
19626         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19627         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
19628         return tag_ptr(ret_conv, true);
19629 }
19630
19631 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_err(int64_t e) {
19632         void* e_ptr = untag_ptr(e);
19633         CHECK_ACCESS(e_ptr);
19634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19636         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19637         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
19638         return tag_ptr(ret_conv, true);
19639 }
19640
19641 jboolean  CS_LDK_CResult_RouteHintDecodeErrorZ_is_ok(int64_t o) {
19642         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
19643         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
19644         return ret_conv;
19645 }
19646
19647 void  CS_LDK_CResult_RouteHintDecodeErrorZ_free(int64_t _res) {
19648         if (!ptr_is_owned(_res)) return;
19649         void* _res_ptr = untag_ptr(_res);
19650         CHECK_ACCESS(_res_ptr);
19651         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
19652         FREE(untag_ptr(_res));
19653         CResult_RouteHintDecodeErrorZ_free(_res_conv);
19654 }
19655
19656 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
19657         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19658         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
19659         return tag_ptr(ret_conv, true);
19660 }
19661 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone_ptr(int64_t arg) {
19662         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
19663         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
19664         return ret_conv;
19665 }
19666
19667 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone(int64_t orig) {
19668         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
19669         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
19670         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
19671         return tag_ptr(ret_conv, true);
19672 }
19673
19674 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_ok(int64_t o) {
19675         LDKRouteHintHop o_conv;
19676         o_conv.inner = untag_ptr(o);
19677         o_conv.is_owned = ptr_is_owned(o);
19678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19679         o_conv = RouteHintHop_clone(&o_conv);
19680         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19681         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
19682         return tag_ptr(ret_conv, true);
19683 }
19684
19685 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_err(int64_t e) {
19686         void* e_ptr = untag_ptr(e);
19687         CHECK_ACCESS(e_ptr);
19688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19690         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19691         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
19692         return tag_ptr(ret_conv, true);
19693 }
19694
19695 jboolean  CS_LDK_CResult_RouteHintHopDecodeErrorZ_is_ok(int64_t o) {
19696         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
19697         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
19698         return ret_conv;
19699 }
19700
19701 void  CS_LDK_CResult_RouteHintHopDecodeErrorZ_free(int64_t _res) {
19702         if (!ptr_is_owned(_res)) return;
19703         void* _res_ptr = untag_ptr(_res);
19704         CHECK_ACCESS(_res_ptr);
19705         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
19706         FREE(untag_ptr(_res));
19707         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
19708 }
19709
19710 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
19711         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19712         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
19713         return tag_ptr(ret_conv, true);
19714 }
19715 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone_ptr(int64_t arg) {
19716         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
19717         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
19718         return ret_conv;
19719 }
19720
19721 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone(int64_t orig) {
19722         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
19723         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
19724         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
19725         return tag_ptr(ret_conv, true);
19726 }
19727
19728 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_ok(int64_t o) {
19729         LDKFixedPenaltyScorer o_conv;
19730         o_conv.inner = untag_ptr(o);
19731         o_conv.is_owned = ptr_is_owned(o);
19732         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19733         o_conv = FixedPenaltyScorer_clone(&o_conv);
19734         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19735         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
19736         return tag_ptr(ret_conv, true);
19737 }
19738
19739 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_err(int64_t e) {
19740         void* e_ptr = untag_ptr(e);
19741         CHECK_ACCESS(e_ptr);
19742         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19743         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19744         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19745         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
19746         return tag_ptr(ret_conv, true);
19747 }
19748
19749 jboolean  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(int64_t o) {
19750         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
19751         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
19752         return ret_conv;
19753 }
19754
19755 void  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_free(int64_t _res) {
19756         if (!ptr_is_owned(_res)) return;
19757         void* _res_ptr = untag_ptr(_res);
19758         CHECK_ACCESS(_res_ptr);
19759         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
19760         FREE(untag_ptr(_res));
19761         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
19762 }
19763
19764 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
19765         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19766         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
19767         return tag_ptr(ret_conv, true);
19768 }
19769 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(int64_t arg) {
19770         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
19771         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
19772         return ret_conv;
19773 }
19774
19775 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone(int64_t orig) {
19776         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
19777         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
19778         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
19779         return tag_ptr(ret_conv, true);
19780 }
19781
19782 void  CS_LDK_CVec_NodeIdZ_free(int64_tArray _res) {
19783         LDKCVec_NodeIdZ _res_constr;
19784         _res_constr.datalen = _res->arr_len;
19785         if (_res_constr.datalen > 0)
19786                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
19787         else
19788                 _res_constr.data = NULL;
19789         int64_t* _res_vals = _res->elems;
19790         for (size_t i = 0; i < _res_constr.datalen; i++) {
19791                 int64_t _res_conv_8 = _res_vals[i];
19792                 LDKNodeId _res_conv_8_conv;
19793                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
19794                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
19795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
19796                 _res_constr.data[i] = _res_conv_8_conv;
19797         }
19798         FREE(_res);
19799         CVec_NodeIdZ_free(_res_constr);
19800 }
19801
19802 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
19803         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19804         *ret_conv = C2Tuple_u64u64Z_clone(arg);
19805         return tag_ptr(ret_conv, true);
19806 }
19807 int64_t  CS_LDK_C2Tuple_u64u64Z_clone_ptr(int64_t arg) {
19808         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
19809         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
19810         return ret_conv;
19811 }
19812
19813 int64_t  CS_LDK_C2Tuple_u64u64Z_clone(int64_t orig) {
19814         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
19815         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19816         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
19817         return tag_ptr(ret_conv, true);
19818 }
19819
19820 int64_t  CS_LDK_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
19821         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
19822         *ret_conv = C2Tuple_u64u64Z_new(a, b);
19823         return tag_ptr(ret_conv, true);
19824 }
19825
19826 void  CS_LDK_C2Tuple_u64u64Z_free(int64_t _res) {
19827         if (!ptr_is_owned(_res)) return;
19828         void* _res_ptr = untag_ptr(_res);
19829         CHECK_ACCESS(_res_ptr);
19830         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
19831         FREE(untag_ptr(_res));
19832         C2Tuple_u64u64Z_free(_res_conv);
19833 }
19834
19835 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_some(int64_t o) {
19836         void* o_ptr = untag_ptr(o);
19837         CHECK_ACCESS(o_ptr);
19838         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
19839         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
19840         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19841         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
19842         int64_t ret_ref = tag_ptr(ret_copy, true);
19843         return ret_ref;
19844 }
19845
19846 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_none() {
19847         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19848         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
19849         int64_t ret_ref = tag_ptr(ret_copy, true);
19850         return ret_ref;
19851 }
19852
19853 void  CS_LDK_COption_C2Tuple_u64u64ZZ_free(int64_t _res) {
19854         if (!ptr_is_owned(_res)) return;
19855         void* _res_ptr = untag_ptr(_res);
19856         CHECK_ACCESS(_res_ptr);
19857         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
19858         FREE(untag_ptr(_res));
19859         COption_C2Tuple_u64u64ZZ_free(_res_conv);
19860 }
19861
19862 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
19863         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19864         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
19865         int64_t ret_ref = tag_ptr(ret_copy, true);
19866         return ret_ref;
19867 }
19868 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone_ptr(int64_t arg) {
19869         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
19870         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
19871         return ret_conv;
19872 }
19873
19874 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone(int64_t orig) {
19875         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
19876         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
19877         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
19878         int64_t ret_ref = tag_ptr(ret_copy, true);
19879         return ret_ref;
19880 }
19881
19882 int64_t  CS_LDK_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
19883         LDKThirtyTwoU16s a_ref;
19884         CHECK(a->arr_len == 32);
19885         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19886         LDKThirtyTwoU16s b_ref;
19887         CHECK(b->arr_len == 32);
19888         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19889         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
19890         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
19891         return tag_ptr(ret_conv, true);
19892 }
19893
19894 void  CS_LDK_C2Tuple_Z_free(int64_t _res) {
19895         if (!ptr_is_owned(_res)) return;
19896         void* _res_ptr = untag_ptr(_res);
19897         CHECK_ACCESS(_res_ptr);
19898         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
19899         FREE(untag_ptr(_res));
19900         C2Tuple_Z_free(_res_conv);
19901 }
19902
19903 int64_t  CS_LDK_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
19904         LDKThirtyTwoU16s a_ref;
19905         CHECK(a->arr_len == 32);
19906         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
19907         LDKThirtyTwoU16s b_ref;
19908         CHECK(b->arr_len == 32);
19909         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
19910         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
19911         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
19912         return tag_ptr(ret_conv, true);
19913 }
19914
19915 void  CS_LDK_C2Tuple__u1632_u1632Z_free(int64_t _res) {
19916         if (!ptr_is_owned(_res)) return;
19917         void* _res_ptr = untag_ptr(_res);
19918         CHECK_ACCESS(_res_ptr);
19919         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
19920         FREE(untag_ptr(_res));
19921         C2Tuple__u1632_u1632Z_free(_res_conv);
19922 }
19923
19924 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(int64_t o) {
19925         void* o_ptr = untag_ptr(o);
19926         CHECK_ACCESS(o_ptr);
19927         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
19928         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
19929         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19930         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
19931         int64_t ret_ref = tag_ptr(ret_copy, true);
19932         return ret_ref;
19933 }
19934
19935 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
19936         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
19937         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
19938         int64_t ret_ref = tag_ptr(ret_copy, true);
19939         return ret_ref;
19940 }
19941
19942 void  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(int64_t _res) {
19943         if (!ptr_is_owned(_res)) return;
19944         void* _res_ptr = untag_ptr(_res);
19945         CHECK_ACCESS(_res_ptr);
19946         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
19947         FREE(untag_ptr(_res));
19948         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
19949 }
19950
19951 int64_t  CS_LDK_COption_f64Z_some(double o) {
19952         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19953         *ret_copy = COption_f64Z_some(o);
19954         int64_t ret_ref = tag_ptr(ret_copy, true);
19955         return ret_ref;
19956 }
19957
19958 int64_t  CS_LDK_COption_f64Z_none() {
19959         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19960         *ret_copy = COption_f64Z_none();
19961         int64_t ret_ref = tag_ptr(ret_copy, true);
19962         return ret_ref;
19963 }
19964
19965 void  CS_LDK_COption_f64Z_free(int64_t _res) {
19966         if (!ptr_is_owned(_res)) return;
19967         void* _res_ptr = untag_ptr(_res);
19968         CHECK_ACCESS(_res_ptr);
19969         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
19970         FREE(untag_ptr(_res));
19971         COption_f64Z_free(_res_conv);
19972 }
19973
19974 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
19975         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19976         *ret_copy = COption_f64Z_clone(arg);
19977         int64_t ret_ref = tag_ptr(ret_copy, true);
19978         return ret_ref;
19979 }
19980 int64_t  CS_LDK_COption_f64Z_clone_ptr(int64_t arg) {
19981         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
19982         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
19983         return ret_conv;
19984 }
19985
19986 int64_t  CS_LDK_COption_f64Z_clone(int64_t orig) {
19987         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
19988         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
19989         *ret_copy = COption_f64Z_clone(orig_conv);
19990         int64_t ret_ref = tag_ptr(ret_copy, true);
19991         return ret_ref;
19992 }
19993
19994 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_ok(int64_t o) {
19995         LDKProbabilisticScorer o_conv;
19996         o_conv.inner = untag_ptr(o);
19997         o_conv.is_owned = ptr_is_owned(o);
19998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19999         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
20000         
20001         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
20002         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
20003         return tag_ptr(ret_conv, true);
20004 }
20005
20006 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_err(int64_t e) {
20007         void* e_ptr = untag_ptr(e);
20008         CHECK_ACCESS(e_ptr);
20009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20011         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
20012         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
20013         return tag_ptr(ret_conv, true);
20014 }
20015
20016 jboolean  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(int64_t o) {
20017         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
20018         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
20019         return ret_conv;
20020 }
20021
20022 void  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_free(int64_t _res) {
20023         if (!ptr_is_owned(_res)) return;
20024         void* _res_ptr = untag_ptr(_res);
20025         CHECK_ACCESS(_res_ptr);
20026         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
20027         FREE(untag_ptr(_res));
20028         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
20029 }
20030
20031 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
20032         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20033         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
20034         return tag_ptr(ret_conv, true);
20035 }
20036 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone_ptr(int64_t arg) {
20037         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
20038         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
20039         return ret_conv;
20040 }
20041
20042 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone(int64_t orig) {
20043         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
20044         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20045         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
20046         return tag_ptr(ret_conv, true);
20047 }
20048
20049 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
20050         LDKTransaction b_ref;
20051         b_ref.datalen = b->arr_len;
20052         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
20053         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
20054         b_ref.data_is_owned = true;
20055         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
20056         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
20057         return tag_ptr(ret_conv, true);
20058 }
20059
20060 void  CS_LDK_C2Tuple_usizeTransactionZ_free(int64_t _res) {
20061         if (!ptr_is_owned(_res)) return;
20062         void* _res_ptr = untag_ptr(_res);
20063         CHECK_ACCESS(_res_ptr);
20064         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
20065         FREE(untag_ptr(_res));
20066         C2Tuple_usizeTransactionZ_free(_res_conv);
20067 }
20068
20069 void  CS_LDK_CVec_C2Tuple_usizeTransactionZZ_free(int64_tArray _res) {
20070         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
20071         _res_constr.datalen = _res->arr_len;
20072         if (_res_constr.datalen > 0)
20073                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
20074         else
20075                 _res_constr.data = NULL;
20076         int64_t* _res_vals = _res->elems;
20077         for (size_t c = 0; c < _res_constr.datalen; c++) {
20078                 int64_t _res_conv_28 = _res_vals[c];
20079                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
20080                 CHECK_ACCESS(_res_conv_28_ptr);
20081                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
20082                 FREE(untag_ptr(_res_conv_28));
20083                 _res_constr.data[c] = _res_conv_28_conv;
20084         }
20085         FREE(_res);
20086         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
20087 }
20088
20089 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
20090         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20091         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
20092         return tag_ptr(ret_conv, true);
20093 }
20094 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
20095         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
20096         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
20097         return ret_conv;
20098 }
20099
20100 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(int64_t orig) {
20101         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
20102         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20103         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
20104         return tag_ptr(ret_conv, true);
20105 }
20106
20107 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, int64_t c) {
20108         LDKThirtyTwoBytes a_ref;
20109         CHECK(a->arr_len == 32);
20110         memcpy(a_ref.data, a->elems, 32); FREE(a);
20111         void* c_ptr = untag_ptr(c);
20112         CHECK_ACCESS(c_ptr);
20113         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
20114         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
20115         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
20116         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
20117         return tag_ptr(ret_conv, true);
20118 }
20119
20120 void  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(int64_t _res) {
20121         if (!ptr_is_owned(_res)) return;
20122         void* _res_ptr = untag_ptr(_res);
20123         CHECK_ACCESS(_res_ptr);
20124         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
20125         FREE(untag_ptr(_res));
20126         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
20127 }
20128
20129 void  CS_LDK_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(int64_tArray _res) {
20130         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
20131         _res_constr.datalen = _res->arr_len;
20132         if (_res_constr.datalen > 0)
20133                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
20134         else
20135                 _res_constr.data = NULL;
20136         int64_t* _res_vals = _res->elems;
20137         for (size_t c = 0; c < _res_constr.datalen; c++) {
20138                 int64_t _res_conv_54 = _res_vals[c];
20139                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
20140                 CHECK_ACCESS(_res_conv_54_ptr);
20141                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
20142                 FREE(untag_ptr(_res_conv_54));
20143                 _res_constr.data[c] = _res_conv_54_conv;
20144         }
20145         FREE(_res);
20146         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
20147 }
20148
20149 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_ok(int32_t o) {
20150         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_cs(o);
20151         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20152         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
20153         return tag_ptr(ret_conv, true);
20154 }
20155
20156 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
20157         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20158         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
20159         return tag_ptr(ret_conv, true);
20160 }
20161
20162 jboolean  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(int64_t o) {
20163         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
20164         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
20165         return ret_conv;
20166 }
20167
20168 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_free(int64_t _res) {
20169         if (!ptr_is_owned(_res)) return;
20170         void* _res_ptr = untag_ptr(_res);
20171         CHECK_ACCESS(_res_ptr);
20172         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
20173         FREE(untag_ptr(_res));
20174         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
20175 }
20176
20177 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
20178         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20179         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
20180         return tag_ptr(ret_conv, true);
20181 }
20182 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(int64_t arg) {
20183         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
20184         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
20185         return ret_conv;
20186 }
20187
20188 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone(int64_t orig) {
20189         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
20190         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
20191         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
20192         return tag_ptr(ret_conv, true);
20193 }
20194
20195 void  CS_LDK_CVec_MonitorEventZ_free(int64_tArray _res) {
20196         LDKCVec_MonitorEventZ _res_constr;
20197         _res_constr.datalen = _res->arr_len;
20198         if (_res_constr.datalen > 0)
20199                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
20200         else
20201                 _res_constr.data = NULL;
20202         int64_t* _res_vals = _res->elems;
20203         for (size_t o = 0; o < _res_constr.datalen; o++) {
20204                 int64_t _res_conv_14 = _res_vals[o];
20205                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
20206                 CHECK_ACCESS(_res_conv_14_ptr);
20207                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
20208                 FREE(untag_ptr(_res_conv_14));
20209                 _res_constr.data[o] = _res_conv_14_conv;
20210         }
20211         FREE(_res);
20212         CVec_MonitorEventZ_free(_res_constr);
20213 }
20214
20215 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
20216         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20217         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
20218         return tag_ptr(ret_conv, true);
20219 }
20220 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(int64_t arg) {
20221         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
20222         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
20223         return ret_conv;
20224 }
20225
20226 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(int64_t orig) {
20227         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
20228         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20229         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
20230         return tag_ptr(ret_conv, true);
20231 }
20232
20233 int64_t  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(int64_t a, int64_tArray b, int8_tArray c) {
20234         LDKOutPoint a_conv;
20235         a_conv.inner = untag_ptr(a);
20236         a_conv.is_owned = ptr_is_owned(a);
20237         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20238         a_conv = OutPoint_clone(&a_conv);
20239         LDKCVec_MonitorEventZ b_constr;
20240         b_constr.datalen = b->arr_len;
20241         if (b_constr.datalen > 0)
20242                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
20243         else
20244                 b_constr.data = NULL;
20245         int64_t* b_vals = b->elems;
20246         for (size_t o = 0; o < b_constr.datalen; o++) {
20247                 int64_t b_conv_14 = b_vals[o];
20248                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
20249                 CHECK_ACCESS(b_conv_14_ptr);
20250                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
20251                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
20252                 b_constr.data[o] = b_conv_14_conv;
20253         }
20254         FREE(b);
20255         LDKPublicKey c_ref;
20256         CHECK(c->arr_len == 33);
20257         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
20258         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
20259         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
20260         return tag_ptr(ret_conv, true);
20261 }
20262
20263 void  CS_LDK_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(int64_t _res) {
20264         if (!ptr_is_owned(_res)) return;
20265         void* _res_ptr = untag_ptr(_res);
20266         CHECK_ACCESS(_res_ptr);
20267         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
20268         FREE(untag_ptr(_res));
20269         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
20270 }
20271
20272 void  CS_LDK_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(int64_tArray _res) {
20273         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
20274         _res_constr.datalen = _res->arr_len;
20275         if (_res_constr.datalen > 0)
20276                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
20277         else
20278                 _res_constr.data = NULL;
20279         int64_t* _res_vals = _res->elems;
20280         for (size_t x = 0; x < _res_constr.datalen; x++) {
20281                 int64_t _res_conv_49 = _res_vals[x];
20282                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
20283                 CHECK_ACCESS(_res_conv_49_ptr);
20284                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
20285                 FREE(untag_ptr(_res_conv_49));
20286                 _res_constr.data[x] = _res_conv_49_conv;
20287         }
20288         FREE(_res);
20289         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
20290 }
20291
20292 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_ok(int64_t o) {
20293         LDKInitFeatures o_conv;
20294         o_conv.inner = untag_ptr(o);
20295         o_conv.is_owned = ptr_is_owned(o);
20296         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20297         o_conv = InitFeatures_clone(&o_conv);
20298         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20299         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
20300         return tag_ptr(ret_conv, true);
20301 }
20302
20303 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_err(int64_t e) {
20304         void* e_ptr = untag_ptr(e);
20305         CHECK_ACCESS(e_ptr);
20306         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20307         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20308         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20309         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
20310         return tag_ptr(ret_conv, true);
20311 }
20312
20313 jboolean  CS_LDK_CResult_InitFeaturesDecodeErrorZ_is_ok(int64_t o) {
20314         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
20315         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
20316         return ret_conv;
20317 }
20318
20319 void  CS_LDK_CResult_InitFeaturesDecodeErrorZ_free(int64_t _res) {
20320         if (!ptr_is_owned(_res)) return;
20321         void* _res_ptr = untag_ptr(_res);
20322         CHECK_ACCESS(_res_ptr);
20323         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
20324         FREE(untag_ptr(_res));
20325         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
20326 }
20327
20328 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20329         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20330         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
20331         return tag_ptr(ret_conv, true);
20332 }
20333 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20334         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
20335         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20336         return ret_conv;
20337 }
20338
20339 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone(int64_t orig) {
20340         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
20341         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
20342         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
20343         return tag_ptr(ret_conv, true);
20344 }
20345
20346 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_ok(int64_t o) {
20347         LDKChannelFeatures o_conv;
20348         o_conv.inner = untag_ptr(o);
20349         o_conv.is_owned = ptr_is_owned(o);
20350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20351         o_conv = ChannelFeatures_clone(&o_conv);
20352         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20353         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
20354         return tag_ptr(ret_conv, true);
20355 }
20356
20357 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_err(int64_t e) {
20358         void* e_ptr = untag_ptr(e);
20359         CHECK_ACCESS(e_ptr);
20360         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20361         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20362         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20363         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
20364         return tag_ptr(ret_conv, true);
20365 }
20366
20367 jboolean  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_is_ok(int64_t o) {
20368         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
20369         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
20370         return ret_conv;
20371 }
20372
20373 void  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_free(int64_t _res) {
20374         if (!ptr_is_owned(_res)) return;
20375         void* _res_ptr = untag_ptr(_res);
20376         CHECK_ACCESS(_res_ptr);
20377         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
20378         FREE(untag_ptr(_res));
20379         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
20380 }
20381
20382 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20383         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20384         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
20385         return tag_ptr(ret_conv, true);
20386 }
20387 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20388         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
20389         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20390         return ret_conv;
20391 }
20392
20393 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone(int64_t orig) {
20394         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
20395         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
20396         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
20397         return tag_ptr(ret_conv, true);
20398 }
20399
20400 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_ok(int64_t o) {
20401         LDKNodeFeatures o_conv;
20402         o_conv.inner = untag_ptr(o);
20403         o_conv.is_owned = ptr_is_owned(o);
20404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20405         o_conv = NodeFeatures_clone(&o_conv);
20406         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20407         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
20408         return tag_ptr(ret_conv, true);
20409 }
20410
20411 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_err(int64_t e) {
20412         void* e_ptr = untag_ptr(e);
20413         CHECK_ACCESS(e_ptr);
20414         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20415         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20416         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20417         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
20418         return tag_ptr(ret_conv, true);
20419 }
20420
20421 jboolean  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_is_ok(int64_t o) {
20422         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
20423         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
20424         return ret_conv;
20425 }
20426
20427 void  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_free(int64_t _res) {
20428         if (!ptr_is_owned(_res)) return;
20429         void* _res_ptr = untag_ptr(_res);
20430         CHECK_ACCESS(_res_ptr);
20431         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
20432         FREE(untag_ptr(_res));
20433         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
20434 }
20435
20436 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20437         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20438         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
20439         return tag_ptr(ret_conv, true);
20440 }
20441 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20442         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
20443         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20444         return ret_conv;
20445 }
20446
20447 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone(int64_t orig) {
20448         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
20449         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
20450         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
20451         return tag_ptr(ret_conv, true);
20452 }
20453
20454 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
20455         LDKBolt11InvoiceFeatures o_conv;
20456         o_conv.inner = untag_ptr(o);
20457         o_conv.is_owned = ptr_is_owned(o);
20458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20459         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
20460         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20461         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20462         return tag_ptr(ret_conv, true);
20463 }
20464
20465 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
20466         void* e_ptr = untag_ptr(e);
20467         CHECK_ACCESS(e_ptr);
20468         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20469         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20470         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20471         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
20472         return tag_ptr(ret_conv, true);
20473 }
20474
20475 jboolean  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
20476         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20477         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20478         return ret_conv;
20479 }
20480
20481 void  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
20482         if (!ptr_is_owned(_res)) return;
20483         void* _res_ptr = untag_ptr(_res);
20484         CHECK_ACCESS(_res_ptr);
20485         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20486         FREE(untag_ptr(_res));
20487         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20488 }
20489
20490 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20491         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20492         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
20493         return tag_ptr(ret_conv, true);
20494 }
20495 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20496         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20497         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20498         return ret_conv;
20499 }
20500
20501 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
20502         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20503         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
20504         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20505         return tag_ptr(ret_conv, true);
20506 }
20507
20508 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
20509         LDKBolt12InvoiceFeatures o_conv;
20510         o_conv.inner = untag_ptr(o);
20511         o_conv.is_owned = ptr_is_owned(o);
20512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20513         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
20514         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20515         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
20516         return tag_ptr(ret_conv, true);
20517 }
20518
20519 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
20520         void* e_ptr = untag_ptr(e);
20521         CHECK_ACCESS(e_ptr);
20522         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20523         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20524         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20525         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
20526         return tag_ptr(ret_conv, true);
20527 }
20528
20529 jboolean  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
20530         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
20531         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
20532         return ret_conv;
20533 }
20534
20535 void  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
20536         if (!ptr_is_owned(_res)) return;
20537         void* _res_ptr = untag_ptr(_res);
20538         CHECK_ACCESS(_res_ptr);
20539         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
20540         FREE(untag_ptr(_res));
20541         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
20542 }
20543
20544 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20545         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20546         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
20547         return tag_ptr(ret_conv, true);
20548 }
20549 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20550         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
20551         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20552         return ret_conv;
20553 }
20554
20555 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
20556         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
20557         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
20558         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
20559         return tag_ptr(ret_conv, true);
20560 }
20561
20562 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_ok(int64_t o) {
20563         LDKBlindedHopFeatures o_conv;
20564         o_conv.inner = untag_ptr(o);
20565         o_conv.is_owned = ptr_is_owned(o);
20566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20567         o_conv = BlindedHopFeatures_clone(&o_conv);
20568         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20569         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
20570         return tag_ptr(ret_conv, true);
20571 }
20572
20573 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_err(int64_t e) {
20574         void* e_ptr = untag_ptr(e);
20575         CHECK_ACCESS(e_ptr);
20576         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20577         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20578         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20579         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
20580         return tag_ptr(ret_conv, true);
20581 }
20582
20583 jboolean  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(int64_t o) {
20584         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
20585         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
20586         return ret_conv;
20587 }
20588
20589 void  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_free(int64_t _res) {
20590         if (!ptr_is_owned(_res)) return;
20591         void* _res_ptr = untag_ptr(_res);
20592         CHECK_ACCESS(_res_ptr);
20593         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
20594         FREE(untag_ptr(_res));
20595         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
20596 }
20597
20598 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20599         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20600         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
20601         return tag_ptr(ret_conv, true);
20602 }
20603 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20604         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
20605         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20606         return ret_conv;
20607 }
20608
20609 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone(int64_t orig) {
20610         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
20611         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
20612         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
20613         return tag_ptr(ret_conv, true);
20614 }
20615
20616 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(int64_t o) {
20617         LDKChannelTypeFeatures o_conv;
20618         o_conv.inner = untag_ptr(o);
20619         o_conv.is_owned = ptr_is_owned(o);
20620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20621         o_conv = ChannelTypeFeatures_clone(&o_conv);
20622         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20623         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
20624         return tag_ptr(ret_conv, true);
20625 }
20626
20627 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_err(int64_t e) {
20628         void* e_ptr = untag_ptr(e);
20629         CHECK_ACCESS(e_ptr);
20630         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20631         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20632         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20633         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
20634         return tag_ptr(ret_conv, true);
20635 }
20636
20637 jboolean  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(int64_t o) {
20638         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
20639         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
20640         return ret_conv;
20641 }
20642
20643 void  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_free(int64_t _res) {
20644         if (!ptr_is_owned(_res)) return;
20645         void* _res_ptr = untag_ptr(_res);
20646         CHECK_ACCESS(_res_ptr);
20647         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
20648         FREE(untag_ptr(_res));
20649         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
20650 }
20651
20652 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
20653         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20654         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
20655         return tag_ptr(ret_conv, true);
20656 }
20657 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
20658         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
20659         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
20660         return ret_conv;
20661 }
20662
20663 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(int64_t orig) {
20664         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
20665         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
20666         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
20667         return tag_ptr(ret_conv, true);
20668 }
20669
20670 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_ok(int64_t o) {
20671         LDKOffer o_conv;
20672         o_conv.inner = untag_ptr(o);
20673         o_conv.is_owned = ptr_is_owned(o);
20674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20675         o_conv = Offer_clone(&o_conv);
20676         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20677         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
20678         return tag_ptr(ret_conv, true);
20679 }
20680
20681 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_err(int64_t e) {
20682         LDKBolt12ParseError e_conv;
20683         e_conv.inner = untag_ptr(e);
20684         e_conv.is_owned = ptr_is_owned(e);
20685         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20686         e_conv = Bolt12ParseError_clone(&e_conv);
20687         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20688         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
20689         return tag_ptr(ret_conv, true);
20690 }
20691
20692 jboolean  CS_LDK_CResult_OfferBolt12ParseErrorZ_is_ok(int64_t o) {
20693         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
20694         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
20695         return ret_conv;
20696 }
20697
20698 void  CS_LDK_CResult_OfferBolt12ParseErrorZ_free(int64_t _res) {
20699         if (!ptr_is_owned(_res)) return;
20700         void* _res_ptr = untag_ptr(_res);
20701         CHECK_ACCESS(_res_ptr);
20702         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
20703         FREE(untag_ptr(_res));
20704         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
20705 }
20706
20707 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
20708         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20709         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
20710         return tag_ptr(ret_conv, true);
20711 }
20712 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone_ptr(int64_t arg) {
20713         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
20714         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
20715         return ret_conv;
20716 }
20717
20718 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone(int64_t orig) {
20719         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
20720         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
20721         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
20722         return tag_ptr(ret_conv, true);
20723 }
20724
20725 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
20726         LDKPublicKey o_ref;
20727         CHECK(o->arr_len == 33);
20728         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
20729         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20730         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
20731         return tag_ptr(ret_conv, true);
20732 }
20733
20734 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_err(int32_t e) {
20735         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
20736         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20737         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
20738         return tag_ptr(ret_conv, true);
20739 }
20740
20741 jboolean  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_is_ok(int64_t o) {
20742         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
20743         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
20744         return ret_conv;
20745 }
20746
20747 void  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_free(int64_t _res) {
20748         if (!ptr_is_owned(_res)) return;
20749         void* _res_ptr = untag_ptr(_res);
20750         CHECK_ACCESS(_res_ptr);
20751         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
20752         FREE(untag_ptr(_res));
20753         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
20754 }
20755
20756 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
20757         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20758         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
20759         return tag_ptr(ret_conv, true);
20760 }
20761 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
20762         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
20763         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
20764         return ret_conv;
20765 }
20766
20767 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone(int64_t orig) {
20768         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
20769         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
20770         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
20771         return tag_ptr(ret_conv, true);
20772 }
20773
20774 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_ok(int64_t o) {
20775         LDKNodeId o_conv;
20776         o_conv.inner = untag_ptr(o);
20777         o_conv.is_owned = ptr_is_owned(o);
20778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20779         o_conv = NodeId_clone(&o_conv);
20780         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20781         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20782         return tag_ptr(ret_conv, true);
20783 }
20784
20785 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_err(int64_t e) {
20786         void* e_ptr = untag_ptr(e);
20787         CHECK_ACCESS(e_ptr);
20788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20790         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20791         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20792         return tag_ptr(ret_conv, true);
20793 }
20794
20795 jboolean  CS_LDK_CResult_NodeIdDecodeErrorZ_is_ok(int64_t o) {
20796         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
20797         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20798         return ret_conv;
20799 }
20800
20801 void  CS_LDK_CResult_NodeIdDecodeErrorZ_free(int64_t _res) {
20802         if (!ptr_is_owned(_res)) return;
20803         void* _res_ptr = untag_ptr(_res);
20804         CHECK_ACCESS(_res_ptr);
20805         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20806         FREE(untag_ptr(_res));
20807         CResult_NodeIdDecodeErrorZ_free(_res_conv);
20808 }
20809
20810 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20811         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20812         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20813         return tag_ptr(ret_conv, true);
20814 }
20815 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone_ptr(int64_t arg) {
20816         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
20817         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20818         return ret_conv;
20819 }
20820
20821 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone(int64_t orig) {
20822         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
20823         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20824         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20825         return tag_ptr(ret_conv, true);
20826 }
20827
20828 int64_t  CS_LDK_COption_NetworkUpdateZ_some(int64_t o) {
20829         void* o_ptr = untag_ptr(o);
20830         CHECK_ACCESS(o_ptr);
20831         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
20832         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
20833         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20834         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
20835         int64_t ret_ref = tag_ptr(ret_copy, true);
20836         return ret_ref;
20837 }
20838
20839 int64_t  CS_LDK_COption_NetworkUpdateZ_none() {
20840         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20841         *ret_copy = COption_NetworkUpdateZ_none();
20842         int64_t ret_ref = tag_ptr(ret_copy, true);
20843         return ret_ref;
20844 }
20845
20846 void  CS_LDK_COption_NetworkUpdateZ_free(int64_t _res) {
20847         if (!ptr_is_owned(_res)) return;
20848         void* _res_ptr = untag_ptr(_res);
20849         CHECK_ACCESS(_res_ptr);
20850         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
20851         FREE(untag_ptr(_res));
20852         COption_NetworkUpdateZ_free(_res_conv);
20853 }
20854
20855 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
20856         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20857         *ret_copy = COption_NetworkUpdateZ_clone(arg);
20858         int64_t ret_ref = tag_ptr(ret_copy, true);
20859         return ret_ref;
20860 }
20861 int64_t  CS_LDK_COption_NetworkUpdateZ_clone_ptr(int64_t arg) {
20862         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
20863         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
20864         return ret_conv;
20865 }
20866
20867 int64_t  CS_LDK_COption_NetworkUpdateZ_clone(int64_t orig) {
20868         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
20869         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
20870         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
20871         int64_t ret_ref = tag_ptr(ret_copy, true);
20872         return ret_ref;
20873 }
20874
20875 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(int64_t o) {
20876         void* o_ptr = untag_ptr(o);
20877         CHECK_ACCESS(o_ptr);
20878         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20879         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
20880         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20881         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20882         return tag_ptr(ret_conv, true);
20883 }
20884
20885 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_err(int64_t e) {
20886         void* e_ptr = untag_ptr(e);
20887         CHECK_ACCESS(e_ptr);
20888         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20889         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20890         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20891         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20892         return tag_ptr(ret_conv, true);
20893 }
20894
20895 jboolean  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(int64_t o) {
20896         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
20897         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20898         return ret_conv;
20899 }
20900
20901 void  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_free(int64_t _res) {
20902         if (!ptr_is_owned(_res)) return;
20903         void* _res_ptr = untag_ptr(_res);
20904         CHECK_ACCESS(_res_ptr);
20905         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20906         FREE(untag_ptr(_res));
20907         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20908 }
20909
20910 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20911         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20912         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20913         return tag_ptr(ret_conv, true);
20914 }
20915 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(int64_t arg) {
20916         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
20917         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20918         return ret_conv;
20919 }
20920
20921 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(int64_t orig) {
20922         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
20923         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20924         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20925         return tag_ptr(ret_conv, true);
20926 }
20927
20928 int64_t  CS_LDK_COption_UtxoLookupZ_some(int64_t o) {
20929         void* o_ptr = untag_ptr(o);
20930         CHECK_ACCESS(o_ptr);
20931         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
20932         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
20933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20934                 LDKUtxoLookup_JCalls_cloned(&o_conv);
20935         }
20936         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20937         *ret_copy = COption_UtxoLookupZ_some(o_conv);
20938         int64_t ret_ref = tag_ptr(ret_copy, true);
20939         return ret_ref;
20940 }
20941
20942 int64_t  CS_LDK_COption_UtxoLookupZ_none() {
20943         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
20944         *ret_copy = COption_UtxoLookupZ_none();
20945         int64_t ret_ref = tag_ptr(ret_copy, true);
20946         return ret_ref;
20947 }
20948
20949 void  CS_LDK_COption_UtxoLookupZ_free(int64_t _res) {
20950         if (!ptr_is_owned(_res)) return;
20951         void* _res_ptr = untag_ptr(_res);
20952         CHECK_ACCESS(_res_ptr);
20953         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
20954         FREE(untag_ptr(_res));
20955         COption_UtxoLookupZ_free(_res_conv);
20956 }
20957
20958 int64_t  CS_LDK_CResult_NoneLightningErrorZ_ok() {
20959         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20960         *ret_conv = CResult_NoneLightningErrorZ_ok();
20961         return tag_ptr(ret_conv, true);
20962 }
20963
20964 int64_t  CS_LDK_CResult_NoneLightningErrorZ_err(int64_t e) {
20965         LDKLightningError e_conv;
20966         e_conv.inner = untag_ptr(e);
20967         e_conv.is_owned = ptr_is_owned(e);
20968         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20969         e_conv = LightningError_clone(&e_conv);
20970         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20971         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
20972         return tag_ptr(ret_conv, true);
20973 }
20974
20975 jboolean  CS_LDK_CResult_NoneLightningErrorZ_is_ok(int64_t o) {
20976         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
20977         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
20978         return ret_conv;
20979 }
20980
20981 void  CS_LDK_CResult_NoneLightningErrorZ_free(int64_t _res) {
20982         if (!ptr_is_owned(_res)) return;
20983         void* _res_ptr = untag_ptr(_res);
20984         CHECK_ACCESS(_res_ptr);
20985         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
20986         FREE(untag_ptr(_res));
20987         CResult_NoneLightningErrorZ_free(_res_conv);
20988 }
20989
20990 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
20991         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20992         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
20993         return tag_ptr(ret_conv, true);
20994 }
20995 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone_ptr(int64_t arg) {
20996         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
20997         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
20998         return ret_conv;
20999 }
21000
21001 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone(int64_t orig) {
21002         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
21003         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21004         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
21005         return tag_ptr(ret_conv, true);
21006 }
21007
21008 int64_t  CS_LDK_CResult_boolLightningErrorZ_ok(jboolean o) {
21009         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21010         *ret_conv = CResult_boolLightningErrorZ_ok(o);
21011         return tag_ptr(ret_conv, true);
21012 }
21013
21014 int64_t  CS_LDK_CResult_boolLightningErrorZ_err(int64_t e) {
21015         LDKLightningError e_conv;
21016         e_conv.inner = untag_ptr(e);
21017         e_conv.is_owned = ptr_is_owned(e);
21018         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21019         e_conv = LightningError_clone(&e_conv);
21020         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21021         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
21022         return tag_ptr(ret_conv, true);
21023 }
21024
21025 jboolean  CS_LDK_CResult_boolLightningErrorZ_is_ok(int64_t o) {
21026         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
21027         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
21028         return ret_conv;
21029 }
21030
21031 void  CS_LDK_CResult_boolLightningErrorZ_free(int64_t _res) {
21032         if (!ptr_is_owned(_res)) return;
21033         void* _res_ptr = untag_ptr(_res);
21034         CHECK_ACCESS(_res_ptr);
21035         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
21036         FREE(untag_ptr(_res));
21037         CResult_boolLightningErrorZ_free(_res_conv);
21038 }
21039
21040 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
21041         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21042         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
21043         return tag_ptr(ret_conv, true);
21044 }
21045 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone_ptr(int64_t arg) {
21046         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
21047         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
21048         return ret_conv;
21049 }
21050
21051 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone(int64_t orig) {
21052         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
21053         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21054         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
21055         return tag_ptr(ret_conv, true);
21056 }
21057
21058 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
21059         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21060         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
21061         return tag_ptr(ret_conv, true);
21062 }
21063 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(int64_t arg) {
21064         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
21065         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
21066         return ret_conv;
21067 }
21068
21069 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(int64_t orig) {
21070         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
21071         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21072         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
21073         return tag_ptr(ret_conv, true);
21074 }
21075
21076 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(int64_t a, int64_t b, int64_t c) {
21077         LDKChannelAnnouncement a_conv;
21078         a_conv.inner = untag_ptr(a);
21079         a_conv.is_owned = ptr_is_owned(a);
21080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21081         a_conv = ChannelAnnouncement_clone(&a_conv);
21082         LDKChannelUpdate b_conv;
21083         b_conv.inner = untag_ptr(b);
21084         b_conv.is_owned = ptr_is_owned(b);
21085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21086         b_conv = ChannelUpdate_clone(&b_conv);
21087         LDKChannelUpdate c_conv;
21088         c_conv.inner = untag_ptr(c);
21089         c_conv.is_owned = ptr_is_owned(c);
21090         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
21091         c_conv = ChannelUpdate_clone(&c_conv);
21092         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
21093         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
21094         return tag_ptr(ret_conv, true);
21095 }
21096
21097 void  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(int64_t _res) {
21098         if (!ptr_is_owned(_res)) return;
21099         void* _res_ptr = untag_ptr(_res);
21100         CHECK_ACCESS(_res_ptr);
21101         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
21102         FREE(untag_ptr(_res));
21103         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
21104 }
21105
21106 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(int64_t o) {
21107         void* o_ptr = untag_ptr(o);
21108         CHECK_ACCESS(o_ptr);
21109         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
21110         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
21111         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21112         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
21113         int64_t ret_ref = tag_ptr(ret_copy, true);
21114         return ret_ref;
21115 }
21116
21117 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
21118         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21119         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
21120         int64_t ret_ref = tag_ptr(ret_copy, true);
21121         return ret_ref;
21122 }
21123
21124 void  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(int64_t _res) {
21125         if (!ptr_is_owned(_res)) return;
21126         void* _res_ptr = untag_ptr(_res);
21127         CHECK_ACCESS(_res_ptr);
21128         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
21129         FREE(untag_ptr(_res));
21130         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
21131 }
21132
21133 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
21134         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21135         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
21136         int64_t ret_ref = tag_ptr(ret_copy, true);
21137         return ret_ref;
21138 }
21139 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(int64_t arg) {
21140         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
21141         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
21142         return ret_conv;
21143 }
21144
21145 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(int64_t orig) {
21146         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
21147         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21148         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
21149         int64_t ret_ref = tag_ptr(ret_copy, true);
21150         return ret_ref;
21151 }
21152
21153 void  CS_LDK_CVec_MessageSendEventZ_free(int64_tArray _res) {
21154         LDKCVec_MessageSendEventZ _res_constr;
21155         _res_constr.datalen = _res->arr_len;
21156         if (_res_constr.datalen > 0)
21157                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
21158         else
21159                 _res_constr.data = NULL;
21160         int64_t* _res_vals = _res->elems;
21161         for (size_t s = 0; s < _res_constr.datalen; s++) {
21162                 int64_t _res_conv_18 = _res_vals[s];
21163                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
21164                 CHECK_ACCESS(_res_conv_18_ptr);
21165                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
21166                 FREE(untag_ptr(_res_conv_18));
21167                 _res_constr.data[s] = _res_conv_18_conv;
21168         }
21169         FREE(_res);
21170         CVec_MessageSendEventZ_free(_res_constr);
21171 }
21172
21173 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_ok(int64_t o) {
21174         LDKChannelUpdateInfo o_conv;
21175         o_conv.inner = untag_ptr(o);
21176         o_conv.is_owned = ptr_is_owned(o);
21177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21178         o_conv = ChannelUpdateInfo_clone(&o_conv);
21179         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21180         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
21181         return tag_ptr(ret_conv, true);
21182 }
21183
21184 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_err(int64_t e) {
21185         void* e_ptr = untag_ptr(e);
21186         CHECK_ACCESS(e_ptr);
21187         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21188         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21189         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21190         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
21191         return tag_ptr(ret_conv, true);
21192 }
21193
21194 jboolean  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(int64_t o) {
21195         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
21196         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
21197         return ret_conv;
21198 }
21199
21200 void  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_free(int64_t _res) {
21201         if (!ptr_is_owned(_res)) return;
21202         void* _res_ptr = untag_ptr(_res);
21203         CHECK_ACCESS(_res_ptr);
21204         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
21205         FREE(untag_ptr(_res));
21206         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
21207 }
21208
21209 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
21210         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21211         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
21212         return tag_ptr(ret_conv, true);
21213 }
21214 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21215         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
21216         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
21217         return ret_conv;
21218 }
21219
21220 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone(int64_t orig) {
21221         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
21222         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
21223         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
21224         return tag_ptr(ret_conv, true);
21225 }
21226
21227 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_ok(int64_t o) {
21228         LDKChannelInfo o_conv;
21229         o_conv.inner = untag_ptr(o);
21230         o_conv.is_owned = ptr_is_owned(o);
21231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21232         o_conv = ChannelInfo_clone(&o_conv);
21233         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21234         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
21235         return tag_ptr(ret_conv, true);
21236 }
21237
21238 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_err(int64_t e) {
21239         void* e_ptr = untag_ptr(e);
21240         CHECK_ACCESS(e_ptr);
21241         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21242         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21243         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21244         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
21245         return tag_ptr(ret_conv, true);
21246 }
21247
21248 jboolean  CS_LDK_CResult_ChannelInfoDecodeErrorZ_is_ok(int64_t o) {
21249         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
21250         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
21251         return ret_conv;
21252 }
21253
21254 void  CS_LDK_CResult_ChannelInfoDecodeErrorZ_free(int64_t _res) {
21255         if (!ptr_is_owned(_res)) return;
21256         void* _res_ptr = untag_ptr(_res);
21257         CHECK_ACCESS(_res_ptr);
21258         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
21259         FREE(untag_ptr(_res));
21260         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
21261 }
21262
21263 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
21264         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21265         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
21266         return tag_ptr(ret_conv, true);
21267 }
21268 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21269         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
21270         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
21271         return ret_conv;
21272 }
21273
21274 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone(int64_t orig) {
21275         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
21276         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
21277         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
21278         return tag_ptr(ret_conv, true);
21279 }
21280
21281 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_ok(int64_t o) {
21282         LDKRoutingFees o_conv;
21283         o_conv.inner = untag_ptr(o);
21284         o_conv.is_owned = ptr_is_owned(o);
21285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21286         o_conv = RoutingFees_clone(&o_conv);
21287         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21288         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
21289         return tag_ptr(ret_conv, true);
21290 }
21291
21292 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_err(int64_t e) {
21293         void* e_ptr = untag_ptr(e);
21294         CHECK_ACCESS(e_ptr);
21295         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21296         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21297         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21298         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
21299         return tag_ptr(ret_conv, true);
21300 }
21301
21302 jboolean  CS_LDK_CResult_RoutingFeesDecodeErrorZ_is_ok(int64_t o) {
21303         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
21304         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
21305         return ret_conv;
21306 }
21307
21308 void  CS_LDK_CResult_RoutingFeesDecodeErrorZ_free(int64_t _res) {
21309         if (!ptr_is_owned(_res)) return;
21310         void* _res_ptr = untag_ptr(_res);
21311         CHECK_ACCESS(_res_ptr);
21312         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
21313         FREE(untag_ptr(_res));
21314         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
21315 }
21316
21317 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
21318         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21319         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
21320         return tag_ptr(ret_conv, true);
21321 }
21322 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone_ptr(int64_t arg) {
21323         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
21324         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
21325         return ret_conv;
21326 }
21327
21328 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone(int64_t orig) {
21329         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
21330         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
21331         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
21332         return tag_ptr(ret_conv, true);
21333 }
21334
21335 void  CS_LDK_CVec_SocketAddressZ_free(int64_tArray _res) {
21336         LDKCVec_SocketAddressZ _res_constr;
21337         _res_constr.datalen = _res->arr_len;
21338         if (_res_constr.datalen > 0)
21339                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21340         else
21341                 _res_constr.data = NULL;
21342         int64_t* _res_vals = _res->elems;
21343         for (size_t p = 0; p < _res_constr.datalen; p++) {
21344                 int64_t _res_conv_15 = _res_vals[p];
21345                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
21346                 CHECK_ACCESS(_res_conv_15_ptr);
21347                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
21348                 FREE(untag_ptr(_res_conv_15));
21349                 _res_constr.data[p] = _res_conv_15_conv;
21350         }
21351         FREE(_res);
21352         CVec_SocketAddressZ_free(_res_constr);
21353 }
21354
21355 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(int64_t o) {
21356         LDKNodeAnnouncementInfo o_conv;
21357         o_conv.inner = untag_ptr(o);
21358         o_conv.is_owned = ptr_is_owned(o);
21359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21360         o_conv = NodeAnnouncementInfo_clone(&o_conv);
21361         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21362         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
21363         return tag_ptr(ret_conv, true);
21364 }
21365
21366 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_err(int64_t e) {
21367         void* e_ptr = untag_ptr(e);
21368         CHECK_ACCESS(e_ptr);
21369         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21370         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21371         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21372         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
21373         return tag_ptr(ret_conv, true);
21374 }
21375
21376 jboolean  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(int64_t o) {
21377         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
21378         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
21379         return ret_conv;
21380 }
21381
21382 void  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_free(int64_t _res) {
21383         if (!ptr_is_owned(_res)) return;
21384         void* _res_ptr = untag_ptr(_res);
21385         CHECK_ACCESS(_res_ptr);
21386         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
21387         FREE(untag_ptr(_res));
21388         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
21389 }
21390
21391 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
21392         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21393         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
21394         return tag_ptr(ret_conv, true);
21395 }
21396 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21397         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
21398         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
21399         return ret_conv;
21400 }
21401
21402 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(int64_t orig) {
21403         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
21404         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
21405         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
21406         return tag_ptr(ret_conv, true);
21407 }
21408
21409 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_ok(int64_t o) {
21410         LDKNodeAlias o_conv;
21411         o_conv.inner = untag_ptr(o);
21412         o_conv.is_owned = ptr_is_owned(o);
21413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21414         o_conv = NodeAlias_clone(&o_conv);
21415         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21416         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
21417         return tag_ptr(ret_conv, true);
21418 }
21419
21420 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_err(int64_t e) {
21421         void* e_ptr = untag_ptr(e);
21422         CHECK_ACCESS(e_ptr);
21423         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21424         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21425         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21426         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
21427         return tag_ptr(ret_conv, true);
21428 }
21429
21430 jboolean  CS_LDK_CResult_NodeAliasDecodeErrorZ_is_ok(int64_t o) {
21431         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
21432         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
21433         return ret_conv;
21434 }
21435
21436 void  CS_LDK_CResult_NodeAliasDecodeErrorZ_free(int64_t _res) {
21437         if (!ptr_is_owned(_res)) return;
21438         void* _res_ptr = untag_ptr(_res);
21439         CHECK_ACCESS(_res_ptr);
21440         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
21441         FREE(untag_ptr(_res));
21442         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
21443 }
21444
21445 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
21446         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21447         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
21448         return tag_ptr(ret_conv, true);
21449 }
21450 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone_ptr(int64_t arg) {
21451         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
21452         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
21453         return ret_conv;
21454 }
21455
21456 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone(int64_t orig) {
21457         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
21458         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
21459         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
21460         return tag_ptr(ret_conv, true);
21461 }
21462
21463 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_ok(int64_t o) {
21464         LDKNodeInfo o_conv;
21465         o_conv.inner = untag_ptr(o);
21466         o_conv.is_owned = ptr_is_owned(o);
21467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21468         o_conv = NodeInfo_clone(&o_conv);
21469         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21470         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
21471         return tag_ptr(ret_conv, true);
21472 }
21473
21474 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_err(int64_t e) {
21475         void* e_ptr = untag_ptr(e);
21476         CHECK_ACCESS(e_ptr);
21477         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21478         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21479         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21480         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
21481         return tag_ptr(ret_conv, true);
21482 }
21483
21484 jboolean  CS_LDK_CResult_NodeInfoDecodeErrorZ_is_ok(int64_t o) {
21485         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
21486         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
21487         return ret_conv;
21488 }
21489
21490 void  CS_LDK_CResult_NodeInfoDecodeErrorZ_free(int64_t _res) {
21491         if (!ptr_is_owned(_res)) return;
21492         void* _res_ptr = untag_ptr(_res);
21493         CHECK_ACCESS(_res_ptr);
21494         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
21495         FREE(untag_ptr(_res));
21496         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
21497 }
21498
21499 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
21500         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21501         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
21502         return tag_ptr(ret_conv, true);
21503 }
21504 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone_ptr(int64_t arg) {
21505         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
21506         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
21507         return ret_conv;
21508 }
21509
21510 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone(int64_t orig) {
21511         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
21512         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
21513         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
21514         return tag_ptr(ret_conv, true);
21515 }
21516
21517 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_ok(int64_t o) {
21518         LDKNetworkGraph o_conv;
21519         o_conv.inner = untag_ptr(o);
21520         o_conv.is_owned = ptr_is_owned(o);
21521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21522         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
21523         
21524         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21525         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
21526         return tag_ptr(ret_conv, true);
21527 }
21528
21529 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_err(int64_t e) {
21530         void* e_ptr = untag_ptr(e);
21531         CHECK_ACCESS(e_ptr);
21532         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21533         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21534         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
21535         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
21536         return tag_ptr(ret_conv, true);
21537 }
21538
21539 jboolean  CS_LDK_CResult_NetworkGraphDecodeErrorZ_is_ok(int64_t o) {
21540         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
21541         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
21542         return ret_conv;
21543 }
21544
21545 void  CS_LDK_CResult_NetworkGraphDecodeErrorZ_free(int64_t _res) {
21546         if (!ptr_is_owned(_res)) return;
21547         void* _res_ptr = untag_ptr(_res);
21548         CHECK_ACCESS(_res_ptr);
21549         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
21550         FREE(untag_ptr(_res));
21551         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
21552 }
21553
21554 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_some(int64_tArray o) {
21555         LDKCVec_SocketAddressZ o_constr;
21556         o_constr.datalen = o->arr_len;
21557         if (o_constr.datalen > 0)
21558                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
21559         else
21560                 o_constr.data = NULL;
21561         int64_t* o_vals = o->elems;
21562         for (size_t p = 0; p < o_constr.datalen; p++) {
21563                 int64_t o_conv_15 = o_vals[p];
21564                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
21565                 CHECK_ACCESS(o_conv_15_ptr);
21566                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
21567                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
21568                 o_constr.data[p] = o_conv_15_conv;
21569         }
21570         FREE(o);
21571         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21572         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
21573         int64_t ret_ref = tag_ptr(ret_copy, true);
21574         return ret_ref;
21575 }
21576
21577 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_none() {
21578         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21579         *ret_copy = COption_CVec_SocketAddressZZ_none();
21580         int64_t ret_ref = tag_ptr(ret_copy, true);
21581         return ret_ref;
21582 }
21583
21584 void  CS_LDK_COption_CVec_SocketAddressZZ_free(int64_t _res) {
21585         if (!ptr_is_owned(_res)) return;
21586         void* _res_ptr = untag_ptr(_res);
21587         CHECK_ACCESS(_res_ptr);
21588         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
21589         FREE(untag_ptr(_res));
21590         COption_CVec_SocketAddressZZ_free(_res_conv);
21591 }
21592
21593 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
21594         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21595         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
21596         int64_t ret_ref = tag_ptr(ret_copy, true);
21597         return ret_ref;
21598 }
21599 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone_ptr(int64_t arg) {
21600         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
21601         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
21602         return ret_conv;
21603 }
21604
21605 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone(int64_t orig) {
21606         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
21607         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
21608         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
21609         int64_t ret_ref = tag_ptr(ret_copy, true);
21610         return ret_ref;
21611 }
21612
21613 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(int64_t o) {
21614         LDKPendingHTLCInfo o_conv;
21615         o_conv.inner = untag_ptr(o);
21616         o_conv.is_owned = ptr_is_owned(o);
21617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21618         o_conv = PendingHTLCInfo_clone(&o_conv);
21619         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21620         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
21621         return tag_ptr(ret_conv, true);
21622 }
21623
21624 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_err(int64_t e) {
21625         LDKInboundHTLCErr e_conv;
21626         e_conv.inner = untag_ptr(e);
21627         e_conv.is_owned = ptr_is_owned(e);
21628         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21629         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
21630         
21631         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
21632         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
21633         return tag_ptr(ret_conv, true);
21634 }
21635
21636 jboolean  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(int64_t o) {
21637         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
21638         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
21639         return ret_conv;
21640 }
21641
21642 void  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_free(int64_t _res) {
21643         if (!ptr_is_owned(_res)) return;
21644         void* _res_ptr = untag_ptr(_res);
21645         CHECK_ACCESS(_res_ptr);
21646         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
21647         FREE(untag_ptr(_res));
21648         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
21649 }
21650
21651 void  CS_LDK_CVec_HTLCOutputInCommitmentZ_free(int64_tArray _res) {
21652         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
21653         _res_constr.datalen = _res->arr_len;
21654         if (_res_constr.datalen > 0)
21655                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
21656         else
21657                 _res_constr.data = NULL;
21658         int64_t* _res_vals = _res->elems;
21659         for (size_t y = 0; y < _res_constr.datalen; y++) {
21660                 int64_t _res_conv_24 = _res_vals[y];
21661                 LDKHTLCOutputInCommitment _res_conv_24_conv;
21662                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
21663                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
21664                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
21665                 _res_constr.data[y] = _res_conv_24_conv;
21666         }
21667         FREE(_res);
21668         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
21669 }
21670
21671 void  CS_LDK_CVec_HTLCDescriptorZ_free(int64_tArray _res) {
21672         LDKCVec_HTLCDescriptorZ _res_constr;
21673         _res_constr.datalen = _res->arr_len;
21674         if (_res_constr.datalen > 0)
21675                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
21676         else
21677                 _res_constr.data = NULL;
21678         int64_t* _res_vals = _res->elems;
21679         for (size_t q = 0; q < _res_constr.datalen; q++) {
21680                 int64_t _res_conv_16 = _res_vals[q];
21681                 LDKHTLCDescriptor _res_conv_16_conv;
21682                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21683                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21685                 _res_constr.data[q] = _res_conv_16_conv;
21686         }
21687         FREE(_res);
21688         CVec_HTLCDescriptorZ_free(_res_constr);
21689 }
21690
21691 void  CS_LDK_CVec_UtxoZ_free(int64_tArray _res) {
21692         LDKCVec_UtxoZ _res_constr;
21693         _res_constr.datalen = _res->arr_len;
21694         if (_res_constr.datalen > 0)
21695                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21696         else
21697                 _res_constr.data = NULL;
21698         int64_t* _res_vals = _res->elems;
21699         for (size_t g = 0; g < _res_constr.datalen; g++) {
21700                 int64_t _res_conv_6 = _res_vals[g];
21701                 LDKUtxo _res_conv_6_conv;
21702                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21703                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21704                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21705                 _res_constr.data[g] = _res_conv_6_conv;
21706         }
21707         FREE(_res);
21708         CVec_UtxoZ_free(_res_constr);
21709 }
21710
21711 int64_t  CS_LDK_COption_TxOutZ_some(int64_t o) {
21712         void* o_ptr = untag_ptr(o);
21713         CHECK_ACCESS(o_ptr);
21714         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
21715         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
21716         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21717         *ret_copy = COption_TxOutZ_some(o_conv);
21718         int64_t ret_ref = tag_ptr(ret_copy, true);
21719         return ret_ref;
21720 }
21721
21722 int64_t  CS_LDK_COption_TxOutZ_none() {
21723         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21724         *ret_copy = COption_TxOutZ_none();
21725         int64_t ret_ref = tag_ptr(ret_copy, true);
21726         return ret_ref;
21727 }
21728
21729 void  CS_LDK_COption_TxOutZ_free(int64_t _res) {
21730         if (!ptr_is_owned(_res)) return;
21731         void* _res_ptr = untag_ptr(_res);
21732         CHECK_ACCESS(_res_ptr);
21733         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
21734         FREE(untag_ptr(_res));
21735         COption_TxOutZ_free(_res_conv);
21736 }
21737
21738 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
21739         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21740         *ret_copy = COption_TxOutZ_clone(arg);
21741         int64_t ret_ref = tag_ptr(ret_copy, true);
21742         return ret_ref;
21743 }
21744 int64_t  CS_LDK_COption_TxOutZ_clone_ptr(int64_t arg) {
21745         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
21746         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
21747         return ret_conv;
21748 }
21749
21750 int64_t  CS_LDK_COption_TxOutZ_clone(int64_t orig) {
21751         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
21752         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
21753         *ret_copy = COption_TxOutZ_clone(orig_conv);
21754         int64_t ret_ref = tag_ptr(ret_copy, true);
21755         return ret_ref;
21756 }
21757
21758 void  CS_LDK_CVec_InputZ_free(int64_tArray _res) {
21759         LDKCVec_InputZ _res_constr;
21760         _res_constr.datalen = _res->arr_len;
21761         if (_res_constr.datalen > 0)
21762                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21763         else
21764                 _res_constr.data = NULL;
21765         int64_t* _res_vals = _res->elems;
21766         for (size_t h = 0; h < _res_constr.datalen; h++) {
21767                 int64_t _res_conv_7 = _res_vals[h];
21768                 LDKInput _res_conv_7_conv;
21769                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
21770                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
21771                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
21772                 _res_constr.data[h] = _res_conv_7_conv;
21773         }
21774         FREE(_res);
21775         CVec_InputZ_free(_res_constr);
21776 }
21777
21778 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_ok(int64_t o) {
21779         LDKCoinSelection o_conv;
21780         o_conv.inner = untag_ptr(o);
21781         o_conv.is_owned = ptr_is_owned(o);
21782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21783         o_conv = CoinSelection_clone(&o_conv);
21784         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21785         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
21786         return tag_ptr(ret_conv, true);
21787 }
21788
21789 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_err() {
21790         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21791         *ret_conv = CResult_CoinSelectionNoneZ_err();
21792         return tag_ptr(ret_conv, true);
21793 }
21794
21795 jboolean  CS_LDK_CResult_CoinSelectionNoneZ_is_ok(int64_t o) {
21796         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
21797         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
21798         return ret_conv;
21799 }
21800
21801 void  CS_LDK_CResult_CoinSelectionNoneZ_free(int64_t _res) {
21802         if (!ptr_is_owned(_res)) return;
21803         void* _res_ptr = untag_ptr(_res);
21804         CHECK_ACCESS(_res_ptr);
21805         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
21806         FREE(untag_ptr(_res));
21807         CResult_CoinSelectionNoneZ_free(_res_conv);
21808 }
21809
21810 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
21811         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21812         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
21813         return tag_ptr(ret_conv, true);
21814 }
21815 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone_ptr(int64_t arg) {
21816         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
21817         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
21818         return ret_conv;
21819 }
21820
21821 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone(int64_t orig) {
21822         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
21823         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21824         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
21825         return tag_ptr(ret_conv, true);
21826 }
21827
21828 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_ok(int64_tArray o) {
21829         LDKCVec_UtxoZ o_constr;
21830         o_constr.datalen = o->arr_len;
21831         if (o_constr.datalen > 0)
21832                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
21833         else
21834                 o_constr.data = NULL;
21835         int64_t* o_vals = o->elems;
21836         for (size_t g = 0; g < o_constr.datalen; g++) {
21837                 int64_t o_conv_6 = o_vals[g];
21838                 LDKUtxo o_conv_6_conv;
21839                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
21840                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
21841                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
21842                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
21843                 o_constr.data[g] = o_conv_6_conv;
21844         }
21845         FREE(o);
21846         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21847         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
21848         return tag_ptr(ret_conv, true);
21849 }
21850
21851 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_err() {
21852         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21853         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
21854         return tag_ptr(ret_conv, true);
21855 }
21856
21857 jboolean  CS_LDK_CResult_CVec_UtxoZNoneZ_is_ok(int64_t o) {
21858         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
21859         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
21860         return ret_conv;
21861 }
21862
21863 void  CS_LDK_CResult_CVec_UtxoZNoneZ_free(int64_t _res) {
21864         if (!ptr_is_owned(_res)) return;
21865         void* _res_ptr = untag_ptr(_res);
21866         CHECK_ACCESS(_res_ptr);
21867         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
21868         FREE(untag_ptr(_res));
21869         CResult_CVec_UtxoZNoneZ_free(_res_conv);
21870 }
21871
21872 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
21873         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21874         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
21875         return tag_ptr(ret_conv, true);
21876 }
21877 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone_ptr(int64_t arg) {
21878         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
21879         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
21880         return ret_conv;
21881 }
21882
21883 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone(int64_t orig) {
21884         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
21885         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21886         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
21887         return tag_ptr(ret_conv, true);
21888 }
21889
21890 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
21891         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21892         *ret_conv = C2Tuple_u64u16Z_clone(arg);
21893         return tag_ptr(ret_conv, true);
21894 }
21895 int64_t  CS_LDK_C2Tuple_u64u16Z_clone_ptr(int64_t arg) {
21896         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
21897         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
21898         return ret_conv;
21899 }
21900
21901 int64_t  CS_LDK_C2Tuple_u64u16Z_clone(int64_t orig) {
21902         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
21903         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21904         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
21905         return tag_ptr(ret_conv, true);
21906 }
21907
21908 int64_t  CS_LDK_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
21909         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
21910         *ret_conv = C2Tuple_u64u16Z_new(a, b);
21911         return tag_ptr(ret_conv, true);
21912 }
21913
21914 void  CS_LDK_C2Tuple_u64u16Z_free(int64_t _res) {
21915         if (!ptr_is_owned(_res)) return;
21916         void* _res_ptr = untag_ptr(_res);
21917         CHECK_ACCESS(_res_ptr);
21918         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
21919         FREE(untag_ptr(_res));
21920         C2Tuple_u64u16Z_free(_res_conv);
21921 }
21922
21923 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_some(int64_t o) {
21924         void* o_ptr = untag_ptr(o);
21925         CHECK_ACCESS(o_ptr);
21926         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
21927         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
21928         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21929         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
21930         int64_t ret_ref = tag_ptr(ret_copy, true);
21931         return ret_ref;
21932 }
21933
21934 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_none() {
21935         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21936         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
21937         int64_t ret_ref = tag_ptr(ret_copy, true);
21938         return ret_ref;
21939 }
21940
21941 void  CS_LDK_COption_C2Tuple_u64u16ZZ_free(int64_t _res) {
21942         if (!ptr_is_owned(_res)) return;
21943         void* _res_ptr = untag_ptr(_res);
21944         CHECK_ACCESS(_res_ptr);
21945         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
21946         FREE(untag_ptr(_res));
21947         COption_C2Tuple_u64u16ZZ_free(_res_conv);
21948 }
21949
21950 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
21951         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21952         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
21953         int64_t ret_ref = tag_ptr(ret_copy, true);
21954         return ret_ref;
21955 }
21956 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone_ptr(int64_t arg) {
21957         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
21958         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
21959         return ret_conv;
21960 }
21961
21962 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone(int64_t orig) {
21963         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
21964         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
21965         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
21966         int64_t ret_ref = tag_ptr(ret_copy, true);
21967         return ret_ref;
21968 }
21969
21970 int64_t  CS_LDK_COption_ChannelShutdownStateZ_some(int32_t o) {
21971         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
21972         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21973         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
21974         int64_t ret_ref = tag_ptr(ret_copy, true);
21975         return ret_ref;
21976 }
21977
21978 int64_t  CS_LDK_COption_ChannelShutdownStateZ_none() {
21979         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21980         *ret_copy = COption_ChannelShutdownStateZ_none();
21981         int64_t ret_ref = tag_ptr(ret_copy, true);
21982         return ret_ref;
21983 }
21984
21985 void  CS_LDK_COption_ChannelShutdownStateZ_free(int64_t _res) {
21986         if (!ptr_is_owned(_res)) return;
21987         void* _res_ptr = untag_ptr(_res);
21988         CHECK_ACCESS(_res_ptr);
21989         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
21990         FREE(untag_ptr(_res));
21991         COption_ChannelShutdownStateZ_free(_res_conv);
21992 }
21993
21994 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
21995         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
21996         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
21997         int64_t ret_ref = tag_ptr(ret_copy, true);
21998         return ret_ref;
21999 }
22000 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone_ptr(int64_t arg) {
22001         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
22002         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
22003         return ret_conv;
22004 }
22005
22006 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone(int64_t orig) {
22007         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
22008         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
22009         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
22010         int64_t ret_ref = tag_ptr(ret_copy, true);
22011         return ret_ref;
22012 }
22013
22014 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
22015         LDKThirtyTwoBytes o_ref;
22016         CHECK(o->arr_len == 32);
22017         memcpy(o_ref.data, o->elems, 32); FREE(o);
22018         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22019         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
22020         return tag_ptr(ret_conv, true);
22021 }
22022
22023 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_err(int64_t e) {
22024         void* e_ptr = untag_ptr(e);
22025         CHECK_ACCESS(e_ptr);
22026         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
22027         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
22028         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22029         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
22030         return tag_ptr(ret_conv, true);
22031 }
22032
22033 jboolean  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(int64_t o) {
22034         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
22035         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
22036         return ret_conv;
22037 }
22038
22039 void  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_free(int64_t _res) {
22040         if (!ptr_is_owned(_res)) return;
22041         void* _res_ptr = untag_ptr(_res);
22042         CHECK_ACCESS(_res_ptr);
22043         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
22044         FREE(untag_ptr(_res));
22045         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
22046 }
22047
22048 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
22049         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22050         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
22051         return tag_ptr(ret_conv, true);
22052 }
22053 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(int64_t arg) {
22054         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
22055         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
22056         return ret_conv;
22057 }
22058
22059 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone(int64_t orig) {
22060         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
22061         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
22062         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
22063         return tag_ptr(ret_conv, true);
22064 }
22065
22066 void  CS_LDK_CVec_RecentPaymentDetailsZ_free(int64_tArray _res) {
22067         LDKCVec_RecentPaymentDetailsZ _res_constr;
22068         _res_constr.datalen = _res->arr_len;
22069         if (_res_constr.datalen > 0)
22070                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
22071         else
22072                 _res_constr.data = NULL;
22073         int64_t* _res_vals = _res->elems;
22074         for (size_t w = 0; w < _res_constr.datalen; w++) {
22075                 int64_t _res_conv_22 = _res_vals[w];
22076                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
22077                 CHECK_ACCESS(_res_conv_22_ptr);
22078                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
22079                 FREE(untag_ptr(_res_conv_22));
22080                 _res_constr.data[w] = _res_conv_22_conv;
22081         }
22082         FREE(_res);
22083         CVec_RecentPaymentDetailsZ_free(_res_constr);
22084 }
22085
22086 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_ok() {
22087         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22088         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
22089         return tag_ptr(ret_conv, true);
22090 }
22091
22092 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_err(int64_t e) {
22093         void* e_ptr = untag_ptr(e);
22094         CHECK_ACCESS(e_ptr);
22095         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22096         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22097         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22098         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
22099         return tag_ptr(ret_conv, true);
22100 }
22101
22102 jboolean  CS_LDK_CResult_NonePaymentSendFailureZ_is_ok(int64_t o) {
22103         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
22104         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
22105         return ret_conv;
22106 }
22107
22108 void  CS_LDK_CResult_NonePaymentSendFailureZ_free(int64_t _res) {
22109         if (!ptr_is_owned(_res)) return;
22110         void* _res_ptr = untag_ptr(_res);
22111         CHECK_ACCESS(_res_ptr);
22112         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
22113         FREE(untag_ptr(_res));
22114         CResult_NonePaymentSendFailureZ_free(_res_conv);
22115 }
22116
22117 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
22118         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22119         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
22120         return tag_ptr(ret_conv, true);
22121 }
22122 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone_ptr(int64_t arg) {
22123         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
22124         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
22125         return ret_conv;
22126 }
22127
22128 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone(int64_t orig) {
22129         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
22130         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
22131         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
22132         return tag_ptr(ret_conv, true);
22133 }
22134
22135 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_ok() {
22136         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22137         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
22138         return tag_ptr(ret_conv, true);
22139 }
22140
22141 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_err(int32_t e) {
22142         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
22143         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22144         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
22145         return tag_ptr(ret_conv, true);
22146 }
22147
22148 jboolean  CS_LDK_CResult_NoneRetryableSendFailureZ_is_ok(int64_t o) {
22149         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
22150         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
22151         return ret_conv;
22152 }
22153
22154 void  CS_LDK_CResult_NoneRetryableSendFailureZ_free(int64_t _res) {
22155         if (!ptr_is_owned(_res)) return;
22156         void* _res_ptr = untag_ptr(_res);
22157         CHECK_ACCESS(_res_ptr);
22158         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
22159         FREE(untag_ptr(_res));
22160         CResult_NoneRetryableSendFailureZ_free(_res_conv);
22161 }
22162
22163 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
22164         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22165         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
22166         return tag_ptr(ret_conv, true);
22167 }
22168 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone_ptr(int64_t arg) {
22169         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
22170         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
22171         return ret_conv;
22172 }
22173
22174 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone(int64_t orig) {
22175         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
22176         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
22177         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
22178         return tag_ptr(ret_conv, true);
22179 }
22180
22181 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
22182         LDKThirtyTwoBytes o_ref;
22183         CHECK(o->arr_len == 32);
22184         memcpy(o_ref.data, o->elems, 32); FREE(o);
22185         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22186         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
22187         return tag_ptr(ret_conv, true);
22188 }
22189
22190 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(int64_t e) {
22191         void* e_ptr = untag_ptr(e);
22192         CHECK_ACCESS(e_ptr);
22193         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22194         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22195         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22196         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
22197         return tag_ptr(ret_conv, true);
22198 }
22199
22200 jboolean  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(int64_t o) {
22201         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
22202         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
22203         return ret_conv;
22204 }
22205
22206 void  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(int64_t _res) {
22207         if (!ptr_is_owned(_res)) return;
22208         void* _res_ptr = untag_ptr(_res);
22209         CHECK_ACCESS(_res_ptr);
22210         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
22211         FREE(untag_ptr(_res));
22212         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
22213 }
22214
22215 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
22216         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22217         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
22218         return tag_ptr(ret_conv, true);
22219 }
22220 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(int64_t arg) {
22221         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
22222         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
22223         return ret_conv;
22224 }
22225
22226 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(int64_t orig) {
22227         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
22228         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
22229         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
22230         return tag_ptr(ret_conv, true);
22231 }
22232
22233 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
22234         LDKThirtyTwoBytes o_ref;
22235         CHECK(o->arr_len == 32);
22236         memcpy(o_ref.data, o->elems, 32); FREE(o);
22237         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22238         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
22239         return tag_ptr(ret_conv, true);
22240 }
22241
22242 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(int32_t e) {
22243         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
22244         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22245         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
22246         return tag_ptr(ret_conv, true);
22247 }
22248
22249 jboolean  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(int64_t o) {
22250         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
22251         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
22252         return ret_conv;
22253 }
22254
22255 void  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(int64_t _res) {
22256         if (!ptr_is_owned(_res)) return;
22257         void* _res_ptr = untag_ptr(_res);
22258         CHECK_ACCESS(_res_ptr);
22259         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
22260         FREE(untag_ptr(_res));
22261         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
22262 }
22263
22264 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
22265         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22266         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
22267         return tag_ptr(ret_conv, true);
22268 }
22269 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(int64_t arg) {
22270         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
22271         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
22272         return ret_conv;
22273 }
22274
22275 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(int64_t orig) {
22276         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
22277         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
22278         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
22279         return tag_ptr(ret_conv, true);
22280 }
22281
22282 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
22283         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22284         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
22285         return tag_ptr(ret_conv, true);
22286 }
22287 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(int64_t arg) {
22288         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
22289         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
22290         return ret_conv;
22291 }
22292
22293 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(int64_t orig) {
22294         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
22295         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22296         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
22297         return tag_ptr(ret_conv, true);
22298 }
22299
22300 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
22301         LDKThirtyTwoBytes a_ref;
22302         CHECK(a->arr_len == 32);
22303         memcpy(a_ref.data, a->elems, 32); FREE(a);
22304         LDKThirtyTwoBytes b_ref;
22305         CHECK(b->arr_len == 32);
22306         memcpy(b_ref.data, b->elems, 32); FREE(b);
22307         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
22308         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
22309         return tag_ptr(ret_conv, true);
22310 }
22311
22312 void  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(int64_t _res) {
22313         if (!ptr_is_owned(_res)) return;
22314         void* _res_ptr = untag_ptr(_res);
22315         CHECK_ACCESS(_res_ptr);
22316         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
22317         FREE(untag_ptr(_res));
22318         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
22319 }
22320
22321 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(int64_t o) {
22322         void* o_ptr = untag_ptr(o);
22323         CHECK_ACCESS(o_ptr);
22324         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22325         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22326         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22327         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
22328         return tag_ptr(ret_conv, true);
22329 }
22330
22331 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(int64_t e) {
22332         void* e_ptr = untag_ptr(e);
22333         CHECK_ACCESS(e_ptr);
22334         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
22335         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
22336         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22337         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
22338         return tag_ptr(ret_conv, true);
22339 }
22340
22341 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(int64_t o) {
22342         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
22343         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
22344         return ret_conv;
22345 }
22346
22347 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(int64_t _res) {
22348         if (!ptr_is_owned(_res)) return;
22349         void* _res_ptr = untag_ptr(_res);
22350         CHECK_ACCESS(_res_ptr);
22351         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
22352         FREE(untag_ptr(_res));
22353         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
22354 }
22355
22356 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
22357         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22358         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
22359         return tag_ptr(ret_conv, true);
22360 }
22361 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(int64_t arg) {
22362         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
22363         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
22364         return ret_conv;
22365 }
22366
22367 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(int64_t orig) {
22368         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
22369         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
22370         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
22371         return tag_ptr(ret_conv, true);
22372 }
22373
22374 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(int64_tArray _res) {
22375         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
22376         _res_constr.datalen = _res->arr_len;
22377         if (_res_constr.datalen > 0)
22378                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22379         else
22380                 _res_constr.data = NULL;
22381         int64_t* _res_vals = _res->elems;
22382         for (size_t o = 0; o < _res_constr.datalen; o++) {
22383                 int64_t _res_conv_40 = _res_vals[o];
22384                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22385                 CHECK_ACCESS(_res_conv_40_ptr);
22386                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
22387                 FREE(untag_ptr(_res_conv_40));
22388                 _res_constr.data[o] = _res_conv_40_conv;
22389         }
22390         FREE(_res);
22391         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
22392 }
22393
22394 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(int64_tArray o) {
22395         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
22396         o_constr.datalen = o->arr_len;
22397         if (o_constr.datalen > 0)
22398                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
22399         else
22400                 o_constr.data = NULL;
22401         int64_t* o_vals = o->elems;
22402         for (size_t o = 0; o < o_constr.datalen; o++) {
22403                 int64_t o_conv_40 = o_vals[o];
22404                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
22405                 CHECK_ACCESS(o_conv_40_ptr);
22406                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
22407                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
22408                 o_constr.data[o] = o_conv_40_conv;
22409         }
22410         FREE(o);
22411         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22412         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
22413         return tag_ptr(ret_conv, true);
22414 }
22415
22416 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(int64_t e) {
22417         void* e_ptr = untag_ptr(e);
22418         CHECK_ACCESS(e_ptr);
22419         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
22420         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
22421         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22422         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
22423         return tag_ptr(ret_conv, true);
22424 }
22425
22426 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(int64_t o) {
22427         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
22428         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
22429         return ret_conv;
22430 }
22431
22432 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(int64_t _res) {
22433         if (!ptr_is_owned(_res)) return;
22434         void* _res_ptr = untag_ptr(_res);
22435         CHECK_ACCESS(_res_ptr);
22436         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
22437         FREE(untag_ptr(_res));
22438         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
22439 }
22440
22441 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
22442         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22443         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
22444         return tag_ptr(ret_conv, true);
22445 }
22446 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(int64_t arg) {
22447         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
22448         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
22449         return ret_conv;
22450 }
22451
22452 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(int64_t orig) {
22453         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
22454         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
22455         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
22456         return tag_ptr(ret_conv, true);
22457 }
22458
22459 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
22460         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22461         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
22462         return tag_ptr(ret_conv, true);
22463 }
22464 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(int64_t arg) {
22465         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
22466         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
22467         return ret_conv;
22468 }
22469
22470 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(int64_t orig) {
22471         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
22472         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22473         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
22474         return tag_ptr(ret_conv, true);
22475 }
22476
22477 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_new(int8_tArray a, int8_tArray b) {
22478         LDKThirtyTwoBytes a_ref;
22479         CHECK(a->arr_len == 32);
22480         memcpy(a_ref.data, a->elems, 32); FREE(a);
22481         LDKPublicKey b_ref;
22482         CHECK(b->arr_len == 33);
22483         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
22484         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
22485         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
22486         return tag_ptr(ret_conv, true);
22487 }
22488
22489 void  CS_LDK_C2Tuple_ThirtyTwoBytesPublicKeyZ_free(int64_t _res) {
22490         if (!ptr_is_owned(_res)) return;
22491         void* _res_ptr = untag_ptr(_res);
22492         CHECK_ACCESS(_res_ptr);
22493         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
22494         FREE(untag_ptr(_res));
22495         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
22496 }
22497
22498 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(int64_tArray _res) {
22499         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
22500         _res_constr.datalen = _res->arr_len;
22501         if (_res_constr.datalen > 0)
22502                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
22503         else
22504                 _res_constr.data = NULL;
22505         int64_t* _res_vals = _res->elems;
22506         for (size_t j = 0; j < _res_constr.datalen; j++) {
22507                 int64_t _res_conv_35 = _res_vals[j];
22508                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
22509                 CHECK_ACCESS(_res_conv_35_ptr);
22510                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
22511                 FREE(untag_ptr(_res_conv_35));
22512                 _res_constr.data[j] = _res_conv_35_conv;
22513         }
22514         FREE(_res);
22515         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
22516 }
22517
22518 int64_t  CS_LDK_COption_StrZ_some(jstring o) {
22519         LDKStr o_conv = str_ref_to_owned_c(o);
22520         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22521         *ret_copy = COption_StrZ_some(o_conv);
22522         int64_t ret_ref = tag_ptr(ret_copy, true);
22523         return ret_ref;
22524 }
22525
22526 int64_t  CS_LDK_COption_StrZ_none() {
22527         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22528         *ret_copy = COption_StrZ_none();
22529         int64_t ret_ref = tag_ptr(ret_copy, true);
22530         return ret_ref;
22531 }
22532
22533 void  CS_LDK_COption_StrZ_free(int64_t _res) {
22534         if (!ptr_is_owned(_res)) return;
22535         void* _res_ptr = untag_ptr(_res);
22536         CHECK_ACCESS(_res_ptr);
22537         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
22538         FREE(untag_ptr(_res));
22539         COption_StrZ_free(_res_conv);
22540 }
22541
22542 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
22543         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22544         *ret_copy = COption_StrZ_clone(arg);
22545         int64_t ret_ref = tag_ptr(ret_copy, true);
22546         return ret_ref;
22547 }
22548 int64_t  CS_LDK_COption_StrZ_clone_ptr(int64_t arg) {
22549         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
22550         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
22551         return ret_conv;
22552 }
22553
22554 int64_t  CS_LDK_COption_StrZ_clone(int64_t orig) {
22555         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
22556         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
22557         *ret_copy = COption_StrZ_clone(orig_conv);
22558         int64_t ret_ref = tag_ptr(ret_copy, true);
22559         return ret_ref;
22560 }
22561
22562 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_ok() {
22563         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22564         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22565         return tag_ptr(ret_conv, true);
22566 }
22567
22568 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_err(int32_t e) {
22569         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22570         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22571         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22572         return tag_ptr(ret_conv, true);
22573 }
22574
22575 jboolean  CS_LDK_CResult_NoneBolt12SemanticErrorZ_is_ok(int64_t o) {
22576         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22577         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22578         return ret_conv;
22579 }
22580
22581 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_free(int64_t _res) {
22582         if (!ptr_is_owned(_res)) return;
22583         void* _res_ptr = untag_ptr(_res);
22584         CHECK_ACCESS(_res_ptr);
22585         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22586         FREE(untag_ptr(_res));
22587         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22588 }
22589
22590 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22591         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22592         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22593         return tag_ptr(ret_conv, true);
22594 }
22595 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22596         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22597         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22598         return ret_conv;
22599 }
22600
22601 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone(int64_t orig) {
22602         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22603         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22604         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22605         return tag_ptr(ret_conv, true);
22606 }
22607
22608 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(int64_t o) {
22609         void* o_ptr = untag_ptr(o);
22610         CHECK_ACCESS(o_ptr);
22611         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
22612         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
22613         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22614         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
22615         return tag_ptr(ret_conv, true);
22616 }
22617
22618 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
22619         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22620         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
22621         return tag_ptr(ret_conv, true);
22622 }
22623
22624 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(int64_t o) {
22625         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
22626         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
22627         return ret_conv;
22628 }
22629
22630 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(int64_t _res) {
22631         if (!ptr_is_owned(_res)) return;
22632         void* _res_ptr = untag_ptr(_res);
22633         CHECK_ACCESS(_res_ptr);
22634         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
22635         FREE(untag_ptr(_res));
22636         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
22637 }
22638
22639 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
22640         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22641         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
22642         return tag_ptr(ret_conv, true);
22643 }
22644 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(int64_t arg) {
22645         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
22646         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
22647         return ret_conv;
22648 }
22649
22650 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(int64_t orig) {
22651         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
22652         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
22653         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
22654         return tag_ptr(ret_conv, true);
22655 }
22656
22657 int64_t  CS_LDK_COption_OffersMessageZ_some(int64_t o) {
22658         void* o_ptr = untag_ptr(o);
22659         CHECK_ACCESS(o_ptr);
22660         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
22661         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
22662         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22663         *ret_copy = COption_OffersMessageZ_some(o_conv);
22664         int64_t ret_ref = tag_ptr(ret_copy, true);
22665         return ret_ref;
22666 }
22667
22668 int64_t  CS_LDK_COption_OffersMessageZ_none() {
22669         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22670         *ret_copy = COption_OffersMessageZ_none();
22671         int64_t ret_ref = tag_ptr(ret_copy, true);
22672         return ret_ref;
22673 }
22674
22675 void  CS_LDK_COption_OffersMessageZ_free(int64_t _res) {
22676         if (!ptr_is_owned(_res)) return;
22677         void* _res_ptr = untag_ptr(_res);
22678         CHECK_ACCESS(_res_ptr);
22679         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
22680         FREE(untag_ptr(_res));
22681         COption_OffersMessageZ_free(_res_conv);
22682 }
22683
22684 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
22685         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22686         *ret_copy = COption_OffersMessageZ_clone(arg);
22687         int64_t ret_ref = tag_ptr(ret_copy, true);
22688         return ret_ref;
22689 }
22690 int64_t  CS_LDK_COption_OffersMessageZ_clone_ptr(int64_t arg) {
22691         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
22692         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
22693         return ret_conv;
22694 }
22695
22696 int64_t  CS_LDK_COption_OffersMessageZ_clone(int64_t orig) {
22697         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
22698         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
22699         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
22700         int64_t ret_ref = tag_ptr(ret_copy, true);
22701         return ret_ref;
22702 }
22703
22704 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
22705         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22706         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
22707         return tag_ptr(ret_conv, true);
22708 }
22709 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(int64_t arg) {
22710         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
22711         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
22712         return ret_conv;
22713 }
22714
22715 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(int64_t orig) {
22716         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
22717         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22718         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
22719         return tag_ptr(ret_conv, true);
22720 }
22721
22722 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
22723         void* a_ptr = untag_ptr(a);
22724         CHECK_ACCESS(a_ptr);
22725         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
22726         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
22727         void* b_ptr = untag_ptr(b);
22728         CHECK_ACCESS(b_ptr);
22729         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
22730         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
22731         LDKBlindedPath c_conv;
22732         c_conv.inner = untag_ptr(c);
22733         c_conv.is_owned = ptr_is_owned(c);
22734         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
22735         c_conv = BlindedPath_clone(&c_conv);
22736         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
22737         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
22738         return tag_ptr(ret_conv, true);
22739 }
22740
22741 void  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_free(int64_t _res) {
22742         if (!ptr_is_owned(_res)) return;
22743         void* _res_ptr = untag_ptr(_res);
22744         CHECK_ACCESS(_res_ptr);
22745         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
22746         FREE(untag_ptr(_res));
22747         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
22748 }
22749
22750 void  CS_LDK_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(int64_tArray _res) {
22751         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
22752         _res_constr.datalen = _res->arr_len;
22753         if (_res_constr.datalen > 0)
22754                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
22755         else
22756                 _res_constr.data = NULL;
22757         int64_t* _res_vals = _res->elems;
22758         for (size_t x = 0; x < _res_constr.datalen; x++) {
22759                 int64_t _res_conv_49 = _res_vals[x];
22760                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22761                 CHECK_ACCESS(_res_conv_49_ptr);
22762                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
22763                 FREE(untag_ptr(_res_conv_49));
22764                 _res_constr.data[x] = _res_conv_49_conv;
22765         }
22766         FREE(_res);
22767         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
22768 }
22769
22770 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(int64_t o) {
22771         LDKCounterpartyForwardingInfo o_conv;
22772         o_conv.inner = untag_ptr(o);
22773         o_conv.is_owned = ptr_is_owned(o);
22774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22775         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
22776         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22777         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
22778         return tag_ptr(ret_conv, true);
22779 }
22780
22781 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(int64_t e) {
22782         void* e_ptr = untag_ptr(e);
22783         CHECK_ACCESS(e_ptr);
22784         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22785         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22786         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22787         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
22788         return tag_ptr(ret_conv, true);
22789 }
22790
22791 jboolean  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(int64_t o) {
22792         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
22793         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
22794         return ret_conv;
22795 }
22796
22797 void  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(int64_t _res) {
22798         if (!ptr_is_owned(_res)) return;
22799         void* _res_ptr = untag_ptr(_res);
22800         CHECK_ACCESS(_res_ptr);
22801         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
22802         FREE(untag_ptr(_res));
22803         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
22804 }
22805
22806 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
22807         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22808         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
22809         return tag_ptr(ret_conv, true);
22810 }
22811 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(int64_t arg) {
22812         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
22813         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
22814         return ret_conv;
22815 }
22816
22817 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(int64_t orig) {
22818         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
22819         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
22820         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
22821         return tag_ptr(ret_conv, true);
22822 }
22823
22824 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_ok(int64_t o) {
22825         LDKChannelCounterparty o_conv;
22826         o_conv.inner = untag_ptr(o);
22827         o_conv.is_owned = ptr_is_owned(o);
22828         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22829         o_conv = ChannelCounterparty_clone(&o_conv);
22830         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22831         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
22832         return tag_ptr(ret_conv, true);
22833 }
22834
22835 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_err(int64_t e) {
22836         void* e_ptr = untag_ptr(e);
22837         CHECK_ACCESS(e_ptr);
22838         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22839         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22840         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22841         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
22842         return tag_ptr(ret_conv, true);
22843 }
22844
22845 jboolean  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(int64_t o) {
22846         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
22847         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
22848         return ret_conv;
22849 }
22850
22851 void  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_free(int64_t _res) {
22852         if (!ptr_is_owned(_res)) return;
22853         void* _res_ptr = untag_ptr(_res);
22854         CHECK_ACCESS(_res_ptr);
22855         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
22856         FREE(untag_ptr(_res));
22857         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
22858 }
22859
22860 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
22861         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22862         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
22863         return tag_ptr(ret_conv, true);
22864 }
22865 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(int64_t arg) {
22866         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
22867         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
22868         return ret_conv;
22869 }
22870
22871 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone(int64_t orig) {
22872         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
22873         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
22874         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
22875         return tag_ptr(ret_conv, true);
22876 }
22877
22878 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_ok(int64_t o) {
22879         LDKChannelDetails o_conv;
22880         o_conv.inner = untag_ptr(o);
22881         o_conv.is_owned = ptr_is_owned(o);
22882         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22883         o_conv = ChannelDetails_clone(&o_conv);
22884         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22885         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
22886         return tag_ptr(ret_conv, true);
22887 }
22888
22889 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_err(int64_t e) {
22890         void* e_ptr = untag_ptr(e);
22891         CHECK_ACCESS(e_ptr);
22892         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22893         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22894         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22895         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
22896         return tag_ptr(ret_conv, true);
22897 }
22898
22899 jboolean  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_is_ok(int64_t o) {
22900         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
22901         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
22902         return ret_conv;
22903 }
22904
22905 void  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_free(int64_t _res) {
22906         if (!ptr_is_owned(_res)) return;
22907         void* _res_ptr = untag_ptr(_res);
22908         CHECK_ACCESS(_res_ptr);
22909         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
22910         FREE(untag_ptr(_res));
22911         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
22912 }
22913
22914 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
22915         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22916         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
22917         return tag_ptr(ret_conv, true);
22918 }
22919 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
22920         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
22921         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
22922         return ret_conv;
22923 }
22924
22925 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone(int64_t orig) {
22926         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
22927         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
22928         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
22929         return tag_ptr(ret_conv, true);
22930 }
22931
22932 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_ok(int64_t o) {
22933         LDKPhantomRouteHints o_conv;
22934         o_conv.inner = untag_ptr(o);
22935         o_conv.is_owned = ptr_is_owned(o);
22936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22937         o_conv = PhantomRouteHints_clone(&o_conv);
22938         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22939         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
22940         return tag_ptr(ret_conv, true);
22941 }
22942
22943 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_err(int64_t e) {
22944         void* e_ptr = untag_ptr(e);
22945         CHECK_ACCESS(e_ptr);
22946         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22947         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22948         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22949         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
22950         return tag_ptr(ret_conv, true);
22951 }
22952
22953 jboolean  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(int64_t o) {
22954         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
22955         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
22956         return ret_conv;
22957 }
22958
22959 void  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_free(int64_t _res) {
22960         if (!ptr_is_owned(_res)) return;
22961         void* _res_ptr = untag_ptr(_res);
22962         CHECK_ACCESS(_res_ptr);
22963         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
22964         FREE(untag_ptr(_res));
22965         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
22966 }
22967
22968 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
22969         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22970         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
22971         return tag_ptr(ret_conv, true);
22972 }
22973 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(int64_t arg) {
22974         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
22975         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
22976         return ret_conv;
22977 }
22978
22979 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone(int64_t orig) {
22980         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
22981         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
22982         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
22983         return tag_ptr(ret_conv, true);
22984 }
22985
22986 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_ok(int64_t o) {
22987         LDKBlindedForward o_conv;
22988         o_conv.inner = untag_ptr(o);
22989         o_conv.is_owned = ptr_is_owned(o);
22990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22991         o_conv = BlindedForward_clone(&o_conv);
22992         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
22993         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
22994         return tag_ptr(ret_conv, true);
22995 }
22996
22997 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_err(int64_t e) {
22998         void* e_ptr = untag_ptr(e);
22999         CHECK_ACCESS(e_ptr);
23000         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23001         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23002         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23003         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
23004         return tag_ptr(ret_conv, true);
23005 }
23006
23007 jboolean  CS_LDK_CResult_BlindedForwardDecodeErrorZ_is_ok(int64_t o) {
23008         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
23009         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
23010         return ret_conv;
23011 }
23012
23013 void  CS_LDK_CResult_BlindedForwardDecodeErrorZ_free(int64_t _res) {
23014         if (!ptr_is_owned(_res)) return;
23015         void* _res_ptr = untag_ptr(_res);
23016         CHECK_ACCESS(_res_ptr);
23017         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
23018         FREE(untag_ptr(_res));
23019         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
23020 }
23021
23022 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
23023         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23024         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
23025         return tag_ptr(ret_conv, true);
23026 }
23027 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone_ptr(int64_t arg) {
23028         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
23029         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
23030         return ret_conv;
23031 }
23032
23033 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone(int64_t orig) {
23034         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
23035         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
23036         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
23037         return tag_ptr(ret_conv, true);
23038 }
23039
23040 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_ok(int64_t o) {
23041         void* o_ptr = untag_ptr(o);
23042         CHECK_ACCESS(o_ptr);
23043         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
23044         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
23045         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23046         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
23047         return tag_ptr(ret_conv, true);
23048 }
23049
23050 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_err(int64_t e) {
23051         void* e_ptr = untag_ptr(e);
23052         CHECK_ACCESS(e_ptr);
23053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23055         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23056         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
23057         return tag_ptr(ret_conv, true);
23058 }
23059
23060 jboolean  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(int64_t o) {
23061         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
23062         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
23063         return ret_conv;
23064 }
23065
23066 void  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_free(int64_t _res) {
23067         if (!ptr_is_owned(_res)) return;
23068         void* _res_ptr = untag_ptr(_res);
23069         CHECK_ACCESS(_res_ptr);
23070         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
23071         FREE(untag_ptr(_res));
23072         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
23073 }
23074
23075 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
23076         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23077         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
23078         return tag_ptr(ret_conv, true);
23079 }
23080 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(int64_t arg) {
23081         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
23082         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
23083         return ret_conv;
23084 }
23085
23086 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone(int64_t orig) {
23087         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
23088         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
23089         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
23090         return tag_ptr(ret_conv, true);
23091 }
23092
23093 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_ok(int64_t o) {
23094         LDKPendingHTLCInfo o_conv;
23095         o_conv.inner = untag_ptr(o);
23096         o_conv.is_owned = ptr_is_owned(o);
23097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23098         o_conv = PendingHTLCInfo_clone(&o_conv);
23099         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23100         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
23101         return tag_ptr(ret_conv, true);
23102 }
23103
23104 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_err(int64_t e) {
23105         void* e_ptr = untag_ptr(e);
23106         CHECK_ACCESS(e_ptr);
23107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23109         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23110         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
23111         return tag_ptr(ret_conv, true);
23112 }
23113
23114 jboolean  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(int64_t o) {
23115         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
23116         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
23117         return ret_conv;
23118 }
23119
23120 void  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_free(int64_t _res) {
23121         if (!ptr_is_owned(_res)) return;
23122         void* _res_ptr = untag_ptr(_res);
23123         CHECK_ACCESS(_res_ptr);
23124         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
23125         FREE(untag_ptr(_res));
23126         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
23127 }
23128
23129 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
23130         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23131         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
23132         return tag_ptr(ret_conv, true);
23133 }
23134 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23135         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
23136         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
23137         return ret_conv;
23138 }
23139
23140 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone(int64_t orig) {
23141         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
23142         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
23143         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
23144         return tag_ptr(ret_conv, true);
23145 }
23146
23147 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_ok(int32_t o) {
23148         LDKBlindedFailure o_conv = LDKBlindedFailure_from_cs(o);
23149         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23150         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
23151         return tag_ptr(ret_conv, true);
23152 }
23153
23154 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_err(int64_t e) {
23155         void* e_ptr = untag_ptr(e);
23156         CHECK_ACCESS(e_ptr);
23157         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23158         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23159         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23160         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
23161         return tag_ptr(ret_conv, true);
23162 }
23163
23164 jboolean  CS_LDK_CResult_BlindedFailureDecodeErrorZ_is_ok(int64_t o) {
23165         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
23166         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
23167         return ret_conv;
23168 }
23169
23170 void  CS_LDK_CResult_BlindedFailureDecodeErrorZ_free(int64_t _res) {
23171         if (!ptr_is_owned(_res)) return;
23172         void* _res_ptr = untag_ptr(_res);
23173         CHECK_ACCESS(_res_ptr);
23174         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
23175         FREE(untag_ptr(_res));
23176         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
23177 }
23178
23179 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
23180         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23181         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
23182         return tag_ptr(ret_conv, true);
23183 }
23184 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone_ptr(int64_t arg) {
23185         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
23186         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
23187         return ret_conv;
23188 }
23189
23190 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone(int64_t orig) {
23191         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
23192         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
23193         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
23194         return tag_ptr(ret_conv, true);
23195 }
23196
23197 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_ok(int32_t o) {
23198         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
23199         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23200         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
23201         return tag_ptr(ret_conv, true);
23202 }
23203
23204 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_err(int64_t e) {
23205         void* e_ptr = untag_ptr(e);
23206         CHECK_ACCESS(e_ptr);
23207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23209         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23210         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
23211         return tag_ptr(ret_conv, true);
23212 }
23213
23214 jboolean  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(int64_t o) {
23215         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
23216         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
23217         return ret_conv;
23218 }
23219
23220 void  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_free(int64_t _res) {
23221         if (!ptr_is_owned(_res)) return;
23222         void* _res_ptr = untag_ptr(_res);
23223         CHECK_ACCESS(_res_ptr);
23224         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
23225         FREE(untag_ptr(_res));
23226         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
23227 }
23228
23229 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
23230         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23231         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
23232         return tag_ptr(ret_conv, true);
23233 }
23234 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(int64_t arg) {
23235         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
23236         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
23237         return ret_conv;
23238 }
23239
23240 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone(int64_t orig) {
23241         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
23242         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
23243         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
23244         return tag_ptr(ret_conv, true);
23245 }
23246
23247 void  CS_LDK_CVec_ChannelMonitorZ_free(int64_tArray _res) {
23248         LDKCVec_ChannelMonitorZ _res_constr;
23249         _res_constr.datalen = _res->arr_len;
23250         if (_res_constr.datalen > 0)
23251                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
23252         else
23253                 _res_constr.data = NULL;
23254         int64_t* _res_vals = _res->elems;
23255         for (size_t q = 0; q < _res_constr.datalen; q++) {
23256                 int64_t _res_conv_16 = _res_vals[q];
23257                 LDKChannelMonitor _res_conv_16_conv;
23258                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23259                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23260                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23261                 _res_constr.data[q] = _res_conv_16_conv;
23262         }
23263         FREE(_res);
23264         CVec_ChannelMonitorZ_free(_res_constr);
23265 }
23266
23267 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, int64_t b) {
23268         LDKThirtyTwoBytes a_ref;
23269         CHECK(a->arr_len == 32);
23270         memcpy(a_ref.data, a->elems, 32); FREE(a);
23271         LDKChannelManager b_conv;
23272         b_conv.inner = untag_ptr(b);
23273         b_conv.is_owned = ptr_is_owned(b);
23274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23275         // WARNING: we need a move here but no clone is available for LDKChannelManager
23276         
23277         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
23278         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
23279         return tag_ptr(ret_conv, true);
23280 }
23281
23282 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(int64_t _res) {
23283         if (!ptr_is_owned(_res)) return;
23284         void* _res_ptr = untag_ptr(_res);
23285         CHECK_ACCESS(_res_ptr);
23286         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
23287         FREE(untag_ptr(_res));
23288         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
23289 }
23290
23291 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(int64_t o) {
23292         void* o_ptr = untag_ptr(o);
23293         CHECK_ACCESS(o_ptr);
23294         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
23295         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
23296         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
23297         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
23298         return tag_ptr(ret_conv, true);
23299 }
23300
23301 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(int64_t e) {
23302         void* e_ptr = untag_ptr(e);
23303         CHECK_ACCESS(e_ptr);
23304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23306         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
23307         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
23308         return tag_ptr(ret_conv, true);
23309 }
23310
23311 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(int64_t o) {
23312         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
23313         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
23314         return ret_conv;
23315 }
23316
23317 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(int64_t _res) {
23318         if (!ptr_is_owned(_res)) return;
23319         void* _res_ptr = untag_ptr(_res);
23320         CHECK_ACCESS(_res_ptr);
23321         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
23322         FREE(untag_ptr(_res));
23323         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
23324 }
23325
23326 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(int64_t o) {
23327         void* o_ptr = untag_ptr(o);
23328         CHECK_ACCESS(o_ptr);
23329         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23330         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23331         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23332         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
23333         return tag_ptr(ret_conv, true);
23334 }
23335
23336 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_err(int64_t e) {
23337         void* e_ptr = untag_ptr(e);
23338         CHECK_ACCESS(e_ptr);
23339         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23340         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23341         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23342         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
23343         return tag_ptr(ret_conv, true);
23344 }
23345
23346 jboolean  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(int64_t o) {
23347         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
23348         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
23349         return ret_conv;
23350 }
23351
23352 void  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_free(int64_t _res) {
23353         if (!ptr_is_owned(_res)) return;
23354         void* _res_ptr = untag_ptr(_res);
23355         CHECK_ACCESS(_res_ptr);
23356         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
23357         FREE(untag_ptr(_res));
23358         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
23359 }
23360
23361 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
23362         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23363         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
23364         return tag_ptr(ret_conv, true);
23365 }
23366 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(int64_t arg) {
23367         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
23368         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
23369         return ret_conv;
23370 }
23371
23372 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(int64_t orig) {
23373         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
23374         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
23375         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
23376         return tag_ptr(ret_conv, true);
23377 }
23378
23379 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_ok(int64_t o) {
23380         LDKChannelConfig o_conv;
23381         o_conv.inner = untag_ptr(o);
23382         o_conv.is_owned = ptr_is_owned(o);
23383         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23384         o_conv = ChannelConfig_clone(&o_conv);
23385         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23386         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
23387         return tag_ptr(ret_conv, true);
23388 }
23389
23390 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_err(int64_t e) {
23391         void* e_ptr = untag_ptr(e);
23392         CHECK_ACCESS(e_ptr);
23393         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23394         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23395         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23396         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
23397         return tag_ptr(ret_conv, true);
23398 }
23399
23400 jboolean  CS_LDK_CResult_ChannelConfigDecodeErrorZ_is_ok(int64_t o) {
23401         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
23402         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
23403         return ret_conv;
23404 }
23405
23406 void  CS_LDK_CResult_ChannelConfigDecodeErrorZ_free(int64_t _res) {
23407         if (!ptr_is_owned(_res)) return;
23408         void* _res_ptr = untag_ptr(_res);
23409         CHECK_ACCESS(_res_ptr);
23410         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
23411         FREE(untag_ptr(_res));
23412         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
23413 }
23414
23415 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
23416         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23417         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
23418         return tag_ptr(ret_conv, true);
23419 }
23420 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone_ptr(int64_t arg) {
23421         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
23422         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
23423         return ret_conv;
23424 }
23425
23426 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone(int64_t orig) {
23427         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
23428         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23429         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
23430         return tag_ptr(ret_conv, true);
23431 }
23432
23433 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_some(int64_t o) {
23434         void* o_ptr = untag_ptr(o);
23435         CHECK_ACCESS(o_ptr);
23436         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
23437         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
23438         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23439         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
23440         int64_t ret_ref = tag_ptr(ret_copy, true);
23441         return ret_ref;
23442 }
23443
23444 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_none() {
23445         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23446         *ret_copy = COption_MaxDustHTLCExposureZ_none();
23447         int64_t ret_ref = tag_ptr(ret_copy, true);
23448         return ret_ref;
23449 }
23450
23451 void  CS_LDK_COption_MaxDustHTLCExposureZ_free(int64_t _res) {
23452         if (!ptr_is_owned(_res)) return;
23453         void* _res_ptr = untag_ptr(_res);
23454         CHECK_ACCESS(_res_ptr);
23455         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
23456         FREE(untag_ptr(_res));
23457         COption_MaxDustHTLCExposureZ_free(_res_conv);
23458 }
23459
23460 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
23461         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23462         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
23463         int64_t ret_ref = tag_ptr(ret_copy, true);
23464         return ret_ref;
23465 }
23466 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone_ptr(int64_t arg) {
23467         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
23468         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
23469         return ret_conv;
23470 }
23471
23472 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone(int64_t orig) {
23473         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
23474         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
23475         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
23476         int64_t ret_ref = tag_ptr(ret_copy, true);
23477         return ret_ref;
23478 }
23479
23480 int64_t  CS_LDK_COption_APIErrorZ_some(int64_t o) {
23481         void* o_ptr = untag_ptr(o);
23482         CHECK_ACCESS(o_ptr);
23483         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
23484         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
23485         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23486         *ret_copy = COption_APIErrorZ_some(o_conv);
23487         int64_t ret_ref = tag_ptr(ret_copy, true);
23488         return ret_ref;
23489 }
23490
23491 int64_t  CS_LDK_COption_APIErrorZ_none() {
23492         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23493         *ret_copy = COption_APIErrorZ_none();
23494         int64_t ret_ref = tag_ptr(ret_copy, true);
23495         return ret_ref;
23496 }
23497
23498 void  CS_LDK_COption_APIErrorZ_free(int64_t _res) {
23499         if (!ptr_is_owned(_res)) return;
23500         void* _res_ptr = untag_ptr(_res);
23501         CHECK_ACCESS(_res_ptr);
23502         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
23503         FREE(untag_ptr(_res));
23504         COption_APIErrorZ_free(_res_conv);
23505 }
23506
23507 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
23508         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23509         *ret_copy = COption_APIErrorZ_clone(arg);
23510         int64_t ret_ref = tag_ptr(ret_copy, true);
23511         return ret_ref;
23512 }
23513 int64_t  CS_LDK_COption_APIErrorZ_clone_ptr(int64_t arg) {
23514         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
23515         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
23516         return ret_conv;
23517 }
23518
23519 int64_t  CS_LDK_COption_APIErrorZ_clone(int64_t orig) {
23520         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
23521         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
23522         *ret_copy = COption_APIErrorZ_clone(orig_conv);
23523         int64_t ret_ref = tag_ptr(ret_copy, true);
23524         return ret_ref;
23525 }
23526
23527 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_ok(int64_t o) {
23528         void* o_ptr = untag_ptr(o);
23529         CHECK_ACCESS(o_ptr);
23530         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
23531         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
23532         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23533         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
23534         return tag_ptr(ret_conv, true);
23535 }
23536
23537 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_err(int64_t e) {
23538         void* e_ptr = untag_ptr(e);
23539         CHECK_ACCESS(e_ptr);
23540         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23541         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23542         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23543         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
23544         return tag_ptr(ret_conv, true);
23545 }
23546
23547 jboolean  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_is_ok(int64_t o) {
23548         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
23549         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
23550         return ret_conv;
23551 }
23552
23553 void  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_free(int64_t _res) {
23554         if (!ptr_is_owned(_res)) return;
23555         void* _res_ptr = untag_ptr(_res);
23556         CHECK_ACCESS(_res_ptr);
23557         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
23558         FREE(untag_ptr(_res));
23559         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
23560 }
23561
23562 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
23563         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23564         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
23565         return tag_ptr(ret_conv, true);
23566 }
23567 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(int64_t arg) {
23568         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
23569         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
23570         return ret_conv;
23571 }
23572
23573 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone(int64_t orig) {
23574         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
23575         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
23576         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
23577         return tag_ptr(ret_conv, true);
23578 }
23579
23580 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(int64_t o) {
23581         LDKChannelMonitorUpdate o_conv;
23582         o_conv.inner = untag_ptr(o);
23583         o_conv.is_owned = ptr_is_owned(o);
23584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23585         o_conv = ChannelMonitorUpdate_clone(&o_conv);
23586         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23587         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
23588         return tag_ptr(ret_conv, true);
23589 }
23590
23591 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_err(int64_t e) {
23592         void* e_ptr = untag_ptr(e);
23593         CHECK_ACCESS(e_ptr);
23594         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23595         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23596         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23597         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
23598         return tag_ptr(ret_conv, true);
23599 }
23600
23601 jboolean  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(int64_t o) {
23602         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
23603         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
23604         return ret_conv;
23605 }
23606
23607 void  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_free(int64_t _res) {
23608         if (!ptr_is_owned(_res)) return;
23609         void* _res_ptr = untag_ptr(_res);
23610         CHECK_ACCESS(_res_ptr);
23611         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
23612         FREE(untag_ptr(_res));
23613         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
23614 }
23615
23616 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
23617         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23618         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
23619         return tag_ptr(ret_conv, true);
23620 }
23621 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
23622         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
23623         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
23624         return ret_conv;
23625 }
23626
23627 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(int64_t orig) {
23628         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
23629         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23630         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
23631         return tag_ptr(ret_conv, true);
23632 }
23633
23634 int64_t  CS_LDK_COption_MonitorEventZ_some(int64_t o) {
23635         void* o_ptr = untag_ptr(o);
23636         CHECK_ACCESS(o_ptr);
23637         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
23638         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
23639         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23640         *ret_copy = COption_MonitorEventZ_some(o_conv);
23641         int64_t ret_ref = tag_ptr(ret_copy, true);
23642         return ret_ref;
23643 }
23644
23645 int64_t  CS_LDK_COption_MonitorEventZ_none() {
23646         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23647         *ret_copy = COption_MonitorEventZ_none();
23648         int64_t ret_ref = tag_ptr(ret_copy, true);
23649         return ret_ref;
23650 }
23651
23652 void  CS_LDK_COption_MonitorEventZ_free(int64_t _res) {
23653         if (!ptr_is_owned(_res)) return;
23654         void* _res_ptr = untag_ptr(_res);
23655         CHECK_ACCESS(_res_ptr);
23656         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
23657         FREE(untag_ptr(_res));
23658         COption_MonitorEventZ_free(_res_conv);
23659 }
23660
23661 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
23662         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23663         *ret_copy = COption_MonitorEventZ_clone(arg);
23664         int64_t ret_ref = tag_ptr(ret_copy, true);
23665         return ret_ref;
23666 }
23667 int64_t  CS_LDK_COption_MonitorEventZ_clone_ptr(int64_t arg) {
23668         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
23669         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
23670         return ret_conv;
23671 }
23672
23673 int64_t  CS_LDK_COption_MonitorEventZ_clone(int64_t orig) {
23674         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
23675         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
23676         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
23677         int64_t ret_ref = tag_ptr(ret_copy, true);
23678         return ret_ref;
23679 }
23680
23681 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_ok(int64_t o) {
23682         void* o_ptr = untag_ptr(o);
23683         CHECK_ACCESS(o_ptr);
23684         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
23685         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
23686         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23687         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
23688         return tag_ptr(ret_conv, true);
23689 }
23690
23691 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_err(int64_t e) {
23692         void* e_ptr = untag_ptr(e);
23693         CHECK_ACCESS(e_ptr);
23694         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23695         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23696         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23697         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
23698         return tag_ptr(ret_conv, true);
23699 }
23700
23701 jboolean  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(int64_t o) {
23702         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
23703         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
23704         return ret_conv;
23705 }
23706
23707 void  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_free(int64_t _res) {
23708         if (!ptr_is_owned(_res)) return;
23709         void* _res_ptr = untag_ptr(_res);
23710         CHECK_ACCESS(_res_ptr);
23711         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
23712         FREE(untag_ptr(_res));
23713         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
23714 }
23715
23716 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
23717         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23718         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
23719         return tag_ptr(ret_conv, true);
23720 }
23721 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(int64_t arg) {
23722         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
23723         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
23724         return ret_conv;
23725 }
23726
23727 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone(int64_t orig) {
23728         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
23729         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23730         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
23731         return tag_ptr(ret_conv, true);
23732 }
23733
23734 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_ok(int64_t o) {
23735         LDKHTLCUpdate o_conv;
23736         o_conv.inner = untag_ptr(o);
23737         o_conv.is_owned = ptr_is_owned(o);
23738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23739         o_conv = HTLCUpdate_clone(&o_conv);
23740         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23741         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
23742         return tag_ptr(ret_conv, true);
23743 }
23744
23745 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_err(int64_t e) {
23746         void* e_ptr = untag_ptr(e);
23747         CHECK_ACCESS(e_ptr);
23748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23750         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23751         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
23752         return tag_ptr(ret_conv, true);
23753 }
23754
23755 jboolean  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_is_ok(int64_t o) {
23756         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
23757         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
23758         return ret_conv;
23759 }
23760
23761 void  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_free(int64_t _res) {
23762         if (!ptr_is_owned(_res)) return;
23763         void* _res_ptr = untag_ptr(_res);
23764         CHECK_ACCESS(_res_ptr);
23765         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
23766         FREE(untag_ptr(_res));
23767         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
23768 }
23769
23770 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
23771         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23772         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
23773         return tag_ptr(ret_conv, true);
23774 }
23775 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
23776         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
23777         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
23778         return ret_conv;
23779 }
23780
23781 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone(int64_t orig) {
23782         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
23783         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23784         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
23785         return tag_ptr(ret_conv, true);
23786 }
23787
23788 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
23789         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23790         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
23791         return tag_ptr(ret_conv, true);
23792 }
23793 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(int64_t arg) {
23794         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
23795         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
23796         return ret_conv;
23797 }
23798
23799 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone(int64_t orig) {
23800         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
23801         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23802         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
23803         return tag_ptr(ret_conv, true);
23804 }
23805
23806 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_new(int64_t a, int8_tArray b) {
23807         LDKOutPoint a_conv;
23808         a_conv.inner = untag_ptr(a);
23809         a_conv.is_owned = ptr_is_owned(a);
23810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23811         a_conv = OutPoint_clone(&a_conv);
23812         LDKCVec_u8Z b_ref;
23813         b_ref.datalen = b->arr_len;
23814         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23815         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23816         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
23817         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
23818         return tag_ptr(ret_conv, true);
23819 }
23820
23821 void  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_free(int64_t _res) {
23822         if (!ptr_is_owned(_res)) return;
23823         void* _res_ptr = untag_ptr(_res);
23824         CHECK_ACCESS(_res_ptr);
23825         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
23826         FREE(untag_ptr(_res));
23827         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
23828 }
23829
23830 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
23831         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23832         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
23833         return tag_ptr(ret_conv, true);
23834 }
23835 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone_ptr(int64_t arg) {
23836         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
23837         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
23838         return ret_conv;
23839 }
23840
23841 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone(int64_t orig) {
23842         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
23843         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23844         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
23845         return tag_ptr(ret_conv, true);
23846 }
23847
23848 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
23849         LDKCVec_u8Z b_ref;
23850         b_ref.datalen = b->arr_len;
23851         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
23852         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
23853         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
23854         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
23855         return tag_ptr(ret_conv, true);
23856 }
23857
23858 void  CS_LDK_C2Tuple_u32CVec_u8ZZ_free(int64_t _res) {
23859         if (!ptr_is_owned(_res)) return;
23860         void* _res_ptr = untag_ptr(_res);
23861         CHECK_ACCESS(_res_ptr);
23862         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
23863         FREE(untag_ptr(_res));
23864         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
23865 }
23866
23867 void  CS_LDK_CVec_C2Tuple_u32CVec_u8ZZZ_free(int64_tArray _res) {
23868         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
23869         _res_constr.datalen = _res->arr_len;
23870         if (_res_constr.datalen > 0)
23871                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23872         else
23873                 _res_constr.data = NULL;
23874         int64_t* _res_vals = _res->elems;
23875         for (size_t x = 0; x < _res_constr.datalen; x++) {
23876                 int64_t _res_conv_23 = _res_vals[x];
23877                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
23878                 CHECK_ACCESS(_res_conv_23_ptr);
23879                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
23880                 FREE(untag_ptr(_res_conv_23));
23881                 _res_constr.data[x] = _res_conv_23_conv;
23882         }
23883         FREE(_res);
23884         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
23885 }
23886
23887 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
23888         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23889         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
23890         return tag_ptr(ret_conv, true);
23891 }
23892 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(int64_t arg) {
23893         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
23894         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
23895         return ret_conv;
23896 }
23897
23898 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(int64_t orig) {
23899         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
23900         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23901         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
23902         return tag_ptr(ret_conv, true);
23903 }
23904
23905 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, int64_tArray b) {
23906         LDKThirtyTwoBytes a_ref;
23907         CHECK(a->arr_len == 32);
23908         memcpy(a_ref.data, a->elems, 32); FREE(a);
23909         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
23910         b_constr.datalen = b->arr_len;
23911         if (b_constr.datalen > 0)
23912                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
23913         else
23914                 b_constr.data = NULL;
23915         int64_t* b_vals = b->elems;
23916         for (size_t x = 0; x < b_constr.datalen; x++) {
23917                 int64_t b_conv_23 = b_vals[x];
23918                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
23919                 CHECK_ACCESS(b_conv_23_ptr);
23920                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
23921                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
23922                 b_constr.data[x] = b_conv_23_conv;
23923         }
23924         FREE(b);
23925         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
23926         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
23927         return tag_ptr(ret_conv, true);
23928 }
23929
23930 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(int64_t _res) {
23931         if (!ptr_is_owned(_res)) return;
23932         void* _res_ptr = untag_ptr(_res);
23933         CHECK_ACCESS(_res_ptr);
23934         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
23935         FREE(untag_ptr(_res));
23936         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
23937 }
23938
23939 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(int64_tArray _res) {
23940         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
23941         _res_constr.datalen = _res->arr_len;
23942         if (_res_constr.datalen > 0)
23943                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
23944         else
23945                 _res_constr.data = NULL;
23946         int64_t* _res_vals = _res->elems;
23947         for (size_t a = 0; a < _res_constr.datalen; a++) {
23948                 int64_t _res_conv_52 = _res_vals[a];
23949                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
23950                 CHECK_ACCESS(_res_conv_52_ptr);
23951                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
23952                 FREE(untag_ptr(_res_conv_52));
23953                 _res_constr.data[a] = _res_conv_52_conv;
23954         }
23955         FREE(_res);
23956         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
23957 }
23958
23959 void  CS_LDK_CVec_CommitmentTransactionZ_free(int64_tArray _res) {
23960         LDKCVec_CommitmentTransactionZ _res_constr;
23961         _res_constr.datalen = _res->arr_len;
23962         if (_res_constr.datalen > 0)
23963                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
23964         else
23965                 _res_constr.data = NULL;
23966         int64_t* _res_vals = _res->elems;
23967         for (size_t x = 0; x < _res_constr.datalen; x++) {
23968                 int64_t _res_conv_23 = _res_vals[x];
23969                 LDKCommitmentTransaction _res_conv_23_conv;
23970                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
23971                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
23972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
23973                 _res_constr.data[x] = _res_conv_23_conv;
23974         }
23975         FREE(_res);
23976         CVec_CommitmentTransactionZ_free(_res_constr);
23977 }
23978
23979 void  CS_LDK_CVec_TransactionZ_free(ptrArray _res) {
23980         LDKCVec_TransactionZ _res_constr;
23981         _res_constr.datalen = _res->arr_len;
23982         if (_res_constr.datalen > 0)
23983                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
23984         else
23985                 _res_constr.data = NULL;
23986         int8_tArray* _res_vals = (void*) _res->elems;
23987         for (size_t i = 0; i < _res_constr.datalen; i++) {
23988                 int8_tArray _res_conv_8 = _res_vals[i];
23989                 LDKTransaction _res_conv_8_ref;
23990                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
23991                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
23992                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
23993                 _res_conv_8_ref.data_is_owned = true;
23994                 _res_constr.data[i] = _res_conv_8_ref;
23995         }
23996         FREE(_res);
23997         CVec_TransactionZ_free(_res_constr);
23998 }
23999
24000 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
24001         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24002         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
24003         return tag_ptr(ret_conv, true);
24004 }
24005 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone_ptr(int64_t arg) {
24006         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
24007         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
24008         return ret_conv;
24009 }
24010
24011 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone(int64_t orig) {
24012         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
24013         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24014         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
24015         return tag_ptr(ret_conv, true);
24016 }
24017
24018 int64_t  CS_LDK_C2Tuple_u32TxOutZ_new(int32_t a, int64_t b) {
24019         void* b_ptr = untag_ptr(b);
24020         CHECK_ACCESS(b_ptr);
24021         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
24022         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
24023         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
24024         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
24025         return tag_ptr(ret_conv, true);
24026 }
24027
24028 void  CS_LDK_C2Tuple_u32TxOutZ_free(int64_t _res) {
24029         if (!ptr_is_owned(_res)) return;
24030         void* _res_ptr = untag_ptr(_res);
24031         CHECK_ACCESS(_res_ptr);
24032         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
24033         FREE(untag_ptr(_res));
24034         C2Tuple_u32TxOutZ_free(_res_conv);
24035 }
24036
24037 void  CS_LDK_CVec_C2Tuple_u32TxOutZZ_free(int64_tArray _res) {
24038         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
24039         _res_constr.datalen = _res->arr_len;
24040         if (_res_constr.datalen > 0)
24041                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
24042         else
24043                 _res_constr.data = NULL;
24044         int64_t* _res_vals = _res->elems;
24045         for (size_t u = 0; u < _res_constr.datalen; u++) {
24046                 int64_t _res_conv_20 = _res_vals[u];
24047                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
24048                 CHECK_ACCESS(_res_conv_20_ptr);
24049                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
24050                 FREE(untag_ptr(_res_conv_20));
24051                 _res_constr.data[u] = _res_conv_20_conv;
24052         }
24053         FREE(_res);
24054         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
24055 }
24056
24057 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
24058         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24059         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
24060         return tag_ptr(ret_conv, true);
24061 }
24062 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(int64_t arg) {
24063         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
24064         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
24065         return ret_conv;
24066 }
24067
24068 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(int64_t orig) {
24069         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
24070         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24071         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
24072         return tag_ptr(ret_conv, true);
24073 }
24074
24075 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, int64_tArray b) {
24076         LDKThirtyTwoBytes a_ref;
24077         CHECK(a->arr_len == 32);
24078         memcpy(a_ref.data, a->elems, 32); FREE(a);
24079         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
24080         b_constr.datalen = b->arr_len;
24081         if (b_constr.datalen > 0)
24082                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
24083         else
24084                 b_constr.data = NULL;
24085         int64_t* b_vals = b->elems;
24086         for (size_t u = 0; u < b_constr.datalen; u++) {
24087                 int64_t b_conv_20 = b_vals[u];
24088                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
24089                 CHECK_ACCESS(b_conv_20_ptr);
24090                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
24091                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
24092                 b_constr.data[u] = b_conv_20_conv;
24093         }
24094         FREE(b);
24095         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
24096         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
24097         return tag_ptr(ret_conv, true);
24098 }
24099
24100 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(int64_t _res) {
24101         if (!ptr_is_owned(_res)) return;
24102         void* _res_ptr = untag_ptr(_res);
24103         CHECK_ACCESS(_res_ptr);
24104         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
24105         FREE(untag_ptr(_res));
24106         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
24107 }
24108
24109 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(int64_tArray _res) {
24110         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
24111         _res_constr.datalen = _res->arr_len;
24112         if (_res_constr.datalen > 0)
24113                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
24114         else
24115                 _res_constr.data = NULL;
24116         int64_t* _res_vals = _res->elems;
24117         for (size_t x = 0; x < _res_constr.datalen; x++) {
24118                 int64_t _res_conv_49 = _res_vals[x];
24119                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
24120                 CHECK_ACCESS(_res_conv_49_ptr);
24121                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
24122                 FREE(untag_ptr(_res_conv_49));
24123                 _res_constr.data[x] = _res_conv_49_conv;
24124         }
24125         FREE(_res);
24126         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
24127 }
24128
24129 void  CS_LDK_CVec_BalanceZ_free(int64_tArray _res) {
24130         LDKCVec_BalanceZ _res_constr;
24131         _res_constr.datalen = _res->arr_len;
24132         if (_res_constr.datalen > 0)
24133                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
24134         else
24135                 _res_constr.data = NULL;
24136         int64_t* _res_vals = _res->elems;
24137         for (size_t j = 0; j < _res_constr.datalen; j++) {
24138                 int64_t _res_conv_9 = _res_vals[j];
24139                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
24140                 CHECK_ACCESS(_res_conv_9_ptr);
24141                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
24142                 FREE(untag_ptr(_res_conv_9));
24143                 _res_constr.data[j] = _res_conv_9_conv;
24144         }
24145         FREE(_res);
24146         CVec_BalanceZ_free(_res_constr);
24147 }
24148
24149 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
24150         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24151         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
24152         return tag_ptr(ret_conv, true);
24153 }
24154 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(int64_t arg) {
24155         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
24156         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
24157         return ret_conv;
24158 }
24159
24160 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(int64_t orig) {
24161         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
24162         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24163         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
24164         return tag_ptr(ret_conv, true);
24165 }
24166
24167 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, int64_t b) {
24168         LDKThirtyTwoBytes a_ref;
24169         CHECK(a->arr_len == 32);
24170         memcpy(a_ref.data, a->elems, 32); FREE(a);
24171         LDKChannelMonitor b_conv;
24172         b_conv.inner = untag_ptr(b);
24173         b_conv.is_owned = ptr_is_owned(b);
24174         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24175         b_conv = ChannelMonitor_clone(&b_conv);
24176         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
24177         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
24178         return tag_ptr(ret_conv, true);
24179 }
24180
24181 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(int64_t _res) {
24182         if (!ptr_is_owned(_res)) return;
24183         void* _res_ptr = untag_ptr(_res);
24184         CHECK_ACCESS(_res_ptr);
24185         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
24186         FREE(untag_ptr(_res));
24187         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
24188 }
24189
24190 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(int64_t o) {
24191         void* o_ptr = untag_ptr(o);
24192         CHECK_ACCESS(o_ptr);
24193         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
24194         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
24195         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24196         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
24197         return tag_ptr(ret_conv, true);
24198 }
24199
24200 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(int64_t e) {
24201         void* e_ptr = untag_ptr(e);
24202         CHECK_ACCESS(e_ptr);
24203         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24204         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24205         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24206         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
24207         return tag_ptr(ret_conv, true);
24208 }
24209
24210 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(int64_t o) {
24211         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
24212         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
24213         return ret_conv;
24214 }
24215
24216 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(int64_t _res) {
24217         if (!ptr_is_owned(_res)) return;
24218         void* _res_ptr = untag_ptr(_res);
24219         CHECK_ACCESS(_res_ptr);
24220         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
24221         FREE(untag_ptr(_res));
24222         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
24223 }
24224
24225 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
24226         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24227         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
24228         return tag_ptr(ret_conv, true);
24229 }
24230 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(int64_t arg) {
24231         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
24232         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
24233         return ret_conv;
24234 }
24235
24236 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(int64_t orig) {
24237         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
24238         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
24239         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
24240         return tag_ptr(ret_conv, true);
24241 }
24242
24243 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
24244         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24245         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
24246         return tag_ptr(ret_conv, true);
24247 }
24248 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone_ptr(int64_t arg) {
24249         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
24250         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
24251         return ret_conv;
24252 }
24253
24254 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone(int64_t orig) {
24255         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
24256         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24257         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
24258         return tag_ptr(ret_conv, true);
24259 }
24260
24261 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, int64_t b) {
24262         LDKPublicKey a_ref;
24263         CHECK(a->arr_len == 33);
24264         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24265         void* b_ptr = untag_ptr(b);
24266         CHECK_ACCESS(b_ptr);
24267         LDKType b_conv = *(LDKType*)(b_ptr);
24268         if (b_conv.free == LDKType_JCalls_free) {
24269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24270                 LDKType_JCalls_cloned(&b_conv);
24271         }
24272         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
24273         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
24274         return tag_ptr(ret_conv, true);
24275 }
24276
24277 void  CS_LDK_C2Tuple_PublicKeyTypeZ_free(int64_t _res) {
24278         if (!ptr_is_owned(_res)) return;
24279         void* _res_ptr = untag_ptr(_res);
24280         CHECK_ACCESS(_res_ptr);
24281         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
24282         FREE(untag_ptr(_res));
24283         C2Tuple_PublicKeyTypeZ_free(_res_conv);
24284 }
24285
24286 void  CS_LDK_CVec_C2Tuple_PublicKeyTypeZZ_free(int64_tArray _res) {
24287         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
24288         _res_constr.datalen = _res->arr_len;
24289         if (_res_constr.datalen > 0)
24290                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
24291         else
24292                 _res_constr.data = NULL;
24293         int64_t* _res_vals = _res->elems;
24294         for (size_t z = 0; z < _res_constr.datalen; z++) {
24295                 int64_t _res_conv_25 = _res_vals[z];
24296                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
24297                 CHECK_ACCESS(_res_conv_25_ptr);
24298                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
24299                 FREE(untag_ptr(_res_conv_25));
24300                 _res_constr.data[z] = _res_conv_25_conv;
24301         }
24302         FREE(_res);
24303         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
24304 }
24305
24306 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
24307         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24308         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
24309         return tag_ptr(ret_conv, true);
24310 }
24311 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(int64_t arg) {
24312         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
24313         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
24314         return ret_conv;
24315 }
24316
24317 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(int64_t orig) {
24318         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
24319         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24320         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
24321         return tag_ptr(ret_conv, true);
24322 }
24323
24324 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, int64_tArray b) {
24325         LDKPublicKey a_ref;
24326         CHECK(a->arr_len == 33);
24327         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24328         LDKCVec_SocketAddressZ b_constr;
24329         b_constr.datalen = b->arr_len;
24330         if (b_constr.datalen > 0)
24331                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
24332         else
24333                 b_constr.data = NULL;
24334         int64_t* b_vals = b->elems;
24335         for (size_t p = 0; p < b_constr.datalen; p++) {
24336                 int64_t b_conv_15 = b_vals[p];
24337                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
24338                 CHECK_ACCESS(b_conv_15_ptr);
24339                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
24340                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
24341                 b_constr.data[p] = b_conv_15_conv;
24342         }
24343         FREE(b);
24344         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
24345         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
24346         return tag_ptr(ret_conv, true);
24347 }
24348
24349 void  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(int64_t _res) {
24350         if (!ptr_is_owned(_res)) return;
24351         void* _res_ptr = untag_ptr(_res);
24352         CHECK_ACCESS(_res_ptr);
24353         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
24354         FREE(untag_ptr(_res));
24355         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
24356 }
24357
24358 void  CS_LDK_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(int64_tArray _res) {
24359         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
24360         _res_constr.datalen = _res->arr_len;
24361         if (_res_constr.datalen > 0)
24362                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
24363         else
24364                 _res_constr.data = NULL;
24365         int64_t* _res_vals = _res->elems;
24366         for (size_t o = 0; o < _res_constr.datalen; o++) {
24367                 int64_t _res_conv_40 = _res_vals[o];
24368                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24369                 CHECK_ACCESS(_res_conv_40_ptr);
24370                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
24371                 FREE(untag_ptr(_res_conv_40));
24372                 _res_constr.data[o] = _res_conv_40_conv;
24373         }
24374         FREE(_res);
24375         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
24376 }
24377
24378 int64_t  CS_LDK_COption_OnionMessageContentsZ_some(int64_t o) {
24379         void* o_ptr = untag_ptr(o);
24380         CHECK_ACCESS(o_ptr);
24381         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
24382         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
24383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24384                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
24385         }
24386         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24387         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
24388         int64_t ret_ref = tag_ptr(ret_copy, true);
24389         return ret_ref;
24390 }
24391
24392 int64_t  CS_LDK_COption_OnionMessageContentsZ_none() {
24393         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24394         *ret_copy = COption_OnionMessageContentsZ_none();
24395         int64_t ret_ref = tag_ptr(ret_copy, true);
24396         return ret_ref;
24397 }
24398
24399 void  CS_LDK_COption_OnionMessageContentsZ_free(int64_t _res) {
24400         if (!ptr_is_owned(_res)) return;
24401         void* _res_ptr = untag_ptr(_res);
24402         CHECK_ACCESS(_res_ptr);
24403         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
24404         FREE(untag_ptr(_res));
24405         COption_OnionMessageContentsZ_free(_res_conv);
24406 }
24407
24408 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
24409         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24410         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
24411         int64_t ret_ref = tag_ptr(ret_copy, true);
24412         return ret_ref;
24413 }
24414 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone_ptr(int64_t arg) {
24415         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
24416         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
24417         return ret_conv;
24418 }
24419
24420 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone(int64_t orig) {
24421         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
24422         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
24423         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
24424         int64_t ret_ref = tag_ptr(ret_copy, true);
24425         return ret_ref;
24426 }
24427
24428 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(int64_t o) {
24429         void* o_ptr = untag_ptr(o);
24430         CHECK_ACCESS(o_ptr);
24431         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
24432         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
24433         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24434         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
24435         return tag_ptr(ret_conv, true);
24436 }
24437
24438 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(int64_t e) {
24439         void* e_ptr = untag_ptr(e);
24440         CHECK_ACCESS(e_ptr);
24441         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24442         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24443         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24444         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
24445         return tag_ptr(ret_conv, true);
24446 }
24447
24448 jboolean  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(int64_t o) {
24449         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
24450         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
24451         return ret_conv;
24452 }
24453
24454 void  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(int64_t _res) {
24455         if (!ptr_is_owned(_res)) return;
24456         void* _res_ptr = untag_ptr(_res);
24457         CHECK_ACCESS(_res_ptr);
24458         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
24459         FREE(untag_ptr(_res));
24460         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
24461 }
24462
24463 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
24464         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24465         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
24466         return tag_ptr(ret_conv, true);
24467 }
24468 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(int64_t arg) {
24469         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
24470         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
24471         return ret_conv;
24472 }
24473
24474 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(int64_t orig) {
24475         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
24476         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
24477         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
24478         return tag_ptr(ret_conv, true);
24479 }
24480
24481 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
24482         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24483         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
24484         return tag_ptr(ret_conv, true);
24485 }
24486 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(int64_t arg) {
24487         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
24488         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
24489         return ret_conv;
24490 }
24491
24492 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(int64_t orig) {
24493         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
24494         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24495         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
24496         return tag_ptr(ret_conv, true);
24497 }
24498
24499 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
24500         void* a_ptr = untag_ptr(a);
24501         CHECK_ACCESS(a_ptr);
24502         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
24503         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
24504                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24505                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
24506         }
24507         void* b_ptr = untag_ptr(b);
24508         CHECK_ACCESS(b_ptr);
24509         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
24510         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
24511         LDKBlindedPath c_conv;
24512         c_conv.inner = untag_ptr(c);
24513         c_conv.is_owned = ptr_is_owned(c);
24514         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
24515         c_conv = BlindedPath_clone(&c_conv);
24516         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
24517         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
24518         return tag_ptr(ret_conv, true);
24519 }
24520
24521 void  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(int64_t _res) {
24522         if (!ptr_is_owned(_res)) return;
24523         void* _res_ptr = untag_ptr(_res);
24524         CHECK_ACCESS(_res_ptr);
24525         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
24526         FREE(untag_ptr(_res));
24527         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
24528 }
24529
24530 void  CS_LDK_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(int64_tArray _res) {
24531         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
24532         _res_constr.datalen = _res->arr_len;
24533         if (_res_constr.datalen > 0)
24534                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
24535         else
24536                 _res_constr.data = NULL;
24537         int64_t* _res_vals = _res->elems;
24538         for (size_t e = 0; e < _res_constr.datalen; e++) {
24539                 int64_t _res_conv_56 = _res_vals[e];
24540                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
24541                 CHECK_ACCESS(_res_conv_56_ptr);
24542                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
24543                 FREE(untag_ptr(_res_conv_56));
24544                 _res_constr.data[e] = _res_conv_56_conv;
24545         }
24546         FREE(_res);
24547         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
24548 }
24549
24550 int64_t  CS_LDK_COption_TypeZ_some(int64_t o) {
24551         void* o_ptr = untag_ptr(o);
24552         CHECK_ACCESS(o_ptr);
24553         LDKType o_conv = *(LDKType*)(o_ptr);
24554         if (o_conv.free == LDKType_JCalls_free) {
24555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24556                 LDKType_JCalls_cloned(&o_conv);
24557         }
24558         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24559         *ret_copy = COption_TypeZ_some(o_conv);
24560         int64_t ret_ref = tag_ptr(ret_copy, true);
24561         return ret_ref;
24562 }
24563
24564 int64_t  CS_LDK_COption_TypeZ_none() {
24565         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24566         *ret_copy = COption_TypeZ_none();
24567         int64_t ret_ref = tag_ptr(ret_copy, true);
24568         return ret_ref;
24569 }
24570
24571 void  CS_LDK_COption_TypeZ_free(int64_t _res) {
24572         if (!ptr_is_owned(_res)) return;
24573         void* _res_ptr = untag_ptr(_res);
24574         CHECK_ACCESS(_res_ptr);
24575         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
24576         FREE(untag_ptr(_res));
24577         COption_TypeZ_free(_res_conv);
24578 }
24579
24580 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
24581         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24582         *ret_copy = COption_TypeZ_clone(arg);
24583         int64_t ret_ref = tag_ptr(ret_copy, true);
24584         return ret_ref;
24585 }
24586 int64_t  CS_LDK_COption_TypeZ_clone_ptr(int64_t arg) {
24587         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
24588         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
24589         return ret_conv;
24590 }
24591
24592 int64_t  CS_LDK_COption_TypeZ_clone(int64_t orig) {
24593         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
24594         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
24595         *ret_copy = COption_TypeZ_clone(orig_conv);
24596         int64_t ret_ref = tag_ptr(ret_copy, true);
24597         return ret_ref;
24598 }
24599
24600 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_ok(int64_t o) {
24601         void* o_ptr = untag_ptr(o);
24602         CHECK_ACCESS(o_ptr);
24603         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
24604         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
24605         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24606         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
24607         return tag_ptr(ret_conv, true);
24608 }
24609
24610 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_err(int64_t e) {
24611         void* e_ptr = untag_ptr(e);
24612         CHECK_ACCESS(e_ptr);
24613         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24614         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24615         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24616         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
24617         return tag_ptr(ret_conv, true);
24618 }
24619
24620 jboolean  CS_LDK_CResult_COption_TypeZDecodeErrorZ_is_ok(int64_t o) {
24621         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
24622         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
24623         return ret_conv;
24624 }
24625
24626 void  CS_LDK_CResult_COption_TypeZDecodeErrorZ_free(int64_t _res) {
24627         if (!ptr_is_owned(_res)) return;
24628         void* _res_ptr = untag_ptr(_res);
24629         CHECK_ACCESS(_res_ptr);
24630         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
24631         FREE(untag_ptr(_res));
24632         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
24633 }
24634
24635 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
24636         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24637         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
24638         return tag_ptr(ret_conv, true);
24639 }
24640 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone_ptr(int64_t arg) {
24641         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
24642         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
24643         return ret_conv;
24644 }
24645
24646 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone(int64_t orig) {
24647         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
24648         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
24649         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
24650         return tag_ptr(ret_conv, true);
24651 }
24652
24653 int64_t  CS_LDK_COption_SocketAddressZ_some(int64_t o) {
24654         void* o_ptr = untag_ptr(o);
24655         CHECK_ACCESS(o_ptr);
24656         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
24657         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
24658         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24659         *ret_copy = COption_SocketAddressZ_some(o_conv);
24660         int64_t ret_ref = tag_ptr(ret_copy, true);
24661         return ret_ref;
24662 }
24663
24664 int64_t  CS_LDK_COption_SocketAddressZ_none() {
24665         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24666         *ret_copy = COption_SocketAddressZ_none();
24667         int64_t ret_ref = tag_ptr(ret_copy, true);
24668         return ret_ref;
24669 }
24670
24671 void  CS_LDK_COption_SocketAddressZ_free(int64_t _res) {
24672         if (!ptr_is_owned(_res)) return;
24673         void* _res_ptr = untag_ptr(_res);
24674         CHECK_ACCESS(_res_ptr);
24675         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
24676         FREE(untag_ptr(_res));
24677         COption_SocketAddressZ_free(_res_conv);
24678 }
24679
24680 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
24681         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24682         *ret_copy = COption_SocketAddressZ_clone(arg);
24683         int64_t ret_ref = tag_ptr(ret_copy, true);
24684         return ret_ref;
24685 }
24686 int64_t  CS_LDK_COption_SocketAddressZ_clone_ptr(int64_t arg) {
24687         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
24688         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
24689         return ret_conv;
24690 }
24691
24692 int64_t  CS_LDK_COption_SocketAddressZ_clone(int64_t orig) {
24693         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
24694         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
24695         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
24696         int64_t ret_ref = tag_ptr(ret_copy, true);
24697         return ret_ref;
24698 }
24699
24700 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
24701         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24702         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
24703         return tag_ptr(ret_conv, true);
24704 }
24705 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(int64_t arg) {
24706         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
24707         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
24708         return ret_conv;
24709 }
24710
24711 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(int64_t orig) {
24712         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
24713         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24714         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
24715         return tag_ptr(ret_conv, true);
24716 }
24717
24718 int64_t  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_new(int8_tArray a, int64_t b) {
24719         LDKPublicKey a_ref;
24720         CHECK(a->arr_len == 33);
24721         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
24722         void* b_ptr = untag_ptr(b);
24723         CHECK_ACCESS(b_ptr);
24724         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
24725         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
24726         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
24727         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
24728         return tag_ptr(ret_conv, true);
24729 }
24730
24731 void  CS_LDK_C2Tuple_PublicKeyCOption_SocketAddressZZ_free(int64_t _res) {
24732         if (!ptr_is_owned(_res)) return;
24733         void* _res_ptr = untag_ptr(_res);
24734         CHECK_ACCESS(_res_ptr);
24735         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
24736         FREE(untag_ptr(_res));
24737         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
24738 }
24739
24740 void  CS_LDK_CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(int64_tArray _res) {
24741         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
24742         _res_constr.datalen = _res->arr_len;
24743         if (_res_constr.datalen > 0)
24744                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
24745         else
24746                 _res_constr.data = NULL;
24747         int64_t* _res_vals = _res->elems;
24748         for (size_t r = 0; r < _res_constr.datalen; r++) {
24749                 int64_t _res_conv_43 = _res_vals[r];
24750                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
24751                 CHECK_ACCESS(_res_conv_43_ptr);
24752                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
24753                 FREE(untag_ptr(_res_conv_43));
24754                 _res_constr.data[r] = _res_conv_43_conv;
24755         }
24756         FREE(_res);
24757         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
24758 }
24759
24760 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
24761         LDKCVec_u8Z o_ref;
24762         o_ref.datalen = o->arr_len;
24763         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24764         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24765         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24766         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
24767         return tag_ptr(ret_conv, true);
24768 }
24769
24770 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_err(int64_t e) {
24771         LDKPeerHandleError e_conv;
24772         e_conv.inner = untag_ptr(e);
24773         e_conv.is_owned = ptr_is_owned(e);
24774         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24775         e_conv = PeerHandleError_clone(&e_conv);
24776         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24777         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
24778         return tag_ptr(ret_conv, true);
24779 }
24780
24781 jboolean  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(int64_t o) {
24782         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
24783         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
24784         return ret_conv;
24785 }
24786
24787 void  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_free(int64_t _res) {
24788         if (!ptr_is_owned(_res)) return;
24789         void* _res_ptr = untag_ptr(_res);
24790         CHECK_ACCESS(_res_ptr);
24791         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
24792         FREE(untag_ptr(_res));
24793         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
24794 }
24795
24796 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
24797         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24798         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
24799         return tag_ptr(ret_conv, true);
24800 }
24801 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(int64_t arg) {
24802         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
24803         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
24804         return ret_conv;
24805 }
24806
24807 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone(int64_t orig) {
24808         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
24809         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24810         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
24811         return tag_ptr(ret_conv, true);
24812 }
24813
24814 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_ok() {
24815         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24816         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
24817         return tag_ptr(ret_conv, true);
24818 }
24819
24820 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_err(int64_t e) {
24821         LDKPeerHandleError e_conv;
24822         e_conv.inner = untag_ptr(e);
24823         e_conv.is_owned = ptr_is_owned(e);
24824         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24825         e_conv = PeerHandleError_clone(&e_conv);
24826         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24827         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
24828         return tag_ptr(ret_conv, true);
24829 }
24830
24831 jboolean  CS_LDK_CResult_NonePeerHandleErrorZ_is_ok(int64_t o) {
24832         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
24833         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
24834         return ret_conv;
24835 }
24836
24837 void  CS_LDK_CResult_NonePeerHandleErrorZ_free(int64_t _res) {
24838         if (!ptr_is_owned(_res)) return;
24839         void* _res_ptr = untag_ptr(_res);
24840         CHECK_ACCESS(_res_ptr);
24841         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
24842         FREE(untag_ptr(_res));
24843         CResult_NonePeerHandleErrorZ_free(_res_conv);
24844 }
24845
24846 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
24847         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24848         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
24849         return tag_ptr(ret_conv, true);
24850 }
24851 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone_ptr(int64_t arg) {
24852         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
24853         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
24854         return ret_conv;
24855 }
24856
24857 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone(int64_t orig) {
24858         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
24859         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24860         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
24861         return tag_ptr(ret_conv, true);
24862 }
24863
24864 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
24865         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24866         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
24867         return tag_ptr(ret_conv, true);
24868 }
24869
24870 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_err(int64_t e) {
24871         LDKPeerHandleError e_conv;
24872         e_conv.inner = untag_ptr(e);
24873         e_conv.is_owned = ptr_is_owned(e);
24874         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24875         e_conv = PeerHandleError_clone(&e_conv);
24876         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24877         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
24878         return tag_ptr(ret_conv, true);
24879 }
24880
24881 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_is_ok(int64_t o) {
24882         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
24883         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
24884         return ret_conv;
24885 }
24886
24887 void  CS_LDK_CResult_boolPeerHandleErrorZ_free(int64_t _res) {
24888         if (!ptr_is_owned(_res)) return;
24889         void* _res_ptr = untag_ptr(_res);
24890         CHECK_ACCESS(_res_ptr);
24891         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
24892         FREE(untag_ptr(_res));
24893         CResult_boolPeerHandleErrorZ_free(_res_conv);
24894 }
24895
24896 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
24897         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24898         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
24899         return tag_ptr(ret_conv, true);
24900 }
24901 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone_ptr(int64_t arg) {
24902         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
24903         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
24904         return ret_conv;
24905 }
24906
24907 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone(int64_t orig) {
24908         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
24909         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24910         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
24911         return tag_ptr(ret_conv, true);
24912 }
24913
24914 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
24915         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24916         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
24917         return tag_ptr(ret_conv, true);
24918 }
24919
24920 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_err(int64_t e) {
24921         void* e_ptr = untag_ptr(e);
24922         CHECK_ACCESS(e_ptr);
24923         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
24924         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
24925         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
24926         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
24927         return tag_ptr(ret_conv, true);
24928 }
24929
24930 jboolean  CS_LDK_CResult_u32GraphSyncErrorZ_is_ok(int64_t o) {
24931         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
24932         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
24933         return ret_conv;
24934 }
24935
24936 void  CS_LDK_CResult_u32GraphSyncErrorZ_free(int64_t _res) {
24937         if (!ptr_is_owned(_res)) return;
24938         void* _res_ptr = untag_ptr(_res);
24939         CHECK_ACCESS(_res_ptr);
24940         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
24941         FREE(untag_ptr(_res));
24942         CResult_u32GraphSyncErrorZ_free(_res_conv);
24943 }
24944
24945 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
24946         LDKCVec_u8Z o_ref;
24947         o_ref.datalen = o->arr_len;
24948         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24949         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
24950         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24951         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
24952         return tag_ptr(ret_conv, true);
24953 }
24954
24955 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_err(int32_t e) {
24956         LDKIOError e_conv = LDKIOError_from_cs(e);
24957         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24958         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
24959         return tag_ptr(ret_conv, true);
24960 }
24961
24962 jboolean  CS_LDK_CResult_CVec_u8ZIOErrorZ_is_ok(int64_t o) {
24963         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
24964         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
24965         return ret_conv;
24966 }
24967
24968 void  CS_LDK_CResult_CVec_u8ZIOErrorZ_free(int64_t _res) {
24969         if (!ptr_is_owned(_res)) return;
24970         void* _res_ptr = untag_ptr(_res);
24971         CHECK_ACCESS(_res_ptr);
24972         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
24973         FREE(untag_ptr(_res));
24974         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
24975 }
24976
24977 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
24978         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24979         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
24980         return tag_ptr(ret_conv, true);
24981 }
24982 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone_ptr(int64_t arg) {
24983         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
24984         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
24985         return ret_conv;
24986 }
24987
24988 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone(int64_t orig) {
24989         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
24990         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
24991         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
24992         return tag_ptr(ret_conv, true);
24993 }
24994
24995 void  CS_LDK_CVec_StrZ_free(ptrArray _res) {
24996         LDKCVec_StrZ _res_constr;
24997         _res_constr.datalen = _res->arr_len;
24998         if (_res_constr.datalen > 0)
24999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
25000         else
25001                 _res_constr.data = NULL;
25002         jstring* _res_vals = (void*) _res->elems;
25003         for (size_t i = 0; i < _res_constr.datalen; i++) {
25004                 jstring _res_conv_8 = _res_vals[i];
25005                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
25006                 _res_constr.data[i] = dummy;
25007         }
25008         FREE(_res);
25009         CVec_StrZ_free(_res_constr);
25010 }
25011
25012 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
25013         LDKCVec_StrZ o_constr;
25014         o_constr.datalen = o->arr_len;
25015         if (o_constr.datalen > 0)
25016                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
25017         else
25018                 o_constr.data = NULL;
25019         jstring* o_vals = (void*) o->elems;
25020         for (size_t i = 0; i < o_constr.datalen; i++) {
25021                 jstring o_conv_8 = o_vals[i];
25022                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
25023                 o_constr.data[i] = o_conv_8_conv;
25024         }
25025         FREE(o);
25026         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25027         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
25028         return tag_ptr(ret_conv, true);
25029 }
25030
25031 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_err(int32_t e) {
25032         LDKIOError e_conv = LDKIOError_from_cs(e);
25033         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25034         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
25035         return tag_ptr(ret_conv, true);
25036 }
25037
25038 jboolean  CS_LDK_CResult_CVec_StrZIOErrorZ_is_ok(int64_t o) {
25039         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
25040         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
25041         return ret_conv;
25042 }
25043
25044 void  CS_LDK_CResult_CVec_StrZIOErrorZ_free(int64_t _res) {
25045         if (!ptr_is_owned(_res)) return;
25046         void* _res_ptr = untag_ptr(_res);
25047         CHECK_ACCESS(_res_ptr);
25048         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
25049         FREE(untag_ptr(_res));
25050         CResult_CVec_StrZIOErrorZ_free(_res_conv);
25051 }
25052
25053 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
25054         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25055         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
25056         return tag_ptr(ret_conv, true);
25057 }
25058 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone_ptr(int64_t arg) {
25059         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
25060         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
25061         return ret_conv;
25062 }
25063
25064 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone(int64_t orig) {
25065         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
25066         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
25067         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
25068         return tag_ptr(ret_conv, true);
25069 }
25070
25071 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(int64_tArray _res) {
25072         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
25073         _res_constr.datalen = _res->arr_len;
25074         if (_res_constr.datalen > 0)
25075                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
25076         else
25077                 _res_constr.data = NULL;
25078         int64_t* _res_vals = _res->elems;
25079         for (size_t o = 0; o < _res_constr.datalen; o++) {
25080                 int64_t _res_conv_40 = _res_vals[o];
25081                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25082                 CHECK_ACCESS(_res_conv_40_ptr);
25083                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
25084                 FREE(untag_ptr(_res_conv_40));
25085                 _res_constr.data[o] = _res_conv_40_conv;
25086         }
25087         FREE(_res);
25088         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
25089 }
25090
25091 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(int64_tArray o) {
25092         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
25093         o_constr.datalen = o->arr_len;
25094         if (o_constr.datalen > 0)
25095                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
25096         else
25097                 o_constr.data = NULL;
25098         int64_t* o_vals = o->elems;
25099         for (size_t o = 0; o < o_constr.datalen; o++) {
25100                 int64_t o_conv_40 = o_vals[o];
25101                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
25102                 CHECK_ACCESS(o_conv_40_ptr);
25103                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
25104                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
25105                 o_constr.data[o] = o_conv_40_conv;
25106         }
25107         FREE(o);
25108         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25109         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
25110         return tag_ptr(ret_conv, true);
25111 }
25112
25113 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(int32_t e) {
25114         LDKIOError e_conv = LDKIOError_from_cs(e);
25115         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25116         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
25117         return tag_ptr(ret_conv, true);
25118 }
25119
25120 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(int64_t o) {
25121         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
25122         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
25123         return ret_conv;
25124 }
25125
25126 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(int64_t _res) {
25127         if (!ptr_is_owned(_res)) return;
25128         void* _res_ptr = untag_ptr(_res);
25129         CHECK_ACCESS(_res_ptr);
25130         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
25131         FREE(untag_ptr(_res));
25132         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
25133 }
25134
25135 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
25136         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25137         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
25138         return tag_ptr(ret_conv, true);
25139 }
25140 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(int64_t arg) {
25141         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
25142         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
25143         return ret_conv;
25144 }
25145
25146 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(int64_t orig) {
25147         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
25148         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
25149         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
25150         return tag_ptr(ret_conv, true);
25151 }
25152
25153 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(int64_t o) {
25154         void* o_ptr = untag_ptr(o);
25155         CHECK_ACCESS(o_ptr);
25156         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
25157         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
25158         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25159         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
25160         return tag_ptr(ret_conv, true);
25161 }
25162
25163 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(int32_t e) {
25164         LDKIOError e_conv = LDKIOError_from_cs(e);
25165         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25166         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
25167         return tag_ptr(ret_conv, true);
25168 }
25169
25170 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(int64_t o) {
25171         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
25172         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
25173         return ret_conv;
25174 }
25175
25176 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(int64_t _res) {
25177         if (!ptr_is_owned(_res)) return;
25178         void* _res_ptr = untag_ptr(_res);
25179         CHECK_ACCESS(_res_ptr);
25180         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
25181         FREE(untag_ptr(_res));
25182         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
25183 }
25184
25185 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
25186         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25187         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
25188         return tag_ptr(ret_conv, true);
25189 }
25190 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(int64_t arg) {
25191         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
25192         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
25193         return ret_conv;
25194 }
25195
25196 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(int64_t orig) {
25197         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
25198         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
25199         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
25200         return tag_ptr(ret_conv, true);
25201 }
25202
25203 int64_t  CS_LDK_COption_SecretKeyZ_some(int8_tArray o) {
25204         LDKSecretKey o_ref;
25205         CHECK(o->arr_len == 32);
25206         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
25207         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25208         *ret_copy = COption_SecretKeyZ_some(o_ref);
25209         int64_t ret_ref = tag_ptr(ret_copy, true);
25210         return ret_ref;
25211 }
25212
25213 int64_t  CS_LDK_COption_SecretKeyZ_none() {
25214         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25215         *ret_copy = COption_SecretKeyZ_none();
25216         int64_t ret_ref = tag_ptr(ret_copy, true);
25217         return ret_ref;
25218 }
25219
25220 void  CS_LDK_COption_SecretKeyZ_free(int64_t _res) {
25221         if (!ptr_is_owned(_res)) return;
25222         void* _res_ptr = untag_ptr(_res);
25223         CHECK_ACCESS(_res_ptr);
25224         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
25225         FREE(untag_ptr(_res));
25226         COption_SecretKeyZ_free(_res_conv);
25227 }
25228
25229 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
25230         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25231         *ret_copy = COption_SecretKeyZ_clone(arg);
25232         int64_t ret_ref = tag_ptr(ret_copy, true);
25233         return ret_ref;
25234 }
25235 int64_t  CS_LDK_COption_SecretKeyZ_clone_ptr(int64_t arg) {
25236         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
25237         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
25238         return ret_conv;
25239 }
25240
25241 int64_t  CS_LDK_COption_SecretKeyZ_clone(int64_t orig) {
25242         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
25243         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
25244         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
25245         int64_t ret_ref = tag_ptr(ret_copy, true);
25246         return ret_ref;
25247 }
25248
25249 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_ok(int64_t o) {
25250         LDKVerifiedInvoiceRequest o_conv;
25251         o_conv.inner = untag_ptr(o);
25252         o_conv.is_owned = ptr_is_owned(o);
25253         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25254         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
25255         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25256         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
25257         return tag_ptr(ret_conv, true);
25258 }
25259
25260 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_err() {
25261         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25262         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
25263         return tag_ptr(ret_conv, true);
25264 }
25265
25266 jboolean  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_is_ok(int64_t o) {
25267         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
25268         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
25269         return ret_conv;
25270 }
25271
25272 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_free(int64_t _res) {
25273         if (!ptr_is_owned(_res)) return;
25274         void* _res_ptr = untag_ptr(_res);
25275         CHECK_ACCESS(_res_ptr);
25276         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
25277         FREE(untag_ptr(_res));
25278         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
25279 }
25280
25281 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
25282         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25283         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
25284         return tag_ptr(ret_conv, true);
25285 }
25286 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(int64_t arg) {
25287         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
25288         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
25289         return ret_conv;
25290 }
25291
25292 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone(int64_t orig) {
25293         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
25294         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
25295         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
25296         return tag_ptr(ret_conv, true);
25297 }
25298
25299 int32_t  CS_LDK_COption_NoneZ_some() {
25300         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_some());
25301         return ret_conv;
25302 }
25303
25304 int32_t  CS_LDK_COption_NoneZ_none() {
25305         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_none());
25306         return ret_conv;
25307 }
25308
25309 void  CS_LDK_COption_NoneZ_free(int32_t _res) {
25310         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_cs(_res);
25311         COption_NoneZ_free(_res_conv);
25312 }
25313
25314 void  CS_LDK_CVec_WitnessZ_free(ptrArray _res) {
25315         LDKCVec_WitnessZ _res_constr;
25316         _res_constr.datalen = _res->arr_len;
25317         if (_res_constr.datalen > 0)
25318                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
25319         else
25320                 _res_constr.data = NULL;
25321         int8_tArray* _res_vals = (void*) _res->elems;
25322         for (size_t i = 0; i < _res_constr.datalen; i++) {
25323                 int8_tArray _res_conv_8 = _res_vals[i];
25324                 LDKWitness _res_conv_8_ref;
25325                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
25326                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
25327                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
25328                 _res_conv_8_ref.data_is_owned = true;
25329                 _res_constr.data[i] = _res_conv_8_ref;
25330         }
25331         FREE(_res);
25332         CVec_WitnessZ_free(_res_constr);
25333 }
25334
25335 int64_t  CS_LDK_COption_i64Z_some(int64_t o) {
25336         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25337         *ret_copy = COption_i64Z_some(o);
25338         int64_t ret_ref = tag_ptr(ret_copy, true);
25339         return ret_ref;
25340 }
25341
25342 int64_t  CS_LDK_COption_i64Z_none() {
25343         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25344         *ret_copy = COption_i64Z_none();
25345         int64_t ret_ref = tag_ptr(ret_copy, true);
25346         return ret_ref;
25347 }
25348
25349 void  CS_LDK_COption_i64Z_free(int64_t _res) {
25350         if (!ptr_is_owned(_res)) return;
25351         void* _res_ptr = untag_ptr(_res);
25352         CHECK_ACCESS(_res_ptr);
25353         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
25354         FREE(untag_ptr(_res));
25355         COption_i64Z_free(_res_conv);
25356 }
25357
25358 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
25359         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25360         *ret_copy = COption_i64Z_clone(arg);
25361         int64_t ret_ref = tag_ptr(ret_copy, true);
25362         return ret_ref;
25363 }
25364 int64_t  CS_LDK_COption_i64Z_clone_ptr(int64_t arg) {
25365         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
25366         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
25367         return ret_conv;
25368 }
25369
25370 int64_t  CS_LDK_COption_i64Z_clone(int64_t orig) {
25371         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
25372         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
25373         *ret_copy = COption_i64Z_clone(orig_conv);
25374         int64_t ret_ref = tag_ptr(ret_copy, true);
25375         return ret_ref;
25376 }
25377
25378 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_ok(int64_t o) {
25379         void* o_ptr = untag_ptr(o);
25380         CHECK_ACCESS(o_ptr);
25381         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25382         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25383         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25384         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
25385         return tag_ptr(ret_conv, true);
25386 }
25387
25388 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_err(int64_t e) {
25389         void* e_ptr = untag_ptr(e);
25390         CHECK_ACCESS(e_ptr);
25391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25393         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25394         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
25395         return tag_ptr(ret_conv, true);
25396 }
25397
25398 jboolean  CS_LDK_CResult_SocketAddressDecodeErrorZ_is_ok(int64_t o) {
25399         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
25400         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
25401         return ret_conv;
25402 }
25403
25404 void  CS_LDK_CResult_SocketAddressDecodeErrorZ_free(int64_t _res) {
25405         if (!ptr_is_owned(_res)) return;
25406         void* _res_ptr = untag_ptr(_res);
25407         CHECK_ACCESS(_res_ptr);
25408         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
25409         FREE(untag_ptr(_res));
25410         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
25411 }
25412
25413 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
25414         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25415         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
25416         return tag_ptr(ret_conv, true);
25417 }
25418 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone_ptr(int64_t arg) {
25419         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
25420         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
25421         return ret_conv;
25422 }
25423
25424 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone(int64_t orig) {
25425         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
25426         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
25427         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
25428         return tag_ptr(ret_conv, true);
25429 }
25430
25431 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_ok(int64_t o) {
25432         void* o_ptr = untag_ptr(o);
25433         CHECK_ACCESS(o_ptr);
25434         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
25435         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
25436         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25437         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
25438         return tag_ptr(ret_conv, true);
25439 }
25440
25441 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_err(int32_t e) {
25442         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_cs(e);
25443         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25444         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
25445         return tag_ptr(ret_conv, true);
25446 }
25447
25448 jboolean  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(int64_t o) {
25449         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
25450         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
25451         return ret_conv;
25452 }
25453
25454 void  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_free(int64_t _res) {
25455         if (!ptr_is_owned(_res)) return;
25456         void* _res_ptr = untag_ptr(_res);
25457         CHECK_ACCESS(_res_ptr);
25458         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
25459         FREE(untag_ptr(_res));
25460         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
25461 }
25462
25463 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
25464         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25465         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
25466         return tag_ptr(ret_conv, true);
25467 }
25468 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(int64_t arg) {
25469         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
25470         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
25471         return ret_conv;
25472 }
25473
25474 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone(int64_t orig) {
25475         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
25476         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
25477         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
25478         return tag_ptr(ret_conv, true);
25479 }
25480
25481 void  CS_LDK_CVec_UpdateAddHTLCZ_free(int64_tArray _res) {
25482         LDKCVec_UpdateAddHTLCZ _res_constr;
25483         _res_constr.datalen = _res->arr_len;
25484         if (_res_constr.datalen > 0)
25485                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
25486         else
25487                 _res_constr.data = NULL;
25488         int64_t* _res_vals = _res->elems;
25489         for (size_t p = 0; p < _res_constr.datalen; p++) {
25490                 int64_t _res_conv_15 = _res_vals[p];
25491                 LDKUpdateAddHTLC _res_conv_15_conv;
25492                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
25493                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
25494                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
25495                 _res_constr.data[p] = _res_conv_15_conv;
25496         }
25497         FREE(_res);
25498         CVec_UpdateAddHTLCZ_free(_res_constr);
25499 }
25500
25501 void  CS_LDK_CVec_UpdateFulfillHTLCZ_free(int64_tArray _res) {
25502         LDKCVec_UpdateFulfillHTLCZ _res_constr;
25503         _res_constr.datalen = _res->arr_len;
25504         if (_res_constr.datalen > 0)
25505                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
25506         else
25507                 _res_constr.data = NULL;
25508         int64_t* _res_vals = _res->elems;
25509         for (size_t t = 0; t < _res_constr.datalen; t++) {
25510                 int64_t _res_conv_19 = _res_vals[t];
25511                 LDKUpdateFulfillHTLC _res_conv_19_conv;
25512                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
25513                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
25514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
25515                 _res_constr.data[t] = _res_conv_19_conv;
25516         }
25517         FREE(_res);
25518         CVec_UpdateFulfillHTLCZ_free(_res_constr);
25519 }
25520
25521 void  CS_LDK_CVec_UpdateFailHTLCZ_free(int64_tArray _res) {
25522         LDKCVec_UpdateFailHTLCZ _res_constr;
25523         _res_constr.datalen = _res->arr_len;
25524         if (_res_constr.datalen > 0)
25525                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
25526         else
25527                 _res_constr.data = NULL;
25528         int64_t* _res_vals = _res->elems;
25529         for (size_t q = 0; q < _res_constr.datalen; q++) {
25530                 int64_t _res_conv_16 = _res_vals[q];
25531                 LDKUpdateFailHTLC _res_conv_16_conv;
25532                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25533                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25534                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25535                 _res_constr.data[q] = _res_conv_16_conv;
25536         }
25537         FREE(_res);
25538         CVec_UpdateFailHTLCZ_free(_res_constr);
25539 }
25540
25541 void  CS_LDK_CVec_UpdateFailMalformedHTLCZ_free(int64_tArray _res) {
25542         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
25543         _res_constr.datalen = _res->arr_len;
25544         if (_res_constr.datalen > 0)
25545                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
25546         else
25547                 _res_constr.data = NULL;
25548         int64_t* _res_vals = _res->elems;
25549         for (size_t z = 0; z < _res_constr.datalen; z++) {
25550                 int64_t _res_conv_25 = _res_vals[z];
25551                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
25552                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
25553                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
25554                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
25555                 _res_constr.data[z] = _res_conv_25_conv;
25556         }
25557         FREE(_res);
25558         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
25559 }
25560
25561 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_ok(int64_t o) {
25562         LDKAcceptChannel o_conv;
25563         o_conv.inner = untag_ptr(o);
25564         o_conv.is_owned = ptr_is_owned(o);
25565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25566         o_conv = AcceptChannel_clone(&o_conv);
25567         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25568         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
25569         return tag_ptr(ret_conv, true);
25570 }
25571
25572 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_err(int64_t e) {
25573         void* e_ptr = untag_ptr(e);
25574         CHECK_ACCESS(e_ptr);
25575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25577         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25578         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
25579         return tag_ptr(ret_conv, true);
25580 }
25581
25582 jboolean  CS_LDK_CResult_AcceptChannelDecodeErrorZ_is_ok(int64_t o) {
25583         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
25584         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
25585         return ret_conv;
25586 }
25587
25588 void  CS_LDK_CResult_AcceptChannelDecodeErrorZ_free(int64_t _res) {
25589         if (!ptr_is_owned(_res)) return;
25590         void* _res_ptr = untag_ptr(_res);
25591         CHECK_ACCESS(_res_ptr);
25592         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
25593         FREE(untag_ptr(_res));
25594         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
25595 }
25596
25597 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
25598         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25599         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
25600         return tag_ptr(ret_conv, true);
25601 }
25602 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone_ptr(int64_t arg) {
25603         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
25604         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
25605         return ret_conv;
25606 }
25607
25608 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone(int64_t orig) {
25609         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
25610         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
25611         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
25612         return tag_ptr(ret_conv, true);
25613 }
25614
25615 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_ok(int64_t o) {
25616         LDKAcceptChannelV2 o_conv;
25617         o_conv.inner = untag_ptr(o);
25618         o_conv.is_owned = ptr_is_owned(o);
25619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25620         o_conv = AcceptChannelV2_clone(&o_conv);
25621         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25622         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
25623         return tag_ptr(ret_conv, true);
25624 }
25625
25626 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_err(int64_t e) {
25627         void* e_ptr = untag_ptr(e);
25628         CHECK_ACCESS(e_ptr);
25629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25631         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25632         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
25633         return tag_ptr(ret_conv, true);
25634 }
25635
25636 jboolean  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_is_ok(int64_t o) {
25637         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
25638         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
25639         return ret_conv;
25640 }
25641
25642 void  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_free(int64_t _res) {
25643         if (!ptr_is_owned(_res)) return;
25644         void* _res_ptr = untag_ptr(_res);
25645         CHECK_ACCESS(_res_ptr);
25646         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
25647         FREE(untag_ptr(_res));
25648         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
25649 }
25650
25651 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25652         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25653         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
25654         return tag_ptr(ret_conv, true);
25655 }
25656 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
25657         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
25658         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25659         return ret_conv;
25660 }
25661
25662 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone(int64_t orig) {
25663         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
25664         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
25665         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
25666         return tag_ptr(ret_conv, true);
25667 }
25668
25669 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_ok(int64_t o) {
25670         LDKStfu o_conv;
25671         o_conv.inner = untag_ptr(o);
25672         o_conv.is_owned = ptr_is_owned(o);
25673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25674         o_conv = Stfu_clone(&o_conv);
25675         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25676         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
25677         return tag_ptr(ret_conv, true);
25678 }
25679
25680 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_err(int64_t e) {
25681         void* e_ptr = untag_ptr(e);
25682         CHECK_ACCESS(e_ptr);
25683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25685         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25686         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
25687         return tag_ptr(ret_conv, true);
25688 }
25689
25690 jboolean  CS_LDK_CResult_StfuDecodeErrorZ_is_ok(int64_t o) {
25691         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
25692         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
25693         return ret_conv;
25694 }
25695
25696 void  CS_LDK_CResult_StfuDecodeErrorZ_free(int64_t _res) {
25697         if (!ptr_is_owned(_res)) return;
25698         void* _res_ptr = untag_ptr(_res);
25699         CHECK_ACCESS(_res_ptr);
25700         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
25701         FREE(untag_ptr(_res));
25702         CResult_StfuDecodeErrorZ_free(_res_conv);
25703 }
25704
25705 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
25706         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25707         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
25708         return tag_ptr(ret_conv, true);
25709 }
25710 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone_ptr(int64_t arg) {
25711         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
25712         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
25713         return ret_conv;
25714 }
25715
25716 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone(int64_t orig) {
25717         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
25718         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
25719         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
25720         return tag_ptr(ret_conv, true);
25721 }
25722
25723 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_ok(int64_t o) {
25724         LDKSplice o_conv;
25725         o_conv.inner = untag_ptr(o);
25726         o_conv.is_owned = ptr_is_owned(o);
25727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25728         o_conv = Splice_clone(&o_conv);
25729         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25730         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
25731         return tag_ptr(ret_conv, true);
25732 }
25733
25734 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_err(int64_t e) {
25735         void* e_ptr = untag_ptr(e);
25736         CHECK_ACCESS(e_ptr);
25737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25739         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25740         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
25741         return tag_ptr(ret_conv, true);
25742 }
25743
25744 jboolean  CS_LDK_CResult_SpliceDecodeErrorZ_is_ok(int64_t o) {
25745         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
25746         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
25747         return ret_conv;
25748 }
25749
25750 void  CS_LDK_CResult_SpliceDecodeErrorZ_free(int64_t _res) {
25751         if (!ptr_is_owned(_res)) return;
25752         void* _res_ptr = untag_ptr(_res);
25753         CHECK_ACCESS(_res_ptr);
25754         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
25755         FREE(untag_ptr(_res));
25756         CResult_SpliceDecodeErrorZ_free(_res_conv);
25757 }
25758
25759 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
25760         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25761         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
25762         return tag_ptr(ret_conv, true);
25763 }
25764 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone_ptr(int64_t arg) {
25765         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
25766         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
25767         return ret_conv;
25768 }
25769
25770 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone(int64_t orig) {
25771         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
25772         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
25773         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
25774         return tag_ptr(ret_conv, true);
25775 }
25776
25777 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_ok(int64_t o) {
25778         LDKSpliceAck o_conv;
25779         o_conv.inner = untag_ptr(o);
25780         o_conv.is_owned = ptr_is_owned(o);
25781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25782         o_conv = SpliceAck_clone(&o_conv);
25783         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25784         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
25785         return tag_ptr(ret_conv, true);
25786 }
25787
25788 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_err(int64_t e) {
25789         void* e_ptr = untag_ptr(e);
25790         CHECK_ACCESS(e_ptr);
25791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25793         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25794         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
25795         return tag_ptr(ret_conv, true);
25796 }
25797
25798 jboolean  CS_LDK_CResult_SpliceAckDecodeErrorZ_is_ok(int64_t o) {
25799         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
25800         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
25801         return ret_conv;
25802 }
25803
25804 void  CS_LDK_CResult_SpliceAckDecodeErrorZ_free(int64_t _res) {
25805         if (!ptr_is_owned(_res)) return;
25806         void* _res_ptr = untag_ptr(_res);
25807         CHECK_ACCESS(_res_ptr);
25808         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
25809         FREE(untag_ptr(_res));
25810         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
25811 }
25812
25813 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
25814         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25815         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
25816         return tag_ptr(ret_conv, true);
25817 }
25818 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone_ptr(int64_t arg) {
25819         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
25820         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
25821         return ret_conv;
25822 }
25823
25824 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone(int64_t orig) {
25825         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
25826         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
25827         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
25828         return tag_ptr(ret_conv, true);
25829 }
25830
25831 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_ok(int64_t o) {
25832         LDKSpliceLocked o_conv;
25833         o_conv.inner = untag_ptr(o);
25834         o_conv.is_owned = ptr_is_owned(o);
25835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25836         o_conv = SpliceLocked_clone(&o_conv);
25837         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25838         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
25839         return tag_ptr(ret_conv, true);
25840 }
25841
25842 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_err(int64_t e) {
25843         void* e_ptr = untag_ptr(e);
25844         CHECK_ACCESS(e_ptr);
25845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25847         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25848         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
25849         return tag_ptr(ret_conv, true);
25850 }
25851
25852 jboolean  CS_LDK_CResult_SpliceLockedDecodeErrorZ_is_ok(int64_t o) {
25853         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
25854         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
25855         return ret_conv;
25856 }
25857
25858 void  CS_LDK_CResult_SpliceLockedDecodeErrorZ_free(int64_t _res) {
25859         if (!ptr_is_owned(_res)) return;
25860         void* _res_ptr = untag_ptr(_res);
25861         CHECK_ACCESS(_res_ptr);
25862         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
25863         FREE(untag_ptr(_res));
25864         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
25865 }
25866
25867 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
25868         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25869         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
25870         return tag_ptr(ret_conv, true);
25871 }
25872 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone_ptr(int64_t arg) {
25873         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
25874         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
25875         return ret_conv;
25876 }
25877
25878 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone(int64_t orig) {
25879         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
25880         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
25881         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
25882         return tag_ptr(ret_conv, true);
25883 }
25884
25885 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_ok(int64_t o) {
25886         LDKTxAddInput o_conv;
25887         o_conv.inner = untag_ptr(o);
25888         o_conv.is_owned = ptr_is_owned(o);
25889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25890         o_conv = TxAddInput_clone(&o_conv);
25891         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25892         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
25893         return tag_ptr(ret_conv, true);
25894 }
25895
25896 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_err(int64_t e) {
25897         void* e_ptr = untag_ptr(e);
25898         CHECK_ACCESS(e_ptr);
25899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25901         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25902         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
25903         return tag_ptr(ret_conv, true);
25904 }
25905
25906 jboolean  CS_LDK_CResult_TxAddInputDecodeErrorZ_is_ok(int64_t o) {
25907         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
25908         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
25909         return ret_conv;
25910 }
25911
25912 void  CS_LDK_CResult_TxAddInputDecodeErrorZ_free(int64_t _res) {
25913         if (!ptr_is_owned(_res)) return;
25914         void* _res_ptr = untag_ptr(_res);
25915         CHECK_ACCESS(_res_ptr);
25916         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
25917         FREE(untag_ptr(_res));
25918         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
25919 }
25920
25921 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
25922         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25923         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
25924         return tag_ptr(ret_conv, true);
25925 }
25926 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone_ptr(int64_t arg) {
25927         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
25928         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
25929         return ret_conv;
25930 }
25931
25932 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone(int64_t orig) {
25933         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
25934         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
25935         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
25936         return tag_ptr(ret_conv, true);
25937 }
25938
25939 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_ok(int64_t o) {
25940         LDKTxAddOutput o_conv;
25941         o_conv.inner = untag_ptr(o);
25942         o_conv.is_owned = ptr_is_owned(o);
25943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25944         o_conv = TxAddOutput_clone(&o_conv);
25945         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25946         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
25947         return tag_ptr(ret_conv, true);
25948 }
25949
25950 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_err(int64_t e) {
25951         void* e_ptr = untag_ptr(e);
25952         CHECK_ACCESS(e_ptr);
25953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25955         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25956         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
25957         return tag_ptr(ret_conv, true);
25958 }
25959
25960 jboolean  CS_LDK_CResult_TxAddOutputDecodeErrorZ_is_ok(int64_t o) {
25961         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
25962         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
25963         return ret_conv;
25964 }
25965
25966 void  CS_LDK_CResult_TxAddOutputDecodeErrorZ_free(int64_t _res) {
25967         if (!ptr_is_owned(_res)) return;
25968         void* _res_ptr = untag_ptr(_res);
25969         CHECK_ACCESS(_res_ptr);
25970         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
25971         FREE(untag_ptr(_res));
25972         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
25973 }
25974
25975 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
25976         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25977         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
25978         return tag_ptr(ret_conv, true);
25979 }
25980 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone_ptr(int64_t arg) {
25981         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
25982         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
25983         return ret_conv;
25984 }
25985
25986 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone(int64_t orig) {
25987         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
25988         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
25989         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
25990         return tag_ptr(ret_conv, true);
25991 }
25992
25993 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_ok(int64_t o) {
25994         LDKTxRemoveInput o_conv;
25995         o_conv.inner = untag_ptr(o);
25996         o_conv.is_owned = ptr_is_owned(o);
25997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25998         o_conv = TxRemoveInput_clone(&o_conv);
25999         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26000         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
26001         return tag_ptr(ret_conv, true);
26002 }
26003
26004 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_err(int64_t e) {
26005         void* e_ptr = untag_ptr(e);
26006         CHECK_ACCESS(e_ptr);
26007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26009         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26010         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
26011         return tag_ptr(ret_conv, true);
26012 }
26013
26014 jboolean  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_is_ok(int64_t o) {
26015         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
26016         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
26017         return ret_conv;
26018 }
26019
26020 void  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_free(int64_t _res) {
26021         if (!ptr_is_owned(_res)) return;
26022         void* _res_ptr = untag_ptr(_res);
26023         CHECK_ACCESS(_res_ptr);
26024         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
26025         FREE(untag_ptr(_res));
26026         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
26027 }
26028
26029 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
26030         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26031         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
26032         return tag_ptr(ret_conv, true);
26033 }
26034 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(int64_t arg) {
26035         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
26036         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
26037         return ret_conv;
26038 }
26039
26040 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone(int64_t orig) {
26041         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
26042         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
26043         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
26044         return tag_ptr(ret_conv, true);
26045 }
26046
26047 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_ok(int64_t o) {
26048         LDKTxRemoveOutput o_conv;
26049         o_conv.inner = untag_ptr(o);
26050         o_conv.is_owned = ptr_is_owned(o);
26051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26052         o_conv = TxRemoveOutput_clone(&o_conv);
26053         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26054         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
26055         return tag_ptr(ret_conv, true);
26056 }
26057
26058 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_err(int64_t e) {
26059         void* e_ptr = untag_ptr(e);
26060         CHECK_ACCESS(e_ptr);
26061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26063         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26064         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
26065         return tag_ptr(ret_conv, true);
26066 }
26067
26068 jboolean  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_is_ok(int64_t o) {
26069         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
26070         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
26071         return ret_conv;
26072 }
26073
26074 void  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_free(int64_t _res) {
26075         if (!ptr_is_owned(_res)) return;
26076         void* _res_ptr = untag_ptr(_res);
26077         CHECK_ACCESS(_res_ptr);
26078         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
26079         FREE(untag_ptr(_res));
26080         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
26081 }
26082
26083 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
26084         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26085         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
26086         return tag_ptr(ret_conv, true);
26087 }
26088 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(int64_t arg) {
26089         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
26090         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
26091         return ret_conv;
26092 }
26093
26094 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone(int64_t orig) {
26095         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
26096         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
26097         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
26098         return tag_ptr(ret_conv, true);
26099 }
26100
26101 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_ok(int64_t o) {
26102         LDKTxComplete o_conv;
26103         o_conv.inner = untag_ptr(o);
26104         o_conv.is_owned = ptr_is_owned(o);
26105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26106         o_conv = TxComplete_clone(&o_conv);
26107         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26108         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
26109         return tag_ptr(ret_conv, true);
26110 }
26111
26112 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_err(int64_t e) {
26113         void* e_ptr = untag_ptr(e);
26114         CHECK_ACCESS(e_ptr);
26115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26117         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26118         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
26119         return tag_ptr(ret_conv, true);
26120 }
26121
26122 jboolean  CS_LDK_CResult_TxCompleteDecodeErrorZ_is_ok(int64_t o) {
26123         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
26124         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
26125         return ret_conv;
26126 }
26127
26128 void  CS_LDK_CResult_TxCompleteDecodeErrorZ_free(int64_t _res) {
26129         if (!ptr_is_owned(_res)) return;
26130         void* _res_ptr = untag_ptr(_res);
26131         CHECK_ACCESS(_res_ptr);
26132         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
26133         FREE(untag_ptr(_res));
26134         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
26135 }
26136
26137 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
26138         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26139         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
26140         return tag_ptr(ret_conv, true);
26141 }
26142 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone_ptr(int64_t arg) {
26143         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
26144         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
26145         return ret_conv;
26146 }
26147
26148 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone(int64_t orig) {
26149         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
26150         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
26151         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
26152         return tag_ptr(ret_conv, true);
26153 }
26154
26155 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_ok(int64_t o) {
26156         LDKTxSignatures o_conv;
26157         o_conv.inner = untag_ptr(o);
26158         o_conv.is_owned = ptr_is_owned(o);
26159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26160         o_conv = TxSignatures_clone(&o_conv);
26161         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26162         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
26163         return tag_ptr(ret_conv, true);
26164 }
26165
26166 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_err(int64_t e) {
26167         void* e_ptr = untag_ptr(e);
26168         CHECK_ACCESS(e_ptr);
26169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26171         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26172         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
26173         return tag_ptr(ret_conv, true);
26174 }
26175
26176 jboolean  CS_LDK_CResult_TxSignaturesDecodeErrorZ_is_ok(int64_t o) {
26177         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
26178         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
26179         return ret_conv;
26180 }
26181
26182 void  CS_LDK_CResult_TxSignaturesDecodeErrorZ_free(int64_t _res) {
26183         if (!ptr_is_owned(_res)) return;
26184         void* _res_ptr = untag_ptr(_res);
26185         CHECK_ACCESS(_res_ptr);
26186         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
26187         FREE(untag_ptr(_res));
26188         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
26189 }
26190
26191 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26192         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26193         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
26194         return tag_ptr(ret_conv, true);
26195 }
26196 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
26197         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
26198         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26199         return ret_conv;
26200 }
26201
26202 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone(int64_t orig) {
26203         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
26204         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
26205         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
26206         return tag_ptr(ret_conv, true);
26207 }
26208
26209 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_ok(int64_t o) {
26210         LDKTxInitRbf o_conv;
26211         o_conv.inner = untag_ptr(o);
26212         o_conv.is_owned = ptr_is_owned(o);
26213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26214         o_conv = TxInitRbf_clone(&o_conv);
26215         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26216         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
26217         return tag_ptr(ret_conv, true);
26218 }
26219
26220 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_err(int64_t e) {
26221         void* e_ptr = untag_ptr(e);
26222         CHECK_ACCESS(e_ptr);
26223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26225         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26226         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
26227         return tag_ptr(ret_conv, true);
26228 }
26229
26230 jboolean  CS_LDK_CResult_TxInitRbfDecodeErrorZ_is_ok(int64_t o) {
26231         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
26232         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
26233         return ret_conv;
26234 }
26235
26236 void  CS_LDK_CResult_TxInitRbfDecodeErrorZ_free(int64_t _res) {
26237         if (!ptr_is_owned(_res)) return;
26238         void* _res_ptr = untag_ptr(_res);
26239         CHECK_ACCESS(_res_ptr);
26240         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
26241         FREE(untag_ptr(_res));
26242         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
26243 }
26244
26245 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
26246         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26247         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
26248         return tag_ptr(ret_conv, true);
26249 }
26250 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone_ptr(int64_t arg) {
26251         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
26252         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
26253         return ret_conv;
26254 }
26255
26256 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone(int64_t orig) {
26257         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
26258         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
26259         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
26260         return tag_ptr(ret_conv, true);
26261 }
26262
26263 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_ok(int64_t o) {
26264         LDKTxAckRbf o_conv;
26265         o_conv.inner = untag_ptr(o);
26266         o_conv.is_owned = ptr_is_owned(o);
26267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26268         o_conv = TxAckRbf_clone(&o_conv);
26269         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26270         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
26271         return tag_ptr(ret_conv, true);
26272 }
26273
26274 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_err(int64_t e) {
26275         void* e_ptr = untag_ptr(e);
26276         CHECK_ACCESS(e_ptr);
26277         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26278         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26279         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26280         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
26281         return tag_ptr(ret_conv, true);
26282 }
26283
26284 jboolean  CS_LDK_CResult_TxAckRbfDecodeErrorZ_is_ok(int64_t o) {
26285         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
26286         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
26287         return ret_conv;
26288 }
26289
26290 void  CS_LDK_CResult_TxAckRbfDecodeErrorZ_free(int64_t _res) {
26291         if (!ptr_is_owned(_res)) return;
26292         void* _res_ptr = untag_ptr(_res);
26293         CHECK_ACCESS(_res_ptr);
26294         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
26295         FREE(untag_ptr(_res));
26296         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
26297 }
26298
26299 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
26300         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26301         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
26302         return tag_ptr(ret_conv, true);
26303 }
26304 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone_ptr(int64_t arg) {
26305         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
26306         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
26307         return ret_conv;
26308 }
26309
26310 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone(int64_t orig) {
26311         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
26312         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
26313         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
26314         return tag_ptr(ret_conv, true);
26315 }
26316
26317 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_ok(int64_t o) {
26318         LDKTxAbort o_conv;
26319         o_conv.inner = untag_ptr(o);
26320         o_conv.is_owned = ptr_is_owned(o);
26321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26322         o_conv = TxAbort_clone(&o_conv);
26323         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26324         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
26325         return tag_ptr(ret_conv, true);
26326 }
26327
26328 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_err(int64_t e) {
26329         void* e_ptr = untag_ptr(e);
26330         CHECK_ACCESS(e_ptr);
26331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26333         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26334         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
26335         return tag_ptr(ret_conv, true);
26336 }
26337
26338 jboolean  CS_LDK_CResult_TxAbortDecodeErrorZ_is_ok(int64_t o) {
26339         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
26340         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
26341         return ret_conv;
26342 }
26343
26344 void  CS_LDK_CResult_TxAbortDecodeErrorZ_free(int64_t _res) {
26345         if (!ptr_is_owned(_res)) return;
26346         void* _res_ptr = untag_ptr(_res);
26347         CHECK_ACCESS(_res_ptr);
26348         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
26349         FREE(untag_ptr(_res));
26350         CResult_TxAbortDecodeErrorZ_free(_res_conv);
26351 }
26352
26353 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
26354         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26355         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
26356         return tag_ptr(ret_conv, true);
26357 }
26358 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone_ptr(int64_t arg) {
26359         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
26360         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
26361         return ret_conv;
26362 }
26363
26364 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone(int64_t orig) {
26365         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
26366         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
26367         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
26368         return tag_ptr(ret_conv, true);
26369 }
26370
26371 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_ok(int64_t o) {
26372         LDKAnnouncementSignatures o_conv;
26373         o_conv.inner = untag_ptr(o);
26374         o_conv.is_owned = ptr_is_owned(o);
26375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26376         o_conv = AnnouncementSignatures_clone(&o_conv);
26377         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26378         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
26379         return tag_ptr(ret_conv, true);
26380 }
26381
26382 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_err(int64_t e) {
26383         void* e_ptr = untag_ptr(e);
26384         CHECK_ACCESS(e_ptr);
26385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26387         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26388         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
26389         return tag_ptr(ret_conv, true);
26390 }
26391
26392 jboolean  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(int64_t o) {
26393         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
26394         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
26395         return ret_conv;
26396 }
26397
26398 void  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_free(int64_t _res) {
26399         if (!ptr_is_owned(_res)) return;
26400         void* _res_ptr = untag_ptr(_res);
26401         CHECK_ACCESS(_res_ptr);
26402         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
26403         FREE(untag_ptr(_res));
26404         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
26405 }
26406
26407 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
26408         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26409         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
26410         return tag_ptr(ret_conv, true);
26411 }
26412 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
26413         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
26414         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
26415         return ret_conv;
26416 }
26417
26418 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone(int64_t orig) {
26419         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
26420         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
26421         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
26422         return tag_ptr(ret_conv, true);
26423 }
26424
26425 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_ok(int64_t o) {
26426         LDKChannelReestablish o_conv;
26427         o_conv.inner = untag_ptr(o);
26428         o_conv.is_owned = ptr_is_owned(o);
26429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26430         o_conv = ChannelReestablish_clone(&o_conv);
26431         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26432         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
26433         return tag_ptr(ret_conv, true);
26434 }
26435
26436 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_err(int64_t e) {
26437         void* e_ptr = untag_ptr(e);
26438         CHECK_ACCESS(e_ptr);
26439         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26440         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26441         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26442         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
26443         return tag_ptr(ret_conv, true);
26444 }
26445
26446 jboolean  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_is_ok(int64_t o) {
26447         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
26448         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
26449         return ret_conv;
26450 }
26451
26452 void  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_free(int64_t _res) {
26453         if (!ptr_is_owned(_res)) return;
26454         void* _res_ptr = untag_ptr(_res);
26455         CHECK_ACCESS(_res_ptr);
26456         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
26457         FREE(untag_ptr(_res));
26458         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
26459 }
26460
26461 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
26462         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26463         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
26464         return tag_ptr(ret_conv, true);
26465 }
26466 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(int64_t arg) {
26467         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
26468         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
26469         return ret_conv;
26470 }
26471
26472 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone(int64_t orig) {
26473         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
26474         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
26475         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
26476         return tag_ptr(ret_conv, true);
26477 }
26478
26479 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_ok(int64_t o) {
26480         LDKClosingSigned o_conv;
26481         o_conv.inner = untag_ptr(o);
26482         o_conv.is_owned = ptr_is_owned(o);
26483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26484         o_conv = ClosingSigned_clone(&o_conv);
26485         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26486         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
26487         return tag_ptr(ret_conv, true);
26488 }
26489
26490 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_err(int64_t e) {
26491         void* e_ptr = untag_ptr(e);
26492         CHECK_ACCESS(e_ptr);
26493         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26494         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26495         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26496         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
26497         return tag_ptr(ret_conv, true);
26498 }
26499
26500 jboolean  CS_LDK_CResult_ClosingSignedDecodeErrorZ_is_ok(int64_t o) {
26501         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
26502         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
26503         return ret_conv;
26504 }
26505
26506 void  CS_LDK_CResult_ClosingSignedDecodeErrorZ_free(int64_t _res) {
26507         if (!ptr_is_owned(_res)) return;
26508         void* _res_ptr = untag_ptr(_res);
26509         CHECK_ACCESS(_res_ptr);
26510         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
26511         FREE(untag_ptr(_res));
26512         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
26513 }
26514
26515 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
26516         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26517         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
26518         return tag_ptr(ret_conv, true);
26519 }
26520 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26521         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
26522         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
26523         return ret_conv;
26524 }
26525
26526 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone(int64_t orig) {
26527         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
26528         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
26529         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
26530         return tag_ptr(ret_conv, true);
26531 }
26532
26533 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(int64_t o) {
26534         LDKClosingSignedFeeRange o_conv;
26535         o_conv.inner = untag_ptr(o);
26536         o_conv.is_owned = ptr_is_owned(o);
26537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26538         o_conv = ClosingSignedFeeRange_clone(&o_conv);
26539         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26540         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
26541         return tag_ptr(ret_conv, true);
26542 }
26543
26544 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(int64_t e) {
26545         void* e_ptr = untag_ptr(e);
26546         CHECK_ACCESS(e_ptr);
26547         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26548         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26549         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26550         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
26551         return tag_ptr(ret_conv, true);
26552 }
26553
26554 jboolean  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(int64_t o) {
26555         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
26556         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
26557         return ret_conv;
26558 }
26559
26560 void  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(int64_t _res) {
26561         if (!ptr_is_owned(_res)) return;
26562         void* _res_ptr = untag_ptr(_res);
26563         CHECK_ACCESS(_res_ptr);
26564         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
26565         FREE(untag_ptr(_res));
26566         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
26567 }
26568
26569 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
26570         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26571         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
26572         return tag_ptr(ret_conv, true);
26573 }
26574 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(int64_t arg) {
26575         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
26576         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
26577         return ret_conv;
26578 }
26579
26580 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(int64_t orig) {
26581         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
26582         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
26583         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
26584         return tag_ptr(ret_conv, true);
26585 }
26586
26587 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_ok(int64_t o) {
26588         LDKCommitmentSigned o_conv;
26589         o_conv.inner = untag_ptr(o);
26590         o_conv.is_owned = ptr_is_owned(o);
26591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26592         o_conv = CommitmentSigned_clone(&o_conv);
26593         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26594         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
26595         return tag_ptr(ret_conv, true);
26596 }
26597
26598 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_err(int64_t e) {
26599         void* e_ptr = untag_ptr(e);
26600         CHECK_ACCESS(e_ptr);
26601         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26602         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26603         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26604         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
26605         return tag_ptr(ret_conv, true);
26606 }
26607
26608 jboolean  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_is_ok(int64_t o) {
26609         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
26610         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
26611         return ret_conv;
26612 }
26613
26614 void  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_free(int64_t _res) {
26615         if (!ptr_is_owned(_res)) return;
26616         void* _res_ptr = untag_ptr(_res);
26617         CHECK_ACCESS(_res_ptr);
26618         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
26619         FREE(untag_ptr(_res));
26620         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
26621 }
26622
26623 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
26624         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26625         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
26626         return tag_ptr(ret_conv, true);
26627 }
26628 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26629         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
26630         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
26631         return ret_conv;
26632 }
26633
26634 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone(int64_t orig) {
26635         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
26636         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
26637         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
26638         return tag_ptr(ret_conv, true);
26639 }
26640
26641 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_ok(int64_t o) {
26642         LDKFundingCreated o_conv;
26643         o_conv.inner = untag_ptr(o);
26644         o_conv.is_owned = ptr_is_owned(o);
26645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26646         o_conv = FundingCreated_clone(&o_conv);
26647         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26648         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
26649         return tag_ptr(ret_conv, true);
26650 }
26651
26652 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_err(int64_t e) {
26653         void* e_ptr = untag_ptr(e);
26654         CHECK_ACCESS(e_ptr);
26655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26657         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26658         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
26659         return tag_ptr(ret_conv, true);
26660 }
26661
26662 jboolean  CS_LDK_CResult_FundingCreatedDecodeErrorZ_is_ok(int64_t o) {
26663         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
26664         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
26665         return ret_conv;
26666 }
26667
26668 void  CS_LDK_CResult_FundingCreatedDecodeErrorZ_free(int64_t _res) {
26669         if (!ptr_is_owned(_res)) return;
26670         void* _res_ptr = untag_ptr(_res);
26671         CHECK_ACCESS(_res_ptr);
26672         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
26673         FREE(untag_ptr(_res));
26674         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
26675 }
26676
26677 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
26678         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26679         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
26680         return tag_ptr(ret_conv, true);
26681 }
26682 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone_ptr(int64_t arg) {
26683         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
26684         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
26685         return ret_conv;
26686 }
26687
26688 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone(int64_t orig) {
26689         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
26690         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
26691         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
26692         return tag_ptr(ret_conv, true);
26693 }
26694
26695 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_ok(int64_t o) {
26696         LDKFundingSigned o_conv;
26697         o_conv.inner = untag_ptr(o);
26698         o_conv.is_owned = ptr_is_owned(o);
26699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26700         o_conv = FundingSigned_clone(&o_conv);
26701         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26702         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
26703         return tag_ptr(ret_conv, true);
26704 }
26705
26706 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_err(int64_t e) {
26707         void* e_ptr = untag_ptr(e);
26708         CHECK_ACCESS(e_ptr);
26709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26711         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26712         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
26713         return tag_ptr(ret_conv, true);
26714 }
26715
26716 jboolean  CS_LDK_CResult_FundingSignedDecodeErrorZ_is_ok(int64_t o) {
26717         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
26718         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
26719         return ret_conv;
26720 }
26721
26722 void  CS_LDK_CResult_FundingSignedDecodeErrorZ_free(int64_t _res) {
26723         if (!ptr_is_owned(_res)) return;
26724         void* _res_ptr = untag_ptr(_res);
26725         CHECK_ACCESS(_res_ptr);
26726         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
26727         FREE(untag_ptr(_res));
26728         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
26729 }
26730
26731 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
26732         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26733         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
26734         return tag_ptr(ret_conv, true);
26735 }
26736 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
26737         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
26738         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
26739         return ret_conv;
26740 }
26741
26742 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone(int64_t orig) {
26743         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
26744         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
26745         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
26746         return tag_ptr(ret_conv, true);
26747 }
26748
26749 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_ok(int64_t o) {
26750         LDKChannelReady o_conv;
26751         o_conv.inner = untag_ptr(o);
26752         o_conv.is_owned = ptr_is_owned(o);
26753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26754         o_conv = ChannelReady_clone(&o_conv);
26755         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26756         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
26757         return tag_ptr(ret_conv, true);
26758 }
26759
26760 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_err(int64_t e) {
26761         void* e_ptr = untag_ptr(e);
26762         CHECK_ACCESS(e_ptr);
26763         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26764         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26765         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26766         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
26767         return tag_ptr(ret_conv, true);
26768 }
26769
26770 jboolean  CS_LDK_CResult_ChannelReadyDecodeErrorZ_is_ok(int64_t o) {
26771         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
26772         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
26773         return ret_conv;
26774 }
26775
26776 void  CS_LDK_CResult_ChannelReadyDecodeErrorZ_free(int64_t _res) {
26777         if (!ptr_is_owned(_res)) return;
26778         void* _res_ptr = untag_ptr(_res);
26779         CHECK_ACCESS(_res_ptr);
26780         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
26781         FREE(untag_ptr(_res));
26782         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
26783 }
26784
26785 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
26786         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26787         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
26788         return tag_ptr(ret_conv, true);
26789 }
26790 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone_ptr(int64_t arg) {
26791         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
26792         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
26793         return ret_conv;
26794 }
26795
26796 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone(int64_t orig) {
26797         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
26798         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
26799         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
26800         return tag_ptr(ret_conv, true);
26801 }
26802
26803 int64_t  CS_LDK_CResult_InitDecodeErrorZ_ok(int64_t o) {
26804         LDKInit o_conv;
26805         o_conv.inner = untag_ptr(o);
26806         o_conv.is_owned = ptr_is_owned(o);
26807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26808         o_conv = Init_clone(&o_conv);
26809         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26810         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
26811         return tag_ptr(ret_conv, true);
26812 }
26813
26814 int64_t  CS_LDK_CResult_InitDecodeErrorZ_err(int64_t e) {
26815         void* e_ptr = untag_ptr(e);
26816         CHECK_ACCESS(e_ptr);
26817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26819         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26820         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
26821         return tag_ptr(ret_conv, true);
26822 }
26823
26824 jboolean  CS_LDK_CResult_InitDecodeErrorZ_is_ok(int64_t o) {
26825         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
26826         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
26827         return ret_conv;
26828 }
26829
26830 void  CS_LDK_CResult_InitDecodeErrorZ_free(int64_t _res) {
26831         if (!ptr_is_owned(_res)) return;
26832         void* _res_ptr = untag_ptr(_res);
26833         CHECK_ACCESS(_res_ptr);
26834         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
26835         FREE(untag_ptr(_res));
26836         CResult_InitDecodeErrorZ_free(_res_conv);
26837 }
26838
26839 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
26840         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26841         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
26842         return tag_ptr(ret_conv, true);
26843 }
26844 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone_ptr(int64_t arg) {
26845         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
26846         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
26847         return ret_conv;
26848 }
26849
26850 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone(int64_t orig) {
26851         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
26852         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
26853         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
26854         return tag_ptr(ret_conv, true);
26855 }
26856
26857 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_ok(int64_t o) {
26858         LDKOpenChannel o_conv;
26859         o_conv.inner = untag_ptr(o);
26860         o_conv.is_owned = ptr_is_owned(o);
26861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26862         o_conv = OpenChannel_clone(&o_conv);
26863         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26864         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
26865         return tag_ptr(ret_conv, true);
26866 }
26867
26868 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_err(int64_t e) {
26869         void* e_ptr = untag_ptr(e);
26870         CHECK_ACCESS(e_ptr);
26871         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26872         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26873         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26874         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
26875         return tag_ptr(ret_conv, true);
26876 }
26877
26878 jboolean  CS_LDK_CResult_OpenChannelDecodeErrorZ_is_ok(int64_t o) {
26879         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
26880         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
26881         return ret_conv;
26882 }
26883
26884 void  CS_LDK_CResult_OpenChannelDecodeErrorZ_free(int64_t _res) {
26885         if (!ptr_is_owned(_res)) return;
26886         void* _res_ptr = untag_ptr(_res);
26887         CHECK_ACCESS(_res_ptr);
26888         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
26889         FREE(untag_ptr(_res));
26890         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
26891 }
26892
26893 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
26894         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26895         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
26896         return tag_ptr(ret_conv, true);
26897 }
26898 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone_ptr(int64_t arg) {
26899         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
26900         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
26901         return ret_conv;
26902 }
26903
26904 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone(int64_t orig) {
26905         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
26906         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
26907         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
26908         return tag_ptr(ret_conv, true);
26909 }
26910
26911 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_ok(int64_t o) {
26912         LDKOpenChannelV2 o_conv;
26913         o_conv.inner = untag_ptr(o);
26914         o_conv.is_owned = ptr_is_owned(o);
26915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26916         o_conv = OpenChannelV2_clone(&o_conv);
26917         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26918         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
26919         return tag_ptr(ret_conv, true);
26920 }
26921
26922 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_err(int64_t e) {
26923         void* e_ptr = untag_ptr(e);
26924         CHECK_ACCESS(e_ptr);
26925         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26926         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26927         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26928         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
26929         return tag_ptr(ret_conv, true);
26930 }
26931
26932 jboolean  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_is_ok(int64_t o) {
26933         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
26934         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
26935         return ret_conv;
26936 }
26937
26938 void  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_free(int64_t _res) {
26939         if (!ptr_is_owned(_res)) return;
26940         void* _res_ptr = untag_ptr(_res);
26941         CHECK_ACCESS(_res_ptr);
26942         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
26943         FREE(untag_ptr(_res));
26944         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
26945 }
26946
26947 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
26948         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26949         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
26950         return tag_ptr(ret_conv, true);
26951 }
26952 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
26953         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
26954         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
26955         return ret_conv;
26956 }
26957
26958 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone(int64_t orig) {
26959         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
26960         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
26961         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
26962         return tag_ptr(ret_conv, true);
26963 }
26964
26965 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_ok(int64_t o) {
26966         LDKRevokeAndACK o_conv;
26967         o_conv.inner = untag_ptr(o);
26968         o_conv.is_owned = ptr_is_owned(o);
26969         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26970         o_conv = RevokeAndACK_clone(&o_conv);
26971         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26972         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
26973         return tag_ptr(ret_conv, true);
26974 }
26975
26976 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_err(int64_t e) {
26977         void* e_ptr = untag_ptr(e);
26978         CHECK_ACCESS(e_ptr);
26979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26981         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
26982         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
26983         return tag_ptr(ret_conv, true);
26984 }
26985
26986 jboolean  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_is_ok(int64_t o) {
26987         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
26988         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
26989         return ret_conv;
26990 }
26991
26992 void  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_free(int64_t _res) {
26993         if (!ptr_is_owned(_res)) return;
26994         void* _res_ptr = untag_ptr(_res);
26995         CHECK_ACCESS(_res_ptr);
26996         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
26997         FREE(untag_ptr(_res));
26998         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
26999 }
27000
27001 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
27002         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27003         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
27004         return tag_ptr(ret_conv, true);
27005 }
27006 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(int64_t arg) {
27007         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
27008         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
27009         return ret_conv;
27010 }
27011
27012 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone(int64_t orig) {
27013         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
27014         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27015         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
27016         return tag_ptr(ret_conv, true);
27017 }
27018
27019 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_ok(int64_t o) {
27020         LDKShutdown o_conv;
27021         o_conv.inner = untag_ptr(o);
27022         o_conv.is_owned = ptr_is_owned(o);
27023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27024         o_conv = Shutdown_clone(&o_conv);
27025         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27026         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
27027         return tag_ptr(ret_conv, true);
27028 }
27029
27030 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_err(int64_t e) {
27031         void* e_ptr = untag_ptr(e);
27032         CHECK_ACCESS(e_ptr);
27033         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27034         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27035         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27036         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
27037         return tag_ptr(ret_conv, true);
27038 }
27039
27040 jboolean  CS_LDK_CResult_ShutdownDecodeErrorZ_is_ok(int64_t o) {
27041         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
27042         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
27043         return ret_conv;
27044 }
27045
27046 void  CS_LDK_CResult_ShutdownDecodeErrorZ_free(int64_t _res) {
27047         if (!ptr_is_owned(_res)) return;
27048         void* _res_ptr = untag_ptr(_res);
27049         CHECK_ACCESS(_res_ptr);
27050         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
27051         FREE(untag_ptr(_res));
27052         CResult_ShutdownDecodeErrorZ_free(_res_conv);
27053 }
27054
27055 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
27056         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27057         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
27058         return tag_ptr(ret_conv, true);
27059 }
27060 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone_ptr(int64_t arg) {
27061         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
27062         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
27063         return ret_conv;
27064 }
27065
27066 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone(int64_t orig) {
27067         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
27068         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27069         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
27070         return tag_ptr(ret_conv, true);
27071 }
27072
27073 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_ok(int64_t o) {
27074         LDKUpdateFailHTLC o_conv;
27075         o_conv.inner = untag_ptr(o);
27076         o_conv.is_owned = ptr_is_owned(o);
27077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27078         o_conv = UpdateFailHTLC_clone(&o_conv);
27079         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27080         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
27081         return tag_ptr(ret_conv, true);
27082 }
27083
27084 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_err(int64_t e) {
27085         void* e_ptr = untag_ptr(e);
27086         CHECK_ACCESS(e_ptr);
27087         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27088         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27089         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27090         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
27091         return tag_ptr(ret_conv, true);
27092 }
27093
27094 jboolean  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(int64_t o) {
27095         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
27096         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
27097         return ret_conv;
27098 }
27099
27100 void  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_free(int64_t _res) {
27101         if (!ptr_is_owned(_res)) return;
27102         void* _res_ptr = untag_ptr(_res);
27103         CHECK_ACCESS(_res_ptr);
27104         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
27105         FREE(untag_ptr(_res));
27106         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
27107 }
27108
27109 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
27110         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27111         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
27112         return tag_ptr(ret_conv, true);
27113 }
27114 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27115         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
27116         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
27117         return ret_conv;
27118 }
27119
27120 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone(int64_t orig) {
27121         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
27122         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27123         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
27124         return tag_ptr(ret_conv, true);
27125 }
27126
27127 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(int64_t o) {
27128         LDKUpdateFailMalformedHTLC o_conv;
27129         o_conv.inner = untag_ptr(o);
27130         o_conv.is_owned = ptr_is_owned(o);
27131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27132         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
27133         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27134         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
27135         return tag_ptr(ret_conv, true);
27136 }
27137
27138 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(int64_t e) {
27139         void* e_ptr = untag_ptr(e);
27140         CHECK_ACCESS(e_ptr);
27141         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27142         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27143         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27144         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
27145         return tag_ptr(ret_conv, true);
27146 }
27147
27148 jboolean  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(int64_t o) {
27149         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
27150         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
27151         return ret_conv;
27152 }
27153
27154 void  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(int64_t _res) {
27155         if (!ptr_is_owned(_res)) return;
27156         void* _res_ptr = untag_ptr(_res);
27157         CHECK_ACCESS(_res_ptr);
27158         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
27159         FREE(untag_ptr(_res));
27160         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
27161 }
27162
27163 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
27164         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27165         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
27166         return tag_ptr(ret_conv, true);
27167 }
27168 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27169         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
27170         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
27171         return ret_conv;
27172 }
27173
27174 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(int64_t orig) {
27175         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
27176         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27177         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
27178         return tag_ptr(ret_conv, true);
27179 }
27180
27181 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_ok(int64_t o) {
27182         LDKUpdateFee o_conv;
27183         o_conv.inner = untag_ptr(o);
27184         o_conv.is_owned = ptr_is_owned(o);
27185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27186         o_conv = UpdateFee_clone(&o_conv);
27187         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27188         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
27189         return tag_ptr(ret_conv, true);
27190 }
27191
27192 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_err(int64_t e) {
27193         void* e_ptr = untag_ptr(e);
27194         CHECK_ACCESS(e_ptr);
27195         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27196         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27197         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27198         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
27199         return tag_ptr(ret_conv, true);
27200 }
27201
27202 jboolean  CS_LDK_CResult_UpdateFeeDecodeErrorZ_is_ok(int64_t o) {
27203         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
27204         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
27205         return ret_conv;
27206 }
27207
27208 void  CS_LDK_CResult_UpdateFeeDecodeErrorZ_free(int64_t _res) {
27209         if (!ptr_is_owned(_res)) return;
27210         void* _res_ptr = untag_ptr(_res);
27211         CHECK_ACCESS(_res_ptr);
27212         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
27213         FREE(untag_ptr(_res));
27214         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
27215 }
27216
27217 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
27218         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27219         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
27220         return tag_ptr(ret_conv, true);
27221 }
27222 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone_ptr(int64_t arg) {
27223         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
27224         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
27225         return ret_conv;
27226 }
27227
27228 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone(int64_t orig) {
27229         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
27230         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27231         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
27232         return tag_ptr(ret_conv, true);
27233 }
27234
27235 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(int64_t o) {
27236         LDKUpdateFulfillHTLC o_conv;
27237         o_conv.inner = untag_ptr(o);
27238         o_conv.is_owned = ptr_is_owned(o);
27239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27240         o_conv = UpdateFulfillHTLC_clone(&o_conv);
27241         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27242         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
27243         return tag_ptr(ret_conv, true);
27244 }
27245
27246 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_err(int64_t e) {
27247         void* e_ptr = untag_ptr(e);
27248         CHECK_ACCESS(e_ptr);
27249         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27250         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27251         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27252         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
27253         return tag_ptr(ret_conv, true);
27254 }
27255
27256 jboolean  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(int64_t o) {
27257         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
27258         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
27259         return ret_conv;
27260 }
27261
27262 void  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_free(int64_t _res) {
27263         if (!ptr_is_owned(_res)) return;
27264         void* _res_ptr = untag_ptr(_res);
27265         CHECK_ACCESS(_res_ptr);
27266         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
27267         FREE(untag_ptr(_res));
27268         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
27269 }
27270
27271 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
27272         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27273         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
27274         return tag_ptr(ret_conv, true);
27275 }
27276 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27277         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
27278         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
27279         return ret_conv;
27280 }
27281
27282 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(int64_t orig) {
27283         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
27284         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27285         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
27286         return tag_ptr(ret_conv, true);
27287 }
27288
27289 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_ok(int64_t o) {
27290         LDKOnionPacket o_conv;
27291         o_conv.inner = untag_ptr(o);
27292         o_conv.is_owned = ptr_is_owned(o);
27293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27294         o_conv = OnionPacket_clone(&o_conv);
27295         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27296         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
27297         return tag_ptr(ret_conv, true);
27298 }
27299
27300 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_err(int64_t e) {
27301         void* e_ptr = untag_ptr(e);
27302         CHECK_ACCESS(e_ptr);
27303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27305         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27306         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
27307         return tag_ptr(ret_conv, true);
27308 }
27309
27310 jboolean  CS_LDK_CResult_OnionPacketDecodeErrorZ_is_ok(int64_t o) {
27311         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
27312         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
27313         return ret_conv;
27314 }
27315
27316 void  CS_LDK_CResult_OnionPacketDecodeErrorZ_free(int64_t _res) {
27317         if (!ptr_is_owned(_res)) return;
27318         void* _res_ptr = untag_ptr(_res);
27319         CHECK_ACCESS(_res_ptr);
27320         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
27321         FREE(untag_ptr(_res));
27322         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
27323 }
27324
27325 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
27326         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27327         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
27328         return tag_ptr(ret_conv, true);
27329 }
27330 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone_ptr(int64_t arg) {
27331         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
27332         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
27333         return ret_conv;
27334 }
27335
27336 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone(int64_t orig) {
27337         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
27338         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
27339         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
27340         return tag_ptr(ret_conv, true);
27341 }
27342
27343 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_ok(int64_t o) {
27344         LDKUpdateAddHTLC o_conv;
27345         o_conv.inner = untag_ptr(o);
27346         o_conv.is_owned = ptr_is_owned(o);
27347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27348         o_conv = UpdateAddHTLC_clone(&o_conv);
27349         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27350         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
27351         return tag_ptr(ret_conv, true);
27352 }
27353
27354 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_err(int64_t e) {
27355         void* e_ptr = untag_ptr(e);
27356         CHECK_ACCESS(e_ptr);
27357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27359         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27360         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
27361         return tag_ptr(ret_conv, true);
27362 }
27363
27364 jboolean  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(int64_t o) {
27365         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
27366         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
27367         return ret_conv;
27368 }
27369
27370 void  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_free(int64_t _res) {
27371         if (!ptr_is_owned(_res)) return;
27372         void* _res_ptr = untag_ptr(_res);
27373         CHECK_ACCESS(_res_ptr);
27374         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
27375         FREE(untag_ptr(_res));
27376         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
27377 }
27378
27379 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
27380         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27381         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
27382         return tag_ptr(ret_conv, true);
27383 }
27384 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
27385         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
27386         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
27387         return ret_conv;
27388 }
27389
27390 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone(int64_t orig) {
27391         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
27392         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27393         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
27394         return tag_ptr(ret_conv, true);
27395 }
27396
27397 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_ok(int64_t o) {
27398         LDKOnionMessage o_conv;
27399         o_conv.inner = untag_ptr(o);
27400         o_conv.is_owned = ptr_is_owned(o);
27401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27402         o_conv = OnionMessage_clone(&o_conv);
27403         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27404         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
27405         return tag_ptr(ret_conv, true);
27406 }
27407
27408 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_err(int64_t e) {
27409         void* e_ptr = untag_ptr(e);
27410         CHECK_ACCESS(e_ptr);
27411         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27412         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27413         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27414         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
27415         return tag_ptr(ret_conv, true);
27416 }
27417
27418 jboolean  CS_LDK_CResult_OnionMessageDecodeErrorZ_is_ok(int64_t o) {
27419         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
27420         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
27421         return ret_conv;
27422 }
27423
27424 void  CS_LDK_CResult_OnionMessageDecodeErrorZ_free(int64_t _res) {
27425         if (!ptr_is_owned(_res)) return;
27426         void* _res_ptr = untag_ptr(_res);
27427         CHECK_ACCESS(_res_ptr);
27428         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
27429         FREE(untag_ptr(_res));
27430         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
27431 }
27432
27433 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
27434         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27435         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
27436         return tag_ptr(ret_conv, true);
27437 }
27438 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27439         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
27440         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
27441         return ret_conv;
27442 }
27443
27444 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone(int64_t orig) {
27445         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
27446         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
27447         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
27448         return tag_ptr(ret_conv, true);
27449 }
27450
27451 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_ok(int64_t o) {
27452         LDKFinalOnionHopData o_conv;
27453         o_conv.inner = untag_ptr(o);
27454         o_conv.is_owned = ptr_is_owned(o);
27455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27456         o_conv = FinalOnionHopData_clone(&o_conv);
27457         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27458         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
27459         return tag_ptr(ret_conv, true);
27460 }
27461
27462 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_err(int64_t e) {
27463         void* e_ptr = untag_ptr(e);
27464         CHECK_ACCESS(e_ptr);
27465         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27466         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27467         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27468         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
27469         return tag_ptr(ret_conv, true);
27470 }
27471
27472 jboolean  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(int64_t o) {
27473         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
27474         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
27475         return ret_conv;
27476 }
27477
27478 void  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_free(int64_t _res) {
27479         if (!ptr_is_owned(_res)) return;
27480         void* _res_ptr = untag_ptr(_res);
27481         CHECK_ACCESS(_res_ptr);
27482         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
27483         FREE(untag_ptr(_res));
27484         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
27485 }
27486
27487 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
27488         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27489         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
27490         return tag_ptr(ret_conv, true);
27491 }
27492 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(int64_t arg) {
27493         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
27494         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
27495         return ret_conv;
27496 }
27497
27498 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone(int64_t orig) {
27499         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
27500         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
27501         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
27502         return tag_ptr(ret_conv, true);
27503 }
27504
27505 int64_t  CS_LDK_CResult_PingDecodeErrorZ_ok(int64_t o) {
27506         LDKPing o_conv;
27507         o_conv.inner = untag_ptr(o);
27508         o_conv.is_owned = ptr_is_owned(o);
27509         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27510         o_conv = Ping_clone(&o_conv);
27511         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27512         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
27513         return tag_ptr(ret_conv, true);
27514 }
27515
27516 int64_t  CS_LDK_CResult_PingDecodeErrorZ_err(int64_t e) {
27517         void* e_ptr = untag_ptr(e);
27518         CHECK_ACCESS(e_ptr);
27519         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27520         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27521         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27522         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
27523         return tag_ptr(ret_conv, true);
27524 }
27525
27526 jboolean  CS_LDK_CResult_PingDecodeErrorZ_is_ok(int64_t o) {
27527         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
27528         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
27529         return ret_conv;
27530 }
27531
27532 void  CS_LDK_CResult_PingDecodeErrorZ_free(int64_t _res) {
27533         if (!ptr_is_owned(_res)) return;
27534         void* _res_ptr = untag_ptr(_res);
27535         CHECK_ACCESS(_res_ptr);
27536         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
27537         FREE(untag_ptr(_res));
27538         CResult_PingDecodeErrorZ_free(_res_conv);
27539 }
27540
27541 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
27542         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27543         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
27544         return tag_ptr(ret_conv, true);
27545 }
27546 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone_ptr(int64_t arg) {
27547         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
27548         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
27549         return ret_conv;
27550 }
27551
27552 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone(int64_t orig) {
27553         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
27554         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27555         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
27556         return tag_ptr(ret_conv, true);
27557 }
27558
27559 int64_t  CS_LDK_CResult_PongDecodeErrorZ_ok(int64_t o) {
27560         LDKPong o_conv;
27561         o_conv.inner = untag_ptr(o);
27562         o_conv.is_owned = ptr_is_owned(o);
27563         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27564         o_conv = Pong_clone(&o_conv);
27565         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27566         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
27567         return tag_ptr(ret_conv, true);
27568 }
27569
27570 int64_t  CS_LDK_CResult_PongDecodeErrorZ_err(int64_t e) {
27571         void* e_ptr = untag_ptr(e);
27572         CHECK_ACCESS(e_ptr);
27573         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27574         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27575         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27576         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
27577         return tag_ptr(ret_conv, true);
27578 }
27579
27580 jboolean  CS_LDK_CResult_PongDecodeErrorZ_is_ok(int64_t o) {
27581         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
27582         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
27583         return ret_conv;
27584 }
27585
27586 void  CS_LDK_CResult_PongDecodeErrorZ_free(int64_t _res) {
27587         if (!ptr_is_owned(_res)) return;
27588         void* _res_ptr = untag_ptr(_res);
27589         CHECK_ACCESS(_res_ptr);
27590         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
27591         FREE(untag_ptr(_res));
27592         CResult_PongDecodeErrorZ_free(_res_conv);
27593 }
27594
27595 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
27596         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27597         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
27598         return tag_ptr(ret_conv, true);
27599 }
27600 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone_ptr(int64_t arg) {
27601         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
27602         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
27603         return ret_conv;
27604 }
27605
27606 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone(int64_t orig) {
27607         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
27608         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27609         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
27610         return tag_ptr(ret_conv, true);
27611 }
27612
27613 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
27614         LDKUnsignedChannelAnnouncement o_conv;
27615         o_conv.inner = untag_ptr(o);
27616         o_conv.is_owned = ptr_is_owned(o);
27617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27618         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
27619         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27620         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
27621         return tag_ptr(ret_conv, true);
27622 }
27623
27624 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(int64_t e) {
27625         void* e_ptr = untag_ptr(e);
27626         CHECK_ACCESS(e_ptr);
27627         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27628         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27629         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27630         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
27631         return tag_ptr(ret_conv, true);
27632 }
27633
27634 jboolean  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27635         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27636         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27637         return ret_conv;
27638 }
27639
27640 void  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
27641         if (!ptr_is_owned(_res)) return;
27642         void* _res_ptr = untag_ptr(_res);
27643         CHECK_ACCESS(_res_ptr);
27644         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27645         FREE(untag_ptr(_res));
27646         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
27647 }
27648
27649 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27650         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27651         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
27652         return tag_ptr(ret_conv, true);
27653 }
27654 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27655         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27656         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27657         return ret_conv;
27658 }
27659
27660 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
27661         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27662         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27663         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27664         return tag_ptr(ret_conv, true);
27665 }
27666
27667 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
27668         LDKChannelAnnouncement o_conv;
27669         o_conv.inner = untag_ptr(o);
27670         o_conv.is_owned = ptr_is_owned(o);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27672         o_conv = ChannelAnnouncement_clone(&o_conv);
27673         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27674         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
27675         return tag_ptr(ret_conv, true);
27676 }
27677
27678 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_err(int64_t e) {
27679         void* e_ptr = untag_ptr(e);
27680         CHECK_ACCESS(e_ptr);
27681         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27682         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27683         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27684         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
27685         return tag_ptr(ret_conv, true);
27686 }
27687
27688 jboolean  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27689         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
27690         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
27691         return ret_conv;
27692 }
27693
27694 void  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
27695         if (!ptr_is_owned(_res)) return;
27696         void* _res_ptr = untag_ptr(_res);
27697         CHECK_ACCESS(_res_ptr);
27698         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
27699         FREE(untag_ptr(_res));
27700         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
27701 }
27702
27703 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27704         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27705         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
27706         return tag_ptr(ret_conv, true);
27707 }
27708 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27709         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
27710         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27711         return ret_conv;
27712 }
27713
27714 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
27715         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
27716         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27717         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
27718         return tag_ptr(ret_conv, true);
27719 }
27720
27721 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(int64_t o) {
27722         LDKUnsignedChannelUpdate o_conv;
27723         o_conv.inner = untag_ptr(o);
27724         o_conv.is_owned = ptr_is_owned(o);
27725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27726         o_conv = UnsignedChannelUpdate_clone(&o_conv);
27727         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27728         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
27729         return tag_ptr(ret_conv, true);
27730 }
27731
27732 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_err(int64_t e) {
27733         void* e_ptr = untag_ptr(e);
27734         CHECK_ACCESS(e_ptr);
27735         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27736         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27737         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27738         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
27739         return tag_ptr(ret_conv, true);
27740 }
27741
27742 jboolean  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
27743         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
27744         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
27745         return ret_conv;
27746 }
27747
27748 void  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_free(int64_t _res) {
27749         if (!ptr_is_owned(_res)) return;
27750         void* _res_ptr = untag_ptr(_res);
27751         CHECK_ACCESS(_res_ptr);
27752         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
27753         FREE(untag_ptr(_res));
27754         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
27755 }
27756
27757 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27758         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27759         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
27760         return tag_ptr(ret_conv, true);
27761 }
27762 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
27763         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27764         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27765         return ret_conv;
27766 }
27767
27768 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(int64_t orig) {
27769         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27770         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27771         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
27772         return tag_ptr(ret_conv, true);
27773 }
27774
27775 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_ok(int64_t o) {
27776         LDKChannelUpdate o_conv;
27777         o_conv.inner = untag_ptr(o);
27778         o_conv.is_owned = ptr_is_owned(o);
27779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27780         o_conv = ChannelUpdate_clone(&o_conv);
27781         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27782         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
27783         return tag_ptr(ret_conv, true);
27784 }
27785
27786 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_err(int64_t e) {
27787         void* e_ptr = untag_ptr(e);
27788         CHECK_ACCESS(e_ptr);
27789         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27790         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27791         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27792         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
27793         return tag_ptr(ret_conv, true);
27794 }
27795
27796 jboolean  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
27797         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
27798         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
27799         return ret_conv;
27800 }
27801
27802 void  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_free(int64_t _res) {
27803         if (!ptr_is_owned(_res)) return;
27804         void* _res_ptr = untag_ptr(_res);
27805         CHECK_ACCESS(_res_ptr);
27806         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
27807         FREE(untag_ptr(_res));
27808         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
27809 }
27810
27811 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
27812         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27813         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
27814         return tag_ptr(ret_conv, true);
27815 }
27816 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
27817         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
27818         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
27819         return ret_conv;
27820 }
27821
27822 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone(int64_t orig) {
27823         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
27824         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27825         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
27826         return tag_ptr(ret_conv, true);
27827 }
27828
27829 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_ok(int64_t o) {
27830         LDKErrorMessage o_conv;
27831         o_conv.inner = untag_ptr(o);
27832         o_conv.is_owned = ptr_is_owned(o);
27833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27834         o_conv = ErrorMessage_clone(&o_conv);
27835         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27836         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
27837         return tag_ptr(ret_conv, true);
27838 }
27839
27840 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_err(int64_t e) {
27841         void* e_ptr = untag_ptr(e);
27842         CHECK_ACCESS(e_ptr);
27843         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27844         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27845         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27846         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
27847         return tag_ptr(ret_conv, true);
27848 }
27849
27850 jboolean  CS_LDK_CResult_ErrorMessageDecodeErrorZ_is_ok(int64_t o) {
27851         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
27852         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
27853         return ret_conv;
27854 }
27855
27856 void  CS_LDK_CResult_ErrorMessageDecodeErrorZ_free(int64_t _res) {
27857         if (!ptr_is_owned(_res)) return;
27858         void* _res_ptr = untag_ptr(_res);
27859         CHECK_ACCESS(_res_ptr);
27860         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
27861         FREE(untag_ptr(_res));
27862         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
27863 }
27864
27865 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
27866         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27867         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
27868         return tag_ptr(ret_conv, true);
27869 }
27870 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27871         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
27872         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
27873         return ret_conv;
27874 }
27875
27876 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone(int64_t orig) {
27877         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
27878         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27879         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
27880         return tag_ptr(ret_conv, true);
27881 }
27882
27883 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_ok(int64_t o) {
27884         LDKWarningMessage o_conv;
27885         o_conv.inner = untag_ptr(o);
27886         o_conv.is_owned = ptr_is_owned(o);
27887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27888         o_conv = WarningMessage_clone(&o_conv);
27889         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27890         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
27891         return tag_ptr(ret_conv, true);
27892 }
27893
27894 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_err(int64_t e) {
27895         void* e_ptr = untag_ptr(e);
27896         CHECK_ACCESS(e_ptr);
27897         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27898         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27899         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27900         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
27901         return tag_ptr(ret_conv, true);
27902 }
27903
27904 jboolean  CS_LDK_CResult_WarningMessageDecodeErrorZ_is_ok(int64_t o) {
27905         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
27906         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
27907         return ret_conv;
27908 }
27909
27910 void  CS_LDK_CResult_WarningMessageDecodeErrorZ_free(int64_t _res) {
27911         if (!ptr_is_owned(_res)) return;
27912         void* _res_ptr = untag_ptr(_res);
27913         CHECK_ACCESS(_res_ptr);
27914         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
27915         FREE(untag_ptr(_res));
27916         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
27917 }
27918
27919 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
27920         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27921         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
27922         return tag_ptr(ret_conv, true);
27923 }
27924 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone_ptr(int64_t arg) {
27925         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
27926         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
27927         return ret_conv;
27928 }
27929
27930 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone(int64_t orig) {
27931         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
27932         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
27933         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
27934         return tag_ptr(ret_conv, true);
27935 }
27936
27937 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(int64_t o) {
27938         LDKUnsignedNodeAnnouncement o_conv;
27939         o_conv.inner = untag_ptr(o);
27940         o_conv.is_owned = ptr_is_owned(o);
27941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27942         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
27943         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27944         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
27945         return tag_ptr(ret_conv, true);
27946 }
27947
27948 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(int64_t e) {
27949         void* e_ptr = untag_ptr(e);
27950         CHECK_ACCESS(e_ptr);
27951         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27952         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27953         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27954         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
27955         return tag_ptr(ret_conv, true);
27956 }
27957
27958 jboolean  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
27959         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
27960         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
27961         return ret_conv;
27962 }
27963
27964 void  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(int64_t _res) {
27965         if (!ptr_is_owned(_res)) return;
27966         void* _res_ptr = untag_ptr(_res);
27967         CHECK_ACCESS(_res_ptr);
27968         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
27969         FREE(untag_ptr(_res));
27970         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
27971 }
27972
27973 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
27974         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27975         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
27976         return tag_ptr(ret_conv, true);
27977 }
27978 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
27979         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
27980         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
27981         return ret_conv;
27982 }
27983
27984 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
27985         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
27986         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27987         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
27988         return tag_ptr(ret_conv, true);
27989 }
27990
27991 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_ok(int64_t o) {
27992         LDKNodeAnnouncement o_conv;
27993         o_conv.inner = untag_ptr(o);
27994         o_conv.is_owned = ptr_is_owned(o);
27995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27996         o_conv = NodeAnnouncement_clone(&o_conv);
27997         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27998         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
27999         return tag_ptr(ret_conv, true);
28000 }
28001
28002 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_err(int64_t e) {
28003         void* e_ptr = untag_ptr(e);
28004         CHECK_ACCESS(e_ptr);
28005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28007         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28008         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
28009         return tag_ptr(ret_conv, true);
28010 }
28011
28012 jboolean  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
28013         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
28014         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
28015         return ret_conv;
28016 }
28017
28018 void  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_free(int64_t _res) {
28019         if (!ptr_is_owned(_res)) return;
28020         void* _res_ptr = untag_ptr(_res);
28021         CHECK_ACCESS(_res_ptr);
28022         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
28023         FREE(untag_ptr(_res));
28024         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
28025 }
28026
28027 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28028         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28029         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
28030         return tag_ptr(ret_conv, true);
28031 }
28032 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
28033         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
28034         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28035         return ret_conv;
28036 }
28037
28038 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
28039         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
28040         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
28041         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
28042         return tag_ptr(ret_conv, true);
28043 }
28044
28045 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_ok(int64_t o) {
28046         LDKQueryShortChannelIds o_conv;
28047         o_conv.inner = untag_ptr(o);
28048         o_conv.is_owned = ptr_is_owned(o);
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28050         o_conv = QueryShortChannelIds_clone(&o_conv);
28051         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28052         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
28053         return tag_ptr(ret_conv, true);
28054 }
28055
28056 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_err(int64_t e) {
28057         void* e_ptr = untag_ptr(e);
28058         CHECK_ACCESS(e_ptr);
28059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28061         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28062         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
28063         return tag_ptr(ret_conv, true);
28064 }
28065
28066 jboolean  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(int64_t o) {
28067         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
28068         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
28069         return ret_conv;
28070 }
28071
28072 void  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_free(int64_t _res) {
28073         if (!ptr_is_owned(_res)) return;
28074         void* _res_ptr = untag_ptr(_res);
28075         CHECK_ACCESS(_res_ptr);
28076         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
28077         FREE(untag_ptr(_res));
28078         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
28079 }
28080
28081 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
28082         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28083         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
28084         return tag_ptr(ret_conv, true);
28085 }
28086 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(int64_t arg) {
28087         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
28088         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
28089         return ret_conv;
28090 }
28091
28092 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone(int64_t orig) {
28093         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
28094         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
28095         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
28096         return tag_ptr(ret_conv, true);
28097 }
28098
28099 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(int64_t o) {
28100         LDKReplyShortChannelIdsEnd o_conv;
28101         o_conv.inner = untag_ptr(o);
28102         o_conv.is_owned = ptr_is_owned(o);
28103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28104         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
28105         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28106         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
28107         return tag_ptr(ret_conv, true);
28108 }
28109
28110 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(int64_t e) {
28111         void* e_ptr = untag_ptr(e);
28112         CHECK_ACCESS(e_ptr);
28113         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28114         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28115         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28116         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
28117         return tag_ptr(ret_conv, true);
28118 }
28119
28120 jboolean  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(int64_t o) {
28121         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
28122         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
28123         return ret_conv;
28124 }
28125
28126 void  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(int64_t _res) {
28127         if (!ptr_is_owned(_res)) return;
28128         void* _res_ptr = untag_ptr(_res);
28129         CHECK_ACCESS(_res_ptr);
28130         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
28131         FREE(untag_ptr(_res));
28132         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
28133 }
28134
28135 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
28136         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28137         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
28138         return tag_ptr(ret_conv, true);
28139 }
28140 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(int64_t arg) {
28141         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
28142         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
28143         return ret_conv;
28144 }
28145
28146 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(int64_t orig) {
28147         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
28148         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
28149         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
28150         return tag_ptr(ret_conv, true);
28151 }
28152
28153 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_ok(int64_t o) {
28154         LDKQueryChannelRange o_conv;
28155         o_conv.inner = untag_ptr(o);
28156         o_conv.is_owned = ptr_is_owned(o);
28157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28158         o_conv = QueryChannelRange_clone(&o_conv);
28159         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28160         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
28161         return tag_ptr(ret_conv, true);
28162 }
28163
28164 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_err(int64_t e) {
28165         void* e_ptr = untag_ptr(e);
28166         CHECK_ACCESS(e_ptr);
28167         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28168         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28169         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28170         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
28171         return tag_ptr(ret_conv, true);
28172 }
28173
28174 jboolean  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_is_ok(int64_t o) {
28175         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
28176         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
28177         return ret_conv;
28178 }
28179
28180 void  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_free(int64_t _res) {
28181         if (!ptr_is_owned(_res)) return;
28182         void* _res_ptr = untag_ptr(_res);
28183         CHECK_ACCESS(_res_ptr);
28184         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
28185         FREE(untag_ptr(_res));
28186         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
28187 }
28188
28189 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
28190         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28191         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
28192         return tag_ptr(ret_conv, true);
28193 }
28194 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
28195         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
28196         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
28197         return ret_conv;
28198 }
28199
28200 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone(int64_t orig) {
28201         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
28202         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
28203         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
28204         return tag_ptr(ret_conv, true);
28205 }
28206
28207 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_ok(int64_t o) {
28208         LDKReplyChannelRange o_conv;
28209         o_conv.inner = untag_ptr(o);
28210         o_conv.is_owned = ptr_is_owned(o);
28211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28212         o_conv = ReplyChannelRange_clone(&o_conv);
28213         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28214         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
28215         return tag_ptr(ret_conv, true);
28216 }
28217
28218 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_err(int64_t e) {
28219         void* e_ptr = untag_ptr(e);
28220         CHECK_ACCESS(e_ptr);
28221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28223         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28224         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
28225         return tag_ptr(ret_conv, true);
28226 }
28227
28228 jboolean  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(int64_t o) {
28229         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
28230         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
28231         return ret_conv;
28232 }
28233
28234 void  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_free(int64_t _res) {
28235         if (!ptr_is_owned(_res)) return;
28236         void* _res_ptr = untag_ptr(_res);
28237         CHECK_ACCESS(_res_ptr);
28238         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
28239         FREE(untag_ptr(_res));
28240         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
28241 }
28242
28243 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
28244         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28245         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
28246         return tag_ptr(ret_conv, true);
28247 }
28248 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
28249         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
28250         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
28251         return ret_conv;
28252 }
28253
28254 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone(int64_t orig) {
28255         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
28256         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
28257         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
28258         return tag_ptr(ret_conv, true);
28259 }
28260
28261 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_ok(int64_t o) {
28262         LDKGossipTimestampFilter o_conv;
28263         o_conv.inner = untag_ptr(o);
28264         o_conv.is_owned = ptr_is_owned(o);
28265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28266         o_conv = GossipTimestampFilter_clone(&o_conv);
28267         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28268         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
28269         return tag_ptr(ret_conv, true);
28270 }
28271
28272 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_err(int64_t e) {
28273         void* e_ptr = untag_ptr(e);
28274         CHECK_ACCESS(e_ptr);
28275         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28276         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28277         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28278         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
28279         return tag_ptr(ret_conv, true);
28280 }
28281
28282 jboolean  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(int64_t o) {
28283         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
28284         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
28285         return ret_conv;
28286 }
28287
28288 void  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_free(int64_t _res) {
28289         if (!ptr_is_owned(_res)) return;
28290         void* _res_ptr = untag_ptr(_res);
28291         CHECK_ACCESS(_res_ptr);
28292         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
28293         FREE(untag_ptr(_res));
28294         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
28295 }
28296
28297 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
28298         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28299         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
28300         return tag_ptr(ret_conv, true);
28301 }
28302 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(int64_t arg) {
28303         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
28304         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
28305         return ret_conv;
28306 }
28307
28308 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone(int64_t orig) {
28309         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
28310         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28311         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
28312         return tag_ptr(ret_conv, true);
28313 }
28314
28315 void  CS_LDK_CVec_PhantomRouteHintsZ_free(int64_tArray _res) {
28316         LDKCVec_PhantomRouteHintsZ _res_constr;
28317         _res_constr.datalen = _res->arr_len;
28318         if (_res_constr.datalen > 0)
28319                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
28320         else
28321                 _res_constr.data = NULL;
28322         int64_t* _res_vals = _res->elems;
28323         for (size_t t = 0; t < _res_constr.datalen; t++) {
28324                 int64_t _res_conv_19 = _res_vals[t];
28325                 LDKPhantomRouteHints _res_conv_19_conv;
28326                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
28327                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
28328                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
28329                 _res_constr.data[t] = _res_conv_19_conv;
28330         }
28331         FREE(_res);
28332         CVec_PhantomRouteHintsZ_free(_res_constr);
28333 }
28334
28335 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(int64_t o) {
28336         LDKBolt11Invoice o_conv;
28337         o_conv.inner = untag_ptr(o);
28338         o_conv.is_owned = ptr_is_owned(o);
28339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28340         o_conv = Bolt11Invoice_clone(&o_conv);
28341         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28342         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
28343         return tag_ptr(ret_conv, true);
28344 }
28345
28346 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(int64_t e) {
28347         void* e_ptr = untag_ptr(e);
28348         CHECK_ACCESS(e_ptr);
28349         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
28350         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
28351         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28352         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
28353         return tag_ptr(ret_conv, true);
28354 }
28355
28356 jboolean  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(int64_t o) {
28357         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
28358         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
28359         return ret_conv;
28360 }
28361
28362 void  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(int64_t _res) {
28363         if (!ptr_is_owned(_res)) return;
28364         void* _res_ptr = untag_ptr(_res);
28365         CHECK_ACCESS(_res_ptr);
28366         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
28367         FREE(untag_ptr(_res));
28368         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
28369 }
28370
28371 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
28372         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28373         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
28374         return tag_ptr(ret_conv, true);
28375 }
28376 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(int64_t arg) {
28377         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
28378         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
28379         return ret_conv;
28380 }
28381
28382 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(int64_t orig) {
28383         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
28384         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
28385         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
28386         return tag_ptr(ret_conv, true);
28387 }
28388
28389 void  CS_LDK_CVec_FutureZ_free(int64_tArray _res) {
28390         LDKCVec_FutureZ _res_constr;
28391         _res_constr.datalen = _res->arr_len;
28392         if (_res_constr.datalen > 0)
28393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
28394         else
28395                 _res_constr.data = NULL;
28396         int64_t* _res_vals = _res->elems;
28397         for (size_t i = 0; i < _res_constr.datalen; i++) {
28398                 int64_t _res_conv_8 = _res_vals[i];
28399                 LDKFuture _res_conv_8_conv;
28400                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
28401                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
28402                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
28403                 _res_constr.data[i] = _res_conv_8_conv;
28404         }
28405         FREE(_res);
28406         CVec_FutureZ_free(_res_constr);
28407 }
28408
28409 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_ok(int64_t o) {
28410         void* o_ptr = untag_ptr(o);
28411         CHECK_ACCESS(o_ptr);
28412         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
28413         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
28414         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28415         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
28416         return tag_ptr(ret_conv, true);
28417 }
28418
28419 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_err(int64_t e) {
28420         void* e_ptr = untag_ptr(e);
28421         CHECK_ACCESS(e_ptr);
28422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28424         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28425         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
28426         return tag_ptr(ret_conv, true);
28427 }
28428
28429 jboolean  CS_LDK_CResult_OffersMessageDecodeErrorZ_is_ok(int64_t o) {
28430         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
28431         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
28432         return ret_conv;
28433 }
28434
28435 void  CS_LDK_CResult_OffersMessageDecodeErrorZ_free(int64_t _res) {
28436         if (!ptr_is_owned(_res)) return;
28437         void* _res_ptr = untag_ptr(_res);
28438         CHECK_ACCESS(_res_ptr);
28439         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
28440         FREE(untag_ptr(_res));
28441         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
28442 }
28443
28444 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
28445         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28446         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
28447         return tag_ptr(ret_conv, true);
28448 }
28449 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone_ptr(int64_t arg) {
28450         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
28451         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
28452         return ret_conv;
28453 }
28454
28455 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone(int64_t orig) {
28456         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
28457         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
28458         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
28459         return tag_ptr(ret_conv, true);
28460 }
28461
28462 int64_t  CS_LDK_COption_HTLCClaimZ_some(int32_t o) {
28463         LDKHTLCClaim o_conv = LDKHTLCClaim_from_cs(o);
28464         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28465         *ret_copy = COption_HTLCClaimZ_some(o_conv);
28466         int64_t ret_ref = tag_ptr(ret_copy, true);
28467         return ret_ref;
28468 }
28469
28470 int64_t  CS_LDK_COption_HTLCClaimZ_none() {
28471         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
28472         *ret_copy = COption_HTLCClaimZ_none();
28473         int64_t ret_ref = tag_ptr(ret_copy, true);
28474         return ret_ref;
28475 }
28476
28477 void  CS_LDK_COption_HTLCClaimZ_free(int64_t _res) {
28478         if (!ptr_is_owned(_res)) return;
28479         void* _res_ptr = untag_ptr(_res);
28480         CHECK_ACCESS(_res_ptr);
28481         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
28482         FREE(untag_ptr(_res));
28483         COption_HTLCClaimZ_free(_res_conv);
28484 }
28485
28486 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(int64_t o) {
28487         LDKCounterpartyCommitmentSecrets o_conv;
28488         o_conv.inner = untag_ptr(o);
28489         o_conv.is_owned = ptr_is_owned(o);
28490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28491         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
28492         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28493         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
28494         return tag_ptr(ret_conv, true);
28495 }
28496
28497 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(int64_t e) {
28498         void* e_ptr = untag_ptr(e);
28499         CHECK_ACCESS(e_ptr);
28500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28502         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28503         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
28504         return tag_ptr(ret_conv, true);
28505 }
28506
28507 jboolean  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(int64_t o) {
28508         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
28509         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
28510         return ret_conv;
28511 }
28512
28513 void  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(int64_t _res) {
28514         if (!ptr_is_owned(_res)) return;
28515         void* _res_ptr = untag_ptr(_res);
28516         CHECK_ACCESS(_res_ptr);
28517         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
28518         FREE(untag_ptr(_res));
28519         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
28520 }
28521
28522 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
28523         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28524         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
28525         return tag_ptr(ret_conv, true);
28526 }
28527 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(int64_t arg) {
28528         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
28529         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
28530         return ret_conv;
28531 }
28532
28533 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(int64_t orig) {
28534         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
28535         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
28536         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
28537         return tag_ptr(ret_conv, true);
28538 }
28539
28540 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_ok(int64_t o) {
28541         LDKTxCreationKeys o_conv;
28542         o_conv.inner = untag_ptr(o);
28543         o_conv.is_owned = ptr_is_owned(o);
28544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28545         o_conv = TxCreationKeys_clone(&o_conv);
28546         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28547         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
28548         return tag_ptr(ret_conv, true);
28549 }
28550
28551 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_err(int64_t e) {
28552         void* e_ptr = untag_ptr(e);
28553         CHECK_ACCESS(e_ptr);
28554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28556         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28557         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
28558         return tag_ptr(ret_conv, true);
28559 }
28560
28561 jboolean  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_is_ok(int64_t o) {
28562         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
28563         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
28564         return ret_conv;
28565 }
28566
28567 void  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_free(int64_t _res) {
28568         if (!ptr_is_owned(_res)) return;
28569         void* _res_ptr = untag_ptr(_res);
28570         CHECK_ACCESS(_res_ptr);
28571         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
28572         FREE(untag_ptr(_res));
28573         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
28574 }
28575
28576 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
28577         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28578         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
28579         return tag_ptr(ret_conv, true);
28580 }
28581 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(int64_t arg) {
28582         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
28583         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
28584         return ret_conv;
28585 }
28586
28587 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone(int64_t orig) {
28588         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
28589         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28590         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
28591         return tag_ptr(ret_conv, true);
28592 }
28593
28594 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_ok(int64_t o) {
28595         LDKChannelPublicKeys o_conv;
28596         o_conv.inner = untag_ptr(o);
28597         o_conv.is_owned = ptr_is_owned(o);
28598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28599         o_conv = ChannelPublicKeys_clone(&o_conv);
28600         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28601         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
28602         return tag_ptr(ret_conv, true);
28603 }
28604
28605 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_err(int64_t e) {
28606         void* e_ptr = untag_ptr(e);
28607         CHECK_ACCESS(e_ptr);
28608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28610         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28611         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
28612         return tag_ptr(ret_conv, true);
28613 }
28614
28615 jboolean  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(int64_t o) {
28616         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
28617         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
28618         return ret_conv;
28619 }
28620
28621 void  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_free(int64_t _res) {
28622         if (!ptr_is_owned(_res)) return;
28623         void* _res_ptr = untag_ptr(_res);
28624         CHECK_ACCESS(_res_ptr);
28625         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
28626         FREE(untag_ptr(_res));
28627         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
28628 }
28629
28630 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
28631         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28632         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
28633         return tag_ptr(ret_conv, true);
28634 }
28635 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(int64_t arg) {
28636         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
28637         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
28638         return ret_conv;
28639 }
28640
28641 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone(int64_t orig) {
28642         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
28643         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28644         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
28645         return tag_ptr(ret_conv, true);
28646 }
28647
28648 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(int64_t o) {
28649         LDKHTLCOutputInCommitment o_conv;
28650         o_conv.inner = untag_ptr(o);
28651         o_conv.is_owned = ptr_is_owned(o);
28652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28653         o_conv = HTLCOutputInCommitment_clone(&o_conv);
28654         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28655         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
28656         return tag_ptr(ret_conv, true);
28657 }
28658
28659 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(int64_t e) {
28660         void* e_ptr = untag_ptr(e);
28661         CHECK_ACCESS(e_ptr);
28662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28664         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28665         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
28666         return tag_ptr(ret_conv, true);
28667 }
28668
28669 jboolean  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(int64_t o) {
28670         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
28671         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
28672         return ret_conv;
28673 }
28674
28675 void  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(int64_t _res) {
28676         if (!ptr_is_owned(_res)) return;
28677         void* _res_ptr = untag_ptr(_res);
28678         CHECK_ACCESS(_res_ptr);
28679         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
28680         FREE(untag_ptr(_res));
28681         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
28682 }
28683
28684 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
28685         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28686         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
28687         return tag_ptr(ret_conv, true);
28688 }
28689 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(int64_t arg) {
28690         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
28691         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
28692         return ret_conv;
28693 }
28694
28695 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(int64_t orig) {
28696         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
28697         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
28698         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
28699         return tag_ptr(ret_conv, true);
28700 }
28701
28702 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
28703         LDKCounterpartyChannelTransactionParameters o_conv;
28704         o_conv.inner = untag_ptr(o);
28705         o_conv.is_owned = ptr_is_owned(o);
28706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28707         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
28708         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28709         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28710         return tag_ptr(ret_conv, true);
28711 }
28712
28713 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
28714         void* e_ptr = untag_ptr(e);
28715         CHECK_ACCESS(e_ptr);
28716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28718         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28719         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
28720         return tag_ptr(ret_conv, true);
28721 }
28722
28723 jboolean  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
28724         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28725         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28726         return ret_conv;
28727 }
28728
28729 void  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
28730         if (!ptr_is_owned(_res)) return;
28731         void* _res_ptr = untag_ptr(_res);
28732         CHECK_ACCESS(_res_ptr);
28733         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28734         FREE(untag_ptr(_res));
28735         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28736 }
28737
28738 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28739         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28740         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
28741         return tag_ptr(ret_conv, true);
28742 }
28743 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
28744         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28745         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28746         return ret_conv;
28747 }
28748
28749 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
28750         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28751         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
28752         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28753         return tag_ptr(ret_conv, true);
28754 }
28755
28756 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
28757         LDKChannelTransactionParameters o_conv;
28758         o_conv.inner = untag_ptr(o);
28759         o_conv.is_owned = ptr_is_owned(o);
28760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28761         o_conv = ChannelTransactionParameters_clone(&o_conv);
28762         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28763         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
28764         return tag_ptr(ret_conv, true);
28765 }
28766
28767 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
28768         void* e_ptr = untag_ptr(e);
28769         CHECK_ACCESS(e_ptr);
28770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28772         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28773         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
28774         return tag_ptr(ret_conv, true);
28775 }
28776
28777 jboolean  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
28778         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
28779         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
28780         return ret_conv;
28781 }
28782
28783 void  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
28784         if (!ptr_is_owned(_res)) return;
28785         void* _res_ptr = untag_ptr(_res);
28786         CHECK_ACCESS(_res_ptr);
28787         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
28788         FREE(untag_ptr(_res));
28789         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
28790 }
28791
28792 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
28793         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28794         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
28795         return tag_ptr(ret_conv, true);
28796 }
28797 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
28798         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
28799         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
28800         return ret_conv;
28801 }
28802
28803 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
28804         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
28805         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
28806         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
28807         return tag_ptr(ret_conv, true);
28808 }
28809
28810 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28811         LDKHolderCommitmentTransaction o_conv;
28812         o_conv.inner = untag_ptr(o);
28813         o_conv.is_owned = ptr_is_owned(o);
28814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28815         o_conv = HolderCommitmentTransaction_clone(&o_conv);
28816         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28817         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
28818         return tag_ptr(ret_conv, true);
28819 }
28820
28821 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_err(int64_t e) {
28822         void* e_ptr = untag_ptr(e);
28823         CHECK_ACCESS(e_ptr);
28824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28826         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28827         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
28828         return tag_ptr(ret_conv, true);
28829 }
28830
28831 jboolean  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28832         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28833         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28834         return ret_conv;
28835 }
28836
28837 void  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28838         if (!ptr_is_owned(_res)) return;
28839         void* _res_ptr = untag_ptr(_res);
28840         CHECK_ACCESS(_res_ptr);
28841         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28842         FREE(untag_ptr(_res));
28843         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
28844 }
28845
28846 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28847         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28848         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
28849         return tag_ptr(ret_conv, true);
28850 }
28851 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28852         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28853         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28854         return ret_conv;
28855 }
28856
28857 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
28858         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28859         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
28860         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28861         return tag_ptr(ret_conv, true);
28862 }
28863
28864 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28865         LDKBuiltCommitmentTransaction o_conv;
28866         o_conv.inner = untag_ptr(o);
28867         o_conv.is_owned = ptr_is_owned(o);
28868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28869         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
28870         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28871         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
28872         return tag_ptr(ret_conv, true);
28873 }
28874
28875 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(int64_t e) {
28876         void* e_ptr = untag_ptr(e);
28877         CHECK_ACCESS(e_ptr);
28878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28880         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28881         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
28882         return tag_ptr(ret_conv, true);
28883 }
28884
28885 jboolean  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28886         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28887         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28888         return ret_conv;
28889 }
28890
28891 void  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28892         if (!ptr_is_owned(_res)) return;
28893         void* _res_ptr = untag_ptr(_res);
28894         CHECK_ACCESS(_res_ptr);
28895         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
28896         FREE(untag_ptr(_res));
28897         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
28898 }
28899
28900 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28901         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28902         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
28903         return tag_ptr(ret_conv, true);
28904 }
28905 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28906         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28907         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28908         return ret_conv;
28909 }
28910
28911 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
28912         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
28913         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
28914         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
28915         return tag_ptr(ret_conv, true);
28916 }
28917
28918 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_ok(int64_t o) {
28919         LDKTrustedClosingTransaction o_conv;
28920         o_conv.inner = untag_ptr(o);
28921         o_conv.is_owned = ptr_is_owned(o);
28922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28923         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
28924         
28925         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28926         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
28927         return tag_ptr(ret_conv, true);
28928 }
28929
28930 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_err() {
28931         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
28932         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
28933         return tag_ptr(ret_conv, true);
28934 }
28935
28936 jboolean  CS_LDK_CResult_TrustedClosingTransactionNoneZ_is_ok(int64_t o) {
28937         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
28938         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
28939         return ret_conv;
28940 }
28941
28942 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_free(int64_t _res) {
28943         if (!ptr_is_owned(_res)) return;
28944         void* _res_ptr = untag_ptr(_res);
28945         CHECK_ACCESS(_res_ptr);
28946         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
28947         FREE(untag_ptr(_res));
28948         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
28949 }
28950
28951 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_ok(int64_t o) {
28952         LDKCommitmentTransaction o_conv;
28953         o_conv.inner = untag_ptr(o);
28954         o_conv.is_owned = ptr_is_owned(o);
28955         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28956         o_conv = CommitmentTransaction_clone(&o_conv);
28957         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28958         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
28959         return tag_ptr(ret_conv, true);
28960 }
28961
28962 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_err(int64_t e) {
28963         void* e_ptr = untag_ptr(e);
28964         CHECK_ACCESS(e_ptr);
28965         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28966         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28967         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28968         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
28969         return tag_ptr(ret_conv, true);
28970 }
28971
28972 jboolean  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
28973         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
28974         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
28975         return ret_conv;
28976 }
28977
28978 void  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_free(int64_t _res) {
28979         if (!ptr_is_owned(_res)) return;
28980         void* _res_ptr = untag_ptr(_res);
28981         CHECK_ACCESS(_res_ptr);
28982         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
28983         FREE(untag_ptr(_res));
28984         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
28985 }
28986
28987 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
28988         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
28989         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
28990         return tag_ptr(ret_conv, true);
28991 }
28992 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
28993         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
28994         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
28995         return ret_conv;
28996 }
28997
28998 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
28999         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
29000         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
29001         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
29002         return tag_ptr(ret_conv, true);
29003 }
29004
29005 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_ok(int64_t o) {
29006         LDKTrustedCommitmentTransaction o_conv;
29007         o_conv.inner = untag_ptr(o);
29008         o_conv.is_owned = ptr_is_owned(o);
29009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29010         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
29011         
29012         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
29013         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
29014         return tag_ptr(ret_conv, true);
29015 }
29016
29017 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_err() {
29018         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
29019         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
29020         return tag_ptr(ret_conv, true);
29021 }
29022
29023 jboolean  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_is_ok(int64_t o) {
29024         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
29025         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
29026         return ret_conv;
29027 }
29028
29029 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_free(int64_t _res) {
29030         if (!ptr_is_owned(_res)) return;
29031         void* _res_ptr = untag_ptr(_res);
29032         CHECK_ACCESS(_res_ptr);
29033         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
29034         FREE(untag_ptr(_res));
29035         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
29036 }
29037
29038 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
29039         LDKCVec_ECDSASignatureZ o_constr;
29040         o_constr.datalen = o->arr_len;
29041         if (o_constr.datalen > 0)
29042                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
29043         else
29044                 o_constr.data = NULL;
29045         int8_tArray* o_vals = (void*) o->elems;
29046         for (size_t i = 0; i < o_constr.datalen; i++) {
29047                 int8_tArray o_conv_8 = o_vals[i];
29048                 LDKECDSASignature o_conv_8_ref;
29049                 CHECK(o_conv_8->arr_len == 64);
29050                 memcpy(o_conv_8_ref.compact_form, o_conv_8->elems, 64); FREE(o_conv_8);
29051                 o_constr.data[i] = o_conv_8_ref;
29052         }
29053         FREE(o);
29054         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29055         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
29056         return tag_ptr(ret_conv, true);
29057 }
29058
29059 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_err() {
29060         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29061         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
29062         return tag_ptr(ret_conv, true);
29063 }
29064
29065 jboolean  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_is_ok(int64_t o) {
29066         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
29067         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
29068         return ret_conv;
29069 }
29070
29071 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_free(int64_t _res) {
29072         if (!ptr_is_owned(_res)) return;
29073         void* _res_ptr = untag_ptr(_res);
29074         CHECK_ACCESS(_res_ptr);
29075         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
29076         FREE(untag_ptr(_res));
29077         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
29078 }
29079
29080 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
29081         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29082         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
29083         return tag_ptr(ret_conv, true);
29084 }
29085 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(int64_t arg) {
29086         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
29087         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
29088         return ret_conv;
29089 }
29090
29091 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone(int64_t orig) {
29092         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
29093         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
29094         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
29095         return tag_ptr(ret_conv, true);
29096 }
29097
29098 int64_t  CS_LDK_COption_usizeZ_some(int64_t o) {
29099         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29100         *ret_copy = COption_usizeZ_some(o);
29101         int64_t ret_ref = tag_ptr(ret_copy, true);
29102         return ret_ref;
29103 }
29104
29105 int64_t  CS_LDK_COption_usizeZ_none() {
29106         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29107         *ret_copy = COption_usizeZ_none();
29108         int64_t ret_ref = tag_ptr(ret_copy, true);
29109         return ret_ref;
29110 }
29111
29112 void  CS_LDK_COption_usizeZ_free(int64_t _res) {
29113         if (!ptr_is_owned(_res)) return;
29114         void* _res_ptr = untag_ptr(_res);
29115         CHECK_ACCESS(_res_ptr);
29116         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
29117         FREE(untag_ptr(_res));
29118         COption_usizeZ_free(_res_conv);
29119 }
29120
29121 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
29122         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29123         *ret_copy = COption_usizeZ_clone(arg);
29124         int64_t ret_ref = tag_ptr(ret_copy, true);
29125         return ret_ref;
29126 }
29127 int64_t  CS_LDK_COption_usizeZ_clone_ptr(int64_t arg) {
29128         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
29129         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
29130         return ret_conv;
29131 }
29132
29133 int64_t  CS_LDK_COption_usizeZ_clone(int64_t orig) {
29134         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
29135         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
29136         *ret_copy = COption_usizeZ_clone(orig_conv);
29137         int64_t ret_ref = tag_ptr(ret_copy, true);
29138         return ret_ref;
29139 }
29140
29141 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_ok(int64_t o) {
29142         LDKShutdownScript o_conv;
29143         o_conv.inner = untag_ptr(o);
29144         o_conv.is_owned = ptr_is_owned(o);
29145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29146         o_conv = ShutdownScript_clone(&o_conv);
29147         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29148         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
29149         return tag_ptr(ret_conv, true);
29150 }
29151
29152 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_err(int64_t e) {
29153         void* e_ptr = untag_ptr(e);
29154         CHECK_ACCESS(e_ptr);
29155         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29156         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29157         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29158         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
29159         return tag_ptr(ret_conv, true);
29160 }
29161
29162 jboolean  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_is_ok(int64_t o) {
29163         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
29164         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
29165         return ret_conv;
29166 }
29167
29168 void  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_free(int64_t _res) {
29169         if (!ptr_is_owned(_res)) return;
29170         void* _res_ptr = untag_ptr(_res);
29171         CHECK_ACCESS(_res_ptr);
29172         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
29173         FREE(untag_ptr(_res));
29174         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
29175 }
29176
29177 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
29178         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29179         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
29180         return tag_ptr(ret_conv, true);
29181 }
29182 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(int64_t arg) {
29183         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
29184         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
29185         return ret_conv;
29186 }
29187
29188 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone(int64_t orig) {
29189         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
29190         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
29191         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
29192         return tag_ptr(ret_conv, true);
29193 }
29194
29195 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(int64_t o) {
29196         LDKShutdownScript o_conv;
29197         o_conv.inner = untag_ptr(o);
29198         o_conv.is_owned = ptr_is_owned(o);
29199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29200         o_conv = ShutdownScript_clone(&o_conv);
29201         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29202         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
29203         return tag_ptr(ret_conv, true);
29204 }
29205
29206 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_err(int64_t e) {
29207         LDKInvalidShutdownScript e_conv;
29208         e_conv.inner = untag_ptr(e);
29209         e_conv.is_owned = ptr_is_owned(e);
29210         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
29211         e_conv = InvalidShutdownScript_clone(&e_conv);
29212         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29213         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
29214         return tag_ptr(ret_conv, true);
29215 }
29216
29217 jboolean  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(int64_t o) {
29218         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
29219         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
29220         return ret_conv;
29221 }
29222
29223 void  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_free(int64_t _res) {
29224         if (!ptr_is_owned(_res)) return;
29225         void* _res_ptr = untag_ptr(_res);
29226         CHECK_ACCESS(_res_ptr);
29227         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
29228         FREE(untag_ptr(_res));
29229         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
29230 }
29231
29232 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
29233         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29234         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
29235         return tag_ptr(ret_conv, true);
29236 }
29237 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(int64_t arg) {
29238         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
29239         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
29240         return ret_conv;
29241 }
29242
29243 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(int64_t orig) {
29244         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
29245         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
29246         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
29247         return tag_ptr(ret_conv, true);
29248 }
29249
29250 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_ok(int64_t o) {
29251         void* o_ptr = untag_ptr(o);
29252         CHECK_ACCESS(o_ptr);
29253         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
29254         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
29255         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29256         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
29257         return tag_ptr(ret_conv, true);
29258 }
29259
29260 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_err(int64_t e) {
29261         void* e_ptr = untag_ptr(e);
29262         CHECK_ACCESS(e_ptr);
29263         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29264         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29265         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29266         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
29267         return tag_ptr(ret_conv, true);
29268 }
29269
29270 jboolean  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_is_ok(int64_t o) {
29271         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
29272         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
29273         return ret_conv;
29274 }
29275
29276 void  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_free(int64_t _res) {
29277         if (!ptr_is_owned(_res)) return;
29278         void* _res_ptr = untag_ptr(_res);
29279         CHECK_ACCESS(_res_ptr);
29280         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
29281         FREE(untag_ptr(_res));
29282         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
29283 }
29284
29285 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
29286         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29287         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
29288         return tag_ptr(ret_conv, true);
29289 }
29290 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(int64_t arg) {
29291         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
29292         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
29293         return ret_conv;
29294 }
29295
29296 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone(int64_t orig) {
29297         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
29298         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
29299         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
29300         return tag_ptr(ret_conv, true);
29301 }
29302
29303 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_ok(int64_t o) {
29304         LDKClaimedHTLC o_conv;
29305         o_conv.inner = untag_ptr(o);
29306         o_conv.is_owned = ptr_is_owned(o);
29307         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29308         o_conv = ClaimedHTLC_clone(&o_conv);
29309         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29310         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
29311         return tag_ptr(ret_conv, true);
29312 }
29313
29314 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_err(int64_t e) {
29315         void* e_ptr = untag_ptr(e);
29316         CHECK_ACCESS(e_ptr);
29317         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29318         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29319         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29320         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
29321         return tag_ptr(ret_conv, true);
29322 }
29323
29324 jboolean  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_is_ok(int64_t o) {
29325         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
29326         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
29327         return ret_conv;
29328 }
29329
29330 void  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_free(int64_t _res) {
29331         if (!ptr_is_owned(_res)) return;
29332         void* _res_ptr = untag_ptr(_res);
29333         CHECK_ACCESS(_res_ptr);
29334         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
29335         FREE(untag_ptr(_res));
29336         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
29337 }
29338
29339 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29340         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29341         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
29342         return tag_ptr(ret_conv, true);
29343 }
29344 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29345         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
29346         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29347         return ret_conv;
29348 }
29349
29350 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone(int64_t orig) {
29351         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
29352         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
29353         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
29354         return tag_ptr(ret_conv, true);
29355 }
29356
29357 int64_t  CS_LDK_COption_PathFailureZ_some(int64_t o) {
29358         void* o_ptr = untag_ptr(o);
29359         CHECK_ACCESS(o_ptr);
29360         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
29361         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
29362         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29363         *ret_copy = COption_PathFailureZ_some(o_conv);
29364         int64_t ret_ref = tag_ptr(ret_copy, true);
29365         return ret_ref;
29366 }
29367
29368 int64_t  CS_LDK_COption_PathFailureZ_none() {
29369         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29370         *ret_copy = COption_PathFailureZ_none();
29371         int64_t ret_ref = tag_ptr(ret_copy, true);
29372         return ret_ref;
29373 }
29374
29375 void  CS_LDK_COption_PathFailureZ_free(int64_t _res) {
29376         if (!ptr_is_owned(_res)) return;
29377         void* _res_ptr = untag_ptr(_res);
29378         CHECK_ACCESS(_res_ptr);
29379         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
29380         FREE(untag_ptr(_res));
29381         COption_PathFailureZ_free(_res_conv);
29382 }
29383
29384 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
29385         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29386         *ret_copy = COption_PathFailureZ_clone(arg);
29387         int64_t ret_ref = tag_ptr(ret_copy, true);
29388         return ret_ref;
29389 }
29390 int64_t  CS_LDK_COption_PathFailureZ_clone_ptr(int64_t arg) {
29391         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
29392         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
29393         return ret_conv;
29394 }
29395
29396 int64_t  CS_LDK_COption_PathFailureZ_clone(int64_t orig) {
29397         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
29398         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
29399         *ret_copy = COption_PathFailureZ_clone(orig_conv);
29400         int64_t ret_ref = tag_ptr(ret_copy, true);
29401         return ret_ref;
29402 }
29403
29404 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_ok(int64_t o) {
29405         void* o_ptr = untag_ptr(o);
29406         CHECK_ACCESS(o_ptr);
29407         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
29408         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
29409         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29410         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
29411         return tag_ptr(ret_conv, true);
29412 }
29413
29414 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_err(int64_t e) {
29415         void* e_ptr = untag_ptr(e);
29416         CHECK_ACCESS(e_ptr);
29417         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29418         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29419         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29420         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
29421         return tag_ptr(ret_conv, true);
29422 }
29423
29424 jboolean  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_is_ok(int64_t o) {
29425         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
29426         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
29427         return ret_conv;
29428 }
29429
29430 void  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_free(int64_t _res) {
29431         if (!ptr_is_owned(_res)) return;
29432         void* _res_ptr = untag_ptr(_res);
29433         CHECK_ACCESS(_res_ptr);
29434         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
29435         FREE(untag_ptr(_res));
29436         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
29437 }
29438
29439 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
29440         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29441         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
29442         return tag_ptr(ret_conv, true);
29443 }
29444 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(int64_t arg) {
29445         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
29446         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
29447         return ret_conv;
29448 }
29449
29450 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone(int64_t orig) {
29451         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
29452         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
29453         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
29454         return tag_ptr(ret_conv, true);
29455 }
29456
29457 int64_t  CS_LDK_COption_ClosureReasonZ_some(int64_t o) {
29458         void* o_ptr = untag_ptr(o);
29459         CHECK_ACCESS(o_ptr);
29460         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
29461         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
29462         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29463         *ret_copy = COption_ClosureReasonZ_some(o_conv);
29464         int64_t ret_ref = tag_ptr(ret_copy, true);
29465         return ret_ref;
29466 }
29467
29468 int64_t  CS_LDK_COption_ClosureReasonZ_none() {
29469         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29470         *ret_copy = COption_ClosureReasonZ_none();
29471         int64_t ret_ref = tag_ptr(ret_copy, true);
29472         return ret_ref;
29473 }
29474
29475 void  CS_LDK_COption_ClosureReasonZ_free(int64_t _res) {
29476         if (!ptr_is_owned(_res)) return;
29477         void* _res_ptr = untag_ptr(_res);
29478         CHECK_ACCESS(_res_ptr);
29479         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
29480         FREE(untag_ptr(_res));
29481         COption_ClosureReasonZ_free(_res_conv);
29482 }
29483
29484 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
29485         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29486         *ret_copy = COption_ClosureReasonZ_clone(arg);
29487         int64_t ret_ref = tag_ptr(ret_copy, true);
29488         return ret_ref;
29489 }
29490 int64_t  CS_LDK_COption_ClosureReasonZ_clone_ptr(int64_t arg) {
29491         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
29492         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
29493         return ret_conv;
29494 }
29495
29496 int64_t  CS_LDK_COption_ClosureReasonZ_clone(int64_t orig) {
29497         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
29498         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
29499         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
29500         int64_t ret_ref = tag_ptr(ret_copy, true);
29501         return ret_ref;
29502 }
29503
29504 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_ok(int64_t o) {
29505         void* o_ptr = untag_ptr(o);
29506         CHECK_ACCESS(o_ptr);
29507         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
29508         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
29509         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29510         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
29511         return tag_ptr(ret_conv, true);
29512 }
29513
29514 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_err(int64_t e) {
29515         void* e_ptr = untag_ptr(e);
29516         CHECK_ACCESS(e_ptr);
29517         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29518         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29519         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29520         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
29521         return tag_ptr(ret_conv, true);
29522 }
29523
29524 jboolean  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(int64_t o) {
29525         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
29526         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
29527         return ret_conv;
29528 }
29529
29530 void  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_free(int64_t _res) {
29531         if (!ptr_is_owned(_res)) return;
29532         void* _res_ptr = untag_ptr(_res);
29533         CHECK_ACCESS(_res_ptr);
29534         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
29535         FREE(untag_ptr(_res));
29536         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
29537 }
29538
29539 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
29540         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29541         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
29542         return tag_ptr(ret_conv, true);
29543 }
29544 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(int64_t arg) {
29545         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
29546         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
29547         return ret_conv;
29548 }
29549
29550 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone(int64_t orig) {
29551         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
29552         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
29553         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
29554         return tag_ptr(ret_conv, true);
29555 }
29556
29557 int64_t  CS_LDK_COption_HTLCDestinationZ_some(int64_t o) {
29558         void* o_ptr = untag_ptr(o);
29559         CHECK_ACCESS(o_ptr);
29560         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
29561         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
29562         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29563         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
29564         int64_t ret_ref = tag_ptr(ret_copy, true);
29565         return ret_ref;
29566 }
29567
29568 int64_t  CS_LDK_COption_HTLCDestinationZ_none() {
29569         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29570         *ret_copy = COption_HTLCDestinationZ_none();
29571         int64_t ret_ref = tag_ptr(ret_copy, true);
29572         return ret_ref;
29573 }
29574
29575 void  CS_LDK_COption_HTLCDestinationZ_free(int64_t _res) {
29576         if (!ptr_is_owned(_res)) return;
29577         void* _res_ptr = untag_ptr(_res);
29578         CHECK_ACCESS(_res_ptr);
29579         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
29580         FREE(untag_ptr(_res));
29581         COption_HTLCDestinationZ_free(_res_conv);
29582 }
29583
29584 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
29585         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29586         *ret_copy = COption_HTLCDestinationZ_clone(arg);
29587         int64_t ret_ref = tag_ptr(ret_copy, true);
29588         return ret_ref;
29589 }
29590 int64_t  CS_LDK_COption_HTLCDestinationZ_clone_ptr(int64_t arg) {
29591         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
29592         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
29593         return ret_conv;
29594 }
29595
29596 int64_t  CS_LDK_COption_HTLCDestinationZ_clone(int64_t orig) {
29597         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
29598         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
29599         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
29600         int64_t ret_ref = tag_ptr(ret_copy, true);
29601         return ret_ref;
29602 }
29603
29604 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(int64_t o) {
29605         void* o_ptr = untag_ptr(o);
29606         CHECK_ACCESS(o_ptr);
29607         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
29608         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
29609         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29610         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
29611         return tag_ptr(ret_conv, true);
29612 }
29613
29614 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_err(int64_t e) {
29615         void* e_ptr = untag_ptr(e);
29616         CHECK_ACCESS(e_ptr);
29617         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29618         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29619         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29620         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
29621         return tag_ptr(ret_conv, true);
29622 }
29623
29624 jboolean  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(int64_t o) {
29625         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
29626         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
29627         return ret_conv;
29628 }
29629
29630 void  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_free(int64_t _res) {
29631         if (!ptr_is_owned(_res)) return;
29632         void* _res_ptr = untag_ptr(_res);
29633         CHECK_ACCESS(_res_ptr);
29634         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
29635         FREE(untag_ptr(_res));
29636         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
29637 }
29638
29639 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
29640         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29641         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
29642         return tag_ptr(ret_conv, true);
29643 }
29644 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(int64_t arg) {
29645         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
29646         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
29647         return ret_conv;
29648 }
29649
29650 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(int64_t orig) {
29651         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
29652         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
29653         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
29654         return tag_ptr(ret_conv, true);
29655 }
29656
29657 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_ok(int32_t o) {
29658         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
29659         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29660         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
29661         return tag_ptr(ret_conv, true);
29662 }
29663
29664 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_err(int64_t e) {
29665         void* e_ptr = untag_ptr(e);
29666         CHECK_ACCESS(e_ptr);
29667         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29668         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29669         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29670         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
29671         return tag_ptr(ret_conv, true);
29672 }
29673
29674 jboolean  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(int64_t o) {
29675         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
29676         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
29677         return ret_conv;
29678 }
29679
29680 void  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_free(int64_t _res) {
29681         if (!ptr_is_owned(_res)) return;
29682         void* _res_ptr = untag_ptr(_res);
29683         CHECK_ACCESS(_res_ptr);
29684         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
29685         FREE(untag_ptr(_res));
29686         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
29687 }
29688
29689 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
29690         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29691         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
29692         return tag_ptr(ret_conv, true);
29693 }
29694 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(int64_t arg) {
29695         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
29696         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
29697         return ret_conv;
29698 }
29699
29700 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone(int64_t orig) {
29701         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
29702         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
29703         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
29704         return tag_ptr(ret_conv, true);
29705 }
29706
29707 int64_t  CS_LDK_COption_U128Z_some(int8_tArray o) {
29708         LDKU128 o_ref;
29709         CHECK(o->arr_len == 16);
29710         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
29711         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29712         *ret_copy = COption_U128Z_some(o_ref);
29713         int64_t ret_ref = tag_ptr(ret_copy, true);
29714         return ret_ref;
29715 }
29716
29717 int64_t  CS_LDK_COption_U128Z_none() {
29718         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29719         *ret_copy = COption_U128Z_none();
29720         int64_t ret_ref = tag_ptr(ret_copy, true);
29721         return ret_ref;
29722 }
29723
29724 void  CS_LDK_COption_U128Z_free(int64_t _res) {
29725         if (!ptr_is_owned(_res)) return;
29726         void* _res_ptr = untag_ptr(_res);
29727         CHECK_ACCESS(_res_ptr);
29728         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
29729         FREE(untag_ptr(_res));
29730         COption_U128Z_free(_res_conv);
29731 }
29732
29733 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
29734         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29735         *ret_copy = COption_U128Z_clone(arg);
29736         int64_t ret_ref = tag_ptr(ret_copy, true);
29737         return ret_ref;
29738 }
29739 int64_t  CS_LDK_COption_U128Z_clone_ptr(int64_t arg) {
29740         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
29741         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
29742         return ret_conv;
29743 }
29744
29745 int64_t  CS_LDK_COption_U128Z_clone(int64_t orig) {
29746         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
29747         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
29748         *ret_copy = COption_U128Z_clone(orig_conv);
29749         int64_t ret_ref = tag_ptr(ret_copy, true);
29750         return ret_ref;
29751 }
29752
29753 void  CS_LDK_CVec_ClaimedHTLCZ_free(int64_tArray _res) {
29754         LDKCVec_ClaimedHTLCZ _res_constr;
29755         _res_constr.datalen = _res->arr_len;
29756         if (_res_constr.datalen > 0)
29757                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
29758         else
29759                 _res_constr.data = NULL;
29760         int64_t* _res_vals = _res->elems;
29761         for (size_t n = 0; n < _res_constr.datalen; n++) {
29762                 int64_t _res_conv_13 = _res_vals[n];
29763                 LDKClaimedHTLC _res_conv_13_conv;
29764                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
29765                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
29766                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
29767                 _res_constr.data[n] = _res_conv_13_conv;
29768         }
29769         FREE(_res);
29770         CVec_ClaimedHTLCZ_free(_res_constr);
29771 }
29772
29773 int64_t  CS_LDK_COption_PaymentFailureReasonZ_some(int32_t o) {
29774         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
29775         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29776         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
29777         int64_t ret_ref = tag_ptr(ret_copy, true);
29778         return ret_ref;
29779 }
29780
29781 int64_t  CS_LDK_COption_PaymentFailureReasonZ_none() {
29782         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29783         *ret_copy = COption_PaymentFailureReasonZ_none();
29784         int64_t ret_ref = tag_ptr(ret_copy, true);
29785         return ret_ref;
29786 }
29787
29788 void  CS_LDK_COption_PaymentFailureReasonZ_free(int64_t _res) {
29789         if (!ptr_is_owned(_res)) return;
29790         void* _res_ptr = untag_ptr(_res);
29791         CHECK_ACCESS(_res_ptr);
29792         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
29793         FREE(untag_ptr(_res));
29794         COption_PaymentFailureReasonZ_free(_res_conv);
29795 }
29796
29797 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
29798         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29799         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
29800         int64_t ret_ref = tag_ptr(ret_copy, true);
29801         return ret_ref;
29802 }
29803 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone_ptr(int64_t arg) {
29804         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
29805         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
29806         return ret_conv;
29807 }
29808
29809 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone(int64_t orig) {
29810         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
29811         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
29812         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
29813         int64_t ret_ref = tag_ptr(ret_copy, true);
29814         return ret_ref;
29815 }
29816
29817 int64_t  CS_LDK_COption_EventZ_some(int64_t o) {
29818         void* o_ptr = untag_ptr(o);
29819         CHECK_ACCESS(o_ptr);
29820         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
29821         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
29822         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29823         *ret_copy = COption_EventZ_some(o_conv);
29824         int64_t ret_ref = tag_ptr(ret_copy, true);
29825         return ret_ref;
29826 }
29827
29828 int64_t  CS_LDK_COption_EventZ_none() {
29829         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29830         *ret_copy = COption_EventZ_none();
29831         int64_t ret_ref = tag_ptr(ret_copy, true);
29832         return ret_ref;
29833 }
29834
29835 void  CS_LDK_COption_EventZ_free(int64_t _res) {
29836         if (!ptr_is_owned(_res)) return;
29837         void* _res_ptr = untag_ptr(_res);
29838         CHECK_ACCESS(_res_ptr);
29839         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
29840         FREE(untag_ptr(_res));
29841         COption_EventZ_free(_res_conv);
29842 }
29843
29844 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
29845         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29846         *ret_copy = COption_EventZ_clone(arg);
29847         int64_t ret_ref = tag_ptr(ret_copy, true);
29848         return ret_ref;
29849 }
29850 int64_t  CS_LDK_COption_EventZ_clone_ptr(int64_t arg) {
29851         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
29852         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
29853         return ret_conv;
29854 }
29855
29856 int64_t  CS_LDK_COption_EventZ_clone(int64_t orig) {
29857         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
29858         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
29859         *ret_copy = COption_EventZ_clone(orig_conv);
29860         int64_t ret_ref = tag_ptr(ret_copy, true);
29861         return ret_ref;
29862 }
29863
29864 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_ok(int64_t o) {
29865         void* o_ptr = untag_ptr(o);
29866         CHECK_ACCESS(o_ptr);
29867         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
29868         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
29869         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29870         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
29871         return tag_ptr(ret_conv, true);
29872 }
29873
29874 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_err(int64_t e) {
29875         void* e_ptr = untag_ptr(e);
29876         CHECK_ACCESS(e_ptr);
29877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29879         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29880         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
29881         return tag_ptr(ret_conv, true);
29882 }
29883
29884 jboolean  CS_LDK_CResult_COption_EventZDecodeErrorZ_is_ok(int64_t o) {
29885         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
29886         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
29887         return ret_conv;
29888 }
29889
29890 void  CS_LDK_CResult_COption_EventZDecodeErrorZ_free(int64_t _res) {
29891         if (!ptr_is_owned(_res)) return;
29892         void* _res_ptr = untag_ptr(_res);
29893         CHECK_ACCESS(_res_ptr);
29894         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
29895         FREE(untag_ptr(_res));
29896         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
29897 }
29898
29899 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
29900         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29901         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
29902         return tag_ptr(ret_conv, true);
29903 }
29904 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone_ptr(int64_t arg) {
29905         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
29906         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
29907         return ret_conv;
29908 }
29909
29910 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone(int64_t orig) {
29911         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
29912         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
29913         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
29914         return tag_ptr(ret_conv, true);
29915 }
29916
29917 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_ok(int32_t o) {
29918         LDKSiPrefix o_conv = LDKSiPrefix_from_cs(o);
29919         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29920         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
29921         return tag_ptr(ret_conv, true);
29922 }
29923
29924 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_err(int64_t e) {
29925         void* e_ptr = untag_ptr(e);
29926         CHECK_ACCESS(e_ptr);
29927         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
29928         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
29929         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29930         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
29931         return tag_ptr(ret_conv, true);
29932 }
29933
29934 jboolean  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_is_ok(int64_t o) {
29935         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
29936         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
29937         return ret_conv;
29938 }
29939
29940 void  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_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_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
29945         FREE(untag_ptr(_res));
29946         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
29947 }
29948
29949 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
29950         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29951         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
29952         return tag_ptr(ret_conv, true);
29953 }
29954 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(int64_t arg) {
29955         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
29956         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
29957         return ret_conv;
29958 }
29959
29960 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone(int64_t orig) {
29961         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
29962         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
29963         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(int64_t o) {
29968         LDKBolt11Invoice 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 = Bolt11Invoice_clone(&o_conv);
29973         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29974         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
29975         return tag_ptr(ret_conv, true);
29976 }
29977
29978 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(int64_t e) {
29979         void* e_ptr = untag_ptr(e);
29980         CHECK_ACCESS(e_ptr);
29981         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
29982         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
29983         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
29984         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
29985         return tag_ptr(ret_conv, true);
29986 }
29987
29988 jboolean  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(int64_t o) {
29989         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
29990         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
29991         return ret_conv;
29992 }
29993
29994 void  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_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_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
29999         FREE(untag_ptr(_res));
30000         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
30001 }
30002
30003 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
30004         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
30005         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
30006         return tag_ptr(ret_conv, true);
30007 }
30008 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(int64_t arg) {
30009         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
30010         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
30011         return ret_conv;
30012 }
30013
30014 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(int64_t orig) {
30015         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
30016         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
30017         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(int64_t o) {
30022         LDKSignedRawBolt11Invoice 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 = SignedRawBolt11Invoice_clone(&o_conv);
30027         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30028         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
30029         return tag_ptr(ret_conv, true);
30030 }
30031
30032 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(int64_t e) {
30033         void* e_ptr = untag_ptr(e);
30034         CHECK_ACCESS(e_ptr);
30035         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
30036         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
30037         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30038         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
30039         return tag_ptr(ret_conv, true);
30040 }
30041
30042 jboolean  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(int64_t o) {
30043         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
30044         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
30045         return ret_conv;
30046 }
30047
30048 void  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_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_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
30053         FREE(untag_ptr(_res));
30054         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
30055 }
30056
30057 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
30058         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30059         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
30060         return tag_ptr(ret_conv, true);
30061 }
30062 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(int64_t arg) {
30063         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
30064         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
30065         return ret_conv;
30066 }
30067
30068 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(int64_t orig) {
30069         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
30070         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
30071         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
30072         return tag_ptr(ret_conv, true);
30073 }
30074
30075 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
30076         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30077         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
30078         return tag_ptr(ret_conv, true);
30079 }
30080 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(int64_t arg) {
30081         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
30082         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
30083         return ret_conv;
30084 }
30085
30086 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(int64_t orig) {
30087         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
30088         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30089         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
30090         return tag_ptr(ret_conv, true);
30091 }
30092
30093 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(int64_t a, int8_tArray b, int64_t c) {
30094         LDKRawBolt11Invoice a_conv;
30095         a_conv.inner = untag_ptr(a);
30096         a_conv.is_owned = ptr_is_owned(a);
30097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30098         a_conv = RawBolt11Invoice_clone(&a_conv);
30099         LDKThirtyTwoBytes b_ref;
30100         CHECK(b->arr_len == 32);
30101         memcpy(b_ref.data, b->elems, 32); FREE(b);
30102         LDKBolt11InvoiceSignature c_conv;
30103         c_conv.inner = untag_ptr(c);
30104         c_conv.is_owned = ptr_is_owned(c);
30105         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30106         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
30107         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
30108         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
30109         return tag_ptr(ret_conv, true);
30110 }
30111
30112 void  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(int64_t _res) {
30113         if (!ptr_is_owned(_res)) return;
30114         void* _res_ptr = untag_ptr(_res);
30115         CHECK_ACCESS(_res_ptr);
30116         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
30117         FREE(untag_ptr(_res));
30118         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
30119 }
30120
30121 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_ok(int64_t o) {
30122         LDKPayeePubKey o_conv;
30123         o_conv.inner = untag_ptr(o);
30124         o_conv.is_owned = ptr_is_owned(o);
30125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30126         o_conv = PayeePubKey_clone(&o_conv);
30127         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30128         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
30129         return tag_ptr(ret_conv, true);
30130 }
30131
30132 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_err(int32_t e) {
30133         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
30134         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30135         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
30136         return tag_ptr(ret_conv, true);
30137 }
30138
30139 jboolean  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(int64_t o) {
30140         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
30141         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
30142         return ret_conv;
30143 }
30144
30145 void  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_free(int64_t _res) {
30146         if (!ptr_is_owned(_res)) return;
30147         void* _res_ptr = untag_ptr(_res);
30148         CHECK_ACCESS(_res_ptr);
30149         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
30150         FREE(untag_ptr(_res));
30151         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
30152 }
30153
30154 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
30155         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30156         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
30157         return tag_ptr(ret_conv, true);
30158 }
30159 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
30160         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
30161         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
30162         return ret_conv;
30163 }
30164
30165 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone(int64_t orig) {
30166         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
30167         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
30168         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
30169         return tag_ptr(ret_conv, true);
30170 }
30171
30172 void  CS_LDK_CVec_PrivateRouteZ_free(int64_tArray _res) {
30173         LDKCVec_PrivateRouteZ _res_constr;
30174         _res_constr.datalen = _res->arr_len;
30175         if (_res_constr.datalen > 0)
30176                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
30177         else
30178                 _res_constr.data = NULL;
30179         int64_t* _res_vals = _res->elems;
30180         for (size_t o = 0; o < _res_constr.datalen; o++) {
30181                 int64_t _res_conv_14 = _res_vals[o];
30182                 LDKPrivateRoute _res_conv_14_conv;
30183                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
30184                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
30185                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
30186                 _res_constr.data[o] = _res_conv_14_conv;
30187         }
30188         FREE(_res);
30189         CVec_PrivateRouteZ_free(_res_constr);
30190 }
30191
30192 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_ok(int64_t o) {
30193         LDKPositiveTimestamp o_conv;
30194         o_conv.inner = untag_ptr(o);
30195         o_conv.is_owned = ptr_is_owned(o);
30196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30197         o_conv = PositiveTimestamp_clone(&o_conv);
30198         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30199         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
30200         return tag_ptr(ret_conv, true);
30201 }
30202
30203 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_err(int32_t e) {
30204         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30205         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30206         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
30207         return tag_ptr(ret_conv, true);
30208 }
30209
30210 jboolean  CS_LDK_CResult_PositiveTimestampCreationErrorZ_is_ok(int64_t o) {
30211         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
30212         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
30213         return ret_conv;
30214 }
30215
30216 void  CS_LDK_CResult_PositiveTimestampCreationErrorZ_free(int64_t _res) {
30217         if (!ptr_is_owned(_res)) return;
30218         void* _res_ptr = untag_ptr(_res);
30219         CHECK_ACCESS(_res_ptr);
30220         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
30221         FREE(untag_ptr(_res));
30222         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
30223 }
30224
30225 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
30226         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30227         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
30228         return tag_ptr(ret_conv, true);
30229 }
30230 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone_ptr(int64_t arg) {
30231         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
30232         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
30233         return ret_conv;
30234 }
30235
30236 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone(int64_t orig) {
30237         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
30238         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
30239         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
30240         return tag_ptr(ret_conv, true);
30241 }
30242
30243 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_ok() {
30244         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30245         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
30246         return tag_ptr(ret_conv, true);
30247 }
30248
30249 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_err(int32_t e) {
30250         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
30251         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30252         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
30253         return tag_ptr(ret_conv, true);
30254 }
30255
30256 jboolean  CS_LDK_CResult_NoneBolt11SemanticErrorZ_is_ok(int64_t o) {
30257         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
30258         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
30259         return ret_conv;
30260 }
30261
30262 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_free(int64_t _res) {
30263         if (!ptr_is_owned(_res)) return;
30264         void* _res_ptr = untag_ptr(_res);
30265         CHECK_ACCESS(_res_ptr);
30266         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
30267         FREE(untag_ptr(_res));
30268         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
30269 }
30270
30271 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
30272         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30273         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
30274         return tag_ptr(ret_conv, true);
30275 }
30276 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
30277         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
30278         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
30279         return ret_conv;
30280 }
30281
30282 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone(int64_t orig) {
30283         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
30284         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
30285         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
30286         return tag_ptr(ret_conv, true);
30287 }
30288
30289 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(int64_t o) {
30290         LDKBolt11Invoice o_conv;
30291         o_conv.inner = untag_ptr(o);
30292         o_conv.is_owned = ptr_is_owned(o);
30293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30294         o_conv = Bolt11Invoice_clone(&o_conv);
30295         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30296         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
30297         return tag_ptr(ret_conv, true);
30298 }
30299
30300 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(int32_t e) {
30301         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
30302         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30303         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
30304         return tag_ptr(ret_conv, true);
30305 }
30306
30307 jboolean  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(int64_t o) {
30308         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
30309         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
30310         return ret_conv;
30311 }
30312
30313 void  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(int64_t _res) {
30314         if (!ptr_is_owned(_res)) return;
30315         void* _res_ptr = untag_ptr(_res);
30316         CHECK_ACCESS(_res_ptr);
30317         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
30318         FREE(untag_ptr(_res));
30319         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
30320 }
30321
30322 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
30323         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30324         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
30325         return tag_ptr(ret_conv, true);
30326 }
30327 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
30328         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
30329         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
30330         return ret_conv;
30331 }
30332
30333 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(int64_t orig) {
30334         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
30335         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
30336         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
30337         return tag_ptr(ret_conv, true);
30338 }
30339
30340 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_ok(int64_t o) {
30341         LDKDescription o_conv;
30342         o_conv.inner = untag_ptr(o);
30343         o_conv.is_owned = ptr_is_owned(o);
30344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30345         o_conv = Description_clone(&o_conv);
30346         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30347         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
30348         return tag_ptr(ret_conv, true);
30349 }
30350
30351 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_err(int32_t e) {
30352         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30353         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30354         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
30355         return tag_ptr(ret_conv, true);
30356 }
30357
30358 jboolean  CS_LDK_CResult_DescriptionCreationErrorZ_is_ok(int64_t o) {
30359         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
30360         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
30361         return ret_conv;
30362 }
30363
30364 void  CS_LDK_CResult_DescriptionCreationErrorZ_free(int64_t _res) {
30365         if (!ptr_is_owned(_res)) return;
30366         void* _res_ptr = untag_ptr(_res);
30367         CHECK_ACCESS(_res_ptr);
30368         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
30369         FREE(untag_ptr(_res));
30370         CResult_DescriptionCreationErrorZ_free(_res_conv);
30371 }
30372
30373 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
30374         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30375         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
30376         return tag_ptr(ret_conv, true);
30377 }
30378 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone_ptr(int64_t arg) {
30379         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
30380         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
30381         return ret_conv;
30382 }
30383
30384 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone(int64_t orig) {
30385         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
30386         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
30387         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
30388         return tag_ptr(ret_conv, true);
30389 }
30390
30391 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_ok(int64_t o) {
30392         LDKPrivateRoute o_conv;
30393         o_conv.inner = untag_ptr(o);
30394         o_conv.is_owned = ptr_is_owned(o);
30395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30396         o_conv = PrivateRoute_clone(&o_conv);
30397         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30398         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
30399         return tag_ptr(ret_conv, true);
30400 }
30401
30402 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_err(int32_t e) {
30403         LDKCreationError e_conv = LDKCreationError_from_cs(e);
30404         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30405         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
30406         return tag_ptr(ret_conv, true);
30407 }
30408
30409 jboolean  CS_LDK_CResult_PrivateRouteCreationErrorZ_is_ok(int64_t o) {
30410         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
30411         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
30412         return ret_conv;
30413 }
30414
30415 void  CS_LDK_CResult_PrivateRouteCreationErrorZ_free(int64_t _res) {
30416         if (!ptr_is_owned(_res)) return;
30417         void* _res_ptr = untag_ptr(_res);
30418         CHECK_ACCESS(_res_ptr);
30419         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
30420         FREE(untag_ptr(_res));
30421         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
30422 }
30423
30424 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
30425         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30426         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
30427         return tag_ptr(ret_conv, true);
30428 }
30429 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone_ptr(int64_t arg) {
30430         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
30431         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
30432         return ret_conv;
30433 }
30434
30435 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone(int64_t orig) {
30436         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
30437         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
30438         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
30439         return tag_ptr(ret_conv, true);
30440 }
30441
30442 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_ok(int64_t o) {
30443         LDKOutPoint o_conv;
30444         o_conv.inner = untag_ptr(o);
30445         o_conv.is_owned = ptr_is_owned(o);
30446         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30447         o_conv = OutPoint_clone(&o_conv);
30448         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30449         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
30450         return tag_ptr(ret_conv, true);
30451 }
30452
30453 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_err(int64_t e) {
30454         void* e_ptr = untag_ptr(e);
30455         CHECK_ACCESS(e_ptr);
30456         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30457         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30458         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30459         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
30460         return tag_ptr(ret_conv, true);
30461 }
30462
30463 jboolean  CS_LDK_CResult_OutPointDecodeErrorZ_is_ok(int64_t o) {
30464         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
30465         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
30466         return ret_conv;
30467 }
30468
30469 void  CS_LDK_CResult_OutPointDecodeErrorZ_free(int64_t _res) {
30470         if (!ptr_is_owned(_res)) return;
30471         void* _res_ptr = untag_ptr(_res);
30472         CHECK_ACCESS(_res_ptr);
30473         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
30474         FREE(untag_ptr(_res));
30475         CResult_OutPointDecodeErrorZ_free(_res_conv);
30476 }
30477
30478 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
30479         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30480         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
30481         return tag_ptr(ret_conv, true);
30482 }
30483 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone_ptr(int64_t arg) {
30484         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
30485         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
30486         return ret_conv;
30487 }
30488
30489 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone(int64_t orig) {
30490         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
30491         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
30492         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
30493         return tag_ptr(ret_conv, true);
30494 }
30495
30496 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_ok(int64_t o) {
30497         LDKBigSize o_conv;
30498         o_conv.inner = untag_ptr(o);
30499         o_conv.is_owned = ptr_is_owned(o);
30500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30501         o_conv = BigSize_clone(&o_conv);
30502         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30503         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
30504         return tag_ptr(ret_conv, true);
30505 }
30506
30507 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_err(int64_t e) {
30508         void* e_ptr = untag_ptr(e);
30509         CHECK_ACCESS(e_ptr);
30510         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30511         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30512         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30513         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
30514         return tag_ptr(ret_conv, true);
30515 }
30516
30517 jboolean  CS_LDK_CResult_BigSizeDecodeErrorZ_is_ok(int64_t o) {
30518         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
30519         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
30520         return ret_conv;
30521 }
30522
30523 void  CS_LDK_CResult_BigSizeDecodeErrorZ_free(int64_t _res) {
30524         if (!ptr_is_owned(_res)) return;
30525         void* _res_ptr = untag_ptr(_res);
30526         CHECK_ACCESS(_res_ptr);
30527         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
30528         FREE(untag_ptr(_res));
30529         CResult_BigSizeDecodeErrorZ_free(_res_conv);
30530 }
30531
30532 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
30533         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30534         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
30535         return tag_ptr(ret_conv, true);
30536 }
30537 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone_ptr(int64_t arg) {
30538         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
30539         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
30540         return ret_conv;
30541 }
30542
30543 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone(int64_t orig) {
30544         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
30545         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
30546         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
30547         return tag_ptr(ret_conv, true);
30548 }
30549
30550 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_ok(int64_t o) {
30551         LDKHostname o_conv;
30552         o_conv.inner = untag_ptr(o);
30553         o_conv.is_owned = ptr_is_owned(o);
30554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30555         o_conv = Hostname_clone(&o_conv);
30556         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30557         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
30558         return tag_ptr(ret_conv, true);
30559 }
30560
30561 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_err(int64_t e) {
30562         void* e_ptr = untag_ptr(e);
30563         CHECK_ACCESS(e_ptr);
30564         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30565         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30566         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30567         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
30568         return tag_ptr(ret_conv, true);
30569 }
30570
30571 jboolean  CS_LDK_CResult_HostnameDecodeErrorZ_is_ok(int64_t o) {
30572         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
30573         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
30574         return ret_conv;
30575 }
30576
30577 void  CS_LDK_CResult_HostnameDecodeErrorZ_free(int64_t _res) {
30578         if (!ptr_is_owned(_res)) return;
30579         void* _res_ptr = untag_ptr(_res);
30580         CHECK_ACCESS(_res_ptr);
30581         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
30582         FREE(untag_ptr(_res));
30583         CResult_HostnameDecodeErrorZ_free(_res_conv);
30584 }
30585
30586 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
30587         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30588         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
30589         return tag_ptr(ret_conv, true);
30590 }
30591 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone_ptr(int64_t arg) {
30592         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
30593         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
30594         return ret_conv;
30595 }
30596
30597 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone(int64_t orig) {
30598         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
30599         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
30600         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
30601         return tag_ptr(ret_conv, true);
30602 }
30603
30604 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_ok(int64_t o) {
30605         LDKTransactionU16LenLimited o_conv;
30606         o_conv.inner = untag_ptr(o);
30607         o_conv.is_owned = ptr_is_owned(o);
30608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30609         o_conv = TransactionU16LenLimited_clone(&o_conv);
30610         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30611         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
30612         return tag_ptr(ret_conv, true);
30613 }
30614
30615 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_err() {
30616         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30617         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
30618         return tag_ptr(ret_conv, true);
30619 }
30620
30621 jboolean  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_is_ok(int64_t o) {
30622         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
30623         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
30624         return ret_conv;
30625 }
30626
30627 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_free(int64_t _res) {
30628         if (!ptr_is_owned(_res)) return;
30629         void* _res_ptr = untag_ptr(_res);
30630         CHECK_ACCESS(_res_ptr);
30631         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
30632         FREE(untag_ptr(_res));
30633         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
30634 }
30635
30636 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
30637         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30638         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
30639         return tag_ptr(ret_conv, true);
30640 }
30641 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(int64_t arg) {
30642         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
30643         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
30644         return ret_conv;
30645 }
30646
30647 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone(int64_t orig) {
30648         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
30649         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
30650         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
30651         return tag_ptr(ret_conv, true);
30652 }
30653
30654 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(int64_t o) {
30655         LDKTransactionU16LenLimited o_conv;
30656         o_conv.inner = untag_ptr(o);
30657         o_conv.is_owned = ptr_is_owned(o);
30658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30659         o_conv = TransactionU16LenLimited_clone(&o_conv);
30660         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30661         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
30662         return tag_ptr(ret_conv, true);
30663 }
30664
30665 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_err(int64_t e) {
30666         void* e_ptr = untag_ptr(e);
30667         CHECK_ACCESS(e_ptr);
30668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30670         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30671         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
30672         return tag_ptr(ret_conv, true);
30673 }
30674
30675 jboolean  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(int64_t o) {
30676         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
30677         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
30678         return ret_conv;
30679 }
30680
30681 void  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_free(int64_t _res) {
30682         if (!ptr_is_owned(_res)) return;
30683         void* _res_ptr = untag_ptr(_res);
30684         CHECK_ACCESS(_res_ptr);
30685         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
30686         FREE(untag_ptr(_res));
30687         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
30688 }
30689
30690 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
30691         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30692         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
30693         return tag_ptr(ret_conv, true);
30694 }
30695 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(int64_t arg) {
30696         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
30697         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
30698         return ret_conv;
30699 }
30700
30701 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(int64_t orig) {
30702         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
30703         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
30704         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
30705         return tag_ptr(ret_conv, true);
30706 }
30707
30708 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_ok(int64_t o) {
30709         LDKUntrustedString o_conv;
30710         o_conv.inner = untag_ptr(o);
30711         o_conv.is_owned = ptr_is_owned(o);
30712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30713         o_conv = UntrustedString_clone(&o_conv);
30714         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30715         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
30716         return tag_ptr(ret_conv, true);
30717 }
30718
30719 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_err(int64_t e) {
30720         void* e_ptr = untag_ptr(e);
30721         CHECK_ACCESS(e_ptr);
30722         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30723         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30724         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30725         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
30726         return tag_ptr(ret_conv, true);
30727 }
30728
30729 jboolean  CS_LDK_CResult_UntrustedStringDecodeErrorZ_is_ok(int64_t o) {
30730         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
30731         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
30732         return ret_conv;
30733 }
30734
30735 void  CS_LDK_CResult_UntrustedStringDecodeErrorZ_free(int64_t _res) {
30736         if (!ptr_is_owned(_res)) return;
30737         void* _res_ptr = untag_ptr(_res);
30738         CHECK_ACCESS(_res_ptr);
30739         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
30740         FREE(untag_ptr(_res));
30741         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
30742 }
30743
30744 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
30745         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30746         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
30747         return tag_ptr(ret_conv, true);
30748 }
30749 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone_ptr(int64_t arg) {
30750         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
30751         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
30752         return ret_conv;
30753 }
30754
30755 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone(int64_t orig) {
30756         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
30757         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
30758         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
30759         return tag_ptr(ret_conv, true);
30760 }
30761
30762 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
30763         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30764         *ret_conv = C2Tuple__u832u16Z_clone(arg);
30765         return tag_ptr(ret_conv, true);
30766 }
30767 int64_t  CS_LDK_C2Tuple__u832u16Z_clone_ptr(int64_t arg) {
30768         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
30769         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
30770         return ret_conv;
30771 }
30772
30773 int64_t  CS_LDK_C2Tuple__u832u16Z_clone(int64_t orig) {
30774         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
30775         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30776         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
30777         return tag_ptr(ret_conv, true);
30778 }
30779
30780 int64_t  CS_LDK_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
30781         LDKThirtyTwoBytes a_ref;
30782         CHECK(a->arr_len == 32);
30783         memcpy(a_ref.data, a->elems, 32); FREE(a);
30784         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
30785         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
30786         return tag_ptr(ret_conv, true);
30787 }
30788
30789 void  CS_LDK_C2Tuple__u832u16Z_free(int64_t _res) {
30790         if (!ptr_is_owned(_res)) return;
30791         void* _res_ptr = untag_ptr(_res);
30792         CHECK_ACCESS(_res_ptr);
30793         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
30794         FREE(untag_ptr(_res));
30795         C2Tuple__u832u16Z_free(_res_conv);
30796 }
30797
30798 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_ok(int64_t o) {
30799         LDKPaymentRelay o_conv;
30800         o_conv.inner = untag_ptr(o);
30801         o_conv.is_owned = ptr_is_owned(o);
30802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30803         o_conv = PaymentRelay_clone(&o_conv);
30804         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30805         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
30806         return tag_ptr(ret_conv, true);
30807 }
30808
30809 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_err(int64_t e) {
30810         void* e_ptr = untag_ptr(e);
30811         CHECK_ACCESS(e_ptr);
30812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30814         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30815         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
30816         return tag_ptr(ret_conv, true);
30817 }
30818
30819 jboolean  CS_LDK_CResult_PaymentRelayDecodeErrorZ_is_ok(int64_t o) {
30820         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
30821         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
30822         return ret_conv;
30823 }
30824
30825 void  CS_LDK_CResult_PaymentRelayDecodeErrorZ_free(int64_t _res) {
30826         if (!ptr_is_owned(_res)) return;
30827         void* _res_ptr = untag_ptr(_res);
30828         CHECK_ACCESS(_res_ptr);
30829         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
30830         FREE(untag_ptr(_res));
30831         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
30832 }
30833
30834 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
30835         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30836         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
30837         return tag_ptr(ret_conv, true);
30838 }
30839 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone_ptr(int64_t arg) {
30840         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
30841         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
30842         return ret_conv;
30843 }
30844
30845 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone(int64_t orig) {
30846         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
30847         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
30848         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
30849         return tag_ptr(ret_conv, true);
30850 }
30851
30852 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_ok(int64_t o) {
30853         LDKPaymentConstraints o_conv;
30854         o_conv.inner = untag_ptr(o);
30855         o_conv.is_owned = ptr_is_owned(o);
30856         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30857         o_conv = PaymentConstraints_clone(&o_conv);
30858         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30859         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
30860         return tag_ptr(ret_conv, true);
30861 }
30862
30863 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_err(int64_t e) {
30864         void* e_ptr = untag_ptr(e);
30865         CHECK_ACCESS(e_ptr);
30866         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30867         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30868         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30869         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
30870         return tag_ptr(ret_conv, true);
30871 }
30872
30873 jboolean  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_is_ok(int64_t o) {
30874         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
30875         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
30876         return ret_conv;
30877 }
30878
30879 void  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_free(int64_t _res) {
30880         if (!ptr_is_owned(_res)) return;
30881         void* _res_ptr = untag_ptr(_res);
30882         CHECK_ACCESS(_res_ptr);
30883         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
30884         FREE(untag_ptr(_res));
30885         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
30886 }
30887
30888 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
30889         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30890         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
30891         return tag_ptr(ret_conv, true);
30892 }
30893 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(int64_t arg) {
30894         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
30895         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
30896         return ret_conv;
30897 }
30898
30899 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone(int64_t orig) {
30900         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
30901         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
30902         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
30903         return tag_ptr(ret_conv, true);
30904 }
30905
30906 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
30907         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30908         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
30909         return tag_ptr(ret_conv, true);
30910 }
30911 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(int64_t arg) {
30912         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
30913         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
30914         return ret_conv;
30915 }
30916
30917 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(int64_t orig) {
30918         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
30919         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30920         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
30921         return tag_ptr(ret_conv, true);
30922 }
30923
30924 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, int64_t b, int64_t c) {
30925         LDKThirtyTwoBytes a_ref;
30926         CHECK(a->arr_len == 32);
30927         memcpy(a_ref.data, a->elems, 32); FREE(a);
30928         LDKRecipientOnionFields b_conv;
30929         b_conv.inner = untag_ptr(b);
30930         b_conv.is_owned = ptr_is_owned(b);
30931         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30932         b_conv = RecipientOnionFields_clone(&b_conv);
30933         LDKRouteParameters c_conv;
30934         c_conv.inner = untag_ptr(c);
30935         c_conv.is_owned = ptr_is_owned(c);
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30937         c_conv = RouteParameters_clone(&c_conv);
30938         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
30939         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
30940         return tag_ptr(ret_conv, true);
30941 }
30942
30943 void  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(int64_t _res) {
30944         if (!ptr_is_owned(_res)) return;
30945         void* _res_ptr = untag_ptr(_res);
30946         CHECK_ACCESS(_res_ptr);
30947         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
30948         FREE(untag_ptr(_res));
30949         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
30950 }
30951
30952 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(int64_t o) {
30953         void* o_ptr = untag_ptr(o);
30954         CHECK_ACCESS(o_ptr);
30955         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
30956         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
30957         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30958         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
30959         return tag_ptr(ret_conv, true);
30960 }
30961
30962 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
30963         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30964         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
30965         return tag_ptr(ret_conv, true);
30966 }
30967
30968 jboolean  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(int64_t o) {
30969         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
30970         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
30971         return ret_conv;
30972 }
30973
30974 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(int64_t _res) {
30975         if (!ptr_is_owned(_res)) return;
30976         void* _res_ptr = untag_ptr(_res);
30977         CHECK_ACCESS(_res_ptr);
30978         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
30979         FREE(untag_ptr(_res));
30980         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
30981 }
30982
30983 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
30984         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30985         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
30986         return tag_ptr(ret_conv, true);
30987 }
30988 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(int64_t arg) {
30989         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
30990         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
30991         return ret_conv;
30992 }
30993
30994 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(int64_t orig) {
30995         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
30996         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
30997         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
30998         return tag_ptr(ret_conv, true);
30999 }
31000
31001 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
31002         LDKStr o_conv = str_ref_to_owned_c(o);
31003         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31004         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
31005         return tag_ptr(ret_conv, true);
31006 }
31007
31008 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_err(int32_t e) {
31009         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
31010         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31011         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
31012         return tag_ptr(ret_conv, true);
31013 }
31014
31015 jboolean  CS_LDK_CResult_StrSecp256k1ErrorZ_is_ok(int64_t o) {
31016         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
31017         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
31018         return ret_conv;
31019 }
31020
31021 void  CS_LDK_CResult_StrSecp256k1ErrorZ_free(int64_t _res) {
31022         if (!ptr_is_owned(_res)) return;
31023         void* _res_ptr = untag_ptr(_res);
31024         CHECK_ACCESS(_res_ptr);
31025         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
31026         FREE(untag_ptr(_res));
31027         CResult_StrSecp256k1ErrorZ_free(_res_conv);
31028 }
31029
31030 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
31031         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31032         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
31033         return tag_ptr(ret_conv, true);
31034 }
31035 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone_ptr(int64_t arg) {
31036         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
31037         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
31038         return ret_conv;
31039 }
31040
31041 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone(int64_t orig) {
31042         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
31043         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
31044         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
31045         return tag_ptr(ret_conv, true);
31046 }
31047
31048 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_ok(int64_t o) {
31049         void* o_ptr = untag_ptr(o);
31050         CHECK_ACCESS(o_ptr);
31051         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
31052         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
31053         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31054         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
31055         return tag_ptr(ret_conv, true);
31056 }
31057
31058 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_err(int32_t e) {
31059         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_cs(e);
31060         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31061         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
31062         return tag_ptr(ret_conv, true);
31063 }
31064
31065 jboolean  CS_LDK_CResult_TxOutUtxoLookupErrorZ_is_ok(int64_t o) {
31066         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
31067         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
31068         return ret_conv;
31069 }
31070
31071 void  CS_LDK_CResult_TxOutUtxoLookupErrorZ_free(int64_t _res) {
31072         if (!ptr_is_owned(_res)) return;
31073         void* _res_ptr = untag_ptr(_res);
31074         CHECK_ACCESS(_res_ptr);
31075         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
31076         FREE(untag_ptr(_res));
31077         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
31078 }
31079
31080 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
31081         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31082         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
31083         return tag_ptr(ret_conv, true);
31084 }
31085 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone_ptr(int64_t arg) {
31086         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
31087         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
31088         return ret_conv;
31089 }
31090
31091 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone(int64_t orig) {
31092         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
31093         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
31094         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
31095         return tag_ptr(ret_conv, true);
31096 }
31097
31098 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
31099         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31100         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
31101         return tag_ptr(ret_conv, true);
31102 }
31103 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(int64_t arg) {
31104         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
31105         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
31106         return ret_conv;
31107 }
31108
31109 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(int64_t orig) {
31110         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
31111         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31112         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
31113         return tag_ptr(ret_conv, true);
31114 }
31115
31116 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, int64_t b, int64_t c) {
31117         LDKPublicKey a_ref;
31118         CHECK(a->arr_len == 33);
31119         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
31120         LDKOnionMessage b_conv;
31121         b_conv.inner = untag_ptr(b);
31122         b_conv.is_owned = ptr_is_owned(b);
31123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31124         b_conv = OnionMessage_clone(&b_conv);
31125         void* c_ptr = untag_ptr(c);
31126         CHECK_ACCESS(c_ptr);
31127         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
31128         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
31129         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
31130         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
31131         return tag_ptr(ret_conv, true);
31132 }
31133
31134 void  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(int64_t _res) {
31135         if (!ptr_is_owned(_res)) return;
31136         void* _res_ptr = untag_ptr(_res);
31137         CHECK_ACCESS(_res_ptr);
31138         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
31139         FREE(untag_ptr(_res));
31140         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
31141 }
31142
31143 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(int64_t o) {
31144         void* o_ptr = untag_ptr(o);
31145         CHECK_ACCESS(o_ptr);
31146         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
31147         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
31148         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
31149         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
31150         return tag_ptr(ret_conv, true);
31151 }
31152
31153 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(int64_t e) {
31154         void* e_ptr = untag_ptr(e);
31155         CHECK_ACCESS(e_ptr);
31156         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
31157         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
31158         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
31159         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
31160         return tag_ptr(ret_conv, true);
31161 }
31162
31163 jboolean  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(int64_t o) {
31164         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
31165         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
31166         return ret_conv;
31167 }
31168
31169 void  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(int64_t _res) {
31170         if (!ptr_is_owned(_res)) return;
31171         void* _res_ptr = untag_ptr(_res);
31172         CHECK_ACCESS(_res_ptr);
31173         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
31174         FREE(untag_ptr(_res));
31175         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
31176 }
31177
31178 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_ok(int64_t o) {
31179         void* o_ptr = untag_ptr(o);
31180         CHECK_ACCESS(o_ptr);
31181         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
31182         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
31183         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
31184         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
31185         return tag_ptr(ret_conv, true);
31186 }
31187
31188 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_err() {
31189         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
31190         *ret_conv = CResult_PeeledOnionNoneZ_err();
31191         return tag_ptr(ret_conv, true);
31192 }
31193
31194 jboolean  CS_LDK_CResult_PeeledOnionNoneZ_is_ok(int64_t o) {
31195         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
31196         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
31197         return ret_conv;
31198 }
31199
31200 void  CS_LDK_CResult_PeeledOnionNoneZ_free(int64_t _res) {
31201         if (!ptr_is_owned(_res)) return;
31202         void* _res_ptr = untag_ptr(_res);
31203         CHECK_ACCESS(_res_ptr);
31204         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
31205         FREE(untag_ptr(_res));
31206         CResult_PeeledOnionNoneZ_free(_res_conv);
31207 }
31208
31209 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_ok(int64_t o) {
31210         void* o_ptr = untag_ptr(o);
31211         CHECK_ACCESS(o_ptr);
31212         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
31213         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
31214         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
31215         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
31216         return tag_ptr(ret_conv, true);
31217 }
31218
31219 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_err(int64_t e) {
31220         void* e_ptr = untag_ptr(e);
31221         CHECK_ACCESS(e_ptr);
31222         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
31223         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
31224         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
31225         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
31226         return tag_ptr(ret_conv, true);
31227 }
31228
31229 jboolean  CS_LDK_CResult_SendSuccessSendErrorZ_is_ok(int64_t o) {
31230         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
31231         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
31232         return ret_conv;
31233 }
31234
31235 void  CS_LDK_CResult_SendSuccessSendErrorZ_free(int64_t _res) {
31236         if (!ptr_is_owned(_res)) return;
31237         void* _res_ptr = untag_ptr(_res);
31238         CHECK_ACCESS(_res_ptr);
31239         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
31240         FREE(untag_ptr(_res));
31241         CResult_SendSuccessSendErrorZ_free(_res_conv);
31242 }
31243
31244 int64_t  CS_LDK_CResult_BlindedPathNoneZ_ok(int64_t o) {
31245         LDKBlindedPath o_conv;
31246         o_conv.inner = untag_ptr(o);
31247         o_conv.is_owned = ptr_is_owned(o);
31248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31249         o_conv = BlindedPath_clone(&o_conv);
31250         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31251         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
31252         return tag_ptr(ret_conv, true);
31253 }
31254
31255 int64_t  CS_LDK_CResult_BlindedPathNoneZ_err() {
31256         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31257         *ret_conv = CResult_BlindedPathNoneZ_err();
31258         return tag_ptr(ret_conv, true);
31259 }
31260
31261 jboolean  CS_LDK_CResult_BlindedPathNoneZ_is_ok(int64_t o) {
31262         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
31263         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
31264         return ret_conv;
31265 }
31266
31267 void  CS_LDK_CResult_BlindedPathNoneZ_free(int64_t _res) {
31268         if (!ptr_is_owned(_res)) return;
31269         void* _res_ptr = untag_ptr(_res);
31270         CHECK_ACCESS(_res_ptr);
31271         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
31272         FREE(untag_ptr(_res));
31273         CResult_BlindedPathNoneZ_free(_res_conv);
31274 }
31275
31276 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
31277         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31278         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
31279         return tag_ptr(ret_conv, true);
31280 }
31281 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone_ptr(int64_t arg) {
31282         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
31283         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
31284         return ret_conv;
31285 }
31286
31287 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone(int64_t orig) {
31288         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
31289         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
31290         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
31291         return tag_ptr(ret_conv, true);
31292 }
31293
31294 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(int64_t o) {
31295         void* o_ptr = untag_ptr(o);
31296         CHECK_ACCESS(o_ptr);
31297         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
31298         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
31299         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31300         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
31301         return tag_ptr(ret_conv, true);
31302 }
31303
31304 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
31305         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31306         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
31307         return tag_ptr(ret_conv, true);
31308 }
31309
31310 jboolean  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(int64_t o) {
31311         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
31312         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
31313         return ret_conv;
31314 }
31315
31316 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(int64_t _res) {
31317         if (!ptr_is_owned(_res)) return;
31318         void* _res_ptr = untag_ptr(_res);
31319         CHECK_ACCESS(_res_ptr);
31320         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
31321         FREE(untag_ptr(_res));
31322         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
31323 }
31324
31325 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
31326         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31327         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
31328         return tag_ptr(ret_conv, true);
31329 }
31330 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(int64_t arg) {
31331         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
31332         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
31333         return ret_conv;
31334 }
31335
31336 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(int64_t orig) {
31337         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
31338         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
31339         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
31340         return tag_ptr(ret_conv, true);
31341 }
31342
31343 void  CS_LDK_CVec_ForwardNodeZ_free(int64_tArray _res) {
31344         LDKCVec_ForwardNodeZ _res_constr;
31345         _res_constr.datalen = _res->arr_len;
31346         if (_res_constr.datalen > 0)
31347                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
31348         else
31349                 _res_constr.data = NULL;
31350         int64_t* _res_vals = _res->elems;
31351         for (size_t n = 0; n < _res_constr.datalen; n++) {
31352                 int64_t _res_conv_13 = _res_vals[n];
31353                 LDKForwardNode _res_conv_13_conv;
31354                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
31355                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
31356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
31357                 _res_constr.data[n] = _res_conv_13_conv;
31358         }
31359         FREE(_res);
31360         CVec_ForwardNodeZ_free(_res_constr);
31361 }
31362
31363 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_ok(int64_t o) {
31364         LDKBlindedPath o_conv;
31365         o_conv.inner = untag_ptr(o);
31366         o_conv.is_owned = ptr_is_owned(o);
31367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31368         o_conv = BlindedPath_clone(&o_conv);
31369         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31370         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
31371         return tag_ptr(ret_conv, true);
31372 }
31373
31374 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_err(int64_t e) {
31375         void* e_ptr = untag_ptr(e);
31376         CHECK_ACCESS(e_ptr);
31377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31379         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31380         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
31381         return tag_ptr(ret_conv, true);
31382 }
31383
31384 jboolean  CS_LDK_CResult_BlindedPathDecodeErrorZ_is_ok(int64_t o) {
31385         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
31386         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
31387         return ret_conv;
31388 }
31389
31390 void  CS_LDK_CResult_BlindedPathDecodeErrorZ_free(int64_t _res) {
31391         if (!ptr_is_owned(_res)) return;
31392         void* _res_ptr = untag_ptr(_res);
31393         CHECK_ACCESS(_res_ptr);
31394         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
31395         FREE(untag_ptr(_res));
31396         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
31397 }
31398
31399 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
31400         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31401         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
31402         return tag_ptr(ret_conv, true);
31403 }
31404 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone_ptr(int64_t arg) {
31405         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
31406         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
31407         return ret_conv;
31408 }
31409
31410 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone(int64_t orig) {
31411         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
31412         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
31413         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
31414         return tag_ptr(ret_conv, true);
31415 }
31416
31417 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_ok(int64_t o) {
31418         LDKBlindedHop o_conv;
31419         o_conv.inner = untag_ptr(o);
31420         o_conv.is_owned = ptr_is_owned(o);
31421         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31422         o_conv = BlindedHop_clone(&o_conv);
31423         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31424         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
31425         return tag_ptr(ret_conv, true);
31426 }
31427
31428 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_err(int64_t e) {
31429         void* e_ptr = untag_ptr(e);
31430         CHECK_ACCESS(e_ptr);
31431         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31432         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31433         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31434         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
31435         return tag_ptr(ret_conv, true);
31436 }
31437
31438 jboolean  CS_LDK_CResult_BlindedHopDecodeErrorZ_is_ok(int64_t o) {
31439         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
31440         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
31441         return ret_conv;
31442 }
31443
31444 void  CS_LDK_CResult_BlindedHopDecodeErrorZ_free(int64_t _res) {
31445         if (!ptr_is_owned(_res)) return;
31446         void* _res_ptr = untag_ptr(_res);
31447         CHECK_ACCESS(_res_ptr);
31448         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
31449         FREE(untag_ptr(_res));
31450         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
31451 }
31452
31453 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
31454         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31455         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
31456         return tag_ptr(ret_conv, true);
31457 }
31458 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone_ptr(int64_t arg) {
31459         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
31460         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
31461         return ret_conv;
31462 }
31463
31464 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone(int64_t orig) {
31465         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
31466         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
31467         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
31468         return tag_ptr(ret_conv, true);
31469 }
31470
31471 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_ok(int64_t o) {
31472         LDKInvoiceError o_conv;
31473         o_conv.inner = untag_ptr(o);
31474         o_conv.is_owned = ptr_is_owned(o);
31475         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31476         o_conv = InvoiceError_clone(&o_conv);
31477         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31478         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
31479         return tag_ptr(ret_conv, true);
31480 }
31481
31482 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_err(int64_t e) {
31483         void* e_ptr = untag_ptr(e);
31484         CHECK_ACCESS(e_ptr);
31485         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31486         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31487         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31488         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
31489         return tag_ptr(ret_conv, true);
31490 }
31491
31492 jboolean  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_is_ok(int64_t o) {
31493         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
31494         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
31495         return ret_conv;
31496 }
31497
31498 void  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_free(int64_t _res) {
31499         if (!ptr_is_owned(_res)) return;
31500         void* _res_ptr = untag_ptr(_res);
31501         CHECK_ACCESS(_res_ptr);
31502         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
31503         FREE(untag_ptr(_res));
31504         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
31505 }
31506
31507 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
31508         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31509         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
31510         return tag_ptr(ret_conv, true);
31511 }
31512 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(int64_t arg) {
31513         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
31514         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
31515         return ret_conv;
31516 }
31517
31518 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone(int64_t orig) {
31519         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
31520         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
31521         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
31522         return tag_ptr(ret_conv, true);
31523 }
31524
31525 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(int64_t o) {
31526         LDKDelayedPaymentBasepoint o_conv;
31527         o_conv.inner = untag_ptr(o);
31528         o_conv.is_owned = ptr_is_owned(o);
31529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31530         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
31531         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31532         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
31533         return tag_ptr(ret_conv, true);
31534 }
31535
31536 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_err(int64_t e) {
31537         void* e_ptr = untag_ptr(e);
31538         CHECK_ACCESS(e_ptr);
31539         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31540         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31541         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31542         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
31543         return tag_ptr(ret_conv, true);
31544 }
31545
31546 jboolean  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(int64_t o) {
31547         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
31548         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
31549         return ret_conv;
31550 }
31551
31552 void  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_free(int64_t _res) {
31553         if (!ptr_is_owned(_res)) return;
31554         void* _res_ptr = untag_ptr(_res);
31555         CHECK_ACCESS(_res_ptr);
31556         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
31557         FREE(untag_ptr(_res));
31558         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
31559 }
31560
31561 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
31562         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31563         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
31564         return tag_ptr(ret_conv, true);
31565 }
31566 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31567         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
31568         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
31569         return ret_conv;
31570 }
31571
31572 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(int64_t orig) {
31573         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
31574         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
31575         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
31576         return tag_ptr(ret_conv, true);
31577 }
31578
31579 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_ok(int64_t o) {
31580         LDKDelayedPaymentKey o_conv;
31581         o_conv.inner = untag_ptr(o);
31582         o_conv.is_owned = ptr_is_owned(o);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31584         o_conv = DelayedPaymentKey_clone(&o_conv);
31585         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31586         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
31587         return tag_ptr(ret_conv, true);
31588 }
31589
31590 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_err(int64_t e) {
31591         void* e_ptr = untag_ptr(e);
31592         CHECK_ACCESS(e_ptr);
31593         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31594         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31595         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31596         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
31597         return tag_ptr(ret_conv, true);
31598 }
31599
31600 jboolean  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(int64_t o) {
31601         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
31602         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
31603         return ret_conv;
31604 }
31605
31606 void  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_free(int64_t _res) {
31607         if (!ptr_is_owned(_res)) return;
31608         void* _res_ptr = untag_ptr(_res);
31609         CHECK_ACCESS(_res_ptr);
31610         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
31611         FREE(untag_ptr(_res));
31612         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
31613 }
31614
31615 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
31616         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31617         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
31618         return tag_ptr(ret_conv, true);
31619 }
31620 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31621         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
31622         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
31623         return ret_conv;
31624 }
31625
31626 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone(int64_t orig) {
31627         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
31628         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
31629         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
31630         return tag_ptr(ret_conv, true);
31631 }
31632
31633 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_ok(int64_t o) {
31634         LDKHtlcBasepoint o_conv;
31635         o_conv.inner = untag_ptr(o);
31636         o_conv.is_owned = ptr_is_owned(o);
31637         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31638         o_conv = HtlcBasepoint_clone(&o_conv);
31639         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31640         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
31641         return tag_ptr(ret_conv, true);
31642 }
31643
31644 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_err(int64_t e) {
31645         void* e_ptr = untag_ptr(e);
31646         CHECK_ACCESS(e_ptr);
31647         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31648         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31649         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31650         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
31651         return tag_ptr(ret_conv, true);
31652 }
31653
31654 jboolean  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_is_ok(int64_t o) {
31655         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
31656         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
31657         return ret_conv;
31658 }
31659
31660 void  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_free(int64_t _res) {
31661         if (!ptr_is_owned(_res)) return;
31662         void* _res_ptr = untag_ptr(_res);
31663         CHECK_ACCESS(_res_ptr);
31664         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
31665         FREE(untag_ptr(_res));
31666         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
31667 }
31668
31669 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
31670         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31671         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
31672         return tag_ptr(ret_conv, true);
31673 }
31674 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31675         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
31676         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
31677         return ret_conv;
31678 }
31679
31680 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone(int64_t orig) {
31681         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
31682         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
31683         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
31684         return tag_ptr(ret_conv, true);
31685 }
31686
31687 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_ok(int64_t o) {
31688         LDKHtlcKey o_conv;
31689         o_conv.inner = untag_ptr(o);
31690         o_conv.is_owned = ptr_is_owned(o);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31692         o_conv = HtlcKey_clone(&o_conv);
31693         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31694         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
31695         return tag_ptr(ret_conv, true);
31696 }
31697
31698 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_err(int64_t e) {
31699         void* e_ptr = untag_ptr(e);
31700         CHECK_ACCESS(e_ptr);
31701         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31702         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31703         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31704         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
31705         return tag_ptr(ret_conv, true);
31706 }
31707
31708 jboolean  CS_LDK_CResult_HtlcKeyDecodeErrorZ_is_ok(int64_t o) {
31709         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
31710         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
31711         return ret_conv;
31712 }
31713
31714 void  CS_LDK_CResult_HtlcKeyDecodeErrorZ_free(int64_t _res) {
31715         if (!ptr_is_owned(_res)) return;
31716         void* _res_ptr = untag_ptr(_res);
31717         CHECK_ACCESS(_res_ptr);
31718         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
31719         FREE(untag_ptr(_res));
31720         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
31721 }
31722
31723 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
31724         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31725         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
31726         return tag_ptr(ret_conv, true);
31727 }
31728 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31729         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
31730         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
31731         return ret_conv;
31732 }
31733
31734 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone(int64_t orig) {
31735         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
31736         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
31737         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
31738         return tag_ptr(ret_conv, true);
31739 }
31740
31741 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_ok(int64_t o) {
31742         LDKRevocationBasepoint o_conv;
31743         o_conv.inner = untag_ptr(o);
31744         o_conv.is_owned = ptr_is_owned(o);
31745         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31746         o_conv = RevocationBasepoint_clone(&o_conv);
31747         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31748         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
31749         return tag_ptr(ret_conv, true);
31750 }
31751
31752 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_err(int64_t e) {
31753         void* e_ptr = untag_ptr(e);
31754         CHECK_ACCESS(e_ptr);
31755         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31756         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31757         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31758         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
31759         return tag_ptr(ret_conv, true);
31760 }
31761
31762 jboolean  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_is_ok(int64_t o) {
31763         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
31764         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
31765         return ret_conv;
31766 }
31767
31768 void  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_free(int64_t _res) {
31769         if (!ptr_is_owned(_res)) return;
31770         void* _res_ptr = untag_ptr(_res);
31771         CHECK_ACCESS(_res_ptr);
31772         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
31773         FREE(untag_ptr(_res));
31774         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
31775 }
31776
31777 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
31778         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31779         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
31780         return tag_ptr(ret_conv, true);
31781 }
31782 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
31783         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
31784         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
31785         return ret_conv;
31786 }
31787
31788 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone(int64_t orig) {
31789         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
31790         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
31791         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
31792         return tag_ptr(ret_conv, true);
31793 }
31794
31795 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_ok(int64_t o) {
31796         LDKRevocationKey o_conv;
31797         o_conv.inner = untag_ptr(o);
31798         o_conv.is_owned = ptr_is_owned(o);
31799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31800         o_conv = RevocationKey_clone(&o_conv);
31801         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31802         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
31803         return tag_ptr(ret_conv, true);
31804 }
31805
31806 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_err(int64_t e) {
31807         void* e_ptr = untag_ptr(e);
31808         CHECK_ACCESS(e_ptr);
31809         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31810         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31811         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31812         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
31813         return tag_ptr(ret_conv, true);
31814 }
31815
31816 jboolean  CS_LDK_CResult_RevocationKeyDecodeErrorZ_is_ok(int64_t o) {
31817         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
31818         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
31819         return ret_conv;
31820 }
31821
31822 void  CS_LDK_CResult_RevocationKeyDecodeErrorZ_free(int64_t _res) {
31823         if (!ptr_is_owned(_res)) return;
31824         void* _res_ptr = untag_ptr(_res);
31825         CHECK_ACCESS(_res_ptr);
31826         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
31827         FREE(untag_ptr(_res));
31828         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
31829 }
31830
31831 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
31832         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31833         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
31834         return tag_ptr(ret_conv, true);
31835 }
31836 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone_ptr(int64_t arg) {
31837         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
31838         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
31839         return ret_conv;
31840 }
31841
31842 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone(int64_t orig) {
31843         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
31844         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
31845         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
31846         return tag_ptr(ret_conv, true);
31847 }
31848
31849 int64_t  CS_LDK_COption_FilterZ_some(int64_t o) {
31850         void* o_ptr = untag_ptr(o);
31851         CHECK_ACCESS(o_ptr);
31852         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
31853         if (o_conv.free == LDKFilter_JCalls_free) {
31854                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31855                 LDKFilter_JCalls_cloned(&o_conv);
31856         }
31857         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31858         *ret_copy = COption_FilterZ_some(o_conv);
31859         int64_t ret_ref = tag_ptr(ret_copy, true);
31860         return ret_ref;
31861 }
31862
31863 int64_t  CS_LDK_COption_FilterZ_none() {
31864         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
31865         *ret_copy = COption_FilterZ_none();
31866         int64_t ret_ref = tag_ptr(ret_copy, true);
31867         return ret_ref;
31868 }
31869
31870 void  CS_LDK_COption_FilterZ_free(int64_t _res) {
31871         if (!ptr_is_owned(_res)) return;
31872         void* _res_ptr = untag_ptr(_res);
31873         CHECK_ACCESS(_res_ptr);
31874         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
31875         FREE(untag_ptr(_res));
31876         COption_FilterZ_free(_res_conv);
31877 }
31878
31879 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_ok(int64_t o) {
31880         LDKLockedChannelMonitor o_conv;
31881         o_conv.inner = untag_ptr(o);
31882         o_conv.is_owned = ptr_is_owned(o);
31883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31884         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
31885         
31886         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31887         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
31888         return tag_ptr(ret_conv, true);
31889 }
31890
31891 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_err() {
31892         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
31893         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
31894         return tag_ptr(ret_conv, true);
31895 }
31896
31897 jboolean  CS_LDK_CResult_LockedChannelMonitorNoneZ_is_ok(int64_t o) {
31898         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
31899         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
31900         return ret_conv;
31901 }
31902
31903 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_free(int64_t _res) {
31904         if (!ptr_is_owned(_res)) return;
31905         void* _res_ptr = untag_ptr(_res);
31906         CHECK_ACCESS(_res_ptr);
31907         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
31908         FREE(untag_ptr(_res));
31909         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
31910 }
31911
31912 void  CS_LDK_CVec_OutPointZ_free(int64_tArray _res) {
31913         LDKCVec_OutPointZ _res_constr;
31914         _res_constr.datalen = _res->arr_len;
31915         if (_res_constr.datalen > 0)
31916                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
31917         else
31918                 _res_constr.data = NULL;
31919         int64_t* _res_vals = _res->elems;
31920         for (size_t k = 0; k < _res_constr.datalen; k++) {
31921                 int64_t _res_conv_10 = _res_vals[k];
31922                 LDKOutPoint _res_conv_10_conv;
31923                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
31924                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
31925                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
31926                 _res_constr.data[k] = _res_conv_10_conv;
31927         }
31928         FREE(_res);
31929         CVec_OutPointZ_free(_res_constr);
31930 }
31931
31932 void  CS_LDK_CVec_MonitorUpdateIdZ_free(int64_tArray _res) {
31933         LDKCVec_MonitorUpdateIdZ _res_constr;
31934         _res_constr.datalen = _res->arr_len;
31935         if (_res_constr.datalen > 0)
31936                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31937         else
31938                 _res_constr.data = NULL;
31939         int64_t* _res_vals = _res->elems;
31940         for (size_t r = 0; r < _res_constr.datalen; r++) {
31941                 int64_t _res_conv_17 = _res_vals[r];
31942                 LDKMonitorUpdateId _res_conv_17_conv;
31943                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
31944                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
31945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
31946                 _res_constr.data[r] = _res_conv_17_conv;
31947         }
31948         FREE(_res);
31949         CVec_MonitorUpdateIdZ_free(_res_constr);
31950 }
31951
31952 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
31953         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31954         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
31955         return tag_ptr(ret_conv, true);
31956 }
31957 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(int64_t arg) {
31958         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
31959         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
31960         return ret_conv;
31961 }
31962
31963 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(int64_t orig) {
31964         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
31965         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31966         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
31967         return tag_ptr(ret_conv, true);
31968 }
31969
31970 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(int64_t a, int64_tArray b) {
31971         LDKOutPoint a_conv;
31972         a_conv.inner = untag_ptr(a);
31973         a_conv.is_owned = ptr_is_owned(a);
31974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31975         a_conv = OutPoint_clone(&a_conv);
31976         LDKCVec_MonitorUpdateIdZ b_constr;
31977         b_constr.datalen = b->arr_len;
31978         if (b_constr.datalen > 0)
31979                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
31980         else
31981                 b_constr.data = NULL;
31982         int64_t* b_vals = b->elems;
31983         for (size_t r = 0; r < b_constr.datalen; r++) {
31984                 int64_t b_conv_17 = b_vals[r];
31985                 LDKMonitorUpdateId b_conv_17_conv;
31986                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
31987                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
31988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
31989                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
31990                 b_constr.data[r] = b_conv_17_conv;
31991         }
31992         FREE(b);
31993         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
31994         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
31995         return tag_ptr(ret_conv, true);
31996 }
31997
31998 void  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(int64_t _res) {
31999         if (!ptr_is_owned(_res)) return;
32000         void* _res_ptr = untag_ptr(_res);
32001         CHECK_ACCESS(_res_ptr);
32002         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
32003         FREE(untag_ptr(_res));
32004         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
32005 }
32006
32007 void  CS_LDK_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(int64_tArray _res) {
32008         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
32009         _res_constr.datalen = _res->arr_len;
32010         if (_res_constr.datalen > 0)
32011                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
32012         else
32013                 _res_constr.data = NULL;
32014         int64_t* _res_vals = _res->elems;
32015         for (size_t p = 0; p < _res_constr.datalen; p++) {
32016                 int64_t _res_conv_41 = _res_vals[p];
32017                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
32018                 CHECK_ACCESS(_res_conv_41_ptr);
32019                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
32020                 FREE(untag_ptr(_res_conv_41));
32021                 _res_constr.data[p] = _res_conv_41_conv;
32022         }
32023         FREE(_res);
32024         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
32025 }
32026
32027 void  CS_LDK_APIError_free(int64_t this_ptr) {
32028         if (!ptr_is_owned(this_ptr)) return;
32029         void* this_ptr_ptr = untag_ptr(this_ptr);
32030         CHECK_ACCESS(this_ptr_ptr);
32031         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
32032         FREE(untag_ptr(this_ptr));
32033         APIError_free(this_ptr_conv);
32034 }
32035
32036 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
32037         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32038         *ret_copy = APIError_clone(arg);
32039         int64_t ret_ref = tag_ptr(ret_copy, true);
32040         return ret_ref;
32041 }
32042 int64_t  CS_LDK_APIError_clone_ptr(int64_t arg) {
32043         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
32044         int64_t ret_conv = APIError_clone_ptr(arg_conv);
32045         return ret_conv;
32046 }
32047
32048 int64_t  CS_LDK_APIError_clone(int64_t orig) {
32049         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
32050         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32051         *ret_copy = APIError_clone(orig_conv);
32052         int64_t ret_ref = tag_ptr(ret_copy, true);
32053         return ret_ref;
32054 }
32055
32056 int64_t  CS_LDK_APIError_apimisuse_error(jstring err) {
32057         LDKStr err_conv = str_ref_to_owned_c(err);
32058         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32059         *ret_copy = APIError_apimisuse_error(err_conv);
32060         int64_t ret_ref = tag_ptr(ret_copy, true);
32061         return ret_ref;
32062 }
32063
32064 int64_t  CS_LDK_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
32065         LDKStr err_conv = str_ref_to_owned_c(err);
32066         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32067         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
32068         int64_t ret_ref = tag_ptr(ret_copy, true);
32069         return ret_ref;
32070 }
32071
32072 int64_t  CS_LDK_APIError_invalid_route(jstring err) {
32073         LDKStr err_conv = str_ref_to_owned_c(err);
32074         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32075         *ret_copy = APIError_invalid_route(err_conv);
32076         int64_t ret_ref = tag_ptr(ret_copy, true);
32077         return ret_ref;
32078 }
32079
32080 int64_t  CS_LDK_APIError_channel_unavailable(jstring err) {
32081         LDKStr err_conv = str_ref_to_owned_c(err);
32082         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32083         *ret_copy = APIError_channel_unavailable(err_conv);
32084         int64_t ret_ref = tag_ptr(ret_copy, true);
32085         return ret_ref;
32086 }
32087
32088 int64_t  CS_LDK_APIError_monitor_update_in_progress() {
32089         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32090         *ret_copy = APIError_monitor_update_in_progress();
32091         int64_t ret_ref = tag_ptr(ret_copy, true);
32092         return ret_ref;
32093 }
32094
32095 int64_t  CS_LDK_APIError_incompatible_shutdown_script(int64_t script) {
32096         LDKShutdownScript script_conv;
32097         script_conv.inner = untag_ptr(script);
32098         script_conv.is_owned = ptr_is_owned(script);
32099         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
32100         script_conv = ShutdownScript_clone(&script_conv);
32101         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32102         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
32103         int64_t ret_ref = tag_ptr(ret_copy, true);
32104         return ret_ref;
32105 }
32106
32107 jboolean  CS_LDK_APIError_eq(int64_t a, int64_t b) {
32108         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
32109         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
32110         jboolean ret_conv = APIError_eq(a_conv, b_conv);
32111         return ret_conv;
32112 }
32113
32114 int8_tArray  CS_LDK_APIError_write(int64_t obj) {
32115         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
32116         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
32117         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32118         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32119         CVec_u8Z_free(ret_var);
32120         return ret_arr;
32121 }
32122
32123 int64_t  CS_LDK_APIError_read(int8_tArray ser) {
32124         LDKu8slice ser_ref;
32125         ser_ref.datalen = ser->arr_len;
32126         ser_ref.data = ser->elems;
32127         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
32128         *ret_conv = APIError_read(ser_ref);
32129         FREE(ser);
32130         return tag_ptr(ret_conv, true);
32131 }
32132
32133 void  CS_LDK_BigSize_free(int64_t this_obj) {
32134         LDKBigSize this_obj_conv;
32135         this_obj_conv.inner = untag_ptr(this_obj);
32136         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32138         BigSize_free(this_obj_conv);
32139 }
32140
32141 int64_t  CS_LDK_BigSize_get_a(int64_t this_ptr) {
32142         LDKBigSize this_ptr_conv;
32143         this_ptr_conv.inner = untag_ptr(this_ptr);
32144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32146         this_ptr_conv.is_owned = false;
32147         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
32148         return ret_conv;
32149 }
32150
32151 void  CS_LDK_BigSize_set_a(int64_t this_ptr, int64_t val) {
32152         LDKBigSize this_ptr_conv;
32153         this_ptr_conv.inner = untag_ptr(this_ptr);
32154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32156         this_ptr_conv.is_owned = false;
32157         BigSize_set_a(&this_ptr_conv, val);
32158 }
32159
32160 int64_t  CS_LDK_BigSize_new(int64_t a_arg) {
32161         LDKBigSize ret_var = BigSize_new(a_arg);
32162         int64_t ret_ref = 0;
32163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32165         return ret_ref;
32166 }
32167
32168 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
32169         LDKBigSize ret_var = BigSize_clone(arg);
32170         int64_t ret_ref = 0;
32171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32173         return ret_ref;
32174 }
32175 int64_t  CS_LDK_BigSize_clone_ptr(int64_t arg) {
32176         LDKBigSize arg_conv;
32177         arg_conv.inner = untag_ptr(arg);
32178         arg_conv.is_owned = ptr_is_owned(arg);
32179         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32180         arg_conv.is_owned = false;
32181         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
32182         return ret_conv;
32183 }
32184
32185 int64_t  CS_LDK_BigSize_clone(int64_t orig) {
32186         LDKBigSize orig_conv;
32187         orig_conv.inner = untag_ptr(orig);
32188         orig_conv.is_owned = ptr_is_owned(orig);
32189         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32190         orig_conv.is_owned = false;
32191         LDKBigSize ret_var = BigSize_clone(&orig_conv);
32192         int64_t ret_ref = 0;
32193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32195         return ret_ref;
32196 }
32197
32198 int64_t  CS_LDK_BigSize_hash(int64_t o) {
32199         LDKBigSize o_conv;
32200         o_conv.inner = untag_ptr(o);
32201         o_conv.is_owned = ptr_is_owned(o);
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32203         o_conv.is_owned = false;
32204         int64_t ret_conv = BigSize_hash(&o_conv);
32205         return ret_conv;
32206 }
32207
32208 jboolean  CS_LDK_BigSize_eq(int64_t a, int64_t b) {
32209         LDKBigSize a_conv;
32210         a_conv.inner = untag_ptr(a);
32211         a_conv.is_owned = ptr_is_owned(a);
32212         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32213         a_conv.is_owned = false;
32214         LDKBigSize b_conv;
32215         b_conv.inner = untag_ptr(b);
32216         b_conv.is_owned = ptr_is_owned(b);
32217         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32218         b_conv.is_owned = false;
32219         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
32220         return ret_conv;
32221 }
32222
32223 int8_tArray  CS_LDK_BigSize_write(int64_t obj) {
32224         LDKBigSize obj_conv;
32225         obj_conv.inner = untag_ptr(obj);
32226         obj_conv.is_owned = ptr_is_owned(obj);
32227         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32228         obj_conv.is_owned = false;
32229         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
32230         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32231         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32232         CVec_u8Z_free(ret_var);
32233         return ret_arr;
32234 }
32235
32236 int64_t  CS_LDK_BigSize_read(int8_tArray ser) {
32237         LDKu8slice ser_ref;
32238         ser_ref.datalen = ser->arr_len;
32239         ser_ref.data = ser->elems;
32240         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32241         *ret_conv = BigSize_read(ser_ref);
32242         FREE(ser);
32243         return tag_ptr(ret_conv, true);
32244 }
32245
32246 void  CS_LDK_Hostname_free(int64_t this_obj) {
32247         LDKHostname this_obj_conv;
32248         this_obj_conv.inner = untag_ptr(this_obj);
32249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32251         Hostname_free(this_obj_conv);
32252 }
32253
32254 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
32255         LDKHostname ret_var = Hostname_clone(arg);
32256         int64_t ret_ref = 0;
32257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32259         return ret_ref;
32260 }
32261 int64_t  CS_LDK_Hostname_clone_ptr(int64_t arg) {
32262         LDKHostname arg_conv;
32263         arg_conv.inner = untag_ptr(arg);
32264         arg_conv.is_owned = ptr_is_owned(arg);
32265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32266         arg_conv.is_owned = false;
32267         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
32268         return ret_conv;
32269 }
32270
32271 int64_t  CS_LDK_Hostname_clone(int64_t orig) {
32272         LDKHostname orig_conv;
32273         orig_conv.inner = untag_ptr(orig);
32274         orig_conv.is_owned = ptr_is_owned(orig);
32275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32276         orig_conv.is_owned = false;
32277         LDKHostname ret_var = Hostname_clone(&orig_conv);
32278         int64_t ret_ref = 0;
32279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32281         return ret_ref;
32282 }
32283
32284 int64_t  CS_LDK_Hostname_hash(int64_t o) {
32285         LDKHostname o_conv;
32286         o_conv.inner = untag_ptr(o);
32287         o_conv.is_owned = ptr_is_owned(o);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32289         o_conv.is_owned = false;
32290         int64_t ret_conv = Hostname_hash(&o_conv);
32291         return ret_conv;
32292 }
32293
32294 jboolean  CS_LDK_Hostname_eq(int64_t a, int64_t b) {
32295         LDKHostname a_conv;
32296         a_conv.inner = untag_ptr(a);
32297         a_conv.is_owned = ptr_is_owned(a);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32299         a_conv.is_owned = false;
32300         LDKHostname b_conv;
32301         b_conv.inner = untag_ptr(b);
32302         b_conv.is_owned = ptr_is_owned(b);
32303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32304         b_conv.is_owned = false;
32305         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32306         return ret_conv;
32307 }
32308
32309 int8_t  CS_LDK_Hostname_len(int64_t this_arg) {
32310         LDKHostname this_arg_conv;
32311         this_arg_conv.inner = untag_ptr(this_arg);
32312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32314         this_arg_conv.is_owned = false;
32315         int8_t ret_conv = Hostname_len(&this_arg_conv);
32316         return ret_conv;
32317 }
32318
32319 int8_tArray  CS_LDK_Hostname_write(int64_t obj) {
32320         LDKHostname obj_conv;
32321         obj_conv.inner = untag_ptr(obj);
32322         obj_conv.is_owned = ptr_is_owned(obj);
32323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32324         obj_conv.is_owned = false;
32325         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32328         CVec_u8Z_free(ret_var);
32329         return ret_arr;
32330 }
32331
32332 int64_t  CS_LDK_Hostname_read(int8_tArray ser) {
32333         LDKu8slice ser_ref;
32334         ser_ref.datalen = ser->arr_len;
32335         ser_ref.data = ser->elems;
32336         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32337         *ret_conv = Hostname_read(ser_ref);
32338         FREE(ser);
32339         return tag_ptr(ret_conv, true);
32340 }
32341
32342 void  CS_LDK_TransactionU16LenLimited_free(int64_t this_obj) {
32343         LDKTransactionU16LenLimited this_obj_conv;
32344         this_obj_conv.inner = untag_ptr(this_obj);
32345         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32347         TransactionU16LenLimited_free(this_obj_conv);
32348 }
32349
32350 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32351         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32352         int64_t ret_ref = 0;
32353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32355         return ret_ref;
32356 }
32357 int64_t  CS_LDK_TransactionU16LenLimited_clone_ptr(int64_t arg) {
32358         LDKTransactionU16LenLimited arg_conv;
32359         arg_conv.inner = untag_ptr(arg);
32360         arg_conv.is_owned = ptr_is_owned(arg);
32361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32362         arg_conv.is_owned = false;
32363         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32364         return ret_conv;
32365 }
32366
32367 int64_t  CS_LDK_TransactionU16LenLimited_clone(int64_t orig) {
32368         LDKTransactionU16LenLimited orig_conv;
32369         orig_conv.inner = untag_ptr(orig);
32370         orig_conv.is_owned = ptr_is_owned(orig);
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32372         orig_conv.is_owned = false;
32373         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32374         int64_t ret_ref = 0;
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32377         return ret_ref;
32378 }
32379
32380 int64_t  CS_LDK_TransactionU16LenLimited_hash(int64_t o) {
32381         LDKTransactionU16LenLimited o_conv;
32382         o_conv.inner = untag_ptr(o);
32383         o_conv.is_owned = ptr_is_owned(o);
32384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32385         o_conv.is_owned = false;
32386         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
32387         return ret_conv;
32388 }
32389
32390 jboolean  CS_LDK_TransactionU16LenLimited_eq(int64_t a, int64_t b) {
32391         LDKTransactionU16LenLimited a_conv;
32392         a_conv.inner = untag_ptr(a);
32393         a_conv.is_owned = ptr_is_owned(a);
32394         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32395         a_conv.is_owned = false;
32396         LDKTransactionU16LenLimited b_conv;
32397         b_conv.inner = untag_ptr(b);
32398         b_conv.is_owned = ptr_is_owned(b);
32399         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32400         b_conv.is_owned = false;
32401         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32402         return ret_conv;
32403 }
32404
32405 int64_t  CS_LDK_TransactionU16LenLimited_new(int8_tArray transaction) {
32406         LDKTransaction transaction_ref;
32407         transaction_ref.datalen = transaction->arr_len;
32408         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32409         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
32410         transaction_ref.data_is_owned = true;
32411         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32412         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32413         return tag_ptr(ret_conv, true);
32414 }
32415
32416 int8_tArray  CS_LDK_TransactionU16LenLimited_into_transaction(int64_t this_arg) {
32417         LDKTransactionU16LenLimited this_arg_conv;
32418         this_arg_conv.inner = untag_ptr(this_arg);
32419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32421         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32422         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32423         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32424         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32425         Transaction_free(ret_var);
32426         return ret_arr;
32427 }
32428
32429 int8_tArray  CS_LDK_TransactionU16LenLimited_write(int64_t obj) {
32430         LDKTransactionU16LenLimited obj_conv;
32431         obj_conv.inner = untag_ptr(obj);
32432         obj_conv.is_owned = ptr_is_owned(obj);
32433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32434         obj_conv.is_owned = false;
32435         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32436         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32437         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32438         CVec_u8Z_free(ret_var);
32439         return ret_arr;
32440 }
32441
32442 int64_t  CS_LDK_TransactionU16LenLimited_read(int8_tArray ser) {
32443         LDKu8slice ser_ref;
32444         ser_ref.datalen = ser->arr_len;
32445         ser_ref.data = ser->elems;
32446         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32447         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32448         FREE(ser);
32449         return tag_ptr(ret_conv, true);
32450 }
32451
32452 int64_t  CS_LDK_sign(int8_tArray msg, int8_tArray sk) {
32453         LDKu8slice msg_ref;
32454         msg_ref.datalen = msg->arr_len;
32455         msg_ref.data = msg->elems;
32456         uint8_t sk_arr[32];
32457         CHECK(sk->arr_len == 32);
32458         memcpy(sk_arr, sk->elems, 32); FREE(sk);
32459         uint8_t (*sk_ref)[32] = &sk_arr;
32460         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
32461         *ret_conv = sign(msg_ref, sk_ref);
32462         FREE(msg);
32463         return tag_ptr(ret_conv, true);
32464 }
32465
32466 int64_t  CS_LDK_recover_pk(int8_tArray msg, jstring sig) {
32467         LDKu8slice msg_ref;
32468         msg_ref.datalen = msg->arr_len;
32469         msg_ref.data = msg->elems;
32470         LDKStr sig_conv = str_ref_to_owned_c(sig);
32471         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
32472         *ret_conv = recover_pk(msg_ref, sig_conv);
32473         FREE(msg);
32474         return tag_ptr(ret_conv, true);
32475 }
32476
32477 jboolean  CS_LDK_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
32478         LDKu8slice msg_ref;
32479         msg_ref.datalen = msg->arr_len;
32480         msg_ref.data = msg->elems;
32481         LDKStr sig_conv = str_ref_to_owned_c(sig);
32482         LDKPublicKey pk_ref;
32483         CHECK(pk->arr_len == 33);
32484         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
32485         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32486         FREE(msg);
32487         return ret_conv;
32488 }
32489
32490 int8_tArray  CS_LDK_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
32491         LDKu8slice hrp_bytes_ref;
32492         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
32493         hrp_bytes_ref.data = hrp_bytes->elems;
32494         LDKCVec_U5Z data_without_signature_constr;
32495         data_without_signature_constr.datalen = data_without_signature->arr_len;
32496         if (data_without_signature_constr.datalen > 0)
32497                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
32498         else
32499                 data_without_signature_constr.data = NULL;
32500         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
32501         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
32502                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
32503                 
32504                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
32505         }
32506         FREE(data_without_signature);
32507         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
32508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32510         CVec_u8Z_free(ret_var);
32511         FREE(hrp_bytes);
32512         return ret_arr;
32513 }
32514
32515 void  CS_LDK_KVStore_free(int64_t this_ptr) {
32516         if (!ptr_is_owned(this_ptr)) return;
32517         void* this_ptr_ptr = untag_ptr(this_ptr);
32518         CHECK_ACCESS(this_ptr_ptr);
32519         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
32520         FREE(untag_ptr(this_ptr));
32521         KVStore_free(this_ptr_conv);
32522 }
32523
32524 void  CS_LDK_Persister_free(int64_t this_ptr) {
32525         if (!ptr_is_owned(this_ptr)) return;
32526         void* this_ptr_ptr = untag_ptr(this_ptr);
32527         CHECK_ACCESS(this_ptr_ptr);
32528         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
32529         FREE(untag_ptr(this_ptr));
32530         Persister_free(this_ptr_conv);
32531 }
32532
32533 int64_t  CS_LDK_read_channel_monitors(int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
32534         void* kv_store_ptr = untag_ptr(kv_store);
32535         CHECK_ACCESS(kv_store_ptr);
32536         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32537         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32538                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32539                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32540         }
32541         void* entropy_source_ptr = untag_ptr(entropy_source);
32542         CHECK_ACCESS(entropy_source_ptr);
32543         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32544         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32545                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32546                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32547         }
32548         void* signer_provider_ptr = untag_ptr(signer_provider);
32549         CHECK_ACCESS(signer_provider_ptr);
32550         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32551         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32552                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32553                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32554         }
32555         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32556         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
32557         return tag_ptr(ret_conv, true);
32558 }
32559
32560 void  CS_LDK_MonitorUpdatingPersister_free(int64_t this_obj) {
32561         LDKMonitorUpdatingPersister this_obj_conv;
32562         this_obj_conv.inner = untag_ptr(this_obj);
32563         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32565         MonitorUpdatingPersister_free(this_obj_conv);
32566 }
32567
32568 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) {
32569         void* kv_store_ptr = untag_ptr(kv_store);
32570         CHECK_ACCESS(kv_store_ptr);
32571         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
32572         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
32573                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32574                 LDKKVStore_JCalls_cloned(&kv_store_conv);
32575         }
32576         void* logger_ptr = untag_ptr(logger);
32577         CHECK_ACCESS(logger_ptr);
32578         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32579         if (logger_conv.free == LDKLogger_JCalls_free) {
32580                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32581                 LDKLogger_JCalls_cloned(&logger_conv);
32582         }
32583         void* entropy_source_ptr = untag_ptr(entropy_source);
32584         CHECK_ACCESS(entropy_source_ptr);
32585         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32586         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32587                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32588                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32589         }
32590         void* signer_provider_ptr = untag_ptr(signer_provider);
32591         CHECK_ACCESS(signer_provider_ptr);
32592         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32593         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32594                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32595                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32596         }
32597         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
32598         int64_t ret_ref = 0;
32599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32601         return ret_ref;
32602 }
32603
32604 int64_t  CS_LDK_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
32605         LDKMonitorUpdatingPersister this_arg_conv;
32606         this_arg_conv.inner = untag_ptr(this_arg);
32607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32609         this_arg_conv.is_owned = false;
32610         void* broadcaster_ptr = untag_ptr(broadcaster);
32611         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32612         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32613         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32614         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32615         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32616         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32617         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
32618         return tag_ptr(ret_conv, true);
32619 }
32620
32621 int64_t  CS_LDK_MonitorUpdatingPersister_read_channel_monitor_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
32622         LDKMonitorUpdatingPersister this_arg_conv;
32623         this_arg_conv.inner = untag_ptr(this_arg);
32624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32626         this_arg_conv.is_owned = false;
32627         void* broadcaster_ptr = untag_ptr(broadcaster);
32628         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
32629         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
32630         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32631         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
32632         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
32633         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
32634         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32635         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
32636         return tag_ptr(ret_conv, true);
32637 }
32638
32639 int64_t  CS_LDK_MonitorUpdatingPersister_cleanup_stale_updates(int64_t this_arg, jboolean lazy) {
32640         LDKMonitorUpdatingPersister this_arg_conv;
32641         this_arg_conv.inner = untag_ptr(this_arg);
32642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32644         this_arg_conv.is_owned = false;
32645         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
32646         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
32647         return tag_ptr(ret_conv, true);
32648 }
32649
32650 int64_t  CS_LDK_MonitorUpdatingPersister_as_Persist(int64_t this_arg) {
32651         LDKMonitorUpdatingPersister this_arg_conv;
32652         this_arg_conv.inner = untag_ptr(this_arg);
32653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32655         this_arg_conv.is_owned = false;
32656         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
32657         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
32658         return tag_ptr(ret_ret, true);
32659 }
32660
32661 void  CS_LDK_UntrustedString_free(int64_t this_obj) {
32662         LDKUntrustedString this_obj_conv;
32663         this_obj_conv.inner = untag_ptr(this_obj);
32664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32666         UntrustedString_free(this_obj_conv);
32667 }
32668
32669 jstring  CS_LDK_UntrustedString_get_a(int64_t this_ptr) {
32670         LDKUntrustedString this_ptr_conv;
32671         this_ptr_conv.inner = untag_ptr(this_ptr);
32672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32674         this_ptr_conv.is_owned = false;
32675         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
32676         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
32677         Str_free(ret_str);
32678         return ret_conv;
32679 }
32680
32681 void  CS_LDK_UntrustedString_set_a(int64_t this_ptr, jstring val) {
32682         LDKUntrustedString this_ptr_conv;
32683         this_ptr_conv.inner = untag_ptr(this_ptr);
32684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32686         this_ptr_conv.is_owned = false;
32687         LDKStr val_conv = str_ref_to_owned_c(val);
32688         UntrustedString_set_a(&this_ptr_conv, val_conv);
32689 }
32690
32691 int64_t  CS_LDK_UntrustedString_new(jstring a_arg) {
32692         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32693         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
32694         int64_t ret_ref = 0;
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32697         return ret_ref;
32698 }
32699
32700 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
32701         LDKUntrustedString ret_var = UntrustedString_clone(arg);
32702         int64_t ret_ref = 0;
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32705         return ret_ref;
32706 }
32707 int64_t  CS_LDK_UntrustedString_clone_ptr(int64_t arg) {
32708         LDKUntrustedString arg_conv;
32709         arg_conv.inner = untag_ptr(arg);
32710         arg_conv.is_owned = ptr_is_owned(arg);
32711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32712         arg_conv.is_owned = false;
32713         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
32714         return ret_conv;
32715 }
32716
32717 int64_t  CS_LDK_UntrustedString_clone(int64_t orig) {
32718         LDKUntrustedString orig_conv;
32719         orig_conv.inner = untag_ptr(orig);
32720         orig_conv.is_owned = ptr_is_owned(orig);
32721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32722         orig_conv.is_owned = false;
32723         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
32724         int64_t ret_ref = 0;
32725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32727         return ret_ref;
32728 }
32729
32730 jboolean  CS_LDK_UntrustedString_eq(int64_t a, int64_t b) {
32731         LDKUntrustedString a_conv;
32732         a_conv.inner = untag_ptr(a);
32733         a_conv.is_owned = ptr_is_owned(a);
32734         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32735         a_conv.is_owned = false;
32736         LDKUntrustedString b_conv;
32737         b_conv.inner = untag_ptr(b);
32738         b_conv.is_owned = ptr_is_owned(b);
32739         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32740         b_conv.is_owned = false;
32741         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
32742         return ret_conv;
32743 }
32744
32745 int64_t  CS_LDK_UntrustedString_hash(int64_t o) {
32746         LDKUntrustedString o_conv;
32747         o_conv.inner = untag_ptr(o);
32748         o_conv.is_owned = ptr_is_owned(o);
32749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32750         o_conv.is_owned = false;
32751         int64_t ret_conv = UntrustedString_hash(&o_conv);
32752         return ret_conv;
32753 }
32754
32755 int8_tArray  CS_LDK_UntrustedString_write(int64_t obj) {
32756         LDKUntrustedString obj_conv;
32757         obj_conv.inner = untag_ptr(obj);
32758         obj_conv.is_owned = ptr_is_owned(obj);
32759         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32760         obj_conv.is_owned = false;
32761         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
32762         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32763         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32764         CVec_u8Z_free(ret_var);
32765         return ret_arr;
32766 }
32767
32768 int64_t  CS_LDK_UntrustedString_read(int8_tArray ser) {
32769         LDKu8slice ser_ref;
32770         ser_ref.datalen = ser->arr_len;
32771         ser_ref.data = ser->elems;
32772         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
32773         *ret_conv = UntrustedString_read(ser_ref);
32774         FREE(ser);
32775         return tag_ptr(ret_conv, true);
32776 }
32777
32778 void  CS_LDK_PrintableString_free(int64_t this_obj) {
32779         LDKPrintableString this_obj_conv;
32780         this_obj_conv.inner = untag_ptr(this_obj);
32781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32783         PrintableString_free(this_obj_conv);
32784 }
32785
32786 jstring  CS_LDK_PrintableString_get_a(int64_t this_ptr) {
32787         LDKPrintableString this_ptr_conv;
32788         this_ptr_conv.inner = untag_ptr(this_ptr);
32789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32791         this_ptr_conv.is_owned = false;
32792         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
32793         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
32794         Str_free(ret_str);
32795         return ret_conv;
32796 }
32797
32798 void  CS_LDK_PrintableString_set_a(int64_t this_ptr, jstring val) {
32799         LDKPrintableString this_ptr_conv;
32800         this_ptr_conv.inner = untag_ptr(this_ptr);
32801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32803         this_ptr_conv.is_owned = false;
32804         LDKStr val_conv = str_ref_to_owned_c(val);
32805         PrintableString_set_a(&this_ptr_conv, val_conv);
32806 }
32807
32808 int64_t  CS_LDK_PrintableString_new(jstring a_arg) {
32809         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
32810         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
32811         int64_t ret_ref = 0;
32812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32814         return ret_ref;
32815 }
32816
32817 void  CS_LDK_FutureCallback_free(int64_t this_ptr) {
32818         if (!ptr_is_owned(this_ptr)) return;
32819         void* this_ptr_ptr = untag_ptr(this_ptr);
32820         CHECK_ACCESS(this_ptr_ptr);
32821         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
32822         FREE(untag_ptr(this_ptr));
32823         FutureCallback_free(this_ptr_conv);
32824 }
32825
32826 void  CS_LDK_Future_free(int64_t this_obj) {
32827         LDKFuture this_obj_conv;
32828         this_obj_conv.inner = untag_ptr(this_obj);
32829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32831         Future_free(this_obj_conv);
32832 }
32833
32834 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
32835         LDKFuture ret_var = Future_clone(arg);
32836         int64_t ret_ref = 0;
32837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32839         return ret_ref;
32840 }
32841 int64_t  CS_LDK_Future_clone_ptr(int64_t arg) {
32842         LDKFuture arg_conv;
32843         arg_conv.inner = untag_ptr(arg);
32844         arg_conv.is_owned = ptr_is_owned(arg);
32845         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32846         arg_conv.is_owned = false;
32847         int64_t ret_conv = Future_clone_ptr(&arg_conv);
32848         return ret_conv;
32849 }
32850
32851 int64_t  CS_LDK_Future_clone(int64_t orig) {
32852         LDKFuture orig_conv;
32853         orig_conv.inner = untag_ptr(orig);
32854         orig_conv.is_owned = ptr_is_owned(orig);
32855         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32856         orig_conv.is_owned = false;
32857         LDKFuture ret_var = Future_clone(&orig_conv);
32858         int64_t ret_ref = 0;
32859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32861         return ret_ref;
32862 }
32863
32864 void  CS_LDK_Future_register_callback_fn(int64_t this_arg, int64_t callback) {
32865         LDKFuture this_arg_conv;
32866         this_arg_conv.inner = untag_ptr(this_arg);
32867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32869         this_arg_conv.is_owned = false;
32870         void* callback_ptr = untag_ptr(callback);
32871         CHECK_ACCESS(callback_ptr);
32872         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
32873         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
32874                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32875                 LDKFutureCallback_JCalls_cloned(&callback_conv);
32876         }
32877         Future_register_callback_fn(&this_arg_conv, callback_conv);
32878 }
32879
32880 void  CS_LDK_Future_wait(int64_t this_arg) {
32881         LDKFuture this_arg_conv;
32882         this_arg_conv.inner = untag_ptr(this_arg);
32883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32885         this_arg_conv = Future_clone(&this_arg_conv);
32886         Future_wait(this_arg_conv);
32887 }
32888
32889 jboolean  CS_LDK_Future_wait_timeout(int64_t this_arg, int64_t max_wait) {
32890         LDKFuture this_arg_conv;
32891         this_arg_conv.inner = untag_ptr(this_arg);
32892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32894         this_arg_conv = Future_clone(&this_arg_conv);
32895         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
32896         return ret_conv;
32897 }
32898
32899 void  CS_LDK_Sleeper_free(int64_t this_obj) {
32900         LDKSleeper this_obj_conv;
32901         this_obj_conv.inner = untag_ptr(this_obj);
32902         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32904         Sleeper_free(this_obj_conv);
32905 }
32906
32907 int64_t  CS_LDK_Sleeper_from_single_future(int64_t future) {
32908         LDKFuture future_conv;
32909         future_conv.inner = untag_ptr(future);
32910         future_conv.is_owned = ptr_is_owned(future);
32911         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
32912         future_conv = Future_clone(&future_conv);
32913         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
32914         int64_t ret_ref = 0;
32915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32917         return ret_ref;
32918 }
32919
32920 int64_t  CS_LDK_Sleeper_from_two_futures(int64_t fut_a, int64_t fut_b) {
32921         LDKFuture fut_a_conv;
32922         fut_a_conv.inner = untag_ptr(fut_a);
32923         fut_a_conv.is_owned = ptr_is_owned(fut_a);
32924         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
32925         fut_a_conv = Future_clone(&fut_a_conv);
32926         LDKFuture fut_b_conv;
32927         fut_b_conv.inner = untag_ptr(fut_b);
32928         fut_b_conv.is_owned = ptr_is_owned(fut_b);
32929         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
32930         fut_b_conv = Future_clone(&fut_b_conv);
32931         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
32932         int64_t ret_ref = 0;
32933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32935         return ret_ref;
32936 }
32937
32938 int64_t  CS_LDK_Sleeper_new(int64_tArray futures) {
32939         LDKCVec_FutureZ futures_constr;
32940         futures_constr.datalen = futures->arr_len;
32941         if (futures_constr.datalen > 0)
32942                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
32943         else
32944                 futures_constr.data = NULL;
32945         int64_t* futures_vals = futures->elems;
32946         for (size_t i = 0; i < futures_constr.datalen; i++) {
32947                 int64_t futures_conv_8 = futures_vals[i];
32948                 LDKFuture futures_conv_8_conv;
32949                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
32950                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
32951                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
32952                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
32953                 futures_constr.data[i] = futures_conv_8_conv;
32954         }
32955         FREE(futures);
32956         LDKSleeper ret_var = Sleeper_new(futures_constr);
32957         int64_t ret_ref = 0;
32958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32960         return ret_ref;
32961 }
32962
32963 void  CS_LDK_Sleeper_wait(int64_t this_arg) {
32964         LDKSleeper this_arg_conv;
32965         this_arg_conv.inner = untag_ptr(this_arg);
32966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32968         this_arg_conv.is_owned = false;
32969         Sleeper_wait(&this_arg_conv);
32970 }
32971
32972 jboolean  CS_LDK_Sleeper_wait_timeout(int64_t this_arg, int64_t max_wait) {
32973         LDKSleeper this_arg_conv;
32974         this_arg_conv.inner = untag_ptr(this_arg);
32975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32977         this_arg_conv.is_owned = false;
32978         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
32979         return ret_conv;
32980 }
32981
32982 int32_t  CS_LDK_Level_clone(int64_t orig) {
32983         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
32984         int32_t ret_conv = LDKLevel_to_cs(Level_clone(orig_conv));
32985         return ret_conv;
32986 }
32987
32988 int32_t  CS_LDK_Level_gossip() {
32989         int32_t ret_conv = LDKLevel_to_cs(Level_gossip());
32990         return ret_conv;
32991 }
32992
32993 int32_t  CS_LDK_Level_trace() {
32994         int32_t ret_conv = LDKLevel_to_cs(Level_trace());
32995         return ret_conv;
32996 }
32997
32998 int32_t  CS_LDK_Level_debug() {
32999         int32_t ret_conv = LDKLevel_to_cs(Level_debug());
33000         return ret_conv;
33001 }
33002
33003 int32_t  CS_LDK_Level_info() {
33004         int32_t ret_conv = LDKLevel_to_cs(Level_info());
33005         return ret_conv;
33006 }
33007
33008 int32_t  CS_LDK_Level_warn() {
33009         int32_t ret_conv = LDKLevel_to_cs(Level_warn());
33010         return ret_conv;
33011 }
33012
33013 int32_t  CS_LDK_Level_error() {
33014         int32_t ret_conv = LDKLevel_to_cs(Level_error());
33015         return ret_conv;
33016 }
33017
33018 jboolean  CS_LDK_Level_eq(int64_t a, int64_t b) {
33019         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
33020         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
33021         jboolean ret_conv = Level_eq(a_conv, b_conv);
33022         return ret_conv;
33023 }
33024
33025 int64_t  CS_LDK_Level_hash(int64_t o) {
33026         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
33027         int64_t ret_conv = Level_hash(o_conv);
33028         return ret_conv;
33029 }
33030
33031 int32_t  CS_LDK_Level_max() {
33032         int32_t ret_conv = LDKLevel_to_cs(Level_max());
33033         return ret_conv;
33034 }
33035
33036 void  CS_LDK_Record_free(int64_t this_obj) {
33037         LDKRecord this_obj_conv;
33038         this_obj_conv.inner = untag_ptr(this_obj);
33039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33041         Record_free(this_obj_conv);
33042 }
33043
33044 int32_t  CS_LDK_Record_get_level(int64_t this_ptr) {
33045         LDKRecord this_ptr_conv;
33046         this_ptr_conv.inner = untag_ptr(this_ptr);
33047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33049         this_ptr_conv.is_owned = false;
33050         int32_t ret_conv = LDKLevel_to_cs(Record_get_level(&this_ptr_conv));
33051         return ret_conv;
33052 }
33053
33054 void  CS_LDK_Record_set_level(int64_t this_ptr, int32_t val) {
33055         LDKRecord this_ptr_conv;
33056         this_ptr_conv.inner = untag_ptr(this_ptr);
33057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33059         this_ptr_conv.is_owned = false;
33060         LDKLevel val_conv = LDKLevel_from_cs(val);
33061         Record_set_level(&this_ptr_conv, val_conv);
33062 }
33063
33064 int8_tArray  CS_LDK_Record_get_peer_id(int64_t this_ptr) {
33065         LDKRecord this_ptr_conv;
33066         this_ptr_conv.inner = untag_ptr(this_ptr);
33067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33069         this_ptr_conv.is_owned = false;
33070         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33071         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
33072         return ret_arr;
33073 }
33074
33075 void  CS_LDK_Record_set_peer_id(int64_t this_ptr, int8_tArray val) {
33076         LDKRecord this_ptr_conv;
33077         this_ptr_conv.inner = untag_ptr(this_ptr);
33078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33080         this_ptr_conv.is_owned = false;
33081         LDKPublicKey val_ref;
33082         CHECK(val->arr_len == 33);
33083         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33084         Record_set_peer_id(&this_ptr_conv, val_ref);
33085 }
33086
33087 int64_t  CS_LDK_Record_get_channel_id(int64_t this_ptr) {
33088         LDKRecord this_ptr_conv;
33089         this_ptr_conv.inner = untag_ptr(this_ptr);
33090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33092         this_ptr_conv.is_owned = false;
33093         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
33094         *ret_copy = Record_get_channel_id(&this_ptr_conv);
33095         int64_t ret_ref = tag_ptr(ret_copy, true);
33096         return ret_ref;
33097 }
33098
33099 void  CS_LDK_Record_set_channel_id(int64_t this_ptr, int64_t val) {
33100         LDKRecord this_ptr_conv;
33101         this_ptr_conv.inner = untag_ptr(this_ptr);
33102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33104         this_ptr_conv.is_owned = false;
33105         void* val_ptr = untag_ptr(val);
33106         CHECK_ACCESS(val_ptr);
33107         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
33108         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
33109         Record_set_channel_id(&this_ptr_conv, val_conv);
33110 }
33111
33112 jstring  CS_LDK_Record_get_args(int64_t this_ptr) {
33113         LDKRecord this_ptr_conv;
33114         this_ptr_conv.inner = untag_ptr(this_ptr);
33115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33117         this_ptr_conv.is_owned = false;
33118         LDKStr ret_str = Record_get_args(&this_ptr_conv);
33119         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33120         Str_free(ret_str);
33121         return ret_conv;
33122 }
33123
33124 void  CS_LDK_Record_set_args(int64_t this_ptr, jstring val) {
33125         LDKRecord this_ptr_conv;
33126         this_ptr_conv.inner = untag_ptr(this_ptr);
33127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33129         this_ptr_conv.is_owned = false;
33130         LDKStr val_conv = str_ref_to_owned_c(val);
33131         Record_set_args(&this_ptr_conv, val_conv);
33132 }
33133
33134 jstring  CS_LDK_Record_get_module_path(int64_t this_ptr) {
33135         LDKRecord this_ptr_conv;
33136         this_ptr_conv.inner = untag_ptr(this_ptr);
33137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33139         this_ptr_conv.is_owned = false;
33140         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
33141         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33142         Str_free(ret_str);
33143         return ret_conv;
33144 }
33145
33146 void  CS_LDK_Record_set_module_path(int64_t this_ptr, jstring val) {
33147         LDKRecord this_ptr_conv;
33148         this_ptr_conv.inner = untag_ptr(this_ptr);
33149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33151         this_ptr_conv.is_owned = false;
33152         LDKStr val_conv = str_ref_to_owned_c(val);
33153         Record_set_module_path(&this_ptr_conv, val_conv);
33154 }
33155
33156 jstring  CS_LDK_Record_get_file(int64_t this_ptr) {
33157         LDKRecord this_ptr_conv;
33158         this_ptr_conv.inner = untag_ptr(this_ptr);
33159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33161         this_ptr_conv.is_owned = false;
33162         LDKStr ret_str = Record_get_file(&this_ptr_conv);
33163         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
33164         Str_free(ret_str);
33165         return ret_conv;
33166 }
33167
33168 void  CS_LDK_Record_set_file(int64_t this_ptr, jstring val) {
33169         LDKRecord this_ptr_conv;
33170         this_ptr_conv.inner = untag_ptr(this_ptr);
33171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33173         this_ptr_conv.is_owned = false;
33174         LDKStr val_conv = str_ref_to_owned_c(val);
33175         Record_set_file(&this_ptr_conv, val_conv);
33176 }
33177
33178 int32_t  CS_LDK_Record_get_line(int64_t this_ptr) {
33179         LDKRecord this_ptr_conv;
33180         this_ptr_conv.inner = untag_ptr(this_ptr);
33181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33183         this_ptr_conv.is_owned = false;
33184         int32_t ret_conv = Record_get_line(&this_ptr_conv);
33185         return ret_conv;
33186 }
33187
33188 void  CS_LDK_Record_set_line(int64_t this_ptr, int32_t val) {
33189         LDKRecord this_ptr_conv;
33190         this_ptr_conv.inner = untag_ptr(this_ptr);
33191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33193         this_ptr_conv.is_owned = false;
33194         Record_set_line(&this_ptr_conv, val);
33195 }
33196
33197 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) {
33198         LDKLevel level_arg_conv = LDKLevel_from_cs(level_arg);
33199         LDKPublicKey peer_id_arg_ref;
33200         CHECK(peer_id_arg->arr_len == 33);
33201         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
33202         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
33203         CHECK_ACCESS(channel_id_arg_ptr);
33204         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
33205         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
33206         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
33207         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
33208         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
33209         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);
33210         int64_t ret_ref = 0;
33211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33213         return ret_ref;
33214 }
33215
33216 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
33217         LDKRecord ret_var = Record_clone(arg);
33218         int64_t ret_ref = 0;
33219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33221         return ret_ref;
33222 }
33223 int64_t  CS_LDK_Record_clone_ptr(int64_t arg) {
33224         LDKRecord arg_conv;
33225         arg_conv.inner = untag_ptr(arg);
33226         arg_conv.is_owned = ptr_is_owned(arg);
33227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33228         arg_conv.is_owned = false;
33229         int64_t ret_conv = Record_clone_ptr(&arg_conv);
33230         return ret_conv;
33231 }
33232
33233 int64_t  CS_LDK_Record_clone(int64_t orig) {
33234         LDKRecord orig_conv;
33235         orig_conv.inner = untag_ptr(orig);
33236         orig_conv.is_owned = ptr_is_owned(orig);
33237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33238         orig_conv.is_owned = false;
33239         LDKRecord ret_var = Record_clone(&orig_conv);
33240         int64_t ret_ref = 0;
33241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33243         return ret_ref;
33244 }
33245
33246 void  CS_LDK_Logger_free(int64_t this_ptr) {
33247         if (!ptr_is_owned(this_ptr)) return;
33248         void* this_ptr_ptr = untag_ptr(this_ptr);
33249         CHECK_ACCESS(this_ptr_ptr);
33250         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
33251         FREE(untag_ptr(this_ptr));
33252         Logger_free(this_ptr_conv);
33253 }
33254
33255 void  CS_LDK_ChannelHandshakeConfig_free(int64_t this_obj) {
33256         LDKChannelHandshakeConfig this_obj_conv;
33257         this_obj_conv.inner = untag_ptr(this_obj);
33258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33260         ChannelHandshakeConfig_free(this_obj_conv);
33261 }
33262
33263 int32_t  CS_LDK_ChannelHandshakeConfig_get_minimum_depth(int64_t this_ptr) {
33264         LDKChannelHandshakeConfig this_ptr_conv;
33265         this_ptr_conv.inner = untag_ptr(this_ptr);
33266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33268         this_ptr_conv.is_owned = false;
33269         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
33270         return ret_conv;
33271 }
33272
33273 void  CS_LDK_ChannelHandshakeConfig_set_minimum_depth(int64_t this_ptr, int32_t val) {
33274         LDKChannelHandshakeConfig this_ptr_conv;
33275         this_ptr_conv.inner = untag_ptr(this_ptr);
33276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33278         this_ptr_conv.is_owned = false;
33279         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
33280 }
33281
33282 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_to_self_delay(int64_t this_ptr) {
33283         LDKChannelHandshakeConfig this_ptr_conv;
33284         this_ptr_conv.inner = untag_ptr(this_ptr);
33285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33287         this_ptr_conv.is_owned = false;
33288         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
33289         return ret_conv;
33290 }
33291
33292 void  CS_LDK_ChannelHandshakeConfig_set_our_to_self_delay(int64_t this_ptr, int16_t val) {
33293         LDKChannelHandshakeConfig this_ptr_conv;
33294         this_ptr_conv.inner = untag_ptr(this_ptr);
33295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33297         this_ptr_conv.is_owned = false;
33298         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
33299 }
33300
33301 int64_t  CS_LDK_ChannelHandshakeConfig_get_our_htlc_minimum_msat(int64_t this_ptr) {
33302         LDKChannelHandshakeConfig this_ptr_conv;
33303         this_ptr_conv.inner = untag_ptr(this_ptr);
33304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33306         this_ptr_conv.is_owned = false;
33307         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
33308         return ret_conv;
33309 }
33310
33311 void  CS_LDK_ChannelHandshakeConfig_set_our_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
33312         LDKChannelHandshakeConfig this_ptr_conv;
33313         this_ptr_conv.inner = untag_ptr(this_ptr);
33314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33316         this_ptr_conv.is_owned = false;
33317         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
33318 }
33319
33320 int8_t  CS_LDK_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr) {
33321         LDKChannelHandshakeConfig this_ptr_conv;
33322         this_ptr_conv.inner = untag_ptr(this_ptr);
33323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33325         this_ptr_conv.is_owned = false;
33326         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
33327         return ret_conv;
33328 }
33329
33330 void  CS_LDK_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr, int8_t val) {
33331         LDKChannelHandshakeConfig this_ptr_conv;
33332         this_ptr_conv.inner = untag_ptr(this_ptr);
33333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33335         this_ptr_conv.is_owned = false;
33336         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
33337 }
33338
33339 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_scid_privacy(int64_t this_ptr) {
33340         LDKChannelHandshakeConfig this_ptr_conv;
33341         this_ptr_conv.inner = untag_ptr(this_ptr);
33342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33344         this_ptr_conv.is_owned = false;
33345         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
33346         return ret_conv;
33347 }
33348
33349 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_scid_privacy(int64_t this_ptr, jboolean val) {
33350         LDKChannelHandshakeConfig this_ptr_conv;
33351         this_ptr_conv.inner = untag_ptr(this_ptr);
33352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33354         this_ptr_conv.is_owned = false;
33355         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
33356 }
33357
33358 jboolean  CS_LDK_ChannelHandshakeConfig_get_announced_channel(int64_t this_ptr) {
33359         LDKChannelHandshakeConfig this_ptr_conv;
33360         this_ptr_conv.inner = untag_ptr(this_ptr);
33361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33363         this_ptr_conv.is_owned = false;
33364         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
33365         return ret_conv;
33366 }
33367
33368 void  CS_LDK_ChannelHandshakeConfig_set_announced_channel(int64_t this_ptr, jboolean val) {
33369         LDKChannelHandshakeConfig this_ptr_conv;
33370         this_ptr_conv.inner = untag_ptr(this_ptr);
33371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33373         this_ptr_conv.is_owned = false;
33374         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
33375 }
33376
33377 jboolean  CS_LDK_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(int64_t this_ptr) {
33378         LDKChannelHandshakeConfig this_ptr_conv;
33379         this_ptr_conv.inner = untag_ptr(this_ptr);
33380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33382         this_ptr_conv.is_owned = false;
33383         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
33384         return ret_conv;
33385 }
33386
33387 void  CS_LDK_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(int64_t this_ptr, jboolean val) {
33388         LDKChannelHandshakeConfig this_ptr_conv;
33389         this_ptr_conv.inner = untag_ptr(this_ptr);
33390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33392         this_ptr_conv.is_owned = false;
33393         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33394 }
33395
33396 int32_t  CS_LDK_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(int64_t this_ptr) {
33397         LDKChannelHandshakeConfig this_ptr_conv;
33398         this_ptr_conv.inner = untag_ptr(this_ptr);
33399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33401         this_ptr_conv.is_owned = false;
33402         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33403         return ret_conv;
33404 }
33405
33406 void  CS_LDK_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(int64_t this_ptr, int32_t val) {
33407         LDKChannelHandshakeConfig this_ptr_conv;
33408         this_ptr_conv.inner = untag_ptr(this_ptr);
33409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411         this_ptr_conv.is_owned = false;
33412         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33413 }
33414
33415 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr) {
33416         LDKChannelHandshakeConfig this_ptr_conv;
33417         this_ptr_conv.inner = untag_ptr(this_ptr);
33418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33420         this_ptr_conv.is_owned = false;
33421         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33422         return ret_conv;
33423 }
33424
33425 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr, jboolean val) {
33426         LDKChannelHandshakeConfig this_ptr_conv;
33427         this_ptr_conv.inner = untag_ptr(this_ptr);
33428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33430         this_ptr_conv.is_owned = false;
33431         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33432 }
33433
33434 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_max_accepted_htlcs(int64_t this_ptr) {
33435         LDKChannelHandshakeConfig this_ptr_conv;
33436         this_ptr_conv.inner = untag_ptr(this_ptr);
33437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33439         this_ptr_conv.is_owned = false;
33440         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33441         return ret_conv;
33442 }
33443
33444 void  CS_LDK_ChannelHandshakeConfig_set_our_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
33445         LDKChannelHandshakeConfig this_ptr_conv;
33446         this_ptr_conv.inner = untag_ptr(this_ptr);
33447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33449         this_ptr_conv.is_owned = false;
33450         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33451 }
33452
33453 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) {
33454         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);
33455         int64_t ret_ref = 0;
33456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33458         return ret_ref;
33459 }
33460
33461 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33462         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33463         int64_t ret_ref = 0;
33464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33466         return ret_ref;
33467 }
33468 int64_t  CS_LDK_ChannelHandshakeConfig_clone_ptr(int64_t arg) {
33469         LDKChannelHandshakeConfig arg_conv;
33470         arg_conv.inner = untag_ptr(arg);
33471         arg_conv.is_owned = ptr_is_owned(arg);
33472         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33473         arg_conv.is_owned = false;
33474         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33475         return ret_conv;
33476 }
33477
33478 int64_t  CS_LDK_ChannelHandshakeConfig_clone(int64_t orig) {
33479         LDKChannelHandshakeConfig orig_conv;
33480         orig_conv.inner = untag_ptr(orig);
33481         orig_conv.is_owned = ptr_is_owned(orig);
33482         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33483         orig_conv.is_owned = false;
33484         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33485         int64_t ret_ref = 0;
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33488         return ret_ref;
33489 }
33490
33491 int64_t  CS_LDK_ChannelHandshakeConfig_default() {
33492         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33493         int64_t ret_ref = 0;
33494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33496         return ret_ref;
33497 }
33498
33499 void  CS_LDK_ChannelHandshakeLimits_free(int64_t this_obj) {
33500         LDKChannelHandshakeLimits this_obj_conv;
33501         this_obj_conv.inner = untag_ptr(this_obj);
33502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33504         ChannelHandshakeLimits_free(this_obj_conv);
33505 }
33506
33507 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_funding_satoshis(int64_t this_ptr) {
33508         LDKChannelHandshakeLimits this_ptr_conv;
33509         this_ptr_conv.inner = untag_ptr(this_ptr);
33510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512         this_ptr_conv.is_owned = false;
33513         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33514         return ret_conv;
33515 }
33516
33517 void  CS_LDK_ChannelHandshakeLimits_set_min_funding_satoshis(int64_t this_ptr, int64_t val) {
33518         LDKChannelHandshakeLimits this_ptr_conv;
33519         this_ptr_conv.inner = untag_ptr(this_ptr);
33520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33522         this_ptr_conv.is_owned = false;
33523         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33524 }
33525
33526 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_funding_satoshis(int64_t this_ptr) {
33527         LDKChannelHandshakeLimits this_ptr_conv;
33528         this_ptr_conv.inner = untag_ptr(this_ptr);
33529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33531         this_ptr_conv.is_owned = false;
33532         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33533         return ret_conv;
33534 }
33535
33536 void  CS_LDK_ChannelHandshakeLimits_set_max_funding_satoshis(int64_t this_ptr, int64_t val) {
33537         LDKChannelHandshakeLimits this_ptr_conv;
33538         this_ptr_conv.inner = untag_ptr(this_ptr);
33539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33541         this_ptr_conv.is_owned = false;
33542         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33543 }
33544
33545 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_htlc_minimum_msat(int64_t this_ptr) {
33546         LDKChannelHandshakeLimits this_ptr_conv;
33547         this_ptr_conv.inner = untag_ptr(this_ptr);
33548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33550         this_ptr_conv.is_owned = false;
33551         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33552         return ret_conv;
33553 }
33554
33555 void  CS_LDK_ChannelHandshakeLimits_set_max_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
33556         LDKChannelHandshakeLimits this_ptr_conv;
33557         this_ptr_conv.inner = untag_ptr(this_ptr);
33558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33560         this_ptr_conv.is_owned = false;
33561         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33562 }
33563
33564 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(int64_t this_ptr) {
33565         LDKChannelHandshakeLimits this_ptr_conv;
33566         this_ptr_conv.inner = untag_ptr(this_ptr);
33567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33569         this_ptr_conv.is_owned = false;
33570         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33571         return ret_conv;
33572 }
33573
33574 void  CS_LDK_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
33575         LDKChannelHandshakeLimits this_ptr_conv;
33576         this_ptr_conv.inner = untag_ptr(this_ptr);
33577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33579         this_ptr_conv.is_owned = false;
33580         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33581 }
33582
33583 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(int64_t this_ptr) {
33584         LDKChannelHandshakeLimits this_ptr_conv;
33585         this_ptr_conv.inner = untag_ptr(this_ptr);
33586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33588         this_ptr_conv.is_owned = false;
33589         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33590         return ret_conv;
33591 }
33592
33593 void  CS_LDK_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
33594         LDKChannelHandshakeLimits this_ptr_conv;
33595         this_ptr_conv.inner = untag_ptr(this_ptr);
33596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33598         this_ptr_conv.is_owned = false;
33599         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33600 }
33601
33602 int16_t  CS_LDK_ChannelHandshakeLimits_get_min_max_accepted_htlcs(int64_t this_ptr) {
33603         LDKChannelHandshakeLimits this_ptr_conv;
33604         this_ptr_conv.inner = untag_ptr(this_ptr);
33605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33607         this_ptr_conv.is_owned = false;
33608         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33609         return ret_conv;
33610 }
33611
33612 void  CS_LDK_ChannelHandshakeLimits_set_min_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
33613         LDKChannelHandshakeLimits this_ptr_conv;
33614         this_ptr_conv.inner = untag_ptr(this_ptr);
33615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33617         this_ptr_conv.is_owned = false;
33618         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33619 }
33620
33621 int32_t  CS_LDK_ChannelHandshakeLimits_get_max_minimum_depth(int64_t this_ptr) {
33622         LDKChannelHandshakeLimits this_ptr_conv;
33623         this_ptr_conv.inner = untag_ptr(this_ptr);
33624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33626         this_ptr_conv.is_owned = false;
33627         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33628         return ret_conv;
33629 }
33630
33631 void  CS_LDK_ChannelHandshakeLimits_set_max_minimum_depth(int64_t this_ptr, int32_t val) {
33632         LDKChannelHandshakeLimits this_ptr_conv;
33633         this_ptr_conv.inner = untag_ptr(this_ptr);
33634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33636         this_ptr_conv.is_owned = false;
33637         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33638 }
33639
33640 jboolean  CS_LDK_ChannelHandshakeLimits_get_trust_own_funding_0conf(int64_t this_ptr) {
33641         LDKChannelHandshakeLimits this_ptr_conv;
33642         this_ptr_conv.inner = untag_ptr(this_ptr);
33643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33645         this_ptr_conv.is_owned = false;
33646         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33647         return ret_conv;
33648 }
33649
33650 void  CS_LDK_ChannelHandshakeLimits_set_trust_own_funding_0conf(int64_t this_ptr, jboolean val) {
33651         LDKChannelHandshakeLimits this_ptr_conv;
33652         this_ptr_conv.inner = untag_ptr(this_ptr);
33653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655         this_ptr_conv.is_owned = false;
33656         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33657 }
33658
33659 jboolean  CS_LDK_ChannelHandshakeLimits_get_force_announced_channel_preference(int64_t this_ptr) {
33660         LDKChannelHandshakeLimits this_ptr_conv;
33661         this_ptr_conv.inner = untag_ptr(this_ptr);
33662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33664         this_ptr_conv.is_owned = false;
33665         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33666         return ret_conv;
33667 }
33668
33669 void  CS_LDK_ChannelHandshakeLimits_set_force_announced_channel_preference(int64_t this_ptr, jboolean val) {
33670         LDKChannelHandshakeLimits this_ptr_conv;
33671         this_ptr_conv.inner = untag_ptr(this_ptr);
33672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33674         this_ptr_conv.is_owned = false;
33675         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33676 }
33677
33678 int16_t  CS_LDK_ChannelHandshakeLimits_get_their_to_self_delay(int64_t this_ptr) {
33679         LDKChannelHandshakeLimits this_ptr_conv;
33680         this_ptr_conv.inner = untag_ptr(this_ptr);
33681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33683         this_ptr_conv.is_owned = false;
33684         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33685         return ret_conv;
33686 }
33687
33688 void  CS_LDK_ChannelHandshakeLimits_set_their_to_self_delay(int64_t this_ptr, int16_t val) {
33689         LDKChannelHandshakeLimits this_ptr_conv;
33690         this_ptr_conv.inner = untag_ptr(this_ptr);
33691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33693         this_ptr_conv.is_owned = false;
33694         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33695 }
33696
33697 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) {
33698         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);
33699         int64_t ret_ref = 0;
33700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33702         return ret_ref;
33703 }
33704
33705 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33706         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33707         int64_t ret_ref = 0;
33708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33710         return ret_ref;
33711 }
33712 int64_t  CS_LDK_ChannelHandshakeLimits_clone_ptr(int64_t arg) {
33713         LDKChannelHandshakeLimits arg_conv;
33714         arg_conv.inner = untag_ptr(arg);
33715         arg_conv.is_owned = ptr_is_owned(arg);
33716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33717         arg_conv.is_owned = false;
33718         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
33719         return ret_conv;
33720 }
33721
33722 int64_t  CS_LDK_ChannelHandshakeLimits_clone(int64_t orig) {
33723         LDKChannelHandshakeLimits orig_conv;
33724         orig_conv.inner = untag_ptr(orig);
33725         orig_conv.is_owned = ptr_is_owned(orig);
33726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33727         orig_conv.is_owned = false;
33728         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
33729         int64_t ret_ref = 0;
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33732         return ret_ref;
33733 }
33734
33735 int64_t  CS_LDK_ChannelHandshakeLimits_default() {
33736         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
33737         int64_t ret_ref = 0;
33738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33740         return ret_ref;
33741 }
33742
33743 void  CS_LDK_MaxDustHTLCExposure_free(int64_t this_ptr) {
33744         if (!ptr_is_owned(this_ptr)) return;
33745         void* this_ptr_ptr = untag_ptr(this_ptr);
33746         CHECK_ACCESS(this_ptr_ptr);
33747         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
33748         FREE(untag_ptr(this_ptr));
33749         MaxDustHTLCExposure_free(this_ptr_conv);
33750 }
33751
33752 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
33753         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33754         *ret_copy = MaxDustHTLCExposure_clone(arg);
33755         int64_t ret_ref = tag_ptr(ret_copy, true);
33756         return ret_ref;
33757 }
33758 int64_t  CS_LDK_MaxDustHTLCExposure_clone_ptr(int64_t arg) {
33759         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
33760         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
33761         return ret_conv;
33762 }
33763
33764 int64_t  CS_LDK_MaxDustHTLCExposure_clone(int64_t orig) {
33765         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
33766         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33767         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
33768         int64_t ret_ref = tag_ptr(ret_copy, true);
33769         return ret_ref;
33770 }
33771
33772 int64_t  CS_LDK_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
33773         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33774         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
33775         int64_t ret_ref = tag_ptr(ret_copy, true);
33776         return ret_ref;
33777 }
33778
33779 int64_t  CS_LDK_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
33780         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33781         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
33782         int64_t ret_ref = tag_ptr(ret_copy, true);
33783         return ret_ref;
33784 }
33785
33786 jboolean  CS_LDK_MaxDustHTLCExposure_eq(int64_t a, int64_t b) {
33787         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
33788         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
33789         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
33790         return ret_conv;
33791 }
33792
33793 int8_tArray  CS_LDK_MaxDustHTLCExposure_write(int64_t obj) {
33794         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
33795         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
33796         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33797         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33798         CVec_u8Z_free(ret_var);
33799         return ret_arr;
33800 }
33801
33802 int64_t  CS_LDK_MaxDustHTLCExposure_read(int8_tArray ser) {
33803         LDKu8slice ser_ref;
33804         ser_ref.datalen = ser->arr_len;
33805         ser_ref.data = ser->elems;
33806         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
33807         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
33808         FREE(ser);
33809         return tag_ptr(ret_conv, true);
33810 }
33811
33812 void  CS_LDK_ChannelConfig_free(int64_t this_obj) {
33813         LDKChannelConfig this_obj_conv;
33814         this_obj_conv.inner = untag_ptr(this_obj);
33815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33817         ChannelConfig_free(this_obj_conv);
33818 }
33819
33820 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
33821         LDKChannelConfig this_ptr_conv;
33822         this_ptr_conv.inner = untag_ptr(this_ptr);
33823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33825         this_ptr_conv.is_owned = false;
33826         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
33827         return ret_conv;
33828 }
33829
33830 void  CS_LDK_ChannelConfig_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
33831         LDKChannelConfig this_ptr_conv;
33832         this_ptr_conv.inner = untag_ptr(this_ptr);
33833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33835         this_ptr_conv.is_owned = false;
33836         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
33837 }
33838
33839 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_base_msat(int64_t this_ptr) {
33840         LDKChannelConfig this_ptr_conv;
33841         this_ptr_conv.inner = untag_ptr(this_ptr);
33842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33844         this_ptr_conv.is_owned = false;
33845         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
33846         return ret_conv;
33847 }
33848
33849 void  CS_LDK_ChannelConfig_set_forwarding_fee_base_msat(int64_t this_ptr, int32_t val) {
33850         LDKChannelConfig this_ptr_conv;
33851         this_ptr_conv.inner = untag_ptr(this_ptr);
33852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33854         this_ptr_conv.is_owned = false;
33855         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
33856 }
33857
33858 int16_t  CS_LDK_ChannelConfig_get_cltv_expiry_delta(int64_t this_ptr) {
33859         LDKChannelConfig this_ptr_conv;
33860         this_ptr_conv.inner = untag_ptr(this_ptr);
33861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33863         this_ptr_conv.is_owned = false;
33864         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
33865         return ret_conv;
33866 }
33867
33868 void  CS_LDK_ChannelConfig_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
33869         LDKChannelConfig this_ptr_conv;
33870         this_ptr_conv.inner = untag_ptr(this_ptr);
33871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33873         this_ptr_conv.is_owned = false;
33874         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
33875 }
33876
33877 int64_t  CS_LDK_ChannelConfig_get_max_dust_htlc_exposure(int64_t this_ptr) {
33878         LDKChannelConfig this_ptr_conv;
33879         this_ptr_conv.inner = untag_ptr(this_ptr);
33880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33882         this_ptr_conv.is_owned = false;
33883         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
33884         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
33885         int64_t ret_ref = tag_ptr(ret_copy, true);
33886         return ret_ref;
33887 }
33888
33889 void  CS_LDK_ChannelConfig_set_max_dust_htlc_exposure(int64_t this_ptr, int64_t val) {
33890         LDKChannelConfig this_ptr_conv;
33891         this_ptr_conv.inner = untag_ptr(this_ptr);
33892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33894         this_ptr_conv.is_owned = false;
33895         void* val_ptr = untag_ptr(val);
33896         CHECK_ACCESS(val_ptr);
33897         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
33898         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
33899         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
33900 }
33901
33902 int64_t  CS_LDK_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
33903         LDKChannelConfig this_ptr_conv;
33904         this_ptr_conv.inner = untag_ptr(this_ptr);
33905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33907         this_ptr_conv.is_owned = false;
33908         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
33909         return ret_conv;
33910 }
33911
33912 void  CS_LDK_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
33913         LDKChannelConfig this_ptr_conv;
33914         this_ptr_conv.inner = untag_ptr(this_ptr);
33915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33917         this_ptr_conv.is_owned = false;
33918         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
33919 }
33920
33921 jboolean  CS_LDK_ChannelConfig_get_accept_underpaying_htlcs(int64_t this_ptr) {
33922         LDKChannelConfig this_ptr_conv;
33923         this_ptr_conv.inner = untag_ptr(this_ptr);
33924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33926         this_ptr_conv.is_owned = false;
33927         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
33928         return ret_conv;
33929 }
33930
33931 void  CS_LDK_ChannelConfig_set_accept_underpaying_htlcs(int64_t this_ptr, jboolean val) {
33932         LDKChannelConfig this_ptr_conv;
33933         this_ptr_conv.inner = untag_ptr(this_ptr);
33934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33936         this_ptr_conv.is_owned = false;
33937         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
33938 }
33939
33940 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) {
33941         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
33942         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
33943         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
33944         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
33945         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);
33946         int64_t ret_ref = 0;
33947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33949         return ret_ref;
33950 }
33951
33952 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
33953         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
33954         int64_t ret_ref = 0;
33955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33957         return ret_ref;
33958 }
33959 int64_t  CS_LDK_ChannelConfig_clone_ptr(int64_t arg) {
33960         LDKChannelConfig arg_conv;
33961         arg_conv.inner = untag_ptr(arg);
33962         arg_conv.is_owned = ptr_is_owned(arg);
33963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33964         arg_conv.is_owned = false;
33965         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
33966         return ret_conv;
33967 }
33968
33969 int64_t  CS_LDK_ChannelConfig_clone(int64_t orig) {
33970         LDKChannelConfig orig_conv;
33971         orig_conv.inner = untag_ptr(orig);
33972         orig_conv.is_owned = ptr_is_owned(orig);
33973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33974         orig_conv.is_owned = false;
33975         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
33976         int64_t ret_ref = 0;
33977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33979         return ret_ref;
33980 }
33981
33982 jboolean  CS_LDK_ChannelConfig_eq(int64_t a, int64_t b) {
33983         LDKChannelConfig a_conv;
33984         a_conv.inner = untag_ptr(a);
33985         a_conv.is_owned = ptr_is_owned(a);
33986         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33987         a_conv.is_owned = false;
33988         LDKChannelConfig b_conv;
33989         b_conv.inner = untag_ptr(b);
33990         b_conv.is_owned = ptr_is_owned(b);
33991         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33992         b_conv.is_owned = false;
33993         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
33994         return ret_conv;
33995 }
33996
33997 void  CS_LDK_ChannelConfig_apply(int64_t this_arg, int64_t update) {
33998         LDKChannelConfig this_arg_conv;
33999         this_arg_conv.inner = untag_ptr(this_arg);
34000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34002         this_arg_conv.is_owned = false;
34003         LDKChannelConfigUpdate update_conv;
34004         update_conv.inner = untag_ptr(update);
34005         update_conv.is_owned = ptr_is_owned(update);
34006         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
34007         update_conv.is_owned = false;
34008         ChannelConfig_apply(&this_arg_conv, &update_conv);
34009 }
34010
34011 int64_t  CS_LDK_ChannelConfig_default() {
34012         LDKChannelConfig ret_var = ChannelConfig_default();
34013         int64_t ret_ref = 0;
34014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34016         return ret_ref;
34017 }
34018
34019 int8_tArray  CS_LDK_ChannelConfig_write(int64_t obj) {
34020         LDKChannelConfig obj_conv;
34021         obj_conv.inner = untag_ptr(obj);
34022         obj_conv.is_owned = ptr_is_owned(obj);
34023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34024         obj_conv.is_owned = false;
34025         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
34026         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34027         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34028         CVec_u8Z_free(ret_var);
34029         return ret_arr;
34030 }
34031
34032 int64_t  CS_LDK_ChannelConfig_read(int8_tArray ser) {
34033         LDKu8slice ser_ref;
34034         ser_ref.datalen = ser->arr_len;
34035         ser_ref.data = ser->elems;
34036         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
34037         *ret_conv = ChannelConfig_read(ser_ref);
34038         FREE(ser);
34039         return tag_ptr(ret_conv, true);
34040 }
34041
34042 void  CS_LDK_ChannelConfigUpdate_free(int64_t this_obj) {
34043         LDKChannelConfigUpdate this_obj_conv;
34044         this_obj_conv.inner = untag_ptr(this_obj);
34045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34047         ChannelConfigUpdate_free(this_obj_conv);
34048 }
34049
34050 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
34051         LDKChannelConfigUpdate this_ptr_conv;
34052         this_ptr_conv.inner = untag_ptr(this_ptr);
34053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34055         this_ptr_conv.is_owned = false;
34056         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34057         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34058         int64_t ret_ref = tag_ptr(ret_copy, true);
34059         return ret_ref;
34060 }
34061
34062 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int64_t val) {
34063         LDKChannelConfigUpdate this_ptr_conv;
34064         this_ptr_conv.inner = untag_ptr(this_ptr);
34065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34067         this_ptr_conv.is_owned = false;
34068         void* val_ptr = untag_ptr(val);
34069         CHECK_ACCESS(val_ptr);
34070         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34071         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34072         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
34073 }
34074
34075 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_base_msat(int64_t this_ptr) {
34076         LDKChannelConfigUpdate this_ptr_conv;
34077         this_ptr_conv.inner = untag_ptr(this_ptr);
34078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34080         this_ptr_conv.is_owned = false;
34081         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34082         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
34083         int64_t ret_ref = tag_ptr(ret_copy, true);
34084         return ret_ref;
34085 }
34086
34087 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_base_msat(int64_t this_ptr, int64_t val) {
34088         LDKChannelConfigUpdate this_ptr_conv;
34089         this_ptr_conv.inner = untag_ptr(this_ptr);
34090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34092         this_ptr_conv.is_owned = false;
34093         void* val_ptr = untag_ptr(val);
34094         CHECK_ACCESS(val_ptr);
34095         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34096         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34097         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
34098 }
34099
34100 int64_t  CS_LDK_ChannelConfigUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
34101         LDKChannelConfigUpdate this_ptr_conv;
34102         this_ptr_conv.inner = untag_ptr(this_ptr);
34103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34105         this_ptr_conv.is_owned = false;
34106         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34107         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34108         int64_t ret_ref = tag_ptr(ret_copy, true);
34109         return ret_ref;
34110 }
34111
34112 void  CS_LDK_ChannelConfigUpdate_set_cltv_expiry_delta(int64_t this_ptr, int64_t val) {
34113         LDKChannelConfigUpdate this_ptr_conv;
34114         this_ptr_conv.inner = untag_ptr(this_ptr);
34115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34117         this_ptr_conv.is_owned = false;
34118         void* val_ptr = untag_ptr(val);
34119         CHECK_ACCESS(val_ptr);
34120         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34121         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34122         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
34123 }
34124
34125 int64_t  CS_LDK_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(int64_t this_ptr) {
34126         LDKChannelConfigUpdate this_ptr_conv;
34127         this_ptr_conv.inner = untag_ptr(this_ptr);
34128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130         this_ptr_conv.is_owned = false;
34131         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
34132         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
34133         int64_t ret_ref = tag_ptr(ret_copy, true);
34134         return ret_ref;
34135 }
34136
34137 void  CS_LDK_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(int64_t this_ptr, int64_t val) {
34138         LDKChannelConfigUpdate this_ptr_conv;
34139         this_ptr_conv.inner = untag_ptr(this_ptr);
34140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34142         this_ptr_conv.is_owned = false;
34143         void* val_ptr = untag_ptr(val);
34144         CHECK_ACCESS(val_ptr);
34145         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
34146         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
34147         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
34148 }
34149
34150 int64_t  CS_LDK_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
34151         LDKChannelConfigUpdate this_ptr_conv;
34152         this_ptr_conv.inner = untag_ptr(this_ptr);
34153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34155         this_ptr_conv.is_owned = false;
34156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34157         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34158         int64_t ret_ref = tag_ptr(ret_copy, true);
34159         return ret_ref;
34160 }
34161
34162 void  CS_LDK_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
34163         LDKChannelConfigUpdate this_ptr_conv;
34164         this_ptr_conv.inner = untag_ptr(this_ptr);
34165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34167         this_ptr_conv.is_owned = false;
34168         void* val_ptr = untag_ptr(val);
34169         CHECK_ACCESS(val_ptr);
34170         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34171         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34172         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
34173 }
34174
34175 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) {
34176         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
34177         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
34178         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
34179         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
34180         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
34181         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
34182         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
34183         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
34184         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
34185         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
34186         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
34187         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
34188         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
34189         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
34190         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
34191         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
34192         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
34193         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
34194         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
34195         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
34196         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);
34197         int64_t ret_ref = 0;
34198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34200         return ret_ref;
34201 }
34202
34203 int64_t  CS_LDK_ChannelConfigUpdate_default() {
34204         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
34205         int64_t ret_ref = 0;
34206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34208         return ret_ref;
34209 }
34210
34211 void  CS_LDK_UserConfig_free(int64_t this_obj) {
34212         LDKUserConfig this_obj_conv;
34213         this_obj_conv.inner = untag_ptr(this_obj);
34214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34216         UserConfig_free(this_obj_conv);
34217 }
34218
34219 int64_t  CS_LDK_UserConfig_get_channel_handshake_config(int64_t this_ptr) {
34220         LDKUserConfig this_ptr_conv;
34221         this_ptr_conv.inner = untag_ptr(this_ptr);
34222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34224         this_ptr_conv.is_owned = false;
34225         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
34226         int64_t ret_ref = 0;
34227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34229         return ret_ref;
34230 }
34231
34232 void  CS_LDK_UserConfig_set_channel_handshake_config(int64_t this_ptr, int64_t val) {
34233         LDKUserConfig this_ptr_conv;
34234         this_ptr_conv.inner = untag_ptr(this_ptr);
34235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34237         this_ptr_conv.is_owned = false;
34238         LDKChannelHandshakeConfig val_conv;
34239         val_conv.inner = untag_ptr(val);
34240         val_conv.is_owned = ptr_is_owned(val);
34241         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34242         val_conv = ChannelHandshakeConfig_clone(&val_conv);
34243         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
34244 }
34245
34246 int64_t  CS_LDK_UserConfig_get_channel_handshake_limits(int64_t this_ptr) {
34247         LDKUserConfig this_ptr_conv;
34248         this_ptr_conv.inner = untag_ptr(this_ptr);
34249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34251         this_ptr_conv.is_owned = false;
34252         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
34253         int64_t ret_ref = 0;
34254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34256         return ret_ref;
34257 }
34258
34259 void  CS_LDK_UserConfig_set_channel_handshake_limits(int64_t this_ptr, int64_t val) {
34260         LDKUserConfig this_ptr_conv;
34261         this_ptr_conv.inner = untag_ptr(this_ptr);
34262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34264         this_ptr_conv.is_owned = false;
34265         LDKChannelHandshakeLimits val_conv;
34266         val_conv.inner = untag_ptr(val);
34267         val_conv.is_owned = ptr_is_owned(val);
34268         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34269         val_conv = ChannelHandshakeLimits_clone(&val_conv);
34270         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
34271 }
34272
34273 int64_t  CS_LDK_UserConfig_get_channel_config(int64_t this_ptr) {
34274         LDKUserConfig this_ptr_conv;
34275         this_ptr_conv.inner = untag_ptr(this_ptr);
34276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34278         this_ptr_conv.is_owned = false;
34279         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
34280         int64_t ret_ref = 0;
34281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34283         return ret_ref;
34284 }
34285
34286 void  CS_LDK_UserConfig_set_channel_config(int64_t this_ptr, int64_t val) {
34287         LDKUserConfig this_ptr_conv;
34288         this_ptr_conv.inner = untag_ptr(this_ptr);
34289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34291         this_ptr_conv.is_owned = false;
34292         LDKChannelConfig val_conv;
34293         val_conv.inner = untag_ptr(val);
34294         val_conv.is_owned = ptr_is_owned(val);
34295         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34296         val_conv = ChannelConfig_clone(&val_conv);
34297         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
34298 }
34299
34300 jboolean  CS_LDK_UserConfig_get_accept_forwards_to_priv_channels(int64_t this_ptr) {
34301         LDKUserConfig this_ptr_conv;
34302         this_ptr_conv.inner = untag_ptr(this_ptr);
34303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34305         this_ptr_conv.is_owned = false;
34306         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
34307         return ret_conv;
34308 }
34309
34310 void  CS_LDK_UserConfig_set_accept_forwards_to_priv_channels(int64_t this_ptr, jboolean val) {
34311         LDKUserConfig this_ptr_conv;
34312         this_ptr_conv.inner = untag_ptr(this_ptr);
34313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34315         this_ptr_conv.is_owned = false;
34316         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
34317 }
34318
34319 jboolean  CS_LDK_UserConfig_get_accept_inbound_channels(int64_t this_ptr) {
34320         LDKUserConfig this_ptr_conv;
34321         this_ptr_conv.inner = untag_ptr(this_ptr);
34322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34324         this_ptr_conv.is_owned = false;
34325         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
34326         return ret_conv;
34327 }
34328
34329 void  CS_LDK_UserConfig_set_accept_inbound_channels(int64_t this_ptr, jboolean val) {
34330         LDKUserConfig this_ptr_conv;
34331         this_ptr_conv.inner = untag_ptr(this_ptr);
34332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34334         this_ptr_conv.is_owned = false;
34335         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
34336 }
34337
34338 jboolean  CS_LDK_UserConfig_get_manually_accept_inbound_channels(int64_t this_ptr) {
34339         LDKUserConfig this_ptr_conv;
34340         this_ptr_conv.inner = untag_ptr(this_ptr);
34341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34343         this_ptr_conv.is_owned = false;
34344         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
34345         return ret_conv;
34346 }
34347
34348 void  CS_LDK_UserConfig_set_manually_accept_inbound_channels(int64_t this_ptr, jboolean val) {
34349         LDKUserConfig this_ptr_conv;
34350         this_ptr_conv.inner = untag_ptr(this_ptr);
34351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34353         this_ptr_conv.is_owned = false;
34354         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
34355 }
34356
34357 jboolean  CS_LDK_UserConfig_get_accept_intercept_htlcs(int64_t this_ptr) {
34358         LDKUserConfig this_ptr_conv;
34359         this_ptr_conv.inner = untag_ptr(this_ptr);
34360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34362         this_ptr_conv.is_owned = false;
34363         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
34364         return ret_conv;
34365 }
34366
34367 void  CS_LDK_UserConfig_set_accept_intercept_htlcs(int64_t this_ptr, jboolean val) {
34368         LDKUserConfig this_ptr_conv;
34369         this_ptr_conv.inner = untag_ptr(this_ptr);
34370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34372         this_ptr_conv.is_owned = false;
34373         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
34374 }
34375
34376 jboolean  CS_LDK_UserConfig_get_accept_mpp_keysend(int64_t this_ptr) {
34377         LDKUserConfig this_ptr_conv;
34378         this_ptr_conv.inner = untag_ptr(this_ptr);
34379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34381         this_ptr_conv.is_owned = false;
34382         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
34383         return ret_conv;
34384 }
34385
34386 void  CS_LDK_UserConfig_set_accept_mpp_keysend(int64_t this_ptr, jboolean val) {
34387         LDKUserConfig this_ptr_conv;
34388         this_ptr_conv.inner = untag_ptr(this_ptr);
34389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34391         this_ptr_conv.is_owned = false;
34392         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34393 }
34394
34395 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) {
34396         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34397         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34398         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34400         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34401         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34402         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34403         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34404         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34405         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34406         LDKChannelConfig channel_config_arg_conv;
34407         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34408         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34409         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34410         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34411         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);
34412         int64_t ret_ref = 0;
34413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34415         return ret_ref;
34416 }
34417
34418 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34419         LDKUserConfig ret_var = UserConfig_clone(arg);
34420         int64_t ret_ref = 0;
34421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34423         return ret_ref;
34424 }
34425 int64_t  CS_LDK_UserConfig_clone_ptr(int64_t arg) {
34426         LDKUserConfig arg_conv;
34427         arg_conv.inner = untag_ptr(arg);
34428         arg_conv.is_owned = ptr_is_owned(arg);
34429         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34430         arg_conv.is_owned = false;
34431         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34432         return ret_conv;
34433 }
34434
34435 int64_t  CS_LDK_UserConfig_clone(int64_t orig) {
34436         LDKUserConfig orig_conv;
34437         orig_conv.inner = untag_ptr(orig);
34438         orig_conv.is_owned = ptr_is_owned(orig);
34439         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34440         orig_conv.is_owned = false;
34441         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34442         int64_t ret_ref = 0;
34443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34445         return ret_ref;
34446 }
34447
34448 int64_t  CS_LDK_UserConfig_default() {
34449         LDKUserConfig ret_var = UserConfig_default();
34450         int64_t ret_ref = 0;
34451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34453         return ret_ref;
34454 }
34455
34456 void  CS_LDK_BestBlock_free(int64_t this_obj) {
34457         LDKBestBlock this_obj_conv;
34458         this_obj_conv.inner = untag_ptr(this_obj);
34459         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34461         BestBlock_free(this_obj_conv);
34462 }
34463
34464 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34465         LDKBestBlock ret_var = BestBlock_clone(arg);
34466         int64_t ret_ref = 0;
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34469         return ret_ref;
34470 }
34471 int64_t  CS_LDK_BestBlock_clone_ptr(int64_t arg) {
34472         LDKBestBlock arg_conv;
34473         arg_conv.inner = untag_ptr(arg);
34474         arg_conv.is_owned = ptr_is_owned(arg);
34475         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34476         arg_conv.is_owned = false;
34477         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34478         return ret_conv;
34479 }
34480
34481 int64_t  CS_LDK_BestBlock_clone(int64_t orig) {
34482         LDKBestBlock orig_conv;
34483         orig_conv.inner = untag_ptr(orig);
34484         orig_conv.is_owned = ptr_is_owned(orig);
34485         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34486         orig_conv.is_owned = false;
34487         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34488         int64_t ret_ref = 0;
34489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34491         return ret_ref;
34492 }
34493
34494 jboolean  CS_LDK_BestBlock_eq(int64_t a, int64_t b) {
34495         LDKBestBlock a_conv;
34496         a_conv.inner = untag_ptr(a);
34497         a_conv.is_owned = ptr_is_owned(a);
34498         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34499         a_conv.is_owned = false;
34500         LDKBestBlock b_conv;
34501         b_conv.inner = untag_ptr(b);
34502         b_conv.is_owned = ptr_is_owned(b);
34503         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34504         b_conv.is_owned = false;
34505         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34506         return ret_conv;
34507 }
34508
34509 int64_t  CS_LDK_BestBlock_from_network(int32_t network) {
34510         LDKNetwork network_conv = LDKNetwork_from_cs(network);
34511         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34512         int64_t ret_ref = 0;
34513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34515         return ret_ref;
34516 }
34517
34518 int64_t  CS_LDK_BestBlock_new(int8_tArray block_hash, int32_t height) {
34519         LDKThirtyTwoBytes block_hash_ref;
34520         CHECK(block_hash->arr_len == 32);
34521         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
34522         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34523         int64_t ret_ref = 0;
34524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34526         return ret_ref;
34527 }
34528
34529 int8_tArray  CS_LDK_BestBlock_block_hash(int64_t this_arg) {
34530         LDKBestBlock this_arg_conv;
34531         this_arg_conv.inner = untag_ptr(this_arg);
34532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34534         this_arg_conv.is_owned = false;
34535         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34536         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
34537         return ret_arr;
34538 }
34539
34540 int32_t  CS_LDK_BestBlock_height(int64_t this_arg) {
34541         LDKBestBlock this_arg_conv;
34542         this_arg_conv.inner = untag_ptr(this_arg);
34543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34545         this_arg_conv.is_owned = false;
34546         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34547         return ret_conv;
34548 }
34549
34550 void  CS_LDK_Listen_free(int64_t this_ptr) {
34551         if (!ptr_is_owned(this_ptr)) return;
34552         void* this_ptr_ptr = untag_ptr(this_ptr);
34553         CHECK_ACCESS(this_ptr_ptr);
34554         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34555         FREE(untag_ptr(this_ptr));
34556         Listen_free(this_ptr_conv);
34557 }
34558
34559 void  CS_LDK_Confirm_free(int64_t this_ptr) {
34560         if (!ptr_is_owned(this_ptr)) return;
34561         void* this_ptr_ptr = untag_ptr(this_ptr);
34562         CHECK_ACCESS(this_ptr_ptr);
34563         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34564         FREE(untag_ptr(this_ptr));
34565         Confirm_free(this_ptr_conv);
34566 }
34567
34568 int32_t  CS_LDK_ChannelMonitorUpdateStatus_clone(int64_t orig) {
34569         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34570         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_clone(orig_conv));
34571         return ret_conv;
34572 }
34573
34574 int32_t  CS_LDK_ChannelMonitorUpdateStatus_completed() {
34575         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_completed());
34576         return ret_conv;
34577 }
34578
34579 int32_t  CS_LDK_ChannelMonitorUpdateStatus_in_progress() {
34580         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_in_progress());
34581         return ret_conv;
34582 }
34583
34584 int32_t  CS_LDK_ChannelMonitorUpdateStatus_unrecoverable_error() {
34585         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_unrecoverable_error());
34586         return ret_conv;
34587 }
34588
34589 jboolean  CS_LDK_ChannelMonitorUpdateStatus_eq(int64_t a, int64_t b) {
34590         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34591         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34592         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34593         return ret_conv;
34594 }
34595
34596 void  CS_LDK_Watch_free(int64_t this_ptr) {
34597         if (!ptr_is_owned(this_ptr)) return;
34598         void* this_ptr_ptr = untag_ptr(this_ptr);
34599         CHECK_ACCESS(this_ptr_ptr);
34600         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34601         FREE(untag_ptr(this_ptr));
34602         Watch_free(this_ptr_conv);
34603 }
34604
34605 void  CS_LDK_Filter_free(int64_t this_ptr) {
34606         if (!ptr_is_owned(this_ptr)) return;
34607         void* this_ptr_ptr = untag_ptr(this_ptr);
34608         CHECK_ACCESS(this_ptr_ptr);
34609         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34610         FREE(untag_ptr(this_ptr));
34611         Filter_free(this_ptr_conv);
34612 }
34613
34614 void  CS_LDK_WatchedOutput_free(int64_t this_obj) {
34615         LDKWatchedOutput this_obj_conv;
34616         this_obj_conv.inner = untag_ptr(this_obj);
34617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34619         WatchedOutput_free(this_obj_conv);
34620 }
34621
34622 int64_t  CS_LDK_WatchedOutput_get_block_hash(int64_t this_ptr) {
34623         LDKWatchedOutput this_ptr_conv;
34624         this_ptr_conv.inner = untag_ptr(this_ptr);
34625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34627         this_ptr_conv.is_owned = false;
34628         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
34629         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34630         int64_t ret_ref = tag_ptr(ret_copy, true);
34631         return ret_ref;
34632 }
34633
34634 void  CS_LDK_WatchedOutput_set_block_hash(int64_t this_ptr, int64_t val) {
34635         LDKWatchedOutput this_ptr_conv;
34636         this_ptr_conv.inner = untag_ptr(this_ptr);
34637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34639         this_ptr_conv.is_owned = false;
34640         void* val_ptr = untag_ptr(val);
34641         CHECK_ACCESS(val_ptr);
34642         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
34643         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
34644         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34645 }
34646
34647 int64_t  CS_LDK_WatchedOutput_get_outpoint(int64_t this_ptr) {
34648         LDKWatchedOutput this_ptr_conv;
34649         this_ptr_conv.inner = untag_ptr(this_ptr);
34650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34652         this_ptr_conv.is_owned = false;
34653         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34654         int64_t ret_ref = 0;
34655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34657         return ret_ref;
34658 }
34659
34660 void  CS_LDK_WatchedOutput_set_outpoint(int64_t this_ptr, int64_t val) {
34661         LDKWatchedOutput this_ptr_conv;
34662         this_ptr_conv.inner = untag_ptr(this_ptr);
34663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34665         this_ptr_conv.is_owned = false;
34666         LDKOutPoint val_conv;
34667         val_conv.inner = untag_ptr(val);
34668         val_conv.is_owned = ptr_is_owned(val);
34669         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34670         val_conv = OutPoint_clone(&val_conv);
34671         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34672 }
34673
34674 int8_tArray  CS_LDK_WatchedOutput_get_script_pubkey(int64_t this_ptr) {
34675         LDKWatchedOutput this_ptr_conv;
34676         this_ptr_conv.inner = untag_ptr(this_ptr);
34677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34679         this_ptr_conv.is_owned = false;
34680         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34683         CVec_u8Z_free(ret_var);
34684         return ret_arr;
34685 }
34686
34687 void  CS_LDK_WatchedOutput_set_script_pubkey(int64_t this_ptr, int8_tArray val) {
34688         LDKWatchedOutput this_ptr_conv;
34689         this_ptr_conv.inner = untag_ptr(this_ptr);
34690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34692         this_ptr_conv.is_owned = false;
34693         LDKCVec_u8Z val_ref;
34694         val_ref.datalen = val->arr_len;
34695         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34696         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34697         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34698 }
34699
34700 int64_t  CS_LDK_WatchedOutput_new(int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
34701         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34702         CHECK_ACCESS(block_hash_arg_ptr);
34703         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
34704         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
34705         LDKOutPoint outpoint_arg_conv;
34706         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34707         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34708         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34709         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
34710         LDKCVec_u8Z script_pubkey_arg_ref;
34711         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
34712         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34713         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
34714         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
34715         int64_t ret_ref = 0;
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34718         return ret_ref;
34719 }
34720
34721 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
34722         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
34723         int64_t ret_ref = 0;
34724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34726         return ret_ref;
34727 }
34728 int64_t  CS_LDK_WatchedOutput_clone_ptr(int64_t arg) {
34729         LDKWatchedOutput arg_conv;
34730         arg_conv.inner = untag_ptr(arg);
34731         arg_conv.is_owned = ptr_is_owned(arg);
34732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34733         arg_conv.is_owned = false;
34734         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
34735         return ret_conv;
34736 }
34737
34738 int64_t  CS_LDK_WatchedOutput_clone(int64_t orig) {
34739         LDKWatchedOutput orig_conv;
34740         orig_conv.inner = untag_ptr(orig);
34741         orig_conv.is_owned = ptr_is_owned(orig);
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34743         orig_conv.is_owned = false;
34744         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
34745         int64_t ret_ref = 0;
34746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34748         return ret_ref;
34749 }
34750
34751 jboolean  CS_LDK_WatchedOutput_eq(int64_t a, int64_t b) {
34752         LDKWatchedOutput a_conv;
34753         a_conv.inner = untag_ptr(a);
34754         a_conv.is_owned = ptr_is_owned(a);
34755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34756         a_conv.is_owned = false;
34757         LDKWatchedOutput b_conv;
34758         b_conv.inner = untag_ptr(b);
34759         b_conv.is_owned = ptr_is_owned(b);
34760         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34761         b_conv.is_owned = false;
34762         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
34763         return ret_conv;
34764 }
34765
34766 int64_t  CS_LDK_WatchedOutput_hash(int64_t o) {
34767         LDKWatchedOutput o_conv;
34768         o_conv.inner = untag_ptr(o);
34769         o_conv.is_owned = ptr_is_owned(o);
34770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34771         o_conv.is_owned = false;
34772         int64_t ret_conv = WatchedOutput_hash(&o_conv);
34773         return ret_conv;
34774 }
34775
34776 void  CS_LDK_BroadcasterInterface_free(int64_t this_ptr) {
34777         if (!ptr_is_owned(this_ptr)) return;
34778         void* this_ptr_ptr = untag_ptr(this_ptr);
34779         CHECK_ACCESS(this_ptr_ptr);
34780         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
34781         FREE(untag_ptr(this_ptr));
34782         BroadcasterInterface_free(this_ptr_conv);
34783 }
34784
34785 int32_t  CS_LDK_ConfirmationTarget_clone(int64_t orig) {
34786         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
34787         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_clone(orig_conv));
34788         return ret_conv;
34789 }
34790
34791 int32_t  CS_LDK_ConfirmationTarget_on_chain_sweep() {
34792         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_on_chain_sweep());
34793         return ret_conv;
34794 }
34795
34796 int32_t  CS_LDK_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
34797         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
34798         return ret_conv;
34799 }
34800
34801 int32_t  CS_LDK_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
34802         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
34803         return ret_conv;
34804 }
34805
34806 int32_t  CS_LDK_ConfirmationTarget_anchor_channel_fee() {
34807         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_anchor_channel_fee());
34808         return ret_conv;
34809 }
34810
34811 int32_t  CS_LDK_ConfirmationTarget_non_anchor_channel_fee() {
34812         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_non_anchor_channel_fee());
34813         return ret_conv;
34814 }
34815
34816 int32_t  CS_LDK_ConfirmationTarget_channel_close_minimum() {
34817         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_channel_close_minimum());
34818         return ret_conv;
34819 }
34820
34821 int64_t  CS_LDK_ConfirmationTarget_hash(int64_t o) {
34822         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
34823         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
34824         return ret_conv;
34825 }
34826
34827 jboolean  CS_LDK_ConfirmationTarget_eq(int64_t a, int64_t b) {
34828         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
34829         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
34830         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
34831         return ret_conv;
34832 }
34833
34834 void  CS_LDK_FeeEstimator_free(int64_t this_ptr) {
34835         if (!ptr_is_owned(this_ptr)) return;
34836         void* this_ptr_ptr = untag_ptr(this_ptr);
34837         CHECK_ACCESS(this_ptr_ptr);
34838         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
34839         FREE(untag_ptr(this_ptr));
34840         FeeEstimator_free(this_ptr_conv);
34841 }
34842
34843 void  CS_LDK_MonitorUpdateId_free(int64_t this_obj) {
34844         LDKMonitorUpdateId this_obj_conv;
34845         this_obj_conv.inner = untag_ptr(this_obj);
34846         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34848         MonitorUpdateId_free(this_obj_conv);
34849 }
34850
34851 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
34852         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
34853         int64_t ret_ref = 0;
34854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34856         return ret_ref;
34857 }
34858 int64_t  CS_LDK_MonitorUpdateId_clone_ptr(int64_t arg) {
34859         LDKMonitorUpdateId arg_conv;
34860         arg_conv.inner = untag_ptr(arg);
34861         arg_conv.is_owned = ptr_is_owned(arg);
34862         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34863         arg_conv.is_owned = false;
34864         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
34865         return ret_conv;
34866 }
34867
34868 int64_t  CS_LDK_MonitorUpdateId_clone(int64_t orig) {
34869         LDKMonitorUpdateId orig_conv;
34870         orig_conv.inner = untag_ptr(orig);
34871         orig_conv.is_owned = ptr_is_owned(orig);
34872         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34873         orig_conv.is_owned = false;
34874         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
34875         int64_t ret_ref = 0;
34876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34878         return ret_ref;
34879 }
34880
34881 int64_t  CS_LDK_MonitorUpdateId_hash(int64_t o) {
34882         LDKMonitorUpdateId o_conv;
34883         o_conv.inner = untag_ptr(o);
34884         o_conv.is_owned = ptr_is_owned(o);
34885         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34886         o_conv.is_owned = false;
34887         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
34888         return ret_conv;
34889 }
34890
34891 jboolean  CS_LDK_MonitorUpdateId_eq(int64_t a, int64_t b) {
34892         LDKMonitorUpdateId a_conv;
34893         a_conv.inner = untag_ptr(a);
34894         a_conv.is_owned = ptr_is_owned(a);
34895         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34896         a_conv.is_owned = false;
34897         LDKMonitorUpdateId b_conv;
34898         b_conv.inner = untag_ptr(b);
34899         b_conv.is_owned = ptr_is_owned(b);
34900         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34901         b_conv.is_owned = false;
34902         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
34903         return ret_conv;
34904 }
34905
34906 void  CS_LDK_Persist_free(int64_t this_ptr) {
34907         if (!ptr_is_owned(this_ptr)) return;
34908         void* this_ptr_ptr = untag_ptr(this_ptr);
34909         CHECK_ACCESS(this_ptr_ptr);
34910         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
34911         FREE(untag_ptr(this_ptr));
34912         Persist_free(this_ptr_conv);
34913 }
34914
34915 void  CS_LDK_LockedChannelMonitor_free(int64_t this_obj) {
34916         LDKLockedChannelMonitor this_obj_conv;
34917         this_obj_conv.inner = untag_ptr(this_obj);
34918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34920         LockedChannelMonitor_free(this_obj_conv);
34921 }
34922
34923 void  CS_LDK_ChainMonitor_free(int64_t this_obj) {
34924         LDKChainMonitor this_obj_conv;
34925         this_obj_conv.inner = untag_ptr(this_obj);
34926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34928         ChainMonitor_free(this_obj_conv);
34929 }
34930
34931 int64_t  CS_LDK_ChainMonitor_new(int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
34932         void* chain_source_ptr = untag_ptr(chain_source);
34933         CHECK_ACCESS(chain_source_ptr);
34934         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
34935         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
34936         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
34937                 // Manually implement clone for Java trait instances
34938                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
34939                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34940                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
34941                 }
34942         }
34943         void* broadcaster_ptr = untag_ptr(broadcaster);
34944         CHECK_ACCESS(broadcaster_ptr);
34945         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
34946         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34947                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34948                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
34949         }
34950         void* logger_ptr = untag_ptr(logger);
34951         CHECK_ACCESS(logger_ptr);
34952         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34953         if (logger_conv.free == LDKLogger_JCalls_free) {
34954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34955                 LDKLogger_JCalls_cloned(&logger_conv);
34956         }
34957         void* feeest_ptr = untag_ptr(feeest);
34958         CHECK_ACCESS(feeest_ptr);
34959         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
34960         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
34961                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34962                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
34963         }
34964         void* persister_ptr = untag_ptr(persister);
34965         CHECK_ACCESS(persister_ptr);
34966         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
34967         if (persister_conv.free == LDKPersist_JCalls_free) {
34968                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34969                 LDKPersist_JCalls_cloned(&persister_conv);
34970         }
34971         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
34972         int64_t ret_ref = 0;
34973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34975         return ret_ref;
34976 }
34977
34978 int64_tArray  CS_LDK_ChainMonitor_get_claimable_balances(int64_t this_arg, int64_tArray ignored_channels) {
34979         LDKChainMonitor this_arg_conv;
34980         this_arg_conv.inner = untag_ptr(this_arg);
34981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34983         this_arg_conv.is_owned = false;
34984         LDKCVec_ChannelDetailsZ ignored_channels_constr;
34985         ignored_channels_constr.datalen = ignored_channels->arr_len;
34986         if (ignored_channels_constr.datalen > 0)
34987                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34988         else
34989                 ignored_channels_constr.data = NULL;
34990         int64_t* ignored_channels_vals = ignored_channels->elems;
34991         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
34992                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
34993                 LDKChannelDetails ignored_channels_conv_16_conv;
34994                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
34995                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
34996                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
34997                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
34998                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
34999         }
35000         FREE(ignored_channels);
35001         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
35002         int64_tArray ret_arr = NULL;
35003         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35004         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35005         for (size_t j = 0; j < ret_var.datalen; j++) {
35006                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35007                 *ret_conv_9_copy = ret_var.data[j];
35008                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35009                 ret_arr_ptr[j] = ret_conv_9_ref;
35010         }
35011         
35012         FREE(ret_var.data);
35013         return ret_arr;
35014 }
35015
35016 int64_t  CS_LDK_ChainMonitor_get_monitor(int64_t this_arg, int64_t funding_txo) {
35017         LDKChainMonitor this_arg_conv;
35018         this_arg_conv.inner = untag_ptr(this_arg);
35019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35021         this_arg_conv.is_owned = false;
35022         LDKOutPoint funding_txo_conv;
35023         funding_txo_conv.inner = untag_ptr(funding_txo);
35024         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35025         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35026         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35027         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35028         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
35029         return tag_ptr(ret_conv, true);
35030 }
35031
35032 int64_tArray  CS_LDK_ChainMonitor_list_monitors(int64_t this_arg) {
35033         LDKChainMonitor this_arg_conv;
35034         this_arg_conv.inner = untag_ptr(this_arg);
35035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35037         this_arg_conv.is_owned = false;
35038         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
35039         int64_tArray ret_arr = NULL;
35040         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35041         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35042         for (size_t k = 0; k < ret_var.datalen; k++) {
35043                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
35044                 int64_t ret_conv_10_ref = 0;
35045                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
35046                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
35047                 ret_arr_ptr[k] = ret_conv_10_ref;
35048         }
35049         
35050         FREE(ret_var.data);
35051         return ret_arr;
35052 }
35053
35054 int64_tArray  CS_LDK_ChainMonitor_list_pending_monitor_updates(int64_t this_arg) {
35055         LDKChainMonitor this_arg_conv;
35056         this_arg_conv.inner = untag_ptr(this_arg);
35057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35059         this_arg_conv.is_owned = false;
35060         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
35061         int64_tArray ret_arr = NULL;
35062         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35063         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35064         for (size_t p = 0; p < ret_var.datalen; p++) {
35065                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35066                 *ret_conv_41_conv = ret_var.data[p];
35067                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
35068         }
35069         
35070         FREE(ret_var.data);
35071         return ret_arr;
35072 }
35073
35074 int64_t  CS_LDK_ChainMonitor_channel_monitor_updated(int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
35075         LDKChainMonitor this_arg_conv;
35076         this_arg_conv.inner = untag_ptr(this_arg);
35077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35079         this_arg_conv.is_owned = false;
35080         LDKOutPoint funding_txo_conv;
35081         funding_txo_conv.inner = untag_ptr(funding_txo);
35082         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35083         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35084         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35085         LDKMonitorUpdateId completed_update_id_conv;
35086         completed_update_id_conv.inner = untag_ptr(completed_update_id);
35087         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
35088         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
35089         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
35090         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35091         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
35092         return tag_ptr(ret_conv, true);
35093 }
35094
35095 int64_t  CS_LDK_ChainMonitor_get_update_future(int64_t this_arg) {
35096         LDKChainMonitor this_arg_conv;
35097         this_arg_conv.inner = untag_ptr(this_arg);
35098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35100         this_arg_conv.is_owned = false;
35101         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
35102         int64_t ret_ref = 0;
35103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35105         return ret_ref;
35106 }
35107
35108 void  CS_LDK_ChainMonitor_rebroadcast_pending_claims(int64_t this_arg) {
35109         LDKChainMonitor this_arg_conv;
35110         this_arg_conv.inner = untag_ptr(this_arg);
35111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35113         this_arg_conv.is_owned = false;
35114         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
35115 }
35116
35117 int64_t  CS_LDK_ChainMonitor_as_Listen(int64_t this_arg) {
35118         LDKChainMonitor this_arg_conv;
35119         this_arg_conv.inner = untag_ptr(this_arg);
35120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35122         this_arg_conv.is_owned = false;
35123         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35124         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
35125         return tag_ptr(ret_ret, true);
35126 }
35127
35128 int64_t  CS_LDK_ChainMonitor_as_Confirm(int64_t this_arg) {
35129         LDKChainMonitor this_arg_conv;
35130         this_arg_conv.inner = untag_ptr(this_arg);
35131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35133         this_arg_conv.is_owned = false;
35134         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35135         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
35136         return tag_ptr(ret_ret, true);
35137 }
35138
35139 int64_t  CS_LDK_ChainMonitor_as_Watch(int64_t this_arg) {
35140         LDKChainMonitor this_arg_conv;
35141         this_arg_conv.inner = untag_ptr(this_arg);
35142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35144         this_arg_conv.is_owned = false;
35145         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
35146         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
35147         return tag_ptr(ret_ret, true);
35148 }
35149
35150 int64_t  CS_LDK_ChainMonitor_as_EventsProvider(int64_t this_arg) {
35151         LDKChainMonitor this_arg_conv;
35152         this_arg_conv.inner = untag_ptr(this_arg);
35153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35155         this_arg_conv.is_owned = false;
35156         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35157         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
35158         return tag_ptr(ret_ret, true);
35159 }
35160
35161 void  CS_LDK_ChannelMonitorUpdate_free(int64_t this_obj) {
35162         LDKChannelMonitorUpdate this_obj_conv;
35163         this_obj_conv.inner = untag_ptr(this_obj);
35164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35166         ChannelMonitorUpdate_free(this_obj_conv);
35167 }
35168
35169 int64_t  CS_LDK_ChannelMonitorUpdate_get_update_id(int64_t this_ptr) {
35170         LDKChannelMonitorUpdate this_ptr_conv;
35171         this_ptr_conv.inner = untag_ptr(this_ptr);
35172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35174         this_ptr_conv.is_owned = false;
35175         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
35176         return ret_conv;
35177 }
35178
35179 void  CS_LDK_ChannelMonitorUpdate_set_update_id(int64_t this_ptr, int64_t val) {
35180         LDKChannelMonitorUpdate this_ptr_conv;
35181         this_ptr_conv.inner = untag_ptr(this_ptr);
35182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35184         this_ptr_conv.is_owned = false;
35185         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
35186 }
35187
35188 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
35189         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
35190         int64_t ret_ref = 0;
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35193         return ret_ref;
35194 }
35195 int64_t  CS_LDK_ChannelMonitorUpdate_clone_ptr(int64_t arg) {
35196         LDKChannelMonitorUpdate arg_conv;
35197         arg_conv.inner = untag_ptr(arg);
35198         arg_conv.is_owned = ptr_is_owned(arg);
35199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35200         arg_conv.is_owned = false;
35201         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
35202         return ret_conv;
35203 }
35204
35205 int64_t  CS_LDK_ChannelMonitorUpdate_clone(int64_t orig) {
35206         LDKChannelMonitorUpdate orig_conv;
35207         orig_conv.inner = untag_ptr(orig);
35208         orig_conv.is_owned = ptr_is_owned(orig);
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35210         orig_conv.is_owned = false;
35211         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
35212         int64_t ret_ref = 0;
35213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35215         return ret_ref;
35216 }
35217
35218 jboolean  CS_LDK_ChannelMonitorUpdate_eq(int64_t a, int64_t b) {
35219         LDKChannelMonitorUpdate a_conv;
35220         a_conv.inner = untag_ptr(a);
35221         a_conv.is_owned = ptr_is_owned(a);
35222         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35223         a_conv.is_owned = false;
35224         LDKChannelMonitorUpdate b_conv;
35225         b_conv.inner = untag_ptr(b);
35226         b_conv.is_owned = ptr_is_owned(b);
35227         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35228         b_conv.is_owned = false;
35229         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
35230         return ret_conv;
35231 }
35232
35233 int8_tArray  CS_LDK_ChannelMonitorUpdate_write(int64_t obj) {
35234         LDKChannelMonitorUpdate obj_conv;
35235         obj_conv.inner = untag_ptr(obj);
35236         obj_conv.is_owned = ptr_is_owned(obj);
35237         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35238         obj_conv.is_owned = false;
35239         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
35240         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35241         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35242         CVec_u8Z_free(ret_var);
35243         return ret_arr;
35244 }
35245
35246 int64_t  CS_LDK_ChannelMonitorUpdate_read(int8_tArray ser) {
35247         LDKu8slice ser_ref;
35248         ser_ref.datalen = ser->arr_len;
35249         ser_ref.data = ser->elems;
35250         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
35251         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
35252         FREE(ser);
35253         return tag_ptr(ret_conv, true);
35254 }
35255
35256 void  CS_LDK_MonitorEvent_free(int64_t this_ptr) {
35257         if (!ptr_is_owned(this_ptr)) return;
35258         void* this_ptr_ptr = untag_ptr(this_ptr);
35259         CHECK_ACCESS(this_ptr_ptr);
35260         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
35261         FREE(untag_ptr(this_ptr));
35262         MonitorEvent_free(this_ptr_conv);
35263 }
35264
35265 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
35266         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35267         *ret_copy = MonitorEvent_clone(arg);
35268         int64_t ret_ref = tag_ptr(ret_copy, true);
35269         return ret_ref;
35270 }
35271 int64_t  CS_LDK_MonitorEvent_clone_ptr(int64_t arg) {
35272         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
35273         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
35274         return ret_conv;
35275 }
35276
35277 int64_t  CS_LDK_MonitorEvent_clone(int64_t orig) {
35278         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
35279         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35280         *ret_copy = MonitorEvent_clone(orig_conv);
35281         int64_t ret_ref = tag_ptr(ret_copy, true);
35282         return ret_ref;
35283 }
35284
35285 int64_t  CS_LDK_MonitorEvent_htlcevent(int64_t a) {
35286         LDKHTLCUpdate a_conv;
35287         a_conv.inner = untag_ptr(a);
35288         a_conv.is_owned = ptr_is_owned(a);
35289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35290         a_conv = HTLCUpdate_clone(&a_conv);
35291         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35292         *ret_copy = MonitorEvent_htlcevent(a_conv);
35293         int64_t ret_ref = tag_ptr(ret_copy, true);
35294         return ret_ref;
35295 }
35296
35297 int64_t  CS_LDK_MonitorEvent_holder_force_closed(int64_t a) {
35298         LDKOutPoint a_conv;
35299         a_conv.inner = untag_ptr(a);
35300         a_conv.is_owned = ptr_is_owned(a);
35301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35302         a_conv = OutPoint_clone(&a_conv);
35303         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35304         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
35305         int64_t ret_ref = tag_ptr(ret_copy, true);
35306         return ret_ref;
35307 }
35308
35309 int64_t  CS_LDK_MonitorEvent_completed(int64_t funding_txo, int64_t monitor_update_id) {
35310         LDKOutPoint funding_txo_conv;
35311         funding_txo_conv.inner = untag_ptr(funding_txo);
35312         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35313         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35314         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35315         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35316         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
35317         int64_t ret_ref = tag_ptr(ret_copy, true);
35318         return ret_ref;
35319 }
35320
35321 jboolean  CS_LDK_MonitorEvent_eq(int64_t a, int64_t b) {
35322         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
35323         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
35324         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
35325         return ret_conv;
35326 }
35327
35328 int8_tArray  CS_LDK_MonitorEvent_write(int64_t obj) {
35329         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
35330         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
35331         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35332         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35333         CVec_u8Z_free(ret_var);
35334         return ret_arr;
35335 }
35336
35337 int64_t  CS_LDK_MonitorEvent_read(int8_tArray ser) {
35338         LDKu8slice ser_ref;
35339         ser_ref.datalen = ser->arr_len;
35340         ser_ref.data = ser->elems;
35341         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
35342         *ret_conv = MonitorEvent_read(ser_ref);
35343         FREE(ser);
35344         return tag_ptr(ret_conv, true);
35345 }
35346
35347 void  CS_LDK_HTLCUpdate_free(int64_t this_obj) {
35348         LDKHTLCUpdate this_obj_conv;
35349         this_obj_conv.inner = untag_ptr(this_obj);
35350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35352         HTLCUpdate_free(this_obj_conv);
35353 }
35354
35355 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
35356         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
35357         int64_t ret_ref = 0;
35358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35360         return ret_ref;
35361 }
35362 int64_t  CS_LDK_HTLCUpdate_clone_ptr(int64_t arg) {
35363         LDKHTLCUpdate arg_conv;
35364         arg_conv.inner = untag_ptr(arg);
35365         arg_conv.is_owned = ptr_is_owned(arg);
35366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35367         arg_conv.is_owned = false;
35368         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
35369         return ret_conv;
35370 }
35371
35372 int64_t  CS_LDK_HTLCUpdate_clone(int64_t orig) {
35373         LDKHTLCUpdate orig_conv;
35374         orig_conv.inner = untag_ptr(orig);
35375         orig_conv.is_owned = ptr_is_owned(orig);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35377         orig_conv.is_owned = false;
35378         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
35379         int64_t ret_ref = 0;
35380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35382         return ret_ref;
35383 }
35384
35385 jboolean  CS_LDK_HTLCUpdate_eq(int64_t a, int64_t b) {
35386         LDKHTLCUpdate a_conv;
35387         a_conv.inner = untag_ptr(a);
35388         a_conv.is_owned = ptr_is_owned(a);
35389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35390         a_conv.is_owned = false;
35391         LDKHTLCUpdate b_conv;
35392         b_conv.inner = untag_ptr(b);
35393         b_conv.is_owned = ptr_is_owned(b);
35394         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35395         b_conv.is_owned = false;
35396         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35397         return ret_conv;
35398 }
35399
35400 int8_tArray  CS_LDK_HTLCUpdate_write(int64_t obj) {
35401         LDKHTLCUpdate obj_conv;
35402         obj_conv.inner = untag_ptr(obj);
35403         obj_conv.is_owned = ptr_is_owned(obj);
35404         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35405         obj_conv.is_owned = false;
35406         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35407         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35408         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35409         CVec_u8Z_free(ret_var);
35410         return ret_arr;
35411 }
35412
35413 int64_t  CS_LDK_HTLCUpdate_read(int8_tArray ser) {
35414         LDKu8slice ser_ref;
35415         ser_ref.datalen = ser->arr_len;
35416         ser_ref.data = ser->elems;
35417         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35418         *ret_conv = HTLCUpdate_read(ser_ref);
35419         FREE(ser);
35420         return tag_ptr(ret_conv, true);
35421 }
35422
35423 void  CS_LDK_Balance_free(int64_t this_ptr) {
35424         if (!ptr_is_owned(this_ptr)) return;
35425         void* this_ptr_ptr = untag_ptr(this_ptr);
35426         CHECK_ACCESS(this_ptr_ptr);
35427         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35428         FREE(untag_ptr(this_ptr));
35429         Balance_free(this_ptr_conv);
35430 }
35431
35432 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35433         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35434         *ret_copy = Balance_clone(arg);
35435         int64_t ret_ref = tag_ptr(ret_copy, true);
35436         return ret_ref;
35437 }
35438 int64_t  CS_LDK_Balance_clone_ptr(int64_t arg) {
35439         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35440         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35441         return ret_conv;
35442 }
35443
35444 int64_t  CS_LDK_Balance_clone(int64_t orig) {
35445         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35446         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35447         *ret_copy = Balance_clone(orig_conv);
35448         int64_t ret_ref = tag_ptr(ret_copy, true);
35449         return ret_ref;
35450 }
35451
35452 int64_t  CS_LDK_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
35453         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35454         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35455         int64_t ret_ref = tag_ptr(ret_copy, true);
35456         return ret_ref;
35457 }
35458
35459 int64_t  CS_LDK_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
35460         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35461         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35462         int64_t ret_ref = tag_ptr(ret_copy, true);
35463         return ret_ref;
35464 }
35465
35466 int64_t  CS_LDK_Balance_contentious_claimable(int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
35467         LDKThirtyTwoBytes payment_hash_ref;
35468         CHECK(payment_hash->arr_len == 32);
35469         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35470         LDKThirtyTwoBytes payment_preimage_ref;
35471         CHECK(payment_preimage->arr_len == 32);
35472         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
35473         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35474         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35475         int64_t ret_ref = tag_ptr(ret_copy, true);
35476         return ret_ref;
35477 }
35478
35479 int64_t  CS_LDK_Balance_maybe_timeout_claimable_htlc(int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
35480         LDKThirtyTwoBytes payment_hash_ref;
35481         CHECK(payment_hash->arr_len == 32);
35482         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35483         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35484         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35485         int64_t ret_ref = tag_ptr(ret_copy, true);
35486         return ret_ref;
35487 }
35488
35489 int64_t  CS_LDK_Balance_maybe_preimage_claimable_htlc(int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
35490         LDKThirtyTwoBytes payment_hash_ref;
35491         CHECK(payment_hash->arr_len == 32);
35492         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
35493         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35494         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35495         int64_t ret_ref = tag_ptr(ret_copy, true);
35496         return ret_ref;
35497 }
35498
35499 int64_t  CS_LDK_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
35500         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35501         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35502         int64_t ret_ref = tag_ptr(ret_copy, true);
35503         return ret_ref;
35504 }
35505
35506 jboolean  CS_LDK_Balance_eq(int64_t a, int64_t b) {
35507         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35508         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35509         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35510         return ret_conv;
35511 }
35512
35513 int64_t  CS_LDK_Balance_claimable_amount_satoshis(int64_t this_arg) {
35514         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35515         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35516         return ret_conv;
35517 }
35518
35519 void  CS_LDK_ChannelMonitor_free(int64_t this_obj) {
35520         LDKChannelMonitor this_obj_conv;
35521         this_obj_conv.inner = untag_ptr(this_obj);
35522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35524         ChannelMonitor_free(this_obj_conv);
35525 }
35526
35527 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35528         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35529         int64_t ret_ref = 0;
35530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35532         return ret_ref;
35533 }
35534 int64_t  CS_LDK_ChannelMonitor_clone_ptr(int64_t arg) {
35535         LDKChannelMonitor arg_conv;
35536         arg_conv.inner = untag_ptr(arg);
35537         arg_conv.is_owned = ptr_is_owned(arg);
35538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35539         arg_conv.is_owned = false;
35540         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35541         return ret_conv;
35542 }
35543
35544 int64_t  CS_LDK_ChannelMonitor_clone(int64_t orig) {
35545         LDKChannelMonitor orig_conv;
35546         orig_conv.inner = untag_ptr(orig);
35547         orig_conv.is_owned = ptr_is_owned(orig);
35548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35549         orig_conv.is_owned = false;
35550         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35551         int64_t ret_ref = 0;
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35554         return ret_ref;
35555 }
35556
35557 int8_tArray  CS_LDK_ChannelMonitor_write(int64_t obj) {
35558         LDKChannelMonitor obj_conv;
35559         obj_conv.inner = untag_ptr(obj);
35560         obj_conv.is_owned = ptr_is_owned(obj);
35561         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35562         obj_conv.is_owned = false;
35563         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35564         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35565         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35566         CVec_u8Z_free(ret_var);
35567         return ret_arr;
35568 }
35569
35570 int64_t  CS_LDK_ChannelMonitor_update_monitor(int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35571         LDKChannelMonitor this_arg_conv;
35572         this_arg_conv.inner = untag_ptr(this_arg);
35573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35575         this_arg_conv.is_owned = false;
35576         LDKChannelMonitorUpdate updates_conv;
35577         updates_conv.inner = untag_ptr(updates);
35578         updates_conv.is_owned = ptr_is_owned(updates);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35580         updates_conv.is_owned = false;
35581         void* broadcaster_ptr = untag_ptr(broadcaster);
35582         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35583         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35584         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35585         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
35586         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
35587         void* logger_ptr = untag_ptr(logger);
35588         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35589         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35590         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35591         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35592         return tag_ptr(ret_conv, true);
35593 }
35594
35595 int64_t  CS_LDK_ChannelMonitor_get_latest_update_id(int64_t this_arg) {
35596         LDKChannelMonitor this_arg_conv;
35597         this_arg_conv.inner = untag_ptr(this_arg);
35598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35600         this_arg_conv.is_owned = false;
35601         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35602         return ret_conv;
35603 }
35604
35605 int64_t  CS_LDK_ChannelMonitor_get_funding_txo(int64_t this_arg) {
35606         LDKChannelMonitor this_arg_conv;
35607         this_arg_conv.inner = untag_ptr(this_arg);
35608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35610         this_arg_conv.is_owned = false;
35611         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
35612         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35613         return tag_ptr(ret_conv, true);
35614 }
35615
35616 int64_tArray  CS_LDK_ChannelMonitor_get_outputs_to_watch(int64_t this_arg) {
35617         LDKChannelMonitor this_arg_conv;
35618         this_arg_conv.inner = untag_ptr(this_arg);
35619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35621         this_arg_conv.is_owned = false;
35622         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35623         int64_tArray ret_arr = NULL;
35624         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35625         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35626         for (size_t a = 0; a < ret_var.datalen; a++) {
35627                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
35628                 *ret_conv_52_conv = ret_var.data[a];
35629                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
35630         }
35631         
35632         FREE(ret_var.data);
35633         return ret_arr;
35634 }
35635
35636 void  CS_LDK_ChannelMonitor_load_outputs_to_watch(int64_t this_arg, int64_t filter, int64_t logger) {
35637         LDKChannelMonitor this_arg_conv;
35638         this_arg_conv.inner = untag_ptr(this_arg);
35639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35641         this_arg_conv.is_owned = false;
35642         void* filter_ptr = untag_ptr(filter);
35643         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35644         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35645         void* logger_ptr = untag_ptr(logger);
35646         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35647         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35648         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
35649 }
35650
35651 int64_tArray  CS_LDK_ChannelMonitor_get_and_clear_pending_monitor_events(int64_t this_arg) {
35652         LDKChannelMonitor this_arg_conv;
35653         this_arg_conv.inner = untag_ptr(this_arg);
35654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35656         this_arg_conv.is_owned = false;
35657         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35658         int64_tArray ret_arr = NULL;
35659         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35660         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35661         for (size_t o = 0; o < ret_var.datalen; o++) {
35662                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35663                 *ret_conv_14_copy = ret_var.data[o];
35664                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35665                 ret_arr_ptr[o] = ret_conv_14_ref;
35666         }
35667         
35668         FREE(ret_var.data);
35669         return ret_arr;
35670 }
35671
35672 void  CS_LDK_ChannelMonitor_process_pending_events(int64_t this_arg, int64_t handler) {
35673         LDKChannelMonitor this_arg_conv;
35674         this_arg_conv.inner = untag_ptr(this_arg);
35675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35677         this_arg_conv.is_owned = false;
35678         void* handler_ptr = untag_ptr(handler);
35679         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35680         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35681         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35682 }
35683
35684 int64_t  CS_LDK_ChannelMonitor_initial_counterparty_commitment_tx(int64_t this_arg) {
35685         LDKChannelMonitor this_arg_conv;
35686         this_arg_conv.inner = untag_ptr(this_arg);
35687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35689         this_arg_conv.is_owned = false;
35690         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
35691         int64_t ret_ref = 0;
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35694         return ret_ref;
35695 }
35696
35697 int64_tArray  CS_LDK_ChannelMonitor_counterparty_commitment_txs_from_update(int64_t this_arg, int64_t update) {
35698         LDKChannelMonitor this_arg_conv;
35699         this_arg_conv.inner = untag_ptr(this_arg);
35700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35702         this_arg_conv.is_owned = false;
35703         LDKChannelMonitorUpdate update_conv;
35704         update_conv.inner = untag_ptr(update);
35705         update_conv.is_owned = ptr_is_owned(update);
35706         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
35707         update_conv.is_owned = false;
35708         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
35709         int64_tArray ret_arr = NULL;
35710         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35711         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35712         for (size_t x = 0; x < ret_var.datalen; x++) {
35713                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
35714                 int64_t ret_conv_23_ref = 0;
35715                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
35716                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
35717                 ret_arr_ptr[x] = ret_conv_23_ref;
35718         }
35719         
35720         FREE(ret_var.data);
35721         return ret_arr;
35722 }
35723
35724 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) {
35725         LDKChannelMonitor this_arg_conv;
35726         this_arg_conv.inner = untag_ptr(this_arg);
35727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35729         this_arg_conv.is_owned = false;
35730         LDKTransaction justice_tx_ref;
35731         justice_tx_ref.datalen = justice_tx->arr_len;
35732         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
35733         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
35734         justice_tx_ref.data_is_owned = true;
35735         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
35736         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
35737         return tag_ptr(ret_conv, true);
35738 }
35739
35740 int8_tArray  CS_LDK_ChannelMonitor_get_counterparty_node_id(int64_t this_arg) {
35741         LDKChannelMonitor this_arg_conv;
35742         this_arg_conv.inner = untag_ptr(this_arg);
35743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35745         this_arg_conv.is_owned = false;
35746         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35747         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
35748         return ret_arr;
35749 }
35750
35751 ptrArray  CS_LDK_ChannelMonitor_get_latest_holder_commitment_txn(int64_t this_arg, int64_t logger) {
35752         LDKChannelMonitor this_arg_conv;
35753         this_arg_conv.inner = untag_ptr(this_arg);
35754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35756         this_arg_conv.is_owned = false;
35757         void* logger_ptr = untag_ptr(logger);
35758         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35759         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35760         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35761         ptrArray ret_arr = NULL;
35762         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
35763         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
35764         for (size_t i = 0; i < ret_var.datalen; i++) {
35765                 LDKTransaction ret_conv_8_var = ret_var.data[i];
35766                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
35767                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
35768                 Transaction_free(ret_conv_8_var);
35769                 ret_arr_ptr[i] = ret_conv_8_arr;
35770         }
35771         
35772         FREE(ret_var.data);
35773         return ret_arr;
35774 }
35775
35776 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) {
35777         LDKChannelMonitor this_arg_conv;
35778         this_arg_conv.inner = untag_ptr(this_arg);
35779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35781         this_arg_conv.is_owned = false;
35782         uint8_t header_arr[80];
35783         CHECK(header->arr_len == 80);
35784         memcpy(header_arr, header->elems, 80); FREE(header);
35785         uint8_t (*header_ref)[80] = &header_arr;
35786         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35787         txdata_constr.datalen = txdata->arr_len;
35788         if (txdata_constr.datalen > 0)
35789                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35790         else
35791                 txdata_constr.data = NULL;
35792         int64_t* txdata_vals = txdata->elems;
35793         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35794                 int64_t txdata_conv_28 = txdata_vals[c];
35795                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35796                 CHECK_ACCESS(txdata_conv_28_ptr);
35797                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35798                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35799                 txdata_constr.data[c] = txdata_conv_28_conv;
35800         }
35801         FREE(txdata);
35802         void* broadcaster_ptr = untag_ptr(broadcaster);
35803         CHECK_ACCESS(broadcaster_ptr);
35804         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35805         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35807                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35808         }
35809         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35810         CHECK_ACCESS(fee_estimator_ptr);
35811         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35812         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35814                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35815         }
35816         void* logger_ptr = untag_ptr(logger);
35817         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35818         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35819         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);
35820         int64_tArray ret_arr = NULL;
35821         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35822         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35823         for (size_t x = 0; x < ret_var.datalen; x++) {
35824                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35825                 *ret_conv_49_conv = ret_var.data[x];
35826                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35827         }
35828         
35829         FREE(ret_var.data);
35830         return ret_arr;
35831 }
35832
35833 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) {
35834         LDKChannelMonitor this_arg_conv;
35835         this_arg_conv.inner = untag_ptr(this_arg);
35836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35838         this_arg_conv.is_owned = false;
35839         uint8_t header_arr[80];
35840         CHECK(header->arr_len == 80);
35841         memcpy(header_arr, header->elems, 80); FREE(header);
35842         uint8_t (*header_ref)[80] = &header_arr;
35843         void* broadcaster_ptr = untag_ptr(broadcaster);
35844         CHECK_ACCESS(broadcaster_ptr);
35845         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35846         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35847                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35848                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35849         }
35850         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35851         CHECK_ACCESS(fee_estimator_ptr);
35852         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35853         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35854                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35855                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35856         }
35857         void* logger_ptr = untag_ptr(logger);
35858         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35859         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35860         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35861 }
35862
35863 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) {
35864         LDKChannelMonitor this_arg_conv;
35865         this_arg_conv.inner = untag_ptr(this_arg);
35866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35868         this_arg_conv.is_owned = false;
35869         uint8_t header_arr[80];
35870         CHECK(header->arr_len == 80);
35871         memcpy(header_arr, header->elems, 80); FREE(header);
35872         uint8_t (*header_ref)[80] = &header_arr;
35873         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
35874         txdata_constr.datalen = txdata->arr_len;
35875         if (txdata_constr.datalen > 0)
35876                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
35877         else
35878                 txdata_constr.data = NULL;
35879         int64_t* txdata_vals = txdata->elems;
35880         for (size_t c = 0; c < txdata_constr.datalen; c++) {
35881                 int64_t txdata_conv_28 = txdata_vals[c];
35882                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
35883                 CHECK_ACCESS(txdata_conv_28_ptr);
35884                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
35885                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
35886                 txdata_constr.data[c] = txdata_conv_28_conv;
35887         }
35888         FREE(txdata);
35889         void* broadcaster_ptr = untag_ptr(broadcaster);
35890         CHECK_ACCESS(broadcaster_ptr);
35891         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35892         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35893                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35894                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35895         }
35896         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35897         CHECK_ACCESS(fee_estimator_ptr);
35898         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35899         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35900                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35901                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35902         }
35903         void* logger_ptr = untag_ptr(logger);
35904         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35905         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35906         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);
35907         int64_tArray ret_arr = NULL;
35908         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35909         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35910         for (size_t x = 0; x < ret_var.datalen; x++) {
35911                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35912                 *ret_conv_49_conv = ret_var.data[x];
35913                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35914         }
35915         
35916         FREE(ret_var.data);
35917         return ret_arr;
35918 }
35919
35920 void  CS_LDK_ChannelMonitor_transaction_unconfirmed(int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
35921         LDKChannelMonitor this_arg_conv;
35922         this_arg_conv.inner = untag_ptr(this_arg);
35923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35925         this_arg_conv.is_owned = false;
35926         uint8_t txid_arr[32];
35927         CHECK(txid->arr_len == 32);
35928         memcpy(txid_arr, txid->elems, 32); FREE(txid);
35929         uint8_t (*txid_ref)[32] = &txid_arr;
35930         void* broadcaster_ptr = untag_ptr(broadcaster);
35931         CHECK_ACCESS(broadcaster_ptr);
35932         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35933         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35934                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35935                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35936         }
35937         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35938         CHECK_ACCESS(fee_estimator_ptr);
35939         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35940         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35941                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35942                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35943         }
35944         void* logger_ptr = untag_ptr(logger);
35945         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35946         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35947         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
35948 }
35949
35950 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) {
35951         LDKChannelMonitor this_arg_conv;
35952         this_arg_conv.inner = untag_ptr(this_arg);
35953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35955         this_arg_conv.is_owned = false;
35956         uint8_t header_arr[80];
35957         CHECK(header->arr_len == 80);
35958         memcpy(header_arr, header->elems, 80); FREE(header);
35959         uint8_t (*header_ref)[80] = &header_arr;
35960         void* broadcaster_ptr = untag_ptr(broadcaster);
35961         CHECK_ACCESS(broadcaster_ptr);
35962         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35963         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35965                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35966         }
35967         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35968         CHECK_ACCESS(fee_estimator_ptr);
35969         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35970         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35972                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35973         }
35974         void* logger_ptr = untag_ptr(logger);
35975         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35976         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35977         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
35978         int64_tArray ret_arr = NULL;
35979         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
35980         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
35981         for (size_t x = 0; x < ret_var.datalen; x++) {
35982                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
35983                 *ret_conv_49_conv = ret_var.data[x];
35984                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
35985         }
35986         
35987         FREE(ret_var.data);
35988         return ret_arr;
35989 }
35990
35991 int64_tArray  CS_LDK_ChannelMonitor_get_relevant_txids(int64_t this_arg) {
35992         LDKChannelMonitor this_arg_conv;
35993         this_arg_conv.inner = untag_ptr(this_arg);
35994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35996         this_arg_conv.is_owned = false;
35997         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
35998         int64_tArray ret_arr = NULL;
35999         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36000         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36001         for (size_t c = 0; c < ret_var.datalen; c++) {
36002                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
36003                 *ret_conv_54_conv = ret_var.data[c];
36004                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
36005         }
36006         
36007         FREE(ret_var.data);
36008         return ret_arr;
36009 }
36010
36011 int64_t  CS_LDK_ChannelMonitor_current_best_block(int64_t this_arg) {
36012         LDKChannelMonitor this_arg_conv;
36013         this_arg_conv.inner = untag_ptr(this_arg);
36014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36016         this_arg_conv.is_owned = false;
36017         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
36018         int64_t ret_ref = 0;
36019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36021         return ret_ref;
36022 }
36023
36024 void  CS_LDK_ChannelMonitor_rebroadcast_pending_claims(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36025         LDKChannelMonitor this_arg_conv;
36026         this_arg_conv.inner = untag_ptr(this_arg);
36027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36029         this_arg_conv.is_owned = false;
36030         void* broadcaster_ptr = untag_ptr(broadcaster);
36031         CHECK_ACCESS(broadcaster_ptr);
36032         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36033         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36035                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36036         }
36037         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36038         CHECK_ACCESS(fee_estimator_ptr);
36039         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36040         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36042                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36043         }
36044         void* logger_ptr = untag_ptr(logger);
36045         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
36046         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
36047         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
36048 }
36049
36050 int64_tArray  CS_LDK_ChannelMonitor_get_spendable_outputs(int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
36051         LDKChannelMonitor this_arg_conv;
36052         this_arg_conv.inner = untag_ptr(this_arg);
36053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36055         this_arg_conv.is_owned = false;
36056         LDKTransaction tx_ref;
36057         tx_ref.datalen = tx->arr_len;
36058         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
36059         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
36060         tx_ref.data_is_owned = true;
36061         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
36062         int64_tArray ret_arr = NULL;
36063         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36064         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36065         for (size_t b = 0; b < ret_var.datalen; b++) {
36066                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
36067                 *ret_conv_27_copy = ret_var.data[b];
36068                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
36069                 ret_arr_ptr[b] = ret_conv_27_ref;
36070         }
36071         
36072         FREE(ret_var.data);
36073         return ret_arr;
36074 }
36075
36076 int64_tArray  CS_LDK_ChannelMonitor_get_claimable_balances(int64_t this_arg) {
36077         LDKChannelMonitor this_arg_conv;
36078         this_arg_conv.inner = untag_ptr(this_arg);
36079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36081         this_arg_conv.is_owned = false;
36082         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
36083         int64_tArray ret_arr = NULL;
36084         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36085         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36086         for (size_t j = 0; j < ret_var.datalen; j++) {
36087                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
36088                 *ret_conv_9_copy = ret_var.data[j];
36089                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
36090                 ret_arr_ptr[j] = ret_conv_9_ref;
36091         }
36092         
36093         FREE(ret_var.data);
36094         return ret_arr;
36095 }
36096
36097 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
36098         LDKu8slice ser_ref;
36099         ser_ref.datalen = ser->arr_len;
36100         ser_ref.data = ser->elems;
36101         void* arg_a_ptr = untag_ptr(arg_a);
36102         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
36103         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
36104         void* arg_b_ptr = untag_ptr(arg_b);
36105         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
36106         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
36107         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
36108         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
36109         FREE(ser);
36110         return tag_ptr(ret_conv, true);
36111 }
36112
36113 void  CS_LDK_OutPoint_free(int64_t this_obj) {
36114         LDKOutPoint this_obj_conv;
36115         this_obj_conv.inner = untag_ptr(this_obj);
36116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36118         OutPoint_free(this_obj_conv);
36119 }
36120
36121 int8_tArray  CS_LDK_OutPoint_get_txid(int64_t this_ptr) {
36122         LDKOutPoint this_ptr_conv;
36123         this_ptr_conv.inner = untag_ptr(this_ptr);
36124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36126         this_ptr_conv.is_owned = false;
36127         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36128         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
36129         return ret_arr;
36130 }
36131
36132 void  CS_LDK_OutPoint_set_txid(int64_t this_ptr, int8_tArray val) {
36133         LDKOutPoint this_ptr_conv;
36134         this_ptr_conv.inner = untag_ptr(this_ptr);
36135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36137         this_ptr_conv.is_owned = false;
36138         LDKThirtyTwoBytes val_ref;
36139         CHECK(val->arr_len == 32);
36140         memcpy(val_ref.data, val->elems, 32); FREE(val);
36141         OutPoint_set_txid(&this_ptr_conv, val_ref);
36142 }
36143
36144 int16_t  CS_LDK_OutPoint_get_index(int64_t this_ptr) {
36145         LDKOutPoint this_ptr_conv;
36146         this_ptr_conv.inner = untag_ptr(this_ptr);
36147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36149         this_ptr_conv.is_owned = false;
36150         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
36151         return ret_conv;
36152 }
36153
36154 void  CS_LDK_OutPoint_set_index(int64_t this_ptr, int16_t val) {
36155         LDKOutPoint this_ptr_conv;
36156         this_ptr_conv.inner = untag_ptr(this_ptr);
36157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36159         this_ptr_conv.is_owned = false;
36160         OutPoint_set_index(&this_ptr_conv, val);
36161 }
36162
36163 int64_t  CS_LDK_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
36164         LDKThirtyTwoBytes txid_arg_ref;
36165         CHECK(txid_arg->arr_len == 32);
36166         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
36167         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
36168         int64_t ret_ref = 0;
36169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36171         return ret_ref;
36172 }
36173
36174 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
36175         LDKOutPoint ret_var = OutPoint_clone(arg);
36176         int64_t ret_ref = 0;
36177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36179         return ret_ref;
36180 }
36181 int64_t  CS_LDK_OutPoint_clone_ptr(int64_t arg) {
36182         LDKOutPoint arg_conv;
36183         arg_conv.inner = untag_ptr(arg);
36184         arg_conv.is_owned = ptr_is_owned(arg);
36185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36186         arg_conv.is_owned = false;
36187         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
36188         return ret_conv;
36189 }
36190
36191 int64_t  CS_LDK_OutPoint_clone(int64_t orig) {
36192         LDKOutPoint orig_conv;
36193         orig_conv.inner = untag_ptr(orig);
36194         orig_conv.is_owned = ptr_is_owned(orig);
36195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36196         orig_conv.is_owned = false;
36197         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
36198         int64_t ret_ref = 0;
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36201         return ret_ref;
36202 }
36203
36204 jboolean  CS_LDK_OutPoint_eq(int64_t a, int64_t b) {
36205         LDKOutPoint a_conv;
36206         a_conv.inner = untag_ptr(a);
36207         a_conv.is_owned = ptr_is_owned(a);
36208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36209         a_conv.is_owned = false;
36210         LDKOutPoint b_conv;
36211         b_conv.inner = untag_ptr(b);
36212         b_conv.is_owned = ptr_is_owned(b);
36213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36214         b_conv.is_owned = false;
36215         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
36216         return ret_conv;
36217 }
36218
36219 int64_t  CS_LDK_OutPoint_hash(int64_t o) {
36220         LDKOutPoint o_conv;
36221         o_conv.inner = untag_ptr(o);
36222         o_conv.is_owned = ptr_is_owned(o);
36223         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36224         o_conv.is_owned = false;
36225         int64_t ret_conv = OutPoint_hash(&o_conv);
36226         return ret_conv;
36227 }
36228
36229 int8_tArray  CS_LDK_OutPoint_to_channel_id(int64_t this_arg) {
36230         LDKOutPoint this_arg_conv;
36231         this_arg_conv.inner = untag_ptr(this_arg);
36232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36234         this_arg_conv.is_owned = false;
36235         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36236         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
36237         return ret_arr;
36238 }
36239
36240 int8_tArray  CS_LDK_OutPoint_write(int64_t obj) {
36241         LDKOutPoint obj_conv;
36242         obj_conv.inner = untag_ptr(obj);
36243         obj_conv.is_owned = ptr_is_owned(obj);
36244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36245         obj_conv.is_owned = false;
36246         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
36247         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36248         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36249         CVec_u8Z_free(ret_var);
36250         return ret_arr;
36251 }
36252
36253 int64_t  CS_LDK_OutPoint_read(int8_tArray ser) {
36254         LDKu8slice ser_ref;
36255         ser_ref.datalen = ser->arr_len;
36256         ser_ref.data = ser->elems;
36257         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
36258         *ret_conv = OutPoint_read(ser_ref);
36259         FREE(ser);
36260         return tag_ptr(ret_conv, true);
36261 }
36262
36263 void  CS_LDK_InboundHTLCErr_free(int64_t this_obj) {
36264         LDKInboundHTLCErr this_obj_conv;
36265         this_obj_conv.inner = untag_ptr(this_obj);
36266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36268         InboundHTLCErr_free(this_obj_conv);
36269 }
36270
36271 int16_t  CS_LDK_InboundHTLCErr_get_err_code(int64_t this_ptr) {
36272         LDKInboundHTLCErr this_ptr_conv;
36273         this_ptr_conv.inner = untag_ptr(this_ptr);
36274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36276         this_ptr_conv.is_owned = false;
36277         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
36278         return ret_conv;
36279 }
36280
36281 void  CS_LDK_InboundHTLCErr_set_err_code(int64_t this_ptr, int16_t val) {
36282         LDKInboundHTLCErr this_ptr_conv;
36283         this_ptr_conv.inner = untag_ptr(this_ptr);
36284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36286         this_ptr_conv.is_owned = false;
36287         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
36288 }
36289
36290 int8_tArray  CS_LDK_InboundHTLCErr_get_err_data(int64_t this_ptr) {
36291         LDKInboundHTLCErr this_ptr_conv;
36292         this_ptr_conv.inner = untag_ptr(this_ptr);
36293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36295         this_ptr_conv.is_owned = false;
36296         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
36297         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36298         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36299         CVec_u8Z_free(ret_var);
36300         return ret_arr;
36301 }
36302
36303 void  CS_LDK_InboundHTLCErr_set_err_data(int64_t this_ptr, int8_tArray val) {
36304         LDKInboundHTLCErr this_ptr_conv;
36305         this_ptr_conv.inner = untag_ptr(this_ptr);
36306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36308         this_ptr_conv.is_owned = false;
36309         LDKCVec_u8Z val_ref;
36310         val_ref.datalen = val->arr_len;
36311         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36312         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
36313         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
36314 }
36315
36316 jstring  CS_LDK_InboundHTLCErr_get_msg(int64_t this_ptr) {
36317         LDKInboundHTLCErr this_ptr_conv;
36318         this_ptr_conv.inner = untag_ptr(this_ptr);
36319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36321         this_ptr_conv.is_owned = false;
36322         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
36323         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36324         Str_free(ret_str);
36325         return ret_conv;
36326 }
36327
36328 void  CS_LDK_InboundHTLCErr_set_msg(int64_t this_ptr, jstring val) {
36329         LDKInboundHTLCErr this_ptr_conv;
36330         this_ptr_conv.inner = untag_ptr(this_ptr);
36331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36333         this_ptr_conv.is_owned = false;
36334         LDKStr val_conv = str_ref_to_owned_c(val);
36335         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
36336 }
36337
36338 int64_t  CS_LDK_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
36339         LDKCVec_u8Z err_data_arg_ref;
36340         err_data_arg_ref.datalen = err_data_arg->arr_len;
36341         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36342         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
36343         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
36344         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
36345         int64_t ret_ref = 0;
36346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36348         return ret_ref;
36349 }
36350
36351 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) {
36352         LDKUpdateAddHTLC msg_conv;
36353         msg_conv.inner = untag_ptr(msg);
36354         msg_conv.is_owned = ptr_is_owned(msg);
36355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36356         msg_conv.is_owned = false;
36357         void* node_signer_ptr = untag_ptr(node_signer);
36358         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
36359         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
36360         void* logger_ptr = untag_ptr(logger);
36361         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
36362         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
36363         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
36364         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
36365         return tag_ptr(ret_conv, true);
36366 }
36367
36368 void  CS_LDK_PendingHTLCRouting_free(int64_t this_ptr) {
36369         if (!ptr_is_owned(this_ptr)) return;
36370         void* this_ptr_ptr = untag_ptr(this_ptr);
36371         CHECK_ACCESS(this_ptr_ptr);
36372         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
36373         FREE(untag_ptr(this_ptr));
36374         PendingHTLCRouting_free(this_ptr_conv);
36375 }
36376
36377 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
36378         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36379         *ret_copy = PendingHTLCRouting_clone(arg);
36380         int64_t ret_ref = tag_ptr(ret_copy, true);
36381         return ret_ref;
36382 }
36383 int64_t  CS_LDK_PendingHTLCRouting_clone_ptr(int64_t arg) {
36384         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
36385         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
36386         return ret_conv;
36387 }
36388
36389 int64_t  CS_LDK_PendingHTLCRouting_clone(int64_t orig) {
36390         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
36391         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36392         *ret_copy = PendingHTLCRouting_clone(orig_conv);
36393         int64_t ret_ref = tag_ptr(ret_copy, true);
36394         return ret_ref;
36395 }
36396
36397 int64_t  CS_LDK_PendingHTLCRouting_forward(int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
36398         LDKOnionPacket onion_packet_conv;
36399         onion_packet_conv.inner = untag_ptr(onion_packet);
36400         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
36402         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
36403         LDKBlindedForward blinded_conv;
36404         blinded_conv.inner = untag_ptr(blinded);
36405         blinded_conv.is_owned = ptr_is_owned(blinded);
36406         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
36407         blinded_conv = BlindedForward_clone(&blinded_conv);
36408         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36409         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
36410         int64_t ret_ref = tag_ptr(ret_copy, true);
36411         return ret_ref;
36412 }
36413
36414 int64_t  CS_LDK_PendingHTLCRouting_receive(int64_t payment_data, int64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
36415         LDKFinalOnionHopData payment_data_conv;
36416         payment_data_conv.inner = untag_ptr(payment_data);
36417         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36419         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36420         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36421         CHECK_ACCESS(payment_metadata_ptr);
36422         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36423         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36424         LDKThirtyTwoBytes phantom_shared_secret_ref;
36425         CHECK(phantom_shared_secret->arr_len == 32);
36426         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
36427         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36428         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36429         if (custom_tlvs_constr.datalen > 0)
36430                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36431         else
36432                 custom_tlvs_constr.data = NULL;
36433         int64_t* custom_tlvs_vals = custom_tlvs->elems;
36434         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36435                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36436                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36437                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36438                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36439                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36440                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36441         }
36442         FREE(custom_tlvs);
36443         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36444         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
36445         int64_t ret_ref = tag_ptr(ret_copy, true);
36446         return ret_ref;
36447 }
36448
36449 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) {
36450         LDKFinalOnionHopData payment_data_conv;
36451         payment_data_conv.inner = untag_ptr(payment_data);
36452         payment_data_conv.is_owned = ptr_is_owned(payment_data);
36453         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
36454         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
36455         LDKThirtyTwoBytes payment_preimage_ref;
36456         CHECK(payment_preimage->arr_len == 32);
36457         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
36458         void* payment_metadata_ptr = untag_ptr(payment_metadata);
36459         CHECK_ACCESS(payment_metadata_ptr);
36460         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
36461         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
36462         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
36463         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
36464         if (custom_tlvs_constr.datalen > 0)
36465                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
36466         else
36467                 custom_tlvs_constr.data = NULL;
36468         int64_t* custom_tlvs_vals = custom_tlvs->elems;
36469         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
36470                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
36471                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
36472                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
36473                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
36474                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
36475                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
36476         }
36477         FREE(custom_tlvs);
36478         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36479         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
36480         int64_t ret_ref = tag_ptr(ret_copy, true);
36481         return ret_ref;
36482 }
36483
36484 void  CS_LDK_BlindedForward_free(int64_t this_obj) {
36485         LDKBlindedForward this_obj_conv;
36486         this_obj_conv.inner = untag_ptr(this_obj);
36487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36489         BlindedForward_free(this_obj_conv);
36490 }
36491
36492 int8_tArray  CS_LDK_BlindedForward_get_inbound_blinding_point(int64_t this_ptr) {
36493         LDKBlindedForward this_ptr_conv;
36494         this_ptr_conv.inner = untag_ptr(this_ptr);
36495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36497         this_ptr_conv.is_owned = false;
36498         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36499         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
36500         return ret_arr;
36501 }
36502
36503 void  CS_LDK_BlindedForward_set_inbound_blinding_point(int64_t this_ptr, int8_tArray val) {
36504         LDKBlindedForward this_ptr_conv;
36505         this_ptr_conv.inner = untag_ptr(this_ptr);
36506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36508         this_ptr_conv.is_owned = false;
36509         LDKPublicKey val_ref;
36510         CHECK(val->arr_len == 33);
36511         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36512         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
36513 }
36514
36515 int32_t  CS_LDK_BlindedForward_get_failure(int64_t this_ptr) {
36516         LDKBlindedForward this_ptr_conv;
36517         this_ptr_conv.inner = untag_ptr(this_ptr);
36518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36520         this_ptr_conv.is_owned = false;
36521         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedForward_get_failure(&this_ptr_conv));
36522         return ret_conv;
36523 }
36524
36525 void  CS_LDK_BlindedForward_set_failure(int64_t this_ptr, int32_t val) {
36526         LDKBlindedForward this_ptr_conv;
36527         this_ptr_conv.inner = untag_ptr(this_ptr);
36528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36530         this_ptr_conv.is_owned = false;
36531         LDKBlindedFailure val_conv = LDKBlindedFailure_from_cs(val);
36532         BlindedForward_set_failure(&this_ptr_conv, val_conv);
36533 }
36534
36535 int64_t  CS_LDK_BlindedForward_new(int8_tArray inbound_blinding_point_arg, int32_t failure_arg) {
36536         LDKPublicKey inbound_blinding_point_arg_ref;
36537         CHECK(inbound_blinding_point_arg->arr_len == 33);
36538         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
36539         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_cs(failure_arg);
36540         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
36541         int64_t ret_ref = 0;
36542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36544         return ret_ref;
36545 }
36546
36547 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
36548         LDKBlindedForward ret_var = BlindedForward_clone(arg);
36549         int64_t ret_ref = 0;
36550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36552         return ret_ref;
36553 }
36554 int64_t  CS_LDK_BlindedForward_clone_ptr(int64_t arg) {
36555         LDKBlindedForward arg_conv;
36556         arg_conv.inner = untag_ptr(arg);
36557         arg_conv.is_owned = ptr_is_owned(arg);
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36559         arg_conv.is_owned = false;
36560         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
36561         return ret_conv;
36562 }
36563
36564 int64_t  CS_LDK_BlindedForward_clone(int64_t orig) {
36565         LDKBlindedForward orig_conv;
36566         orig_conv.inner = untag_ptr(orig);
36567         orig_conv.is_owned = ptr_is_owned(orig);
36568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36569         orig_conv.is_owned = false;
36570         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
36571         int64_t ret_ref = 0;
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36574         return ret_ref;
36575 }
36576
36577 int64_t  CS_LDK_BlindedForward_hash(int64_t o) {
36578         LDKBlindedForward o_conv;
36579         o_conv.inner = untag_ptr(o);
36580         o_conv.is_owned = ptr_is_owned(o);
36581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36582         o_conv.is_owned = false;
36583         int64_t ret_conv = BlindedForward_hash(&o_conv);
36584         return ret_conv;
36585 }
36586
36587 jboolean  CS_LDK_BlindedForward_eq(int64_t a, int64_t b) {
36588         LDKBlindedForward a_conv;
36589         a_conv.inner = untag_ptr(a);
36590         a_conv.is_owned = ptr_is_owned(a);
36591         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36592         a_conv.is_owned = false;
36593         LDKBlindedForward b_conv;
36594         b_conv.inner = untag_ptr(b);
36595         b_conv.is_owned = ptr_is_owned(b);
36596         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36597         b_conv.is_owned = false;
36598         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
36599         return ret_conv;
36600 }
36601
36602 void  CS_LDK_PendingHTLCInfo_free(int64_t this_obj) {
36603         LDKPendingHTLCInfo this_obj_conv;
36604         this_obj_conv.inner = untag_ptr(this_obj);
36605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36607         PendingHTLCInfo_free(this_obj_conv);
36608 }
36609
36610 int64_t  CS_LDK_PendingHTLCInfo_get_routing(int64_t this_ptr) {
36611         LDKPendingHTLCInfo this_ptr_conv;
36612         this_ptr_conv.inner = untag_ptr(this_ptr);
36613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36615         this_ptr_conv.is_owned = false;
36616         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
36617         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
36618         int64_t ret_ref = tag_ptr(ret_copy, true);
36619         return ret_ref;
36620 }
36621
36622 void  CS_LDK_PendingHTLCInfo_set_routing(int64_t this_ptr, int64_t val) {
36623         LDKPendingHTLCInfo this_ptr_conv;
36624         this_ptr_conv.inner = untag_ptr(this_ptr);
36625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36627         this_ptr_conv.is_owned = false;
36628         void* val_ptr = untag_ptr(val);
36629         CHECK_ACCESS(val_ptr);
36630         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
36631         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
36632         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
36633 }
36634
36635 int8_tArray  CS_LDK_PendingHTLCInfo_get_incoming_shared_secret(int64_t this_ptr) {
36636         LDKPendingHTLCInfo this_ptr_conv;
36637         this_ptr_conv.inner = untag_ptr(this_ptr);
36638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640         this_ptr_conv.is_owned = false;
36641         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36642         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
36643         return ret_arr;
36644 }
36645
36646 void  CS_LDK_PendingHTLCInfo_set_incoming_shared_secret(int64_t this_ptr, int8_tArray val) {
36647         LDKPendingHTLCInfo this_ptr_conv;
36648         this_ptr_conv.inner = untag_ptr(this_ptr);
36649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36651         this_ptr_conv.is_owned = false;
36652         LDKThirtyTwoBytes val_ref;
36653         CHECK(val->arr_len == 32);
36654         memcpy(val_ref.data, val->elems, 32); FREE(val);
36655         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
36656 }
36657
36658 int8_tArray  CS_LDK_PendingHTLCInfo_get_payment_hash(int64_t this_ptr) {
36659         LDKPendingHTLCInfo this_ptr_conv;
36660         this_ptr_conv.inner = untag_ptr(this_ptr);
36661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36663         this_ptr_conv.is_owned = false;
36664         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36665         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
36666         return ret_arr;
36667 }
36668
36669 void  CS_LDK_PendingHTLCInfo_set_payment_hash(int64_t this_ptr, int8_tArray val) {
36670         LDKPendingHTLCInfo this_ptr_conv;
36671         this_ptr_conv.inner = untag_ptr(this_ptr);
36672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36674         this_ptr_conv.is_owned = false;
36675         LDKThirtyTwoBytes val_ref;
36676         CHECK(val->arr_len == 32);
36677         memcpy(val_ref.data, val->elems, 32); FREE(val);
36678         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
36679 }
36680
36681 int64_t  CS_LDK_PendingHTLCInfo_get_incoming_amt_msat(int64_t this_ptr) {
36682         LDKPendingHTLCInfo this_ptr_conv;
36683         this_ptr_conv.inner = untag_ptr(this_ptr);
36684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36686         this_ptr_conv.is_owned = false;
36687         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36688         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
36689         int64_t ret_ref = tag_ptr(ret_copy, true);
36690         return ret_ref;
36691 }
36692
36693 void  CS_LDK_PendingHTLCInfo_set_incoming_amt_msat(int64_t this_ptr, int64_t val) {
36694         LDKPendingHTLCInfo this_ptr_conv;
36695         this_ptr_conv.inner = untag_ptr(this_ptr);
36696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36698         this_ptr_conv.is_owned = false;
36699         void* val_ptr = untag_ptr(val);
36700         CHECK_ACCESS(val_ptr);
36701         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36702         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36703         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
36704 }
36705
36706 int64_t  CS_LDK_PendingHTLCInfo_get_outgoing_amt_msat(int64_t this_ptr) {
36707         LDKPendingHTLCInfo this_ptr_conv;
36708         this_ptr_conv.inner = untag_ptr(this_ptr);
36709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36711         this_ptr_conv.is_owned = false;
36712         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
36713         return ret_conv;
36714 }
36715
36716 void  CS_LDK_PendingHTLCInfo_set_outgoing_amt_msat(int64_t this_ptr, int64_t val) {
36717         LDKPendingHTLCInfo this_ptr_conv;
36718         this_ptr_conv.inner = untag_ptr(this_ptr);
36719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36721         this_ptr_conv.is_owned = false;
36722         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
36723 }
36724
36725 int32_t  CS_LDK_PendingHTLCInfo_get_outgoing_cltv_value(int64_t this_ptr) {
36726         LDKPendingHTLCInfo this_ptr_conv;
36727         this_ptr_conv.inner = untag_ptr(this_ptr);
36728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36730         this_ptr_conv.is_owned = false;
36731         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
36732         return ret_conv;
36733 }
36734
36735 void  CS_LDK_PendingHTLCInfo_set_outgoing_cltv_value(int64_t this_ptr, int32_t val) {
36736         LDKPendingHTLCInfo this_ptr_conv;
36737         this_ptr_conv.inner = untag_ptr(this_ptr);
36738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36740         this_ptr_conv.is_owned = false;
36741         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
36742 }
36743
36744 int64_t  CS_LDK_PendingHTLCInfo_get_skimmed_fee_msat(int64_t this_ptr) {
36745         LDKPendingHTLCInfo this_ptr_conv;
36746         this_ptr_conv.inner = untag_ptr(this_ptr);
36747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36749         this_ptr_conv.is_owned = false;
36750         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36751         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
36752         int64_t ret_ref = tag_ptr(ret_copy, true);
36753         return ret_ref;
36754 }
36755
36756 void  CS_LDK_PendingHTLCInfo_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
36757         LDKPendingHTLCInfo this_ptr_conv;
36758         this_ptr_conv.inner = untag_ptr(this_ptr);
36759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36761         this_ptr_conv.is_owned = false;
36762         void* val_ptr = untag_ptr(val);
36763         CHECK_ACCESS(val_ptr);
36764         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36765         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36766         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
36767 }
36768
36769 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) {
36770         void* routing_arg_ptr = untag_ptr(routing_arg);
36771         CHECK_ACCESS(routing_arg_ptr);
36772         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
36773         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
36774         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
36775         CHECK(incoming_shared_secret_arg->arr_len == 32);
36776         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
36777         LDKThirtyTwoBytes payment_hash_arg_ref;
36778         CHECK(payment_hash_arg->arr_len == 32);
36779         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
36780         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
36781         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
36782         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
36783         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
36784         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
36785         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
36786         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
36787         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
36788         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);
36789         int64_t ret_ref = 0;
36790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36792         return ret_ref;
36793 }
36794
36795 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
36796         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
36797         int64_t ret_ref = 0;
36798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36800         return ret_ref;
36801 }
36802 int64_t  CS_LDK_PendingHTLCInfo_clone_ptr(int64_t arg) {
36803         LDKPendingHTLCInfo arg_conv;
36804         arg_conv.inner = untag_ptr(arg);
36805         arg_conv.is_owned = ptr_is_owned(arg);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36807         arg_conv.is_owned = false;
36808         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
36809         return ret_conv;
36810 }
36811
36812 int64_t  CS_LDK_PendingHTLCInfo_clone(int64_t orig) {
36813         LDKPendingHTLCInfo orig_conv;
36814         orig_conv.inner = untag_ptr(orig);
36815         orig_conv.is_owned = ptr_is_owned(orig);
36816         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36817         orig_conv.is_owned = false;
36818         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
36819         int64_t ret_ref = 0;
36820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36822         return ret_ref;
36823 }
36824
36825 int32_t  CS_LDK_BlindedFailure_clone(int64_t orig) {
36826         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
36827         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_clone(orig_conv));
36828         return ret_conv;
36829 }
36830
36831 int32_t  CS_LDK_BlindedFailure_from_introduction_node() {
36832         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_introduction_node());
36833         return ret_conv;
36834 }
36835
36836 int32_t  CS_LDK_BlindedFailure_from_blinded_node() {
36837         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_blinded_node());
36838         return ret_conv;
36839 }
36840
36841 int64_t  CS_LDK_BlindedFailure_hash(int64_t o) {
36842         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
36843         int64_t ret_conv = BlindedFailure_hash(o_conv);
36844         return ret_conv;
36845 }
36846
36847 jboolean  CS_LDK_BlindedFailure_eq(int64_t a, int64_t b) {
36848         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
36849         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
36850         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
36851         return ret_conv;
36852 }
36853
36854 void  CS_LDK_FailureCode_free(int64_t this_ptr) {
36855         if (!ptr_is_owned(this_ptr)) return;
36856         void* this_ptr_ptr = untag_ptr(this_ptr);
36857         CHECK_ACCESS(this_ptr_ptr);
36858         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
36859         FREE(untag_ptr(this_ptr));
36860         FailureCode_free(this_ptr_conv);
36861 }
36862
36863 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
36864         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36865         *ret_copy = FailureCode_clone(arg);
36866         int64_t ret_ref = tag_ptr(ret_copy, true);
36867         return ret_ref;
36868 }
36869 int64_t  CS_LDK_FailureCode_clone_ptr(int64_t arg) {
36870         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
36871         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
36872         return ret_conv;
36873 }
36874
36875 int64_t  CS_LDK_FailureCode_clone(int64_t orig) {
36876         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36877         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36878         *ret_copy = FailureCode_clone(orig_conv);
36879         int64_t ret_ref = tag_ptr(ret_copy, true);
36880         return ret_ref;
36881 }
36882
36883 int64_t  CS_LDK_FailureCode_temporary_node_failure() {
36884         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36885         *ret_copy = FailureCode_temporary_node_failure();
36886         int64_t ret_ref = tag_ptr(ret_copy, true);
36887         return ret_ref;
36888 }
36889
36890 int64_t  CS_LDK_FailureCode_required_node_feature_missing() {
36891         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36892         *ret_copy = FailureCode_required_node_feature_missing();
36893         int64_t ret_ref = tag_ptr(ret_copy, true);
36894         return ret_ref;
36895 }
36896
36897 int64_t  CS_LDK_FailureCode_incorrect_or_unknown_payment_details() {
36898         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36899         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
36900         int64_t ret_ref = tag_ptr(ret_copy, true);
36901         return ret_ref;
36902 }
36903
36904 int64_t  CS_LDK_FailureCode_invalid_onion_payload(int64_t a) {
36905         void* a_ptr = untag_ptr(a);
36906         CHECK_ACCESS(a_ptr);
36907         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
36908         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
36909         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
36910         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
36911         int64_t ret_ref = tag_ptr(ret_copy, true);
36912         return ret_ref;
36913 }
36914
36915 void  CS_LDK_ChannelManager_free(int64_t this_obj) {
36916         LDKChannelManager this_obj_conv;
36917         this_obj_conv.inner = untag_ptr(this_obj);
36918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36920         ChannelManager_free(this_obj_conv);
36921 }
36922
36923 void  CS_LDK_ChainParameters_free(int64_t this_obj) {
36924         LDKChainParameters this_obj_conv;
36925         this_obj_conv.inner = untag_ptr(this_obj);
36926         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36928         ChainParameters_free(this_obj_conv);
36929 }
36930
36931 int32_t  CS_LDK_ChainParameters_get_network(int64_t this_ptr) {
36932         LDKChainParameters this_ptr_conv;
36933         this_ptr_conv.inner = untag_ptr(this_ptr);
36934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36936         this_ptr_conv.is_owned = false;
36937         int32_t ret_conv = LDKNetwork_to_cs(ChainParameters_get_network(&this_ptr_conv));
36938         return ret_conv;
36939 }
36940
36941 void  CS_LDK_ChainParameters_set_network(int64_t this_ptr, int32_t val) {
36942         LDKChainParameters this_ptr_conv;
36943         this_ptr_conv.inner = untag_ptr(this_ptr);
36944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36946         this_ptr_conv.is_owned = false;
36947         LDKNetwork val_conv = LDKNetwork_from_cs(val);
36948         ChainParameters_set_network(&this_ptr_conv, val_conv);
36949 }
36950
36951 int64_t  CS_LDK_ChainParameters_get_best_block(int64_t this_ptr) {
36952         LDKChainParameters this_ptr_conv;
36953         this_ptr_conv.inner = untag_ptr(this_ptr);
36954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36956         this_ptr_conv.is_owned = false;
36957         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36958         int64_t ret_ref = 0;
36959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36961         return ret_ref;
36962 }
36963
36964 void  CS_LDK_ChainParameters_set_best_block(int64_t this_ptr, int64_t val) {
36965         LDKChainParameters this_ptr_conv;
36966         this_ptr_conv.inner = untag_ptr(this_ptr);
36967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36969         this_ptr_conv.is_owned = false;
36970         LDKBestBlock val_conv;
36971         val_conv.inner = untag_ptr(val);
36972         val_conv.is_owned = ptr_is_owned(val);
36973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36974         val_conv = BestBlock_clone(&val_conv);
36975         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36976 }
36977
36978 int64_t  CS_LDK_ChainParameters_new(int32_t network_arg, int64_t best_block_arg) {
36979         LDKNetwork network_arg_conv = LDKNetwork_from_cs(network_arg);
36980         LDKBestBlock best_block_arg_conv;
36981         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36982         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36984         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36985         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36986         int64_t ret_ref = 0;
36987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36989         return ret_ref;
36990 }
36991
36992 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36993         LDKChainParameters ret_var = ChainParameters_clone(arg);
36994         int64_t ret_ref = 0;
36995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36997         return ret_ref;
36998 }
36999 int64_t  CS_LDK_ChainParameters_clone_ptr(int64_t arg) {
37000         LDKChainParameters arg_conv;
37001         arg_conv.inner = untag_ptr(arg);
37002         arg_conv.is_owned = ptr_is_owned(arg);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37004         arg_conv.is_owned = false;
37005         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
37006         return ret_conv;
37007 }
37008
37009 int64_t  CS_LDK_ChainParameters_clone(int64_t orig) {
37010         LDKChainParameters orig_conv;
37011         orig_conv.inner = untag_ptr(orig);
37012         orig_conv.is_owned = ptr_is_owned(orig);
37013         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37014         orig_conv.is_owned = false;
37015         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
37016         int64_t ret_ref = 0;
37017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37019         return ret_ref;
37020 }
37021
37022 void  CS_LDK_CounterpartyForwardingInfo_free(int64_t this_obj) {
37023         LDKCounterpartyForwardingInfo this_obj_conv;
37024         this_obj_conv.inner = untag_ptr(this_obj);
37025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37027         CounterpartyForwardingInfo_free(this_obj_conv);
37028 }
37029
37030 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_base_msat(int64_t this_ptr) {
37031         LDKCounterpartyForwardingInfo this_ptr_conv;
37032         this_ptr_conv.inner = untag_ptr(this_ptr);
37033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37035         this_ptr_conv.is_owned = false;
37036         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
37037         return ret_conv;
37038 }
37039
37040 void  CS_LDK_CounterpartyForwardingInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
37041         LDKCounterpartyForwardingInfo this_ptr_conv;
37042         this_ptr_conv.inner = untag_ptr(this_ptr);
37043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37045         this_ptr_conv.is_owned = false;
37046         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
37047 }
37048
37049 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_proportional_millionths(int64_t this_ptr) {
37050         LDKCounterpartyForwardingInfo this_ptr_conv;
37051         this_ptr_conv.inner = untag_ptr(this_ptr);
37052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37054         this_ptr_conv.is_owned = false;
37055         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
37056         return ret_conv;
37057 }
37058
37059 void  CS_LDK_CounterpartyForwardingInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
37060         LDKCounterpartyForwardingInfo this_ptr_conv;
37061         this_ptr_conv.inner = untag_ptr(this_ptr);
37062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37064         this_ptr_conv.is_owned = false;
37065         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
37066 }
37067
37068 int16_t  CS_LDK_CounterpartyForwardingInfo_get_cltv_expiry_delta(int64_t this_ptr) {
37069         LDKCounterpartyForwardingInfo this_ptr_conv;
37070         this_ptr_conv.inner = untag_ptr(this_ptr);
37071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37073         this_ptr_conv.is_owned = false;
37074         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
37075         return ret_conv;
37076 }
37077
37078 void  CS_LDK_CounterpartyForwardingInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
37079         LDKCounterpartyForwardingInfo this_ptr_conv;
37080         this_ptr_conv.inner = untag_ptr(this_ptr);
37081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37083         this_ptr_conv.is_owned = false;
37084         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
37085 }
37086
37087 int64_t  CS_LDK_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
37088         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
37089         int64_t ret_ref = 0;
37090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37092         return ret_ref;
37093 }
37094
37095 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
37096         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
37097         int64_t ret_ref = 0;
37098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37100         return ret_ref;
37101 }
37102 int64_t  CS_LDK_CounterpartyForwardingInfo_clone_ptr(int64_t arg) {
37103         LDKCounterpartyForwardingInfo arg_conv;
37104         arg_conv.inner = untag_ptr(arg);
37105         arg_conv.is_owned = ptr_is_owned(arg);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37107         arg_conv.is_owned = false;
37108         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
37109         return ret_conv;
37110 }
37111
37112 int64_t  CS_LDK_CounterpartyForwardingInfo_clone(int64_t orig) {
37113         LDKCounterpartyForwardingInfo orig_conv;
37114         orig_conv.inner = untag_ptr(orig);
37115         orig_conv.is_owned = ptr_is_owned(orig);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37117         orig_conv.is_owned = false;
37118         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
37119         int64_t ret_ref = 0;
37120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37122         return ret_ref;
37123 }
37124
37125 void  CS_LDK_ChannelCounterparty_free(int64_t this_obj) {
37126         LDKChannelCounterparty this_obj_conv;
37127         this_obj_conv.inner = untag_ptr(this_obj);
37128         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37130         ChannelCounterparty_free(this_obj_conv);
37131 }
37132
37133 int8_tArray  CS_LDK_ChannelCounterparty_get_node_id(int64_t this_ptr) {
37134         LDKChannelCounterparty this_ptr_conv;
37135         this_ptr_conv.inner = untag_ptr(this_ptr);
37136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37138         this_ptr_conv.is_owned = false;
37139         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37140         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
37141         return ret_arr;
37142 }
37143
37144 void  CS_LDK_ChannelCounterparty_set_node_id(int64_t this_ptr, int8_tArray val) {
37145         LDKChannelCounterparty this_ptr_conv;
37146         this_ptr_conv.inner = untag_ptr(this_ptr);
37147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37149         this_ptr_conv.is_owned = false;
37150         LDKPublicKey val_ref;
37151         CHECK(val->arr_len == 33);
37152         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37153         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
37154 }
37155
37156 int64_t  CS_LDK_ChannelCounterparty_get_features(int64_t this_ptr) {
37157         LDKChannelCounterparty this_ptr_conv;
37158         this_ptr_conv.inner = untag_ptr(this_ptr);
37159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37161         this_ptr_conv.is_owned = false;
37162         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
37163         int64_t ret_ref = 0;
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37166         return ret_ref;
37167 }
37168
37169 void  CS_LDK_ChannelCounterparty_set_features(int64_t this_ptr, int64_t val) {
37170         LDKChannelCounterparty this_ptr_conv;
37171         this_ptr_conv.inner = untag_ptr(this_ptr);
37172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37174         this_ptr_conv.is_owned = false;
37175         LDKInitFeatures val_conv;
37176         val_conv.inner = untag_ptr(val);
37177         val_conv.is_owned = ptr_is_owned(val);
37178         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37179         val_conv = InitFeatures_clone(&val_conv);
37180         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
37181 }
37182
37183 int64_t  CS_LDK_ChannelCounterparty_get_unspendable_punishment_reserve(int64_t this_ptr) {
37184         LDKChannelCounterparty this_ptr_conv;
37185         this_ptr_conv.inner = untag_ptr(this_ptr);
37186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37188         this_ptr_conv.is_owned = false;
37189         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
37190         return ret_conv;
37191 }
37192
37193 void  CS_LDK_ChannelCounterparty_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
37194         LDKChannelCounterparty this_ptr_conv;
37195         this_ptr_conv.inner = untag_ptr(this_ptr);
37196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37198         this_ptr_conv.is_owned = false;
37199         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
37200 }
37201
37202 int64_t  CS_LDK_ChannelCounterparty_get_forwarding_info(int64_t this_ptr) {
37203         LDKChannelCounterparty this_ptr_conv;
37204         this_ptr_conv.inner = untag_ptr(this_ptr);
37205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37207         this_ptr_conv.is_owned = false;
37208         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
37209         int64_t ret_ref = 0;
37210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37212         return ret_ref;
37213 }
37214
37215 void  CS_LDK_ChannelCounterparty_set_forwarding_info(int64_t this_ptr, int64_t val) {
37216         LDKChannelCounterparty this_ptr_conv;
37217         this_ptr_conv.inner = untag_ptr(this_ptr);
37218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37220         this_ptr_conv.is_owned = false;
37221         LDKCounterpartyForwardingInfo val_conv;
37222         val_conv.inner = untag_ptr(val);
37223         val_conv.is_owned = ptr_is_owned(val);
37224         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37225         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
37226         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
37227 }
37228
37229 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_minimum_msat(int64_t this_ptr) {
37230         LDKChannelCounterparty this_ptr_conv;
37231         this_ptr_conv.inner = untag_ptr(this_ptr);
37232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37234         this_ptr_conv.is_owned = false;
37235         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37236         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
37237         int64_t ret_ref = tag_ptr(ret_copy, true);
37238         return ret_ref;
37239 }
37240
37241 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37242         LDKChannelCounterparty 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         void* val_ptr = untag_ptr(val);
37248         CHECK_ACCESS(val_ptr);
37249         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37250         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37251         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37252 }
37253
37254 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_maximum_msat(int64_t this_ptr) {
37255         LDKChannelCounterparty this_ptr_conv;
37256         this_ptr_conv.inner = untag_ptr(this_ptr);
37257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37259         this_ptr_conv.is_owned = false;
37260         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37261         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
37262         int64_t ret_ref = tag_ptr(ret_copy, true);
37263         return ret_ref;
37264 }
37265
37266 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
37267         LDKChannelCounterparty this_ptr_conv;
37268         this_ptr_conv.inner = untag_ptr(this_ptr);
37269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37271         this_ptr_conv.is_owned = false;
37272         void* val_ptr = untag_ptr(val);
37273         CHECK_ACCESS(val_ptr);
37274         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37275         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37276         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37277 }
37278
37279 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) {
37280         LDKPublicKey node_id_arg_ref;
37281         CHECK(node_id_arg->arr_len == 33);
37282         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
37283         LDKInitFeatures features_arg_conv;
37284         features_arg_conv.inner = untag_ptr(features_arg);
37285         features_arg_conv.is_owned = ptr_is_owned(features_arg);
37286         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
37287         features_arg_conv = InitFeatures_clone(&features_arg_conv);
37288         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
37289         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
37290         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
37291         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
37292         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
37293         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
37294         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
37295         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
37296         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
37297         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
37298         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
37299         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
37300         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
37301         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);
37302         int64_t ret_ref = 0;
37303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37305         return ret_ref;
37306 }
37307
37308 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
37309         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
37310         int64_t ret_ref = 0;
37311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37313         return ret_ref;
37314 }
37315 int64_t  CS_LDK_ChannelCounterparty_clone_ptr(int64_t arg) {
37316         LDKChannelCounterparty arg_conv;
37317         arg_conv.inner = untag_ptr(arg);
37318         arg_conv.is_owned = ptr_is_owned(arg);
37319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37320         arg_conv.is_owned = false;
37321         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
37322         return ret_conv;
37323 }
37324
37325 int64_t  CS_LDK_ChannelCounterparty_clone(int64_t orig) {
37326         LDKChannelCounterparty orig_conv;
37327         orig_conv.inner = untag_ptr(orig);
37328         orig_conv.is_owned = ptr_is_owned(orig);
37329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37330         orig_conv.is_owned = false;
37331         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
37332         int64_t ret_ref = 0;
37333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37335         return ret_ref;
37336 }
37337
37338 void  CS_LDK_ChannelDetails_free(int64_t this_obj) {
37339         LDKChannelDetails this_obj_conv;
37340         this_obj_conv.inner = untag_ptr(this_obj);
37341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37343         ChannelDetails_free(this_obj_conv);
37344 }
37345
37346 int8_tArray  CS_LDK_ChannelDetails_get_channel_id(int64_t this_ptr) {
37347         LDKChannelDetails 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37353         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
37354         return ret_arr;
37355 }
37356
37357 void  CS_LDK_ChannelDetails_set_channel_id(int64_t this_ptr, int8_tArray val) {
37358         LDKChannelDetails this_ptr_conv;
37359         this_ptr_conv.inner = untag_ptr(this_ptr);
37360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37362         this_ptr_conv.is_owned = false;
37363         LDKThirtyTwoBytes val_ref;
37364         CHECK(val->arr_len == 32);
37365         memcpy(val_ref.data, val->elems, 32); FREE(val);
37366         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
37367 }
37368
37369 int64_t  CS_LDK_ChannelDetails_get_counterparty(int64_t this_ptr) {
37370         LDKChannelDetails this_ptr_conv;
37371         this_ptr_conv.inner = untag_ptr(this_ptr);
37372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37374         this_ptr_conv.is_owned = false;
37375         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
37376         int64_t ret_ref = 0;
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37379         return ret_ref;
37380 }
37381
37382 void  CS_LDK_ChannelDetails_set_counterparty(int64_t this_ptr, int64_t val) {
37383         LDKChannelDetails this_ptr_conv;
37384         this_ptr_conv.inner = untag_ptr(this_ptr);
37385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37387         this_ptr_conv.is_owned = false;
37388         LDKChannelCounterparty val_conv;
37389         val_conv.inner = untag_ptr(val);
37390         val_conv.is_owned = ptr_is_owned(val);
37391         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37392         val_conv = ChannelCounterparty_clone(&val_conv);
37393         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
37394 }
37395
37396 int64_t  CS_LDK_ChannelDetails_get_funding_txo(int64_t this_ptr) {
37397         LDKChannelDetails this_ptr_conv;
37398         this_ptr_conv.inner = untag_ptr(this_ptr);
37399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37401         this_ptr_conv.is_owned = false;
37402         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37403         int64_t ret_ref = 0;
37404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37406         return ret_ref;
37407 }
37408
37409 void  CS_LDK_ChannelDetails_set_funding_txo(int64_t this_ptr, int64_t val) {
37410         LDKChannelDetails this_ptr_conv;
37411         this_ptr_conv.inner = untag_ptr(this_ptr);
37412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37414         this_ptr_conv.is_owned = false;
37415         LDKOutPoint val_conv;
37416         val_conv.inner = untag_ptr(val);
37417         val_conv.is_owned = ptr_is_owned(val);
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37419         val_conv = OutPoint_clone(&val_conv);
37420         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37421 }
37422
37423 int64_t  CS_LDK_ChannelDetails_get_channel_type(int64_t this_ptr) {
37424         LDKChannelDetails this_ptr_conv;
37425         this_ptr_conv.inner = untag_ptr(this_ptr);
37426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37428         this_ptr_conv.is_owned = false;
37429         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37430         int64_t ret_ref = 0;
37431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37433         return ret_ref;
37434 }
37435
37436 void  CS_LDK_ChannelDetails_set_channel_type(int64_t this_ptr, int64_t val) {
37437         LDKChannelDetails this_ptr_conv;
37438         this_ptr_conv.inner = untag_ptr(this_ptr);
37439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37441         this_ptr_conv.is_owned = false;
37442         LDKChannelTypeFeatures val_conv;
37443         val_conv.inner = untag_ptr(val);
37444         val_conv.is_owned = ptr_is_owned(val);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37446         val_conv = ChannelTypeFeatures_clone(&val_conv);
37447         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37448 }
37449
37450 int64_t  CS_LDK_ChannelDetails_get_short_channel_id(int64_t this_ptr) {
37451         LDKChannelDetails this_ptr_conv;
37452         this_ptr_conv.inner = untag_ptr(this_ptr);
37453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37455         this_ptr_conv.is_owned = false;
37456         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37457         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37458         int64_t ret_ref = tag_ptr(ret_copy, true);
37459         return ret_ref;
37460 }
37461
37462 void  CS_LDK_ChannelDetails_set_short_channel_id(int64_t this_ptr, int64_t val) {
37463         LDKChannelDetails this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         void* val_ptr = untag_ptr(val);
37469         CHECK_ACCESS(val_ptr);
37470         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37471         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37472         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37473 }
37474
37475 int64_t  CS_LDK_ChannelDetails_get_outbound_scid_alias(int64_t this_ptr) {
37476         LDKChannelDetails this_ptr_conv;
37477         this_ptr_conv.inner = untag_ptr(this_ptr);
37478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37480         this_ptr_conv.is_owned = false;
37481         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37482         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37483         int64_t ret_ref = tag_ptr(ret_copy, true);
37484         return ret_ref;
37485 }
37486
37487 void  CS_LDK_ChannelDetails_set_outbound_scid_alias(int64_t this_ptr, int64_t val) {
37488         LDKChannelDetails this_ptr_conv;
37489         this_ptr_conv.inner = untag_ptr(this_ptr);
37490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37492         this_ptr_conv.is_owned = false;
37493         void* val_ptr = untag_ptr(val);
37494         CHECK_ACCESS(val_ptr);
37495         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37496         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37497         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37498 }
37499
37500 int64_t  CS_LDK_ChannelDetails_get_inbound_scid_alias(int64_t this_ptr) {
37501         LDKChannelDetails this_ptr_conv;
37502         this_ptr_conv.inner = untag_ptr(this_ptr);
37503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37505         this_ptr_conv.is_owned = false;
37506         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37507         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37508         int64_t ret_ref = tag_ptr(ret_copy, true);
37509         return ret_ref;
37510 }
37511
37512 void  CS_LDK_ChannelDetails_set_inbound_scid_alias(int64_t this_ptr, int64_t val) {
37513         LDKChannelDetails this_ptr_conv;
37514         this_ptr_conv.inner = untag_ptr(this_ptr);
37515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37517         this_ptr_conv.is_owned = false;
37518         void* val_ptr = untag_ptr(val);
37519         CHECK_ACCESS(val_ptr);
37520         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37521         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37522         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37523 }
37524
37525 int64_t  CS_LDK_ChannelDetails_get_channel_value_satoshis(int64_t this_ptr) {
37526         LDKChannelDetails this_ptr_conv;
37527         this_ptr_conv.inner = untag_ptr(this_ptr);
37528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37530         this_ptr_conv.is_owned = false;
37531         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37532         return ret_conv;
37533 }
37534
37535 void  CS_LDK_ChannelDetails_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
37536         LDKChannelDetails this_ptr_conv;
37537         this_ptr_conv.inner = untag_ptr(this_ptr);
37538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37540         this_ptr_conv.is_owned = false;
37541         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37542 }
37543
37544 int64_t  CS_LDK_ChannelDetails_get_unspendable_punishment_reserve(int64_t this_ptr) {
37545         LDKChannelDetails this_ptr_conv;
37546         this_ptr_conv.inner = untag_ptr(this_ptr);
37547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37549         this_ptr_conv.is_owned = false;
37550         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37551         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37552         int64_t ret_ref = tag_ptr(ret_copy, true);
37553         return ret_ref;
37554 }
37555
37556 void  CS_LDK_ChannelDetails_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
37557         LDKChannelDetails this_ptr_conv;
37558         this_ptr_conv.inner = untag_ptr(this_ptr);
37559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37561         this_ptr_conv.is_owned = false;
37562         void* val_ptr = untag_ptr(val);
37563         CHECK_ACCESS(val_ptr);
37564         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37565         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37566         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37567 }
37568
37569 int8_tArray  CS_LDK_ChannelDetails_get_user_channel_id(int64_t this_ptr) {
37570         LDKChannelDetails this_ptr_conv;
37571         this_ptr_conv.inner = untag_ptr(this_ptr);
37572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37574         this_ptr_conv.is_owned = false;
37575         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
37576         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
37577         return ret_arr;
37578 }
37579
37580 void  CS_LDK_ChannelDetails_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
37581         LDKChannelDetails this_ptr_conv;
37582         this_ptr_conv.inner = untag_ptr(this_ptr);
37583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37585         this_ptr_conv.is_owned = false;
37586         LDKU128 val_ref;
37587         CHECK(val->arr_len == 16);
37588         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
37589         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37590 }
37591
37592 int64_t  CS_LDK_ChannelDetails_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
37593         LDKChannelDetails 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         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37599         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37600         int64_t ret_ref = tag_ptr(ret_copy, true);
37601         return ret_ref;
37602 }
37603
37604 void  CS_LDK_ChannelDetails_set_feerate_sat_per_1000_weight(int64_t this_ptr, int64_t val) {
37605         LDKChannelDetails this_ptr_conv;
37606         this_ptr_conv.inner = untag_ptr(this_ptr);
37607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37609         this_ptr_conv.is_owned = false;
37610         void* val_ptr = untag_ptr(val);
37611         CHECK_ACCESS(val_ptr);
37612         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37613         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37614         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37615 }
37616
37617 int64_t  CS_LDK_ChannelDetails_get_balance_msat(int64_t this_ptr) {
37618         LDKChannelDetails this_ptr_conv;
37619         this_ptr_conv.inner = untag_ptr(this_ptr);
37620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37622         this_ptr_conv.is_owned = false;
37623         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37624         return ret_conv;
37625 }
37626
37627 void  CS_LDK_ChannelDetails_set_balance_msat(int64_t this_ptr, int64_t val) {
37628         LDKChannelDetails this_ptr_conv;
37629         this_ptr_conv.inner = untag_ptr(this_ptr);
37630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37632         this_ptr_conv.is_owned = false;
37633         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37634 }
37635
37636 int64_t  CS_LDK_ChannelDetails_get_outbound_capacity_msat(int64_t this_ptr) {
37637         LDKChannelDetails 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 = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37643         return ret_conv;
37644 }
37645
37646 void  CS_LDK_ChannelDetails_set_outbound_capacity_msat(int64_t this_ptr, int64_t val) {
37647         LDKChannelDetails 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         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37653 }
37654
37655 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_limit_msat(int64_t this_ptr) {
37656         LDKChannelDetails 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         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37662         return ret_conv;
37663 }
37664
37665 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_limit_msat(int64_t this_ptr, int64_t val) {
37666         LDKChannelDetails 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         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37672 }
37673
37674 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_minimum_msat(int64_t this_ptr) {
37675         LDKChannelDetails this_ptr_conv;
37676         this_ptr_conv.inner = untag_ptr(this_ptr);
37677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37679         this_ptr_conv.is_owned = false;
37680         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37681         return ret_conv;
37682 }
37683
37684 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37685         LDKChannelDetails this_ptr_conv;
37686         this_ptr_conv.inner = untag_ptr(this_ptr);
37687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37689         this_ptr_conv.is_owned = false;
37690         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37691 }
37692
37693 int64_t  CS_LDK_ChannelDetails_get_inbound_capacity_msat(int64_t this_ptr) {
37694         LDKChannelDetails this_ptr_conv;
37695         this_ptr_conv.inner = untag_ptr(this_ptr);
37696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37698         this_ptr_conv.is_owned = false;
37699         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37700         return ret_conv;
37701 }
37702
37703 void  CS_LDK_ChannelDetails_set_inbound_capacity_msat(int64_t this_ptr, int64_t val) {
37704         LDKChannelDetails this_ptr_conv;
37705         this_ptr_conv.inner = untag_ptr(this_ptr);
37706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37708         this_ptr_conv.is_owned = false;
37709         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37710 }
37711
37712 int64_t  CS_LDK_ChannelDetails_get_confirmations_required(int64_t this_ptr) {
37713         LDKChannelDetails this_ptr_conv;
37714         this_ptr_conv.inner = untag_ptr(this_ptr);
37715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37717         this_ptr_conv.is_owned = false;
37718         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37719         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37720         int64_t ret_ref = tag_ptr(ret_copy, true);
37721         return ret_ref;
37722 }
37723
37724 void  CS_LDK_ChannelDetails_set_confirmations_required(int64_t this_ptr, int64_t val) {
37725         LDKChannelDetails this_ptr_conv;
37726         this_ptr_conv.inner = untag_ptr(this_ptr);
37727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37729         this_ptr_conv.is_owned = false;
37730         void* val_ptr = untag_ptr(val);
37731         CHECK_ACCESS(val_ptr);
37732         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37733         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37734         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37735 }
37736
37737 int64_t  CS_LDK_ChannelDetails_get_confirmations(int64_t this_ptr) {
37738         LDKChannelDetails this_ptr_conv;
37739         this_ptr_conv.inner = untag_ptr(this_ptr);
37740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37742         this_ptr_conv.is_owned = false;
37743         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37744         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37745         int64_t ret_ref = tag_ptr(ret_copy, true);
37746         return ret_ref;
37747 }
37748
37749 void  CS_LDK_ChannelDetails_set_confirmations(int64_t this_ptr, int64_t val) {
37750         LDKChannelDetails this_ptr_conv;
37751         this_ptr_conv.inner = untag_ptr(this_ptr);
37752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37754         this_ptr_conv.is_owned = false;
37755         void* val_ptr = untag_ptr(val);
37756         CHECK_ACCESS(val_ptr);
37757         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37758         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37759         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37760 }
37761
37762 int64_t  CS_LDK_ChannelDetails_get_force_close_spend_delay(int64_t this_ptr) {
37763         LDKChannelDetails this_ptr_conv;
37764         this_ptr_conv.inner = untag_ptr(this_ptr);
37765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37767         this_ptr_conv.is_owned = false;
37768         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37769         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37770         int64_t ret_ref = tag_ptr(ret_copy, true);
37771         return ret_ref;
37772 }
37773
37774 void  CS_LDK_ChannelDetails_set_force_close_spend_delay(int64_t this_ptr, int64_t val) {
37775         LDKChannelDetails this_ptr_conv;
37776         this_ptr_conv.inner = untag_ptr(this_ptr);
37777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37779         this_ptr_conv.is_owned = false;
37780         void* val_ptr = untag_ptr(val);
37781         CHECK_ACCESS(val_ptr);
37782         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37783         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37784         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37785 }
37786
37787 jboolean  CS_LDK_ChannelDetails_get_is_outbound(int64_t this_ptr) {
37788         LDKChannelDetails this_ptr_conv;
37789         this_ptr_conv.inner = untag_ptr(this_ptr);
37790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37792         this_ptr_conv.is_owned = false;
37793         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37794         return ret_conv;
37795 }
37796
37797 void  CS_LDK_ChannelDetails_set_is_outbound(int64_t this_ptr, jboolean val) {
37798         LDKChannelDetails this_ptr_conv;
37799         this_ptr_conv.inner = untag_ptr(this_ptr);
37800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37802         this_ptr_conv.is_owned = false;
37803         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37804 }
37805
37806 jboolean  CS_LDK_ChannelDetails_get_is_channel_ready(int64_t this_ptr) {
37807         LDKChannelDetails this_ptr_conv;
37808         this_ptr_conv.inner = untag_ptr(this_ptr);
37809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37811         this_ptr_conv.is_owned = false;
37812         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37813         return ret_conv;
37814 }
37815
37816 void  CS_LDK_ChannelDetails_set_is_channel_ready(int64_t this_ptr, jboolean val) {
37817         LDKChannelDetails this_ptr_conv;
37818         this_ptr_conv.inner = untag_ptr(this_ptr);
37819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37821         this_ptr_conv.is_owned = false;
37822         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37823 }
37824
37825 int64_t  CS_LDK_ChannelDetails_get_channel_shutdown_state(int64_t this_ptr) {
37826         LDKChannelDetails this_ptr_conv;
37827         this_ptr_conv.inner = untag_ptr(this_ptr);
37828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37830         this_ptr_conv.is_owned = false;
37831         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37832         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37833         int64_t ret_ref = tag_ptr(ret_copy, true);
37834         return ret_ref;
37835 }
37836
37837 void  CS_LDK_ChannelDetails_set_channel_shutdown_state(int64_t this_ptr, int64_t val) {
37838         LDKChannelDetails this_ptr_conv;
37839         this_ptr_conv.inner = untag_ptr(this_ptr);
37840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37842         this_ptr_conv.is_owned = false;
37843         void* val_ptr = untag_ptr(val);
37844         CHECK_ACCESS(val_ptr);
37845         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37846         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37847         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37848 }
37849
37850 jboolean  CS_LDK_ChannelDetails_get_is_usable(int64_t this_ptr) {
37851         LDKChannelDetails this_ptr_conv;
37852         this_ptr_conv.inner = untag_ptr(this_ptr);
37853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37855         this_ptr_conv.is_owned = false;
37856         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37857         return ret_conv;
37858 }
37859
37860 void  CS_LDK_ChannelDetails_set_is_usable(int64_t this_ptr, jboolean val) {
37861         LDKChannelDetails this_ptr_conv;
37862         this_ptr_conv.inner = untag_ptr(this_ptr);
37863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37865         this_ptr_conv.is_owned = false;
37866         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37867 }
37868
37869 jboolean  CS_LDK_ChannelDetails_get_is_public(int64_t this_ptr) {
37870         LDKChannelDetails this_ptr_conv;
37871         this_ptr_conv.inner = untag_ptr(this_ptr);
37872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37874         this_ptr_conv.is_owned = false;
37875         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37876         return ret_conv;
37877 }
37878
37879 void  CS_LDK_ChannelDetails_set_is_public(int64_t this_ptr, jboolean val) {
37880         LDKChannelDetails this_ptr_conv;
37881         this_ptr_conv.inner = untag_ptr(this_ptr);
37882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37884         this_ptr_conv.is_owned = false;
37885         ChannelDetails_set_is_public(&this_ptr_conv, val);
37886 }
37887
37888 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_minimum_msat(int64_t this_ptr) {
37889         LDKChannelDetails this_ptr_conv;
37890         this_ptr_conv.inner = untag_ptr(this_ptr);
37891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37893         this_ptr_conv.is_owned = false;
37894         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37895         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37896         int64_t ret_ref = tag_ptr(ret_copy, true);
37897         return ret_ref;
37898 }
37899
37900 void  CS_LDK_ChannelDetails_set_inbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37901         LDKChannelDetails this_ptr_conv;
37902         this_ptr_conv.inner = untag_ptr(this_ptr);
37903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37905         this_ptr_conv.is_owned = false;
37906         void* val_ptr = untag_ptr(val);
37907         CHECK_ACCESS(val_ptr);
37908         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37909         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37910         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37911 }
37912
37913 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_maximum_msat(int64_t this_ptr) {
37914         LDKChannelDetails this_ptr_conv;
37915         this_ptr_conv.inner = untag_ptr(this_ptr);
37916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37918         this_ptr_conv.is_owned = false;
37919         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37920         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37921         int64_t ret_ref = tag_ptr(ret_copy, true);
37922         return ret_ref;
37923 }
37924
37925 void  CS_LDK_ChannelDetails_set_inbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
37926         LDKChannelDetails this_ptr_conv;
37927         this_ptr_conv.inner = untag_ptr(this_ptr);
37928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37930         this_ptr_conv.is_owned = false;
37931         void* val_ptr = untag_ptr(val);
37932         CHECK_ACCESS(val_ptr);
37933         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37934         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37935         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37936 }
37937
37938 int64_t  CS_LDK_ChannelDetails_get_config(int64_t this_ptr) {
37939         LDKChannelDetails this_ptr_conv;
37940         this_ptr_conv.inner = untag_ptr(this_ptr);
37941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37943         this_ptr_conv.is_owned = false;
37944         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37945         int64_t ret_ref = 0;
37946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37948         return ret_ref;
37949 }
37950
37951 void  CS_LDK_ChannelDetails_set_config(int64_t this_ptr, int64_t val) {
37952         LDKChannelDetails this_ptr_conv;
37953         this_ptr_conv.inner = untag_ptr(this_ptr);
37954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37956         this_ptr_conv.is_owned = false;
37957         LDKChannelConfig val_conv;
37958         val_conv.inner = untag_ptr(val);
37959         val_conv.is_owned = ptr_is_owned(val);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37961         val_conv = ChannelConfig_clone(&val_conv);
37962         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37963 }
37964
37965 int64_t  CS_LDK_ChannelDetails_new(int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
37966         LDKThirtyTwoBytes channel_id_arg_ref;
37967         CHECK(channel_id_arg->arr_len == 32);
37968         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37969         LDKChannelCounterparty counterparty_arg_conv;
37970         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37971         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37973         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37974         LDKOutPoint funding_txo_arg_conv;
37975         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37976         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37977         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37978         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37979         LDKChannelTypeFeatures channel_type_arg_conv;
37980         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37981         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37982         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37983         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37984         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37985         CHECK_ACCESS(short_channel_id_arg_ptr);
37986         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37987         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37988         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37989         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37990         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37991         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37992         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37993         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37994         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37995         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
37996         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
37997         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
37998         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
37999         LDKU128 user_channel_id_arg_ref;
38000         CHECK(user_channel_id_arg->arr_len == 16);
38001         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
38002         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
38003         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
38004         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
38005         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
38006         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
38007         CHECK_ACCESS(confirmations_required_arg_ptr);
38008         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
38009         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
38010         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
38011         CHECK_ACCESS(confirmations_arg_ptr);
38012         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
38013         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
38014         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
38015         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
38016         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
38017         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
38018         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
38019         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
38020         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
38021         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
38022         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
38023         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
38024         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
38025         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
38026         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
38027         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
38028         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
38029         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
38030         LDKChannelConfig config_arg_conv;
38031         config_arg_conv.inner = untag_ptr(config_arg);
38032         config_arg_conv.is_owned = ptr_is_owned(config_arg);
38033         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
38034         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
38035         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
38036         int64_t ret_ref = 0;
38037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38039         return ret_ref;
38040 }
38041
38042 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
38043         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
38044         int64_t ret_ref = 0;
38045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38047         return ret_ref;
38048 }
38049 int64_t  CS_LDK_ChannelDetails_clone_ptr(int64_t arg) {
38050         LDKChannelDetails arg_conv;
38051         arg_conv.inner = untag_ptr(arg);
38052         arg_conv.is_owned = ptr_is_owned(arg);
38053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38054         arg_conv.is_owned = false;
38055         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
38056         return ret_conv;
38057 }
38058
38059 int64_t  CS_LDK_ChannelDetails_clone(int64_t orig) {
38060         LDKChannelDetails orig_conv;
38061         orig_conv.inner = untag_ptr(orig);
38062         orig_conv.is_owned = ptr_is_owned(orig);
38063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38064         orig_conv.is_owned = false;
38065         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
38066         int64_t ret_ref = 0;
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38069         return ret_ref;
38070 }
38071
38072 int64_t  CS_LDK_ChannelDetails_get_inbound_payment_scid(int64_t this_arg) {
38073         LDKChannelDetails this_arg_conv;
38074         this_arg_conv.inner = untag_ptr(this_arg);
38075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38077         this_arg_conv.is_owned = false;
38078         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38079         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
38080         int64_t ret_ref = tag_ptr(ret_copy, true);
38081         return ret_ref;
38082 }
38083
38084 int64_t  CS_LDK_ChannelDetails_get_outbound_payment_scid(int64_t this_arg) {
38085         LDKChannelDetails this_arg_conv;
38086         this_arg_conv.inner = untag_ptr(this_arg);
38087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38089         this_arg_conv.is_owned = false;
38090         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38091         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
38092         int64_t ret_ref = tag_ptr(ret_copy, true);
38093         return ret_ref;
38094 }
38095
38096 int32_t  CS_LDK_ChannelShutdownState_clone(int64_t orig) {
38097         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
38098         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_clone(orig_conv));
38099         return ret_conv;
38100 }
38101
38102 int32_t  CS_LDK_ChannelShutdownState_not_shutting_down() {
38103         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_not_shutting_down());
38104         return ret_conv;
38105 }
38106
38107 int32_t  CS_LDK_ChannelShutdownState_shutdown_initiated() {
38108         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_initiated());
38109         return ret_conv;
38110 }
38111
38112 int32_t  CS_LDK_ChannelShutdownState_resolving_htlcs() {
38113         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_resolving_htlcs());
38114         return ret_conv;
38115 }
38116
38117 int32_t  CS_LDK_ChannelShutdownState_negotiating_closing_fee() {
38118         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_negotiating_closing_fee());
38119         return ret_conv;
38120 }
38121
38122 int32_t  CS_LDK_ChannelShutdownState_shutdown_complete() {
38123         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_complete());
38124         return ret_conv;
38125 }
38126
38127 jboolean  CS_LDK_ChannelShutdownState_eq(int64_t a, int64_t b) {
38128         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
38129         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
38130         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
38131         return ret_conv;
38132 }
38133
38134 void  CS_LDK_RecentPaymentDetails_free(int64_t this_ptr) {
38135         if (!ptr_is_owned(this_ptr)) return;
38136         void* this_ptr_ptr = untag_ptr(this_ptr);
38137         CHECK_ACCESS(this_ptr_ptr);
38138         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
38139         FREE(untag_ptr(this_ptr));
38140         RecentPaymentDetails_free(this_ptr_conv);
38141 }
38142
38143 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
38144         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38145         *ret_copy = RecentPaymentDetails_clone(arg);
38146         int64_t ret_ref = tag_ptr(ret_copy, true);
38147         return ret_ref;
38148 }
38149 int64_t  CS_LDK_RecentPaymentDetails_clone_ptr(int64_t arg) {
38150         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
38151         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
38152         return ret_conv;
38153 }
38154
38155 int64_t  CS_LDK_RecentPaymentDetails_clone(int64_t orig) {
38156         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
38157         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38158         *ret_copy = RecentPaymentDetails_clone(orig_conv);
38159         int64_t ret_ref = tag_ptr(ret_copy, true);
38160         return ret_ref;
38161 }
38162
38163 int64_t  CS_LDK_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
38164         LDKThirtyTwoBytes payment_id_ref;
38165         CHECK(payment_id->arr_len == 32);
38166         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38167         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38168         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
38169         int64_t ret_ref = tag_ptr(ret_copy, true);
38170         return ret_ref;
38171 }
38172
38173 int64_t  CS_LDK_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
38174         LDKThirtyTwoBytes payment_id_ref;
38175         CHECK(payment_id->arr_len == 32);
38176         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38177         LDKThirtyTwoBytes payment_hash_ref;
38178         CHECK(payment_hash->arr_len == 32);
38179         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38180         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38181         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
38182         int64_t ret_ref = tag_ptr(ret_copy, true);
38183         return ret_ref;
38184 }
38185
38186 int64_t  CS_LDK_RecentPaymentDetails_fulfilled(int8_tArray payment_id, int64_t payment_hash) {
38187         LDKThirtyTwoBytes payment_id_ref;
38188         CHECK(payment_id->arr_len == 32);
38189         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38190         void* payment_hash_ptr = untag_ptr(payment_hash);
38191         CHECK_ACCESS(payment_hash_ptr);
38192         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
38193         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
38194         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38195         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
38196         int64_t ret_ref = tag_ptr(ret_copy, true);
38197         return ret_ref;
38198 }
38199
38200 int64_t  CS_LDK_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
38201         LDKThirtyTwoBytes payment_id_ref;
38202         CHECK(payment_id->arr_len == 32);
38203         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38204         LDKThirtyTwoBytes payment_hash_ref;
38205         CHECK(payment_hash->arr_len == 32);
38206         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38207         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38208         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
38209         int64_t ret_ref = tag_ptr(ret_copy, true);
38210         return ret_ref;
38211 }
38212
38213 void  CS_LDK_PhantomRouteHints_free(int64_t this_obj) {
38214         LDKPhantomRouteHints this_obj_conv;
38215         this_obj_conv.inner = untag_ptr(this_obj);
38216         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38218         PhantomRouteHints_free(this_obj_conv);
38219 }
38220
38221 int64_tArray  CS_LDK_PhantomRouteHints_get_channels(int64_t this_ptr) {
38222         LDKPhantomRouteHints 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         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
38228         int64_tArray ret_arr = NULL;
38229         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38230         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38231         for (size_t q = 0; q < ret_var.datalen; q++) {
38232                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38233                 int64_t ret_conv_16_ref = 0;
38234                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38235                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38236                 ret_arr_ptr[q] = ret_conv_16_ref;
38237         }
38238         
38239         FREE(ret_var.data);
38240         return ret_arr;
38241 }
38242
38243 void  CS_LDK_PhantomRouteHints_set_channels(int64_t this_ptr, int64_tArray val) {
38244         LDKPhantomRouteHints this_ptr_conv;
38245         this_ptr_conv.inner = untag_ptr(this_ptr);
38246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38248         this_ptr_conv.is_owned = false;
38249         LDKCVec_ChannelDetailsZ val_constr;
38250         val_constr.datalen = val->arr_len;
38251         if (val_constr.datalen > 0)
38252                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38253         else
38254                 val_constr.data = NULL;
38255         int64_t* val_vals = val->elems;
38256         for (size_t q = 0; q < val_constr.datalen; q++) {
38257                 int64_t val_conv_16 = val_vals[q];
38258                 LDKChannelDetails val_conv_16_conv;
38259                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
38260                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
38261                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
38262                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
38263                 val_constr.data[q] = val_conv_16_conv;
38264         }
38265         FREE(val);
38266         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
38267 }
38268
38269 int64_t  CS_LDK_PhantomRouteHints_get_phantom_scid(int64_t this_ptr) {
38270         LDKPhantomRouteHints this_ptr_conv;
38271         this_ptr_conv.inner = untag_ptr(this_ptr);
38272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38274         this_ptr_conv.is_owned = false;
38275         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
38276         return ret_conv;
38277 }
38278
38279 void  CS_LDK_PhantomRouteHints_set_phantom_scid(int64_t this_ptr, int64_t val) {
38280         LDKPhantomRouteHints this_ptr_conv;
38281         this_ptr_conv.inner = untag_ptr(this_ptr);
38282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38284         this_ptr_conv.is_owned = false;
38285         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
38286 }
38287
38288 int8_tArray  CS_LDK_PhantomRouteHints_get_real_node_pubkey(int64_t this_ptr) {
38289         LDKPhantomRouteHints this_ptr_conv;
38290         this_ptr_conv.inner = untag_ptr(this_ptr);
38291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38293         this_ptr_conv.is_owned = false;
38294         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38295         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
38296         return ret_arr;
38297 }
38298
38299 void  CS_LDK_PhantomRouteHints_set_real_node_pubkey(int64_t this_ptr, int8_tArray val) {
38300         LDKPhantomRouteHints this_ptr_conv;
38301         this_ptr_conv.inner = untag_ptr(this_ptr);
38302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38304         this_ptr_conv.is_owned = false;
38305         LDKPublicKey val_ref;
38306         CHECK(val->arr_len == 33);
38307         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38308         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
38309 }
38310
38311 int64_t  CS_LDK_PhantomRouteHints_new(int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
38312         LDKCVec_ChannelDetailsZ channels_arg_constr;
38313         channels_arg_constr.datalen = channels_arg->arr_len;
38314         if (channels_arg_constr.datalen > 0)
38315                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38316         else
38317                 channels_arg_constr.data = NULL;
38318         int64_t* channels_arg_vals = channels_arg->elems;
38319         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
38320                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
38321                 LDKChannelDetails channels_arg_conv_16_conv;
38322                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
38323                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
38324                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
38325                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
38326                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
38327         }
38328         FREE(channels_arg);
38329         LDKPublicKey real_node_pubkey_arg_ref;
38330         CHECK(real_node_pubkey_arg->arr_len == 33);
38331         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
38332         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
38333         int64_t ret_ref = 0;
38334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38336         return ret_ref;
38337 }
38338
38339 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
38340         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
38341         int64_t ret_ref = 0;
38342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38344         return ret_ref;
38345 }
38346 int64_t  CS_LDK_PhantomRouteHints_clone_ptr(int64_t arg) {
38347         LDKPhantomRouteHints arg_conv;
38348         arg_conv.inner = untag_ptr(arg);
38349         arg_conv.is_owned = ptr_is_owned(arg);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38351         arg_conv.is_owned = false;
38352         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
38353         return ret_conv;
38354 }
38355
38356 int64_t  CS_LDK_PhantomRouteHints_clone(int64_t orig) {
38357         LDKPhantomRouteHints orig_conv;
38358         orig_conv.inner = untag_ptr(orig);
38359         orig_conv.is_owned = ptr_is_owned(orig);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38361         orig_conv.is_owned = false;
38362         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
38363         int64_t ret_ref = 0;
38364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38366         return ret_ref;
38367 }
38368
38369 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) {
38370         void* fee_est_ptr = untag_ptr(fee_est);
38371         CHECK_ACCESS(fee_est_ptr);
38372         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
38373         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
38374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38375                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
38376         }
38377         void* chain_monitor_ptr = untag_ptr(chain_monitor);
38378         CHECK_ACCESS(chain_monitor_ptr);
38379         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
38380         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
38381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38382                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
38383         }
38384         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
38385         CHECK_ACCESS(tx_broadcaster_ptr);
38386         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
38387         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
38388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38389                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
38390         }
38391         void* router_ptr = untag_ptr(router);
38392         CHECK_ACCESS(router_ptr);
38393         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
38394         if (router_conv.free == LDKRouter_JCalls_free) {
38395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38396                 LDKRouter_JCalls_cloned(&router_conv);
38397         }
38398         void* logger_ptr = untag_ptr(logger);
38399         CHECK_ACCESS(logger_ptr);
38400         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38401         if (logger_conv.free == LDKLogger_JCalls_free) {
38402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38403                 LDKLogger_JCalls_cloned(&logger_conv);
38404         }
38405         void* entropy_source_ptr = untag_ptr(entropy_source);
38406         CHECK_ACCESS(entropy_source_ptr);
38407         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
38408         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
38409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38410                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
38411         }
38412         void* node_signer_ptr = untag_ptr(node_signer);
38413         CHECK_ACCESS(node_signer_ptr);
38414         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
38415         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
38416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38417                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38418         }
38419         void* signer_provider_ptr = untag_ptr(signer_provider);
38420         CHECK_ACCESS(signer_provider_ptr);
38421         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38422         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38424                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38425         }
38426         LDKUserConfig config_conv;
38427         config_conv.inner = untag_ptr(config);
38428         config_conv.is_owned = ptr_is_owned(config);
38429         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38430         config_conv = UserConfig_clone(&config_conv);
38431         LDKChainParameters params_conv;
38432         params_conv.inner = untag_ptr(params);
38433         params_conv.is_owned = ptr_is_owned(params);
38434         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38435         params_conv = ChainParameters_clone(&params_conv);
38436         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);
38437         int64_t ret_ref = 0;
38438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38440         return ret_ref;
38441 }
38442
38443 int64_t  CS_LDK_ChannelManager_get_current_default_configuration(int64_t this_arg) {
38444         LDKChannelManager this_arg_conv;
38445         this_arg_conv.inner = untag_ptr(this_arg);
38446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38448         this_arg_conv.is_owned = false;
38449         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38450         int64_t ret_ref = 0;
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38453         return ret_ref;
38454 }
38455
38456 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) {
38457         LDKChannelManager this_arg_conv;
38458         this_arg_conv.inner = untag_ptr(this_arg);
38459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38461         this_arg_conv.is_owned = false;
38462         LDKPublicKey their_network_key_ref;
38463         CHECK(their_network_key->arr_len == 33);
38464         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
38465         LDKU128 user_channel_id_ref;
38466         CHECK(user_channel_id->arr_len == 16);
38467         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
38468         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
38469         CHECK_ACCESS(temporary_channel_id_ptr);
38470         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
38471         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
38472         LDKUserConfig override_config_conv;
38473         override_config_conv.inner = untag_ptr(override_config);
38474         override_config_conv.is_owned = ptr_is_owned(override_config);
38475         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38476         override_config_conv = UserConfig_clone(&override_config_conv);
38477         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
38478         *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);
38479         return tag_ptr(ret_conv, true);
38480 }
38481
38482 int64_tArray  CS_LDK_ChannelManager_list_channels(int64_t this_arg) {
38483         LDKChannelManager this_arg_conv;
38484         this_arg_conv.inner = untag_ptr(this_arg);
38485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38487         this_arg_conv.is_owned = false;
38488         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38489         int64_tArray ret_arr = NULL;
38490         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38491         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38492         for (size_t q = 0; q < ret_var.datalen; q++) {
38493                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38494                 int64_t ret_conv_16_ref = 0;
38495                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38496                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38497                 ret_arr_ptr[q] = ret_conv_16_ref;
38498         }
38499         
38500         FREE(ret_var.data);
38501         return ret_arr;
38502 }
38503
38504 int64_tArray  CS_LDK_ChannelManager_list_usable_channels(int64_t this_arg) {
38505         LDKChannelManager this_arg_conv;
38506         this_arg_conv.inner = untag_ptr(this_arg);
38507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38509         this_arg_conv.is_owned = false;
38510         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38511         int64_tArray ret_arr = NULL;
38512         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38513         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38514         for (size_t q = 0; q < ret_var.datalen; q++) {
38515                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38516                 int64_t ret_conv_16_ref = 0;
38517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38518                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38519                 ret_arr_ptr[q] = ret_conv_16_ref;
38520         }
38521         
38522         FREE(ret_var.data);
38523         return ret_arr;
38524 }
38525
38526 int64_tArray  CS_LDK_ChannelManager_list_channels_with_counterparty(int64_t this_arg, int8_tArray counterparty_node_id) {
38527         LDKChannelManager this_arg_conv;
38528         this_arg_conv.inner = untag_ptr(this_arg);
38529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38531         this_arg_conv.is_owned = false;
38532         LDKPublicKey counterparty_node_id_ref;
38533         CHECK(counterparty_node_id->arr_len == 33);
38534         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38535         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38536         int64_tArray ret_arr = NULL;
38537         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38538         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38539         for (size_t q = 0; q < ret_var.datalen; q++) {
38540                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38541                 int64_t ret_conv_16_ref = 0;
38542                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38543                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38544                 ret_arr_ptr[q] = ret_conv_16_ref;
38545         }
38546         
38547         FREE(ret_var.data);
38548         return ret_arr;
38549 }
38550
38551 int64_tArray  CS_LDK_ChannelManager_list_recent_payments(int64_t this_arg) {
38552         LDKChannelManager this_arg_conv;
38553         this_arg_conv.inner = untag_ptr(this_arg);
38554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38556         this_arg_conv.is_owned = false;
38557         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38558         int64_tArray ret_arr = NULL;
38559         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
38560         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
38561         for (size_t w = 0; w < ret_var.datalen; w++) {
38562                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38563                 *ret_conv_22_copy = ret_var.data[w];
38564                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38565                 ret_arr_ptr[w] = ret_conv_22_ref;
38566         }
38567         
38568         FREE(ret_var.data);
38569         return ret_arr;
38570 }
38571
38572 int64_t  CS_LDK_ChannelManager_close_channel(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38573         LDKChannelManager this_arg_conv;
38574         this_arg_conv.inner = untag_ptr(this_arg);
38575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38577         this_arg_conv.is_owned = false;
38578         uint8_t channel_id_arr[32];
38579         CHECK(channel_id->arr_len == 32);
38580         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38581         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38582         LDKPublicKey counterparty_node_id_ref;
38583         CHECK(counterparty_node_id->arr_len == 33);
38584         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38585         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38586         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38587         return tag_ptr(ret_conv, true);
38588 }
38589
38590 int64_t  CS_LDK_ChannelManager_close_channel_with_feerate_and_script(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
38591         LDKChannelManager this_arg_conv;
38592         this_arg_conv.inner = untag_ptr(this_arg);
38593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38595         this_arg_conv.is_owned = false;
38596         uint8_t channel_id_arr[32];
38597         CHECK(channel_id->arr_len == 32);
38598         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38599         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38600         LDKPublicKey counterparty_node_id_ref;
38601         CHECK(counterparty_node_id->arr_len == 33);
38602         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38603         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38604         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38605         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38606         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38607         LDKShutdownScript shutdown_script_conv;
38608         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38609         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38610         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38611         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38612         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38613         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
38614         return tag_ptr(ret_conv, true);
38615 }
38616
38617 int64_t  CS_LDK_ChannelManager_force_close_broadcasting_latest_txn(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38618         LDKChannelManager this_arg_conv;
38619         this_arg_conv.inner = untag_ptr(this_arg);
38620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38622         this_arg_conv.is_owned = false;
38623         uint8_t channel_id_arr[32];
38624         CHECK(channel_id->arr_len == 32);
38625         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38626         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38627         LDKPublicKey counterparty_node_id_ref;
38628         CHECK(counterparty_node_id->arr_len == 33);
38629         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38630         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38631         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38632         return tag_ptr(ret_conv, true);
38633 }
38634
38635 int64_t  CS_LDK_ChannelManager_force_close_without_broadcasting_txn(int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38636         LDKChannelManager this_arg_conv;
38637         this_arg_conv.inner = untag_ptr(this_arg);
38638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38640         this_arg_conv.is_owned = false;
38641         uint8_t channel_id_arr[32];
38642         CHECK(channel_id->arr_len == 32);
38643         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
38644         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38645         LDKPublicKey counterparty_node_id_ref;
38646         CHECK(counterparty_node_id->arr_len == 33);
38647         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38648         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38649         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38650         return tag_ptr(ret_conv, true);
38651 }
38652
38653 void  CS_LDK_ChannelManager_force_close_all_channels_broadcasting_latest_txn(int64_t this_arg) {
38654         LDKChannelManager this_arg_conv;
38655         this_arg_conv.inner = untag_ptr(this_arg);
38656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38658         this_arg_conv.is_owned = false;
38659         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38660 }
38661
38662 void  CS_LDK_ChannelManager_force_close_all_channels_without_broadcasting_txn(int64_t this_arg) {
38663         LDKChannelManager this_arg_conv;
38664         this_arg_conv.inner = untag_ptr(this_arg);
38665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38667         this_arg_conv.is_owned = false;
38668         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38669 }
38670
38671 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) {
38672         LDKChannelManager this_arg_conv;
38673         this_arg_conv.inner = untag_ptr(this_arg);
38674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38676         this_arg_conv.is_owned = false;
38677         LDKRoute route_conv;
38678         route_conv.inner = untag_ptr(route);
38679         route_conv.is_owned = ptr_is_owned(route);
38680         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38681         route_conv.is_owned = false;
38682         LDKThirtyTwoBytes payment_hash_ref;
38683         CHECK(payment_hash->arr_len == 32);
38684         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38685         LDKRecipientOnionFields recipient_onion_conv;
38686         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38687         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38688         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38689         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38690         LDKThirtyTwoBytes payment_id_ref;
38691         CHECK(payment_id->arr_len == 32);
38692         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38693         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38694         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38695         return tag_ptr(ret_conv, true);
38696 }
38697
38698 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) {
38699         LDKChannelManager this_arg_conv;
38700         this_arg_conv.inner = untag_ptr(this_arg);
38701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38703         this_arg_conv.is_owned = false;
38704         LDKThirtyTwoBytes payment_hash_ref;
38705         CHECK(payment_hash->arr_len == 32);
38706         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
38707         LDKRecipientOnionFields recipient_onion_conv;
38708         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38709         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38710         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38711         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38712         LDKThirtyTwoBytes payment_id_ref;
38713         CHECK(payment_id->arr_len == 32);
38714         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38715         LDKRouteParameters route_params_conv;
38716         route_params_conv.inner = untag_ptr(route_params);
38717         route_params_conv.is_owned = ptr_is_owned(route_params);
38718         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38719         route_params_conv = RouteParameters_clone(&route_params_conv);
38720         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38721         CHECK_ACCESS(retry_strategy_ptr);
38722         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38723         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38724         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38725         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38726         return tag_ptr(ret_conv, true);
38727 }
38728
38729 void  CS_LDK_ChannelManager_abandon_payment(int64_t this_arg, int8_tArray payment_id) {
38730         LDKChannelManager this_arg_conv;
38731         this_arg_conv.inner = untag_ptr(this_arg);
38732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38734         this_arg_conv.is_owned = false;
38735         LDKThirtyTwoBytes payment_id_ref;
38736         CHECK(payment_id->arr_len == 32);
38737         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38738         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38739 }
38740
38741 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) {
38742         LDKChannelManager this_arg_conv;
38743         this_arg_conv.inner = untag_ptr(this_arg);
38744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38746         this_arg_conv.is_owned = false;
38747         LDKRoute route_conv;
38748         route_conv.inner = untag_ptr(route);
38749         route_conv.is_owned = ptr_is_owned(route);
38750         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38751         route_conv.is_owned = false;
38752         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38753         CHECK_ACCESS(payment_preimage_ptr);
38754         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38755         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38756         LDKRecipientOnionFields recipient_onion_conv;
38757         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38758         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38760         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38761         LDKThirtyTwoBytes payment_id_ref;
38762         CHECK(payment_id->arr_len == 32);
38763         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38764         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
38765         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38766         return tag_ptr(ret_conv, true);
38767 }
38768
38769 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) {
38770         LDKChannelManager this_arg_conv;
38771         this_arg_conv.inner = untag_ptr(this_arg);
38772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38774         this_arg_conv.is_owned = false;
38775         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38776         CHECK_ACCESS(payment_preimage_ptr);
38777         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
38778         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
38779         LDKRecipientOnionFields recipient_onion_conv;
38780         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38781         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38782         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38783         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38784         LDKThirtyTwoBytes payment_id_ref;
38785         CHECK(payment_id->arr_len == 32);
38786         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
38787         LDKRouteParameters route_params_conv;
38788         route_params_conv.inner = untag_ptr(route_params);
38789         route_params_conv.is_owned = ptr_is_owned(route_params);
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38791         route_params_conv = RouteParameters_clone(&route_params_conv);
38792         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38793         CHECK_ACCESS(retry_strategy_ptr);
38794         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38795         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38796         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
38797         *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);
38798         return tag_ptr(ret_conv, true);
38799 }
38800
38801 int64_t  CS_LDK_ChannelManager_send_probe(int64_t this_arg, int64_t path) {
38802         LDKChannelManager this_arg_conv;
38803         this_arg_conv.inner = untag_ptr(this_arg);
38804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38806         this_arg_conv.is_owned = false;
38807         LDKPath path_conv;
38808         path_conv.inner = untag_ptr(path);
38809         path_conv.is_owned = ptr_is_owned(path);
38810         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38811         path_conv = Path_clone(&path_conv);
38812         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
38813         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38814         return tag_ptr(ret_conv, true);
38815 }
38816
38817 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) {
38818         LDKChannelManager this_arg_conv;
38819         this_arg_conv.inner = untag_ptr(this_arg);
38820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38822         this_arg_conv.is_owned = false;
38823         LDKPublicKey node_id_ref;
38824         CHECK(node_id->arr_len == 33);
38825         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
38826         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38827         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38828         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38829         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38830         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38831         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
38832         return tag_ptr(ret_conv, true);
38833 }
38834
38835 int64_t  CS_LDK_ChannelManager_send_preflight_probes(int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
38836         LDKChannelManager this_arg_conv;
38837         this_arg_conv.inner = untag_ptr(this_arg);
38838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38840         this_arg_conv.is_owned = false;
38841         LDKRouteParameters route_params_conv;
38842         route_params_conv.inner = untag_ptr(route_params);
38843         route_params_conv.is_owned = ptr_is_owned(route_params);
38844         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38845         route_params_conv = RouteParameters_clone(&route_params_conv);
38846         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
38847         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
38848         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
38849         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
38850         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
38851         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
38852         return tag_ptr(ret_conv, true);
38853 }
38854
38855 int64_t  CS_LDK_ChannelManager_funding_transaction_generated(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
38856         LDKChannelManager this_arg_conv;
38857         this_arg_conv.inner = untag_ptr(this_arg);
38858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38860         this_arg_conv.is_owned = false;
38861         uint8_t temporary_channel_id_arr[32];
38862         CHECK(temporary_channel_id->arr_len == 32);
38863         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
38864         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38865         LDKPublicKey counterparty_node_id_ref;
38866         CHECK(counterparty_node_id->arr_len == 33);
38867         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38868         LDKTransaction funding_transaction_ref;
38869         funding_transaction_ref.datalen = funding_transaction->arr_len;
38870         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38871         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38872         funding_transaction_ref.data_is_owned = true;
38873         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38874         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38875         return tag_ptr(ret_conv, true);
38876 }
38877
38878 int64_t  CS_LDK_ChannelManager_batch_funding_transaction_generated(int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
38879         LDKChannelManager this_arg_conv;
38880         this_arg_conv.inner = untag_ptr(this_arg);
38881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38883         this_arg_conv.is_owned = false;
38884         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
38885         temporary_channels_constr.datalen = temporary_channels->arr_len;
38886         if (temporary_channels_constr.datalen > 0)
38887                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
38888         else
38889                 temporary_channels_constr.data = NULL;
38890         int64_t* temporary_channels_vals = temporary_channels->elems;
38891         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
38892                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
38893                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
38894                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
38895                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
38896                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
38897                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
38898         }
38899         FREE(temporary_channels);
38900         LDKTransaction funding_transaction_ref;
38901         funding_transaction_ref.datalen = funding_transaction->arr_len;
38902         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38903         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
38904         funding_transaction_ref.data_is_owned = true;
38905         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38906         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
38907         return tag_ptr(ret_conv, true);
38908 }
38909
38910 int64_t  CS_LDK_ChannelManager_update_partial_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, int64_t config_update) {
38911         LDKChannelManager this_arg_conv;
38912         this_arg_conv.inner = untag_ptr(this_arg);
38913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38915         this_arg_conv.is_owned = false;
38916         LDKPublicKey counterparty_node_id_ref;
38917         CHECK(counterparty_node_id->arr_len == 33);
38918         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38919         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38920         channel_ids_constr.datalen = channel_ids->arr_len;
38921         if (channel_ids_constr.datalen > 0)
38922                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38923         else
38924                 channel_ids_constr.data = NULL;
38925         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38926         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38927                 int8_tArray channel_ids_conv_8 = channel_ids_vals[i];
38928                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38929                 CHECK(channel_ids_conv_8->arr_len == 32);
38930                 memcpy(channel_ids_conv_8_ref.data, channel_ids_conv_8->elems, 32); FREE(channel_ids_conv_8);
38931                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38932         }
38933         FREE(channel_ids);
38934         LDKChannelConfigUpdate config_update_conv;
38935         config_update_conv.inner = untag_ptr(config_update);
38936         config_update_conv.is_owned = ptr_is_owned(config_update);
38937         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38938         config_update_conv.is_owned = false;
38939         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38940         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38941         return tag_ptr(ret_conv, true);
38942 }
38943
38944 int64_t  CS_LDK_ChannelManager_update_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, ptrArray channel_ids, int64_t config) {
38945         LDKChannelManager this_arg_conv;
38946         this_arg_conv.inner = untag_ptr(this_arg);
38947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38949         this_arg_conv.is_owned = false;
38950         LDKPublicKey counterparty_node_id_ref;
38951         CHECK(counterparty_node_id->arr_len == 33);
38952         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
38953         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38954         channel_ids_constr.datalen = channel_ids->arr_len;
38955         if (channel_ids_constr.datalen > 0)
38956                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38957         else
38958                 channel_ids_constr.data = NULL;
38959         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
38960         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38961                 int8_tArray channel_ids_conv_8 = channel_ids_vals[i];
38962                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38963                 CHECK(channel_ids_conv_8->arr_len == 32);
38964                 memcpy(channel_ids_conv_8_ref.data, channel_ids_conv_8->elems, 32); FREE(channel_ids_conv_8);
38965                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38966         }
38967         FREE(channel_ids);
38968         LDKChannelConfig config_conv;
38969         config_conv.inner = untag_ptr(config);
38970         config_conv.is_owned = ptr_is_owned(config);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38972         config_conv.is_owned = false;
38973         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38974         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38975         return tag_ptr(ret_conv, true);
38976 }
38977
38978 int64_t  CS_LDK_ChannelManager_forward_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
38979         LDKChannelManager this_arg_conv;
38980         this_arg_conv.inner = untag_ptr(this_arg);
38981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38983         this_arg_conv.is_owned = false;
38984         LDKThirtyTwoBytes intercept_id_ref;
38985         CHECK(intercept_id->arr_len == 32);
38986         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
38987         uint8_t next_hop_channel_id_arr[32];
38988         CHECK(next_hop_channel_id->arr_len == 32);
38989         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
38990         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38991         LDKPublicKey next_node_id_ref;
38992         CHECK(next_node_id->arr_len == 33);
38993         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
38994         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38995         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
38996         return tag_ptr(ret_conv, true);
38997 }
38998
38999 int64_t  CS_LDK_ChannelManager_fail_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id) {
39000         LDKChannelManager this_arg_conv;
39001         this_arg_conv.inner = untag_ptr(this_arg);
39002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39004         this_arg_conv.is_owned = false;
39005         LDKThirtyTwoBytes intercept_id_ref;
39006         CHECK(intercept_id->arr_len == 32);
39007         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
39008         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39009         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
39010         return tag_ptr(ret_conv, true);
39011 }
39012
39013 void  CS_LDK_ChannelManager_process_pending_htlc_forwards(int64_t this_arg) {
39014         LDKChannelManager this_arg_conv;
39015         this_arg_conv.inner = untag_ptr(this_arg);
39016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39018         this_arg_conv.is_owned = false;
39019         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
39020 }
39021
39022 void  CS_LDK_ChannelManager_timer_tick_occurred(int64_t this_arg) {
39023         LDKChannelManager this_arg_conv;
39024         this_arg_conv.inner = untag_ptr(this_arg);
39025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39027         this_arg_conv.is_owned = false;
39028         ChannelManager_timer_tick_occurred(&this_arg_conv);
39029 }
39030
39031 void  CS_LDK_ChannelManager_fail_htlc_backwards(int64_t this_arg, int8_tArray payment_hash) {
39032         LDKChannelManager this_arg_conv;
39033         this_arg_conv.inner = untag_ptr(this_arg);
39034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39036         this_arg_conv.is_owned = false;
39037         uint8_t payment_hash_arr[32];
39038         CHECK(payment_hash->arr_len == 32);
39039         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
39040         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
39041         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
39042 }
39043
39044 void  CS_LDK_ChannelManager_fail_htlc_backwards_with_reason(int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
39045         LDKChannelManager this_arg_conv;
39046         this_arg_conv.inner = untag_ptr(this_arg);
39047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39049         this_arg_conv.is_owned = false;
39050         uint8_t payment_hash_arr[32];
39051         CHECK(payment_hash->arr_len == 32);
39052         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
39053         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
39054         void* failure_code_ptr = untag_ptr(failure_code);
39055         CHECK_ACCESS(failure_code_ptr);
39056         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
39057         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
39058         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
39059 }
39060
39061 void  CS_LDK_ChannelManager_claim_funds(int64_t this_arg, int8_tArray payment_preimage) {
39062         LDKChannelManager this_arg_conv;
39063         this_arg_conv.inner = untag_ptr(this_arg);
39064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39066         this_arg_conv.is_owned = false;
39067         LDKThirtyTwoBytes payment_preimage_ref;
39068         CHECK(payment_preimage->arr_len == 32);
39069         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39070         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
39071 }
39072
39073 void  CS_LDK_ChannelManager_claim_funds_with_known_custom_tlvs(int64_t this_arg, int8_tArray payment_preimage) {
39074         LDKChannelManager this_arg_conv;
39075         this_arg_conv.inner = untag_ptr(this_arg);
39076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39078         this_arg_conv.is_owned = false;
39079         LDKThirtyTwoBytes payment_preimage_ref;
39080         CHECK(payment_preimage->arr_len == 32);
39081         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39082         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
39083 }
39084
39085 int8_tArray  CS_LDK_ChannelManager_get_our_node_id(int64_t this_arg) {
39086         LDKChannelManager this_arg_conv;
39087         this_arg_conv.inner = untag_ptr(this_arg);
39088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39090         this_arg_conv.is_owned = false;
39091         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39092         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
39093         return ret_arr;
39094 }
39095
39096 int64_t  CS_LDK_ChannelManager_accept_inbound_channel(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
39097         LDKChannelManager this_arg_conv;
39098         this_arg_conv.inner = untag_ptr(this_arg);
39099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39101         this_arg_conv.is_owned = false;
39102         uint8_t temporary_channel_id_arr[32];
39103         CHECK(temporary_channel_id->arr_len == 32);
39104         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
39105         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
39106         LDKPublicKey counterparty_node_id_ref;
39107         CHECK(counterparty_node_id->arr_len == 33);
39108         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
39109         LDKU128 user_channel_id_ref;
39110         CHECK(user_channel_id->arr_len == 16);
39111         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
39112         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39113         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
39114         return tag_ptr(ret_conv, true);
39115 }
39116
39117 int64_t  CS_LDK_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
39118         LDKChannelManager this_arg_conv;
39119         this_arg_conv.inner = untag_ptr(this_arg);
39120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39122         this_arg_conv.is_owned = false;
39123         uint8_t temporary_channel_id_arr[32];
39124         CHECK(temporary_channel_id->arr_len == 32);
39125         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
39126         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
39127         LDKPublicKey counterparty_node_id_ref;
39128         CHECK(counterparty_node_id->arr_len == 33);
39129         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
39130         LDKU128 user_channel_id_ref;
39131         CHECK(user_channel_id->arr_len == 16);
39132         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
39133         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39134         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
39135         return tag_ptr(ret_conv, true);
39136 }
39137
39138 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) {
39139         LDKChannelManager this_arg_conv;
39140         this_arg_conv.inner = untag_ptr(this_arg);
39141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39143         this_arg_conv.is_owned = false;
39144         LDKOffer offer_conv;
39145         offer_conv.inner = untag_ptr(offer);
39146         offer_conv.is_owned = ptr_is_owned(offer);
39147         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
39148         offer_conv.is_owned = false;
39149         void* quantity_ptr = untag_ptr(quantity);
39150         CHECK_ACCESS(quantity_ptr);
39151         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
39152         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
39153         void* amount_msats_ptr = untag_ptr(amount_msats);
39154         CHECK_ACCESS(amount_msats_ptr);
39155         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
39156         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
39157         void* payer_note_ptr = untag_ptr(payer_note);
39158         CHECK_ACCESS(payer_note_ptr);
39159         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
39160         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
39161         LDKThirtyTwoBytes payment_id_ref;
39162         CHECK(payment_id->arr_len == 32);
39163         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
39164         void* retry_strategy_ptr = untag_ptr(retry_strategy);
39165         CHECK_ACCESS(retry_strategy_ptr);
39166         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
39167         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
39168         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
39169         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
39170         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
39171         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
39172         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
39173         *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);
39174         return tag_ptr(ret_conv, true);
39175 }
39176
39177 int64_t  CS_LDK_ChannelManager_request_refund_payment(int64_t this_arg, int64_t refund) {
39178         LDKChannelManager this_arg_conv;
39179         this_arg_conv.inner = untag_ptr(this_arg);
39180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39182         this_arg_conv.is_owned = false;
39183         LDKRefund refund_conv;
39184         refund_conv.inner = untag_ptr(refund);
39185         refund_conv.is_owned = ptr_is_owned(refund);
39186         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
39187         refund_conv.is_owned = false;
39188         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
39189         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
39190         return tag_ptr(ret_conv, true);
39191 }
39192
39193 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) {
39194         LDKChannelManager this_arg_conv;
39195         this_arg_conv.inner = untag_ptr(this_arg);
39196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39198         this_arg_conv.is_owned = false;
39199         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39200         CHECK_ACCESS(min_value_msat_ptr);
39201         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39202         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39203         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39204         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39205         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39206         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39207         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
39208         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
39209         return tag_ptr(ret_conv, true);
39210 }
39211
39212 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) {
39213         LDKChannelManager this_arg_conv;
39214         this_arg_conv.inner = untag_ptr(this_arg);
39215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39217         this_arg_conv.is_owned = false;
39218         LDKThirtyTwoBytes payment_hash_ref;
39219         CHECK(payment_hash->arr_len == 32);
39220         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39221         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39222         CHECK_ACCESS(min_value_msat_ptr);
39223         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39224         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39225         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
39226         CHECK_ACCESS(min_final_cltv_expiry_ptr);
39227         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
39228         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
39229         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
39230         *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);
39231         return tag_ptr(ret_conv, true);
39232 }
39233
39234 int64_t  CS_LDK_ChannelManager_get_payment_preimage(int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
39235         LDKChannelManager this_arg_conv;
39236         this_arg_conv.inner = untag_ptr(this_arg);
39237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39239         this_arg_conv.is_owned = false;
39240         LDKThirtyTwoBytes payment_hash_ref;
39241         CHECK(payment_hash->arr_len == 32);
39242         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39243         LDKThirtyTwoBytes payment_secret_ref;
39244         CHECK(payment_secret->arr_len == 32);
39245         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
39246         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
39247         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
39248         return tag_ptr(ret_conv, true);
39249 }
39250
39251 int64_t  CS_LDK_ChannelManager_get_phantom_scid(int64_t this_arg) {
39252         LDKChannelManager this_arg_conv;
39253         this_arg_conv.inner = untag_ptr(this_arg);
39254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39256         this_arg_conv.is_owned = false;
39257         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
39258         return ret_conv;
39259 }
39260
39261 int64_t  CS_LDK_ChannelManager_get_phantom_route_hints(int64_t this_arg) {
39262         LDKChannelManager this_arg_conv;
39263         this_arg_conv.inner = untag_ptr(this_arg);
39264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39266         this_arg_conv.is_owned = false;
39267         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
39268         int64_t ret_ref = 0;
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39271         return ret_ref;
39272 }
39273
39274 int64_t  CS_LDK_ChannelManager_get_intercept_scid(int64_t this_arg) {
39275         LDKChannelManager this_arg_conv;
39276         this_arg_conv.inner = untag_ptr(this_arg);
39277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39279         this_arg_conv.is_owned = false;
39280         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
39281         return ret_conv;
39282 }
39283
39284 int64_t  CS_LDK_ChannelManager_compute_inflight_htlcs(int64_t this_arg) {
39285         LDKChannelManager this_arg_conv;
39286         this_arg_conv.inner = untag_ptr(this_arg);
39287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39289         this_arg_conv.is_owned = false;
39290         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
39291         int64_t ret_ref = 0;
39292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39294         return ret_ref;
39295 }
39296
39297 int64_t  CS_LDK_ChannelManager_as_MessageSendEventsProvider(int64_t this_arg) {
39298         LDKChannelManager this_arg_conv;
39299         this_arg_conv.inner = untag_ptr(this_arg);
39300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39302         this_arg_conv.is_owned = false;
39303         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39304         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
39305         return tag_ptr(ret_ret, true);
39306 }
39307
39308 int64_t  CS_LDK_ChannelManager_as_EventsProvider(int64_t this_arg) {
39309         LDKChannelManager this_arg_conv;
39310         this_arg_conv.inner = untag_ptr(this_arg);
39311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39313         this_arg_conv.is_owned = false;
39314         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
39315         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
39316         return tag_ptr(ret_ret, true);
39317 }
39318
39319 int64_t  CS_LDK_ChannelManager_as_Listen(int64_t this_arg) {
39320         LDKChannelManager this_arg_conv;
39321         this_arg_conv.inner = untag_ptr(this_arg);
39322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39324         this_arg_conv.is_owned = false;
39325         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
39326         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
39327         return tag_ptr(ret_ret, true);
39328 }
39329
39330 int64_t  CS_LDK_ChannelManager_as_Confirm(int64_t this_arg) {
39331         LDKChannelManager this_arg_conv;
39332         this_arg_conv.inner = untag_ptr(this_arg);
39333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39335         this_arg_conv.is_owned = false;
39336         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
39337         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
39338         return tag_ptr(ret_ret, true);
39339 }
39340
39341 int64_t  CS_LDK_ChannelManager_get_event_or_persistence_needed_future(int64_t this_arg) {
39342         LDKChannelManager this_arg_conv;
39343         this_arg_conv.inner = untag_ptr(this_arg);
39344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39346         this_arg_conv.is_owned = false;
39347         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
39348         int64_t ret_ref = 0;
39349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39351         return ret_ref;
39352 }
39353
39354 jboolean  CS_LDK_ChannelManager_get_and_clear_needs_persistence(int64_t this_arg) {
39355         LDKChannelManager this_arg_conv;
39356         this_arg_conv.inner = untag_ptr(this_arg);
39357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39359         this_arg_conv.is_owned = false;
39360         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
39361         return ret_conv;
39362 }
39363
39364 int64_t  CS_LDK_ChannelManager_current_best_block(int64_t this_arg) {
39365         LDKChannelManager this_arg_conv;
39366         this_arg_conv.inner = untag_ptr(this_arg);
39367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39369         this_arg_conv.is_owned = false;
39370         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
39371         int64_t ret_ref = 0;
39372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39374         return ret_ref;
39375 }
39376
39377 int64_t  CS_LDK_ChannelManager_node_features(int64_t this_arg) {
39378         LDKChannelManager this_arg_conv;
39379         this_arg_conv.inner = untag_ptr(this_arg);
39380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39382         this_arg_conv.is_owned = false;
39383         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
39384         int64_t ret_ref = 0;
39385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39387         return ret_ref;
39388 }
39389
39390 int64_t  CS_LDK_ChannelManager_channel_features(int64_t this_arg) {
39391         LDKChannelManager this_arg_conv;
39392         this_arg_conv.inner = untag_ptr(this_arg);
39393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39395         this_arg_conv.is_owned = false;
39396         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
39397         int64_t ret_ref = 0;
39398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39400         return ret_ref;
39401 }
39402
39403 int64_t  CS_LDK_ChannelManager_channel_type_features(int64_t this_arg) {
39404         LDKChannelManager this_arg_conv;
39405         this_arg_conv.inner = untag_ptr(this_arg);
39406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39408         this_arg_conv.is_owned = false;
39409         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
39410         int64_t ret_ref = 0;
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39413         return ret_ref;
39414 }
39415
39416 int64_t  CS_LDK_ChannelManager_init_features(int64_t this_arg) {
39417         LDKChannelManager this_arg_conv;
39418         this_arg_conv.inner = untag_ptr(this_arg);
39419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39421         this_arg_conv.is_owned = false;
39422         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
39423         int64_t ret_ref = 0;
39424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39426         return ret_ref;
39427 }
39428
39429 int64_t  CS_LDK_ChannelManager_as_ChannelMessageHandler(int64_t this_arg) {
39430         LDKChannelManager this_arg_conv;
39431         this_arg_conv.inner = untag_ptr(this_arg);
39432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39434         this_arg_conv.is_owned = false;
39435         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
39436         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
39437         return tag_ptr(ret_ret, true);
39438 }
39439
39440 int64_t  CS_LDK_ChannelManager_as_OffersMessageHandler(int64_t this_arg) {
39441         LDKChannelManager this_arg_conv;
39442         this_arg_conv.inner = untag_ptr(this_arg);
39443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39445         this_arg_conv.is_owned = false;
39446         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
39447         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
39448         return tag_ptr(ret_ret, true);
39449 }
39450
39451 int64_t  CS_LDK_provided_init_features(int64_t config) {
39452         LDKUserConfig config_conv;
39453         config_conv.inner = untag_ptr(config);
39454         config_conv.is_owned = ptr_is_owned(config);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
39456         config_conv.is_owned = false;
39457         LDKInitFeatures ret_var = provided_init_features(&config_conv);
39458         int64_t ret_ref = 0;
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39461         return ret_ref;
39462 }
39463
39464 int8_tArray  CS_LDK_CounterpartyForwardingInfo_write(int64_t obj) {
39465         LDKCounterpartyForwardingInfo obj_conv;
39466         obj_conv.inner = untag_ptr(obj);
39467         obj_conv.is_owned = ptr_is_owned(obj);
39468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39469         obj_conv.is_owned = false;
39470         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
39471         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39472         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39473         CVec_u8Z_free(ret_var);
39474         return ret_arr;
39475 }
39476
39477 int64_t  CS_LDK_CounterpartyForwardingInfo_read(int8_tArray ser) {
39478         LDKu8slice ser_ref;
39479         ser_ref.datalen = ser->arr_len;
39480         ser_ref.data = ser->elems;
39481         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
39482         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
39483         FREE(ser);
39484         return tag_ptr(ret_conv, true);
39485 }
39486
39487 int8_tArray  CS_LDK_ChannelCounterparty_write(int64_t obj) {
39488         LDKChannelCounterparty obj_conv;
39489         obj_conv.inner = untag_ptr(obj);
39490         obj_conv.is_owned = ptr_is_owned(obj);
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39492         obj_conv.is_owned = false;
39493         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
39494         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39495         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39496         CVec_u8Z_free(ret_var);
39497         return ret_arr;
39498 }
39499
39500 int64_t  CS_LDK_ChannelCounterparty_read(int8_tArray ser) {
39501         LDKu8slice ser_ref;
39502         ser_ref.datalen = ser->arr_len;
39503         ser_ref.data = ser->elems;
39504         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
39505         *ret_conv = ChannelCounterparty_read(ser_ref);
39506         FREE(ser);
39507         return tag_ptr(ret_conv, true);
39508 }
39509
39510 int8_tArray  CS_LDK_ChannelDetails_write(int64_t obj) {
39511         LDKChannelDetails obj_conv;
39512         obj_conv.inner = untag_ptr(obj);
39513         obj_conv.is_owned = ptr_is_owned(obj);
39514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39515         obj_conv.is_owned = false;
39516         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
39517         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39518         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39519         CVec_u8Z_free(ret_var);
39520         return ret_arr;
39521 }
39522
39523 int64_t  CS_LDK_ChannelDetails_read(int8_tArray ser) {
39524         LDKu8slice ser_ref;
39525         ser_ref.datalen = ser->arr_len;
39526         ser_ref.data = ser->elems;
39527         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
39528         *ret_conv = ChannelDetails_read(ser_ref);
39529         FREE(ser);
39530         return tag_ptr(ret_conv, true);
39531 }
39532
39533 int8_tArray  CS_LDK_PhantomRouteHints_write(int64_t obj) {
39534         LDKPhantomRouteHints obj_conv;
39535         obj_conv.inner = untag_ptr(obj);
39536         obj_conv.is_owned = ptr_is_owned(obj);
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39538         obj_conv.is_owned = false;
39539         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
39540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39542         CVec_u8Z_free(ret_var);
39543         return ret_arr;
39544 }
39545
39546 int64_t  CS_LDK_PhantomRouteHints_read(int8_tArray ser) {
39547         LDKu8slice ser_ref;
39548         ser_ref.datalen = ser->arr_len;
39549         ser_ref.data = ser->elems;
39550         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
39551         *ret_conv = PhantomRouteHints_read(ser_ref);
39552         FREE(ser);
39553         return tag_ptr(ret_conv, true);
39554 }
39555
39556 int8_tArray  CS_LDK_BlindedForward_write(int64_t obj) {
39557         LDKBlindedForward obj_conv;
39558         obj_conv.inner = untag_ptr(obj);
39559         obj_conv.is_owned = ptr_is_owned(obj);
39560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39561         obj_conv.is_owned = false;
39562         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
39563         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39564         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39565         CVec_u8Z_free(ret_var);
39566         return ret_arr;
39567 }
39568
39569 int64_t  CS_LDK_BlindedForward_read(int8_tArray ser) {
39570         LDKu8slice ser_ref;
39571         ser_ref.datalen = ser->arr_len;
39572         ser_ref.data = ser->elems;
39573         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
39574         *ret_conv = BlindedForward_read(ser_ref);
39575         FREE(ser);
39576         return tag_ptr(ret_conv, true);
39577 }
39578
39579 int8_tArray  CS_LDK_PendingHTLCRouting_write(int64_t obj) {
39580         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
39581         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
39582         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39583         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39584         CVec_u8Z_free(ret_var);
39585         return ret_arr;
39586 }
39587
39588 int64_t  CS_LDK_PendingHTLCRouting_read(int8_tArray ser) {
39589         LDKu8slice ser_ref;
39590         ser_ref.datalen = ser->arr_len;
39591         ser_ref.data = ser->elems;
39592         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
39593         *ret_conv = PendingHTLCRouting_read(ser_ref);
39594         FREE(ser);
39595         return tag_ptr(ret_conv, true);
39596 }
39597
39598 int8_tArray  CS_LDK_PendingHTLCInfo_write(int64_t obj) {
39599         LDKPendingHTLCInfo obj_conv;
39600         obj_conv.inner = untag_ptr(obj);
39601         obj_conv.is_owned = ptr_is_owned(obj);
39602         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39603         obj_conv.is_owned = false;
39604         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
39605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39607         CVec_u8Z_free(ret_var);
39608         return ret_arr;
39609 }
39610
39611 int64_t  CS_LDK_PendingHTLCInfo_read(int8_tArray ser) {
39612         LDKu8slice ser_ref;
39613         ser_ref.datalen = ser->arr_len;
39614         ser_ref.data = ser->elems;
39615         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
39616         *ret_conv = PendingHTLCInfo_read(ser_ref);
39617         FREE(ser);
39618         return tag_ptr(ret_conv, true);
39619 }
39620
39621 int8_tArray  CS_LDK_BlindedFailure_write(int64_t obj) {
39622         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
39623         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
39624         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39625         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39626         CVec_u8Z_free(ret_var);
39627         return ret_arr;
39628 }
39629
39630 int64_t  CS_LDK_BlindedFailure_read(int8_tArray ser) {
39631         LDKu8slice ser_ref;
39632         ser_ref.datalen = ser->arr_len;
39633         ser_ref.data = ser->elems;
39634         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
39635         *ret_conv = BlindedFailure_read(ser_ref);
39636         FREE(ser);
39637         return tag_ptr(ret_conv, true);
39638 }
39639
39640 int8_tArray  CS_LDK_ChannelManager_write(int64_t obj) {
39641         LDKChannelManager obj_conv;
39642         obj_conv.inner = untag_ptr(obj);
39643         obj_conv.is_owned = ptr_is_owned(obj);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39645         obj_conv.is_owned = false;
39646         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
39647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39649         CVec_u8Z_free(ret_var);
39650         return ret_arr;
39651 }
39652
39653 int8_tArray  CS_LDK_ChannelShutdownState_write(int64_t obj) {
39654         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
39655         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
39656         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39657         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39658         CVec_u8Z_free(ret_var);
39659         return ret_arr;
39660 }
39661
39662 int64_t  CS_LDK_ChannelShutdownState_read(int8_tArray ser) {
39663         LDKu8slice ser_ref;
39664         ser_ref.datalen = ser->arr_len;
39665         ser_ref.data = ser->elems;
39666         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
39667         *ret_conv = ChannelShutdownState_read(ser_ref);
39668         FREE(ser);
39669         return tag_ptr(ret_conv, true);
39670 }
39671
39672 void  CS_LDK_ChannelManagerReadArgs_free(int64_t this_obj) {
39673         LDKChannelManagerReadArgs this_obj_conv;
39674         this_obj_conv.inner = untag_ptr(this_obj);
39675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39677         ChannelManagerReadArgs_free(this_obj_conv);
39678 }
39679
39680 int64_t  CS_LDK_ChannelManagerReadArgs_get_entropy_source(int64_t this_ptr) {
39681         LDKChannelManagerReadArgs this_ptr_conv;
39682         this_ptr_conv.inner = untag_ptr(this_ptr);
39683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39685         this_ptr_conv.is_owned = false;
39686         // WARNING: This object doesn't live past this scope, needs clone!
39687         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39688         return ret_ret;
39689 }
39690
39691 void  CS_LDK_ChannelManagerReadArgs_set_entropy_source(int64_t this_ptr, int64_t val) {
39692         LDKChannelManagerReadArgs this_ptr_conv;
39693         this_ptr_conv.inner = untag_ptr(this_ptr);
39694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39696         this_ptr_conv.is_owned = false;
39697         void* val_ptr = untag_ptr(val);
39698         CHECK_ACCESS(val_ptr);
39699         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39700         if (val_conv.free == LDKEntropySource_JCalls_free) {
39701                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39702                 LDKEntropySource_JCalls_cloned(&val_conv);
39703         }
39704         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39705 }
39706
39707 int64_t  CS_LDK_ChannelManagerReadArgs_get_node_signer(int64_t this_ptr) {
39708         LDKChannelManagerReadArgs this_ptr_conv;
39709         this_ptr_conv.inner = untag_ptr(this_ptr);
39710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39712         this_ptr_conv.is_owned = false;
39713         // WARNING: This object doesn't live past this scope, needs clone!
39714         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39715         return ret_ret;
39716 }
39717
39718 void  CS_LDK_ChannelManagerReadArgs_set_node_signer(int64_t this_ptr, int64_t val) {
39719         LDKChannelManagerReadArgs this_ptr_conv;
39720         this_ptr_conv.inner = untag_ptr(this_ptr);
39721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39723         this_ptr_conv.is_owned = false;
39724         void* val_ptr = untag_ptr(val);
39725         CHECK_ACCESS(val_ptr);
39726         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39727         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39729                 LDKNodeSigner_JCalls_cloned(&val_conv);
39730         }
39731         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39732 }
39733
39734 int64_t  CS_LDK_ChannelManagerReadArgs_get_signer_provider(int64_t this_ptr) {
39735         LDKChannelManagerReadArgs this_ptr_conv;
39736         this_ptr_conv.inner = untag_ptr(this_ptr);
39737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39739         this_ptr_conv.is_owned = false;
39740         // WARNING: This object doesn't live past this scope, needs clone!
39741         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39742         return ret_ret;
39743 }
39744
39745 void  CS_LDK_ChannelManagerReadArgs_set_signer_provider(int64_t this_ptr, int64_t val) {
39746         LDKChannelManagerReadArgs this_ptr_conv;
39747         this_ptr_conv.inner = untag_ptr(this_ptr);
39748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39750         this_ptr_conv.is_owned = false;
39751         void* val_ptr = untag_ptr(val);
39752         CHECK_ACCESS(val_ptr);
39753         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39754         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39756                 LDKSignerProvider_JCalls_cloned(&val_conv);
39757         }
39758         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39759 }
39760
39761 int64_t  CS_LDK_ChannelManagerReadArgs_get_fee_estimator(int64_t this_ptr) {
39762         LDKChannelManagerReadArgs this_ptr_conv;
39763         this_ptr_conv.inner = untag_ptr(this_ptr);
39764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39766         this_ptr_conv.is_owned = false;
39767         // WARNING: This object doesn't live past this scope, needs clone!
39768         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39769         return ret_ret;
39770 }
39771
39772 void  CS_LDK_ChannelManagerReadArgs_set_fee_estimator(int64_t this_ptr, int64_t val) {
39773         LDKChannelManagerReadArgs this_ptr_conv;
39774         this_ptr_conv.inner = untag_ptr(this_ptr);
39775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39777         this_ptr_conv.is_owned = false;
39778         void* val_ptr = untag_ptr(val);
39779         CHECK_ACCESS(val_ptr);
39780         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39781         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39782                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39783                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39784         }
39785         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39786 }
39787
39788 int64_t  CS_LDK_ChannelManagerReadArgs_get_chain_monitor(int64_t this_ptr) {
39789         LDKChannelManagerReadArgs this_ptr_conv;
39790         this_ptr_conv.inner = untag_ptr(this_ptr);
39791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39793         this_ptr_conv.is_owned = false;
39794         // WARNING: This object doesn't live past this scope, needs clone!
39795         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39796         return ret_ret;
39797 }
39798
39799 void  CS_LDK_ChannelManagerReadArgs_set_chain_monitor(int64_t this_ptr, int64_t val) {
39800         LDKChannelManagerReadArgs this_ptr_conv;
39801         this_ptr_conv.inner = untag_ptr(this_ptr);
39802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39804         this_ptr_conv.is_owned = false;
39805         void* val_ptr = untag_ptr(val);
39806         CHECK_ACCESS(val_ptr);
39807         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39808         if (val_conv.free == LDKWatch_JCalls_free) {
39809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39810                 LDKWatch_JCalls_cloned(&val_conv);
39811         }
39812         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39813 }
39814
39815 int64_t  CS_LDK_ChannelManagerReadArgs_get_tx_broadcaster(int64_t this_ptr) {
39816         LDKChannelManagerReadArgs this_ptr_conv;
39817         this_ptr_conv.inner = untag_ptr(this_ptr);
39818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39820         this_ptr_conv.is_owned = false;
39821         // WARNING: This object doesn't live past this scope, needs clone!
39822         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39823         return ret_ret;
39824 }
39825
39826 void  CS_LDK_ChannelManagerReadArgs_set_tx_broadcaster(int64_t this_ptr, int64_t val) {
39827         LDKChannelManagerReadArgs this_ptr_conv;
39828         this_ptr_conv.inner = untag_ptr(this_ptr);
39829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39831         this_ptr_conv.is_owned = false;
39832         void* val_ptr = untag_ptr(val);
39833         CHECK_ACCESS(val_ptr);
39834         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39835         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39837                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39838         }
39839         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39840 }
39841
39842 int64_t  CS_LDK_ChannelManagerReadArgs_get_router(int64_t this_ptr) {
39843         LDKChannelManagerReadArgs this_ptr_conv;
39844         this_ptr_conv.inner = untag_ptr(this_ptr);
39845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39847         this_ptr_conv.is_owned = false;
39848         // WARNING: This object doesn't live past this scope, needs clone!
39849         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39850         return ret_ret;
39851 }
39852
39853 void  CS_LDK_ChannelManagerReadArgs_set_router(int64_t this_ptr, int64_t val) {
39854         LDKChannelManagerReadArgs this_ptr_conv;
39855         this_ptr_conv.inner = untag_ptr(this_ptr);
39856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39858         this_ptr_conv.is_owned = false;
39859         void* val_ptr = untag_ptr(val);
39860         CHECK_ACCESS(val_ptr);
39861         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39862         if (val_conv.free == LDKRouter_JCalls_free) {
39863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39864                 LDKRouter_JCalls_cloned(&val_conv);
39865         }
39866         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39867 }
39868
39869 int64_t  CS_LDK_ChannelManagerReadArgs_get_logger(int64_t this_ptr) {
39870         LDKChannelManagerReadArgs this_ptr_conv;
39871         this_ptr_conv.inner = untag_ptr(this_ptr);
39872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39874         this_ptr_conv.is_owned = false;
39875         // WARNING: This object doesn't live past this scope, needs clone!
39876         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39877         return ret_ret;
39878 }
39879
39880 void  CS_LDK_ChannelManagerReadArgs_set_logger(int64_t this_ptr, int64_t val) {
39881         LDKChannelManagerReadArgs this_ptr_conv;
39882         this_ptr_conv.inner = untag_ptr(this_ptr);
39883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39885         this_ptr_conv.is_owned = false;
39886         void* val_ptr = untag_ptr(val);
39887         CHECK_ACCESS(val_ptr);
39888         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39889         if (val_conv.free == LDKLogger_JCalls_free) {
39890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39891                 LDKLogger_JCalls_cloned(&val_conv);
39892         }
39893         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39894 }
39895
39896 int64_t  CS_LDK_ChannelManagerReadArgs_get_default_config(int64_t this_ptr) {
39897         LDKChannelManagerReadArgs this_ptr_conv;
39898         this_ptr_conv.inner = untag_ptr(this_ptr);
39899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39901         this_ptr_conv.is_owned = false;
39902         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
39903         int64_t ret_ref = 0;
39904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39906         return ret_ref;
39907 }
39908
39909 void  CS_LDK_ChannelManagerReadArgs_set_default_config(int64_t this_ptr, int64_t val) {
39910         LDKChannelManagerReadArgs this_ptr_conv;
39911         this_ptr_conv.inner = untag_ptr(this_ptr);
39912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39914         this_ptr_conv.is_owned = false;
39915         LDKUserConfig val_conv;
39916         val_conv.inner = untag_ptr(val);
39917         val_conv.is_owned = ptr_is_owned(val);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39919         val_conv = UserConfig_clone(&val_conv);
39920         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39921 }
39922
39923 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) {
39924         void* entropy_source_ptr = untag_ptr(entropy_source);
39925         CHECK_ACCESS(entropy_source_ptr);
39926         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39927         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39928                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39929                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39930         }
39931         void* node_signer_ptr = untag_ptr(node_signer);
39932         CHECK_ACCESS(node_signer_ptr);
39933         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39934         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39936                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39937         }
39938         void* signer_provider_ptr = untag_ptr(signer_provider);
39939         CHECK_ACCESS(signer_provider_ptr);
39940         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39941         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39943                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39944         }
39945         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39946         CHECK_ACCESS(fee_estimator_ptr);
39947         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39948         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39950                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39951         }
39952         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39953         CHECK_ACCESS(chain_monitor_ptr);
39954         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39955         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39956                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39957                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39958         }
39959         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39960         CHECK_ACCESS(tx_broadcaster_ptr);
39961         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39962         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39964                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39965         }
39966         void* router_ptr = untag_ptr(router);
39967         CHECK_ACCESS(router_ptr);
39968         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39969         if (router_conv.free == LDKRouter_JCalls_free) {
39970                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39971                 LDKRouter_JCalls_cloned(&router_conv);
39972         }
39973         void* logger_ptr = untag_ptr(logger);
39974         CHECK_ACCESS(logger_ptr);
39975         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39976         if (logger_conv.free == LDKLogger_JCalls_free) {
39977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39978                 LDKLogger_JCalls_cloned(&logger_conv);
39979         }
39980         LDKUserConfig default_config_conv;
39981         default_config_conv.inner = untag_ptr(default_config);
39982         default_config_conv.is_owned = ptr_is_owned(default_config);
39983         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39984         default_config_conv = UserConfig_clone(&default_config_conv);
39985         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39986         channel_monitors_constr.datalen = channel_monitors->arr_len;
39987         if (channel_monitors_constr.datalen > 0)
39988                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39989         else
39990                 channel_monitors_constr.data = NULL;
39991         int64_t* channel_monitors_vals = channel_monitors->elems;
39992         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39993                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39994                 LDKChannelMonitor channel_monitors_conv_16_conv;
39995                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
39996                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
39997                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
39998                 channel_monitors_conv_16_conv.is_owned = false;
39999                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
40000         }
40001         FREE(channel_monitors);
40002         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);
40003         int64_t ret_ref = 0;
40004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40006         return ret_ref;
40007 }
40008
40009 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, int64_t arg) {
40010         LDKu8slice ser_ref;
40011         ser_ref.datalen = ser->arr_len;
40012         ser_ref.data = ser->elems;
40013         LDKChannelManagerReadArgs arg_conv;
40014         arg_conv.inner = untag_ptr(arg);
40015         arg_conv.is_owned = ptr_is_owned(arg);
40016         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40017         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
40018         
40019         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
40020         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
40021         FREE(ser);
40022         return tag_ptr(ret_conv, true);
40023 }
40024
40025 void  CS_LDK_DelayedPaymentBasepoint_free(int64_t this_obj) {
40026         LDKDelayedPaymentBasepoint 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         DelayedPaymentBasepoint_free(this_obj_conv);
40031 }
40032
40033 int8_tArray  CS_LDK_DelayedPaymentBasepoint_get_a(int64_t this_ptr) {
40034         LDKDelayedPaymentBasepoint 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(33, __LINE__);
40040         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40041         return ret_arr;
40042 }
40043
40044 void  CS_LDK_DelayedPaymentBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40045         LDKDelayedPaymentBasepoint 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         LDKPublicKey val_ref;
40051         CHECK(val->arr_len == 33);
40052         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40053         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
40054 }
40055
40056 int64_t  CS_LDK_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
40057         LDKPublicKey a_arg_ref;
40058         CHECK(a_arg->arr_len == 33);
40059         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40060         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
40061         int64_t ret_ref = 0;
40062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40064         return ret_ref;
40065 }
40066
40067 jboolean  CS_LDK_DelayedPaymentBasepoint_eq(int64_t a, int64_t b) {
40068         LDKDelayedPaymentBasepoint a_conv;
40069         a_conv.inner = untag_ptr(a);
40070         a_conv.is_owned = ptr_is_owned(a);
40071         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40072         a_conv.is_owned = false;
40073         LDKDelayedPaymentBasepoint b_conv;
40074         b_conv.inner = untag_ptr(b);
40075         b_conv.is_owned = ptr_is_owned(b);
40076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40077         b_conv.is_owned = false;
40078         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
40079         return ret_conv;
40080 }
40081
40082 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
40083         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
40084         int64_t ret_ref = 0;
40085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40087         return ret_ref;
40088 }
40089 int64_t  CS_LDK_DelayedPaymentBasepoint_clone_ptr(int64_t arg) {
40090         LDKDelayedPaymentBasepoint arg_conv;
40091         arg_conv.inner = untag_ptr(arg);
40092         arg_conv.is_owned = ptr_is_owned(arg);
40093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40094         arg_conv.is_owned = false;
40095         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
40096         return ret_conv;
40097 }
40098
40099 int64_t  CS_LDK_DelayedPaymentBasepoint_clone(int64_t orig) {
40100         LDKDelayedPaymentBasepoint orig_conv;
40101         orig_conv.inner = untag_ptr(orig);
40102         orig_conv.is_owned = ptr_is_owned(orig);
40103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40104         orig_conv.is_owned = false;
40105         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
40106         int64_t ret_ref = 0;
40107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40109         return ret_ref;
40110 }
40111
40112 int64_t  CS_LDK_DelayedPaymentBasepoint_hash(int64_t o) {
40113         LDKDelayedPaymentBasepoint o_conv;
40114         o_conv.inner = untag_ptr(o);
40115         o_conv.is_owned = ptr_is_owned(o);
40116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40117         o_conv.is_owned = false;
40118         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
40119         return ret_conv;
40120 }
40121
40122 int8_tArray  CS_LDK_DelayedPaymentBasepoint_to_public_key(int64_t this_arg) {
40123         LDKDelayedPaymentBasepoint this_arg_conv;
40124         this_arg_conv.inner = untag_ptr(this_arg);
40125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40127         this_arg_conv.is_owned = false;
40128         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40129         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40130         return ret_arr;
40131 }
40132
40133 int8_tArray  CS_LDK_DelayedPaymentBasepoint_write(int64_t obj) {
40134         LDKDelayedPaymentBasepoint obj_conv;
40135         obj_conv.inner = untag_ptr(obj);
40136         obj_conv.is_owned = ptr_is_owned(obj);
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40138         obj_conv.is_owned = false;
40139         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
40140         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40141         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40142         CVec_u8Z_free(ret_var);
40143         return ret_arr;
40144 }
40145
40146 int64_t  CS_LDK_DelayedPaymentBasepoint_read(int8_tArray ser) {
40147         LDKu8slice ser_ref;
40148         ser_ref.datalen = ser->arr_len;
40149         ser_ref.data = ser->elems;
40150         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40151         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
40152         FREE(ser);
40153         return tag_ptr(ret_conv, true);
40154 }
40155
40156 void  CS_LDK_DelayedPaymentKey_free(int64_t this_obj) {
40157         LDKDelayedPaymentKey this_obj_conv;
40158         this_obj_conv.inner = untag_ptr(this_obj);
40159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40161         DelayedPaymentKey_free(this_obj_conv);
40162 }
40163
40164 int8_tArray  CS_LDK_DelayedPaymentKey_get_a(int64_t this_ptr) {
40165         LDKDelayedPaymentKey this_ptr_conv;
40166         this_ptr_conv.inner = untag_ptr(this_ptr);
40167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40169         this_ptr_conv.is_owned = false;
40170         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40171         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
40172         return ret_arr;
40173 }
40174
40175 void  CS_LDK_DelayedPaymentKey_set_a(int64_t this_ptr, int8_tArray val) {
40176         LDKDelayedPaymentKey this_ptr_conv;
40177         this_ptr_conv.inner = untag_ptr(this_ptr);
40178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40180         this_ptr_conv.is_owned = false;
40181         LDKPublicKey val_ref;
40182         CHECK(val->arr_len == 33);
40183         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40184         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
40185 }
40186
40187 int64_t  CS_LDK_DelayedPaymentKey_new(int8_tArray a_arg) {
40188         LDKPublicKey a_arg_ref;
40189         CHECK(a_arg->arr_len == 33);
40190         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40191         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
40192         int64_t ret_ref = 0;
40193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40195         return ret_ref;
40196 }
40197
40198 jboolean  CS_LDK_DelayedPaymentKey_eq(int64_t a, int64_t b) {
40199         LDKDelayedPaymentKey a_conv;
40200         a_conv.inner = untag_ptr(a);
40201         a_conv.is_owned = ptr_is_owned(a);
40202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40203         a_conv.is_owned = false;
40204         LDKDelayedPaymentKey b_conv;
40205         b_conv.inner = untag_ptr(b);
40206         b_conv.is_owned = ptr_is_owned(b);
40207         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40208         b_conv.is_owned = false;
40209         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
40210         return ret_conv;
40211 }
40212
40213 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
40214         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
40215         int64_t ret_ref = 0;
40216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40218         return ret_ref;
40219 }
40220 int64_t  CS_LDK_DelayedPaymentKey_clone_ptr(int64_t arg) {
40221         LDKDelayedPaymentKey arg_conv;
40222         arg_conv.inner = untag_ptr(arg);
40223         arg_conv.is_owned = ptr_is_owned(arg);
40224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40225         arg_conv.is_owned = false;
40226         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
40227         return ret_conv;
40228 }
40229
40230 int64_t  CS_LDK_DelayedPaymentKey_clone(int64_t orig) {
40231         LDKDelayedPaymentKey orig_conv;
40232         orig_conv.inner = untag_ptr(orig);
40233         orig_conv.is_owned = ptr_is_owned(orig);
40234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40235         orig_conv.is_owned = false;
40236         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
40237         int64_t ret_ref = 0;
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40240         return ret_ref;
40241 }
40242
40243 int64_t  CS_LDK_DelayedPaymentKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40244         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
40245         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40246         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40247         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40248         countersignatory_basepoint_conv.is_owned = false;
40249         LDKPublicKey per_commitment_point_ref;
40250         CHECK(per_commitment_point->arr_len == 33);
40251         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40252         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40253         int64_t ret_ref = 0;
40254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40256         return ret_ref;
40257 }
40258
40259 int64_t  CS_LDK_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
40260         uint8_t sk_arr[32];
40261         CHECK(sk->arr_len == 32);
40262         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40263         uint8_t (*sk_ref)[32] = &sk_arr;
40264         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
40265         int64_t ret_ref = 0;
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40268         return ret_ref;
40269 }
40270
40271 int8_tArray  CS_LDK_DelayedPaymentKey_to_public_key(int64_t this_arg) {
40272         LDKDelayedPaymentKey this_arg_conv;
40273         this_arg_conv.inner = untag_ptr(this_arg);
40274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40276         this_arg_conv.is_owned = false;
40277         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40278         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
40279         return ret_arr;
40280 }
40281
40282 int8_tArray  CS_LDK_DelayedPaymentKey_write(int64_t obj) {
40283         LDKDelayedPaymentKey obj_conv;
40284         obj_conv.inner = untag_ptr(obj);
40285         obj_conv.is_owned = ptr_is_owned(obj);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40287         obj_conv.is_owned = false;
40288         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
40289         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40290         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40291         CVec_u8Z_free(ret_var);
40292         return ret_arr;
40293 }
40294
40295 int64_t  CS_LDK_DelayedPaymentKey_read(int8_tArray ser) {
40296         LDKu8slice ser_ref;
40297         ser_ref.datalen = ser->arr_len;
40298         ser_ref.data = ser->elems;
40299         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40300         *ret_conv = DelayedPaymentKey_read(ser_ref);
40301         FREE(ser);
40302         return tag_ptr(ret_conv, true);
40303 }
40304
40305 void  CS_LDK_HtlcBasepoint_free(int64_t this_obj) {
40306         LDKHtlcBasepoint this_obj_conv;
40307         this_obj_conv.inner = untag_ptr(this_obj);
40308         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40310         HtlcBasepoint_free(this_obj_conv);
40311 }
40312
40313 int8_tArray  CS_LDK_HtlcBasepoint_get_a(int64_t this_ptr) {
40314         LDKHtlcBasepoint this_ptr_conv;
40315         this_ptr_conv.inner = untag_ptr(this_ptr);
40316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40318         this_ptr_conv.is_owned = false;
40319         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40320         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40321         return ret_arr;
40322 }
40323
40324 void  CS_LDK_HtlcBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40325         LDKHtlcBasepoint this_ptr_conv;
40326         this_ptr_conv.inner = untag_ptr(this_ptr);
40327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40329         this_ptr_conv.is_owned = false;
40330         LDKPublicKey val_ref;
40331         CHECK(val->arr_len == 33);
40332         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40333         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
40334 }
40335
40336 int64_t  CS_LDK_HtlcBasepoint_new(int8_tArray a_arg) {
40337         LDKPublicKey a_arg_ref;
40338         CHECK(a_arg->arr_len == 33);
40339         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40340         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
40341         int64_t ret_ref = 0;
40342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40344         return ret_ref;
40345 }
40346
40347 jboolean  CS_LDK_HtlcBasepoint_eq(int64_t a, int64_t b) {
40348         LDKHtlcBasepoint a_conv;
40349         a_conv.inner = untag_ptr(a);
40350         a_conv.is_owned = ptr_is_owned(a);
40351         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40352         a_conv.is_owned = false;
40353         LDKHtlcBasepoint b_conv;
40354         b_conv.inner = untag_ptr(b);
40355         b_conv.is_owned = ptr_is_owned(b);
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40357         b_conv.is_owned = false;
40358         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
40359         return ret_conv;
40360 }
40361
40362 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
40363         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
40364         int64_t ret_ref = 0;
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40367         return ret_ref;
40368 }
40369 int64_t  CS_LDK_HtlcBasepoint_clone_ptr(int64_t arg) {
40370         LDKHtlcBasepoint arg_conv;
40371         arg_conv.inner = untag_ptr(arg);
40372         arg_conv.is_owned = ptr_is_owned(arg);
40373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40374         arg_conv.is_owned = false;
40375         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
40376         return ret_conv;
40377 }
40378
40379 int64_t  CS_LDK_HtlcBasepoint_clone(int64_t orig) {
40380         LDKHtlcBasepoint orig_conv;
40381         orig_conv.inner = untag_ptr(orig);
40382         orig_conv.is_owned = ptr_is_owned(orig);
40383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40384         orig_conv.is_owned = false;
40385         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
40386         int64_t ret_ref = 0;
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40389         return ret_ref;
40390 }
40391
40392 int64_t  CS_LDK_HtlcBasepoint_hash(int64_t o) {
40393         LDKHtlcBasepoint o_conv;
40394         o_conv.inner = untag_ptr(o);
40395         o_conv.is_owned = ptr_is_owned(o);
40396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40397         o_conv.is_owned = false;
40398         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
40399         return ret_conv;
40400 }
40401
40402 int8_tArray  CS_LDK_HtlcBasepoint_to_public_key(int64_t this_arg) {
40403         LDKHtlcBasepoint this_arg_conv;
40404         this_arg_conv.inner = untag_ptr(this_arg);
40405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40407         this_arg_conv.is_owned = false;
40408         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40409         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40410         return ret_arr;
40411 }
40412
40413 int8_tArray  CS_LDK_HtlcBasepoint_write(int64_t obj) {
40414         LDKHtlcBasepoint obj_conv;
40415         obj_conv.inner = untag_ptr(obj);
40416         obj_conv.is_owned = ptr_is_owned(obj);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40418         obj_conv.is_owned = false;
40419         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
40420         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40421         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40422         CVec_u8Z_free(ret_var);
40423         return ret_arr;
40424 }
40425
40426 int64_t  CS_LDK_HtlcBasepoint_read(int8_tArray ser) {
40427         LDKu8slice ser_ref;
40428         ser_ref.datalen = ser->arr_len;
40429         ser_ref.data = ser->elems;
40430         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40431         *ret_conv = HtlcBasepoint_read(ser_ref);
40432         FREE(ser);
40433         return tag_ptr(ret_conv, true);
40434 }
40435
40436 void  CS_LDK_HtlcKey_free(int64_t this_obj) {
40437         LDKHtlcKey this_obj_conv;
40438         this_obj_conv.inner = untag_ptr(this_obj);
40439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40441         HtlcKey_free(this_obj_conv);
40442 }
40443
40444 int8_tArray  CS_LDK_HtlcKey_get_a(int64_t this_ptr) {
40445         LDKHtlcKey this_ptr_conv;
40446         this_ptr_conv.inner = untag_ptr(this_ptr);
40447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40449         this_ptr_conv.is_owned = false;
40450         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40451         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
40452         return ret_arr;
40453 }
40454
40455 void  CS_LDK_HtlcKey_set_a(int64_t this_ptr, int8_tArray val) {
40456         LDKHtlcKey this_ptr_conv;
40457         this_ptr_conv.inner = untag_ptr(this_ptr);
40458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40460         this_ptr_conv.is_owned = false;
40461         LDKPublicKey val_ref;
40462         CHECK(val->arr_len == 33);
40463         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40464         HtlcKey_set_a(&this_ptr_conv, val_ref);
40465 }
40466
40467 int64_t  CS_LDK_HtlcKey_new(int8_tArray a_arg) {
40468         LDKPublicKey a_arg_ref;
40469         CHECK(a_arg->arr_len == 33);
40470         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40471         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
40472         int64_t ret_ref = 0;
40473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40475         return ret_ref;
40476 }
40477
40478 jboolean  CS_LDK_HtlcKey_eq(int64_t a, int64_t b) {
40479         LDKHtlcKey a_conv;
40480         a_conv.inner = untag_ptr(a);
40481         a_conv.is_owned = ptr_is_owned(a);
40482         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40483         a_conv.is_owned = false;
40484         LDKHtlcKey b_conv;
40485         b_conv.inner = untag_ptr(b);
40486         b_conv.is_owned = ptr_is_owned(b);
40487         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40488         b_conv.is_owned = false;
40489         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
40490         return ret_conv;
40491 }
40492
40493 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
40494         LDKHtlcKey ret_var = HtlcKey_clone(arg);
40495         int64_t ret_ref = 0;
40496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40498         return ret_ref;
40499 }
40500 int64_t  CS_LDK_HtlcKey_clone_ptr(int64_t arg) {
40501         LDKHtlcKey arg_conv;
40502         arg_conv.inner = untag_ptr(arg);
40503         arg_conv.is_owned = ptr_is_owned(arg);
40504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40505         arg_conv.is_owned = false;
40506         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
40507         return ret_conv;
40508 }
40509
40510 int64_t  CS_LDK_HtlcKey_clone(int64_t orig) {
40511         LDKHtlcKey orig_conv;
40512         orig_conv.inner = untag_ptr(orig);
40513         orig_conv.is_owned = ptr_is_owned(orig);
40514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40515         orig_conv.is_owned = false;
40516         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
40517         int64_t ret_ref = 0;
40518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40520         return ret_ref;
40521 }
40522
40523 int64_t  CS_LDK_HtlcKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40524         LDKHtlcBasepoint countersignatory_basepoint_conv;
40525         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40526         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40527         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40528         countersignatory_basepoint_conv.is_owned = false;
40529         LDKPublicKey per_commitment_point_ref;
40530         CHECK(per_commitment_point->arr_len == 33);
40531         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40532         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40533         int64_t ret_ref = 0;
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40536         return ret_ref;
40537 }
40538
40539 int64_t  CS_LDK_HtlcKey_from_secret_key(int8_tArray sk) {
40540         uint8_t sk_arr[32];
40541         CHECK(sk->arr_len == 32);
40542         memcpy(sk_arr, sk->elems, 32); FREE(sk);
40543         uint8_t (*sk_ref)[32] = &sk_arr;
40544         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
40545         int64_t ret_ref = 0;
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40548         return ret_ref;
40549 }
40550
40551 int8_tArray  CS_LDK_HtlcKey_to_public_key(int64_t this_arg) {
40552         LDKHtlcKey this_arg_conv;
40553         this_arg_conv.inner = untag_ptr(this_arg);
40554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40556         this_arg_conv.is_owned = false;
40557         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40558         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
40559         return ret_arr;
40560 }
40561
40562 int8_tArray  CS_LDK_HtlcKey_write(int64_t obj) {
40563         LDKHtlcKey obj_conv;
40564         obj_conv.inner = untag_ptr(obj);
40565         obj_conv.is_owned = ptr_is_owned(obj);
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40567         obj_conv.is_owned = false;
40568         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
40569         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40570         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40571         CVec_u8Z_free(ret_var);
40572         return ret_arr;
40573 }
40574
40575 int64_t  CS_LDK_HtlcKey_read(int8_tArray ser) {
40576         LDKu8slice ser_ref;
40577         ser_ref.datalen = ser->arr_len;
40578         ser_ref.data = ser->elems;
40579         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40580         *ret_conv = HtlcKey_read(ser_ref);
40581         FREE(ser);
40582         return tag_ptr(ret_conv, true);
40583 }
40584
40585 void  CS_LDK_RevocationBasepoint_free(int64_t this_obj) {
40586         LDKRevocationBasepoint this_obj_conv;
40587         this_obj_conv.inner = untag_ptr(this_obj);
40588         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40590         RevocationBasepoint_free(this_obj_conv);
40591 }
40592
40593 int8_tArray  CS_LDK_RevocationBasepoint_get_a(int64_t this_ptr) {
40594         LDKRevocationBasepoint this_ptr_conv;
40595         this_ptr_conv.inner = untag_ptr(this_ptr);
40596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40598         this_ptr_conv.is_owned = false;
40599         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40600         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
40601         return ret_arr;
40602 }
40603
40604 void  CS_LDK_RevocationBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
40605         LDKRevocationBasepoint this_ptr_conv;
40606         this_ptr_conv.inner = untag_ptr(this_ptr);
40607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40609         this_ptr_conv.is_owned = false;
40610         LDKPublicKey val_ref;
40611         CHECK(val->arr_len == 33);
40612         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40613         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
40614 }
40615
40616 int64_t  CS_LDK_RevocationBasepoint_new(int8_tArray a_arg) {
40617         LDKPublicKey a_arg_ref;
40618         CHECK(a_arg->arr_len == 33);
40619         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40620         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
40621         int64_t ret_ref = 0;
40622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40624         return ret_ref;
40625 }
40626
40627 jboolean  CS_LDK_RevocationBasepoint_eq(int64_t a, int64_t b) {
40628         LDKRevocationBasepoint a_conv;
40629         a_conv.inner = untag_ptr(a);
40630         a_conv.is_owned = ptr_is_owned(a);
40631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40632         a_conv.is_owned = false;
40633         LDKRevocationBasepoint b_conv;
40634         b_conv.inner = untag_ptr(b);
40635         b_conv.is_owned = ptr_is_owned(b);
40636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40637         b_conv.is_owned = false;
40638         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
40639         return ret_conv;
40640 }
40641
40642 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
40643         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
40644         int64_t ret_ref = 0;
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40647         return ret_ref;
40648 }
40649 int64_t  CS_LDK_RevocationBasepoint_clone_ptr(int64_t arg) {
40650         LDKRevocationBasepoint arg_conv;
40651         arg_conv.inner = untag_ptr(arg);
40652         arg_conv.is_owned = ptr_is_owned(arg);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40654         arg_conv.is_owned = false;
40655         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
40656         return ret_conv;
40657 }
40658
40659 int64_t  CS_LDK_RevocationBasepoint_clone(int64_t orig) {
40660         LDKRevocationBasepoint orig_conv;
40661         orig_conv.inner = untag_ptr(orig);
40662         orig_conv.is_owned = ptr_is_owned(orig);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40664         orig_conv.is_owned = false;
40665         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
40666         int64_t ret_ref = 0;
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40669         return ret_ref;
40670 }
40671
40672 int64_t  CS_LDK_RevocationBasepoint_hash(int64_t o) {
40673         LDKRevocationBasepoint o_conv;
40674         o_conv.inner = untag_ptr(o);
40675         o_conv.is_owned = ptr_is_owned(o);
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40677         o_conv.is_owned = false;
40678         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
40679         return ret_conv;
40680 }
40681
40682 int8_tArray  CS_LDK_RevocationBasepoint_to_public_key(int64_t this_arg) {
40683         LDKRevocationBasepoint this_arg_conv;
40684         this_arg_conv.inner = untag_ptr(this_arg);
40685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40687         this_arg_conv.is_owned = false;
40688         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40689         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
40690         return ret_arr;
40691 }
40692
40693 int8_tArray  CS_LDK_RevocationBasepoint_write(int64_t obj) {
40694         LDKRevocationBasepoint obj_conv;
40695         obj_conv.inner = untag_ptr(obj);
40696         obj_conv.is_owned = ptr_is_owned(obj);
40697         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40698         obj_conv.is_owned = false;
40699         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
40700         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40701         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40702         CVec_u8Z_free(ret_var);
40703         return ret_arr;
40704 }
40705
40706 int64_t  CS_LDK_RevocationBasepoint_read(int8_tArray ser) {
40707         LDKu8slice ser_ref;
40708         ser_ref.datalen = ser->arr_len;
40709         ser_ref.data = ser->elems;
40710         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40711         *ret_conv = RevocationBasepoint_read(ser_ref);
40712         FREE(ser);
40713         return tag_ptr(ret_conv, true);
40714 }
40715
40716 void  CS_LDK_RevocationKey_free(int64_t this_obj) {
40717         LDKRevocationKey this_obj_conv;
40718         this_obj_conv.inner = untag_ptr(this_obj);
40719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40721         RevocationKey_free(this_obj_conv);
40722 }
40723
40724 int8_tArray  CS_LDK_RevocationKey_get_a(int64_t this_ptr) {
40725         LDKRevocationKey this_ptr_conv;
40726         this_ptr_conv.inner = untag_ptr(this_ptr);
40727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40729         this_ptr_conv.is_owned = false;
40730         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40731         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
40732         return ret_arr;
40733 }
40734
40735 void  CS_LDK_RevocationKey_set_a(int64_t this_ptr, int8_tArray val) {
40736         LDKRevocationKey this_ptr_conv;
40737         this_ptr_conv.inner = untag_ptr(this_ptr);
40738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40740         this_ptr_conv.is_owned = false;
40741         LDKPublicKey val_ref;
40742         CHECK(val->arr_len == 33);
40743         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
40744         RevocationKey_set_a(&this_ptr_conv, val_ref);
40745 }
40746
40747 int64_t  CS_LDK_RevocationKey_new(int8_tArray a_arg) {
40748         LDKPublicKey a_arg_ref;
40749         CHECK(a_arg->arr_len == 33);
40750         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
40751         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
40752         int64_t ret_ref = 0;
40753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40755         return ret_ref;
40756 }
40757
40758 jboolean  CS_LDK_RevocationKey_eq(int64_t a, int64_t b) {
40759         LDKRevocationKey a_conv;
40760         a_conv.inner = untag_ptr(a);
40761         a_conv.is_owned = ptr_is_owned(a);
40762         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40763         a_conv.is_owned = false;
40764         LDKRevocationKey b_conv;
40765         b_conv.inner = untag_ptr(b);
40766         b_conv.is_owned = ptr_is_owned(b);
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40768         b_conv.is_owned = false;
40769         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
40770         return ret_conv;
40771 }
40772
40773 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
40774         LDKRevocationKey ret_var = RevocationKey_clone(arg);
40775         int64_t ret_ref = 0;
40776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40778         return ret_ref;
40779 }
40780 int64_t  CS_LDK_RevocationKey_clone_ptr(int64_t arg) {
40781         LDKRevocationKey arg_conv;
40782         arg_conv.inner = untag_ptr(arg);
40783         arg_conv.is_owned = ptr_is_owned(arg);
40784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40785         arg_conv.is_owned = false;
40786         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
40787         return ret_conv;
40788 }
40789
40790 int64_t  CS_LDK_RevocationKey_clone(int64_t orig) {
40791         LDKRevocationKey orig_conv;
40792         orig_conv.inner = untag_ptr(orig);
40793         orig_conv.is_owned = ptr_is_owned(orig);
40794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40795         orig_conv.is_owned = false;
40796         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
40797         int64_t ret_ref = 0;
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40800         return ret_ref;
40801 }
40802
40803 int64_t  CS_LDK_RevocationKey_hash(int64_t o) {
40804         LDKRevocationKey o_conv;
40805         o_conv.inner = untag_ptr(o);
40806         o_conv.is_owned = ptr_is_owned(o);
40807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40808         o_conv.is_owned = false;
40809         int64_t ret_conv = RevocationKey_hash(&o_conv);
40810         return ret_conv;
40811 }
40812
40813 int64_t  CS_LDK_RevocationKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
40814         LDKRevocationBasepoint countersignatory_basepoint_conv;
40815         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
40816         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
40817         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
40818         countersignatory_basepoint_conv.is_owned = false;
40819         LDKPublicKey per_commitment_point_ref;
40820         CHECK(per_commitment_point->arr_len == 33);
40821         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
40822         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
40823         int64_t ret_ref = 0;
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40826         return ret_ref;
40827 }
40828
40829 int8_tArray  CS_LDK_RevocationKey_to_public_key(int64_t this_arg) {
40830         LDKRevocationKey this_arg_conv;
40831         this_arg_conv.inner = untag_ptr(this_arg);
40832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40834         this_arg_conv.is_owned = false;
40835         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40836         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
40837         return ret_arr;
40838 }
40839
40840 int8_tArray  CS_LDK_RevocationKey_write(int64_t obj) {
40841         LDKRevocationKey obj_conv;
40842         obj_conv.inner = untag_ptr(obj);
40843         obj_conv.is_owned = ptr_is_owned(obj);
40844         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40845         obj_conv.is_owned = false;
40846         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
40847         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40848         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40849         CVec_u8Z_free(ret_var);
40850         return ret_arr;
40851 }
40852
40853 int64_t  CS_LDK_RevocationKey_read(int8_tArray ser) {
40854         LDKu8slice ser_ref;
40855         ser_ref.datalen = ser->arr_len;
40856         ser_ref.data = ser->elems;
40857         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40858         *ret_conv = RevocationKey_read(ser_ref);
40859         FREE(ser);
40860         return tag_ptr(ret_conv, true);
40861 }
40862
40863 void  CS_LDK_ExpandedKey_free(int64_t this_obj) {
40864         LDKExpandedKey this_obj_conv;
40865         this_obj_conv.inner = untag_ptr(this_obj);
40866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40868         ExpandedKey_free(this_obj_conv);
40869 }
40870
40871 int64_t  CS_LDK_ExpandedKey_new(int8_tArray key_material) {
40872         uint8_t key_material_arr[32];
40873         CHECK(key_material->arr_len == 32);
40874         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
40875         uint8_t (*key_material_ref)[32] = &key_material_arr;
40876         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
40877         int64_t ret_ref = 0;
40878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40880         return ret_ref;
40881 }
40882
40883 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) {
40884         LDKExpandedKey keys_conv;
40885         keys_conv.inner = untag_ptr(keys);
40886         keys_conv.is_owned = ptr_is_owned(keys);
40887         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40888         keys_conv.is_owned = false;
40889         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40890         CHECK_ACCESS(min_value_msat_ptr);
40891         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40892         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40893         void* entropy_source_ptr = untag_ptr(entropy_source);
40894         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
40895         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
40896         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40897         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40898         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40899         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40900         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
40901         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
40902         return tag_ptr(ret_conv, true);
40903 }
40904
40905 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) {
40906         LDKExpandedKey keys_conv;
40907         keys_conv.inner = untag_ptr(keys);
40908         keys_conv.is_owned = ptr_is_owned(keys);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
40910         keys_conv.is_owned = false;
40911         void* min_value_msat_ptr = untag_ptr(min_value_msat);
40912         CHECK_ACCESS(min_value_msat_ptr);
40913         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
40914         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
40915         LDKThirtyTwoBytes payment_hash_ref;
40916         CHECK(payment_hash->arr_len == 32);
40917         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
40918         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
40919         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
40920         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
40921         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
40922         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
40923         *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);
40924         return tag_ptr(ret_conv, true);
40925 }
40926
40927 void  CS_LDK_DecodeError_free(int64_t this_ptr) {
40928         if (!ptr_is_owned(this_ptr)) return;
40929         void* this_ptr_ptr = untag_ptr(this_ptr);
40930         CHECK_ACCESS(this_ptr_ptr);
40931         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
40932         FREE(untag_ptr(this_ptr));
40933         DecodeError_free(this_ptr_conv);
40934 }
40935
40936 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
40937         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40938         *ret_copy = DecodeError_clone(arg);
40939         int64_t ret_ref = tag_ptr(ret_copy, true);
40940         return ret_ref;
40941 }
40942 int64_t  CS_LDK_DecodeError_clone_ptr(int64_t arg) {
40943         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
40944         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
40945         return ret_conv;
40946 }
40947
40948 int64_t  CS_LDK_DecodeError_clone(int64_t orig) {
40949         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
40950         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40951         *ret_copy = DecodeError_clone(orig_conv);
40952         int64_t ret_ref = tag_ptr(ret_copy, true);
40953         return ret_ref;
40954 }
40955
40956 int64_t  CS_LDK_DecodeError_unknown_version() {
40957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40958         *ret_copy = DecodeError_unknown_version();
40959         int64_t ret_ref = tag_ptr(ret_copy, true);
40960         return ret_ref;
40961 }
40962
40963 int64_t  CS_LDK_DecodeError_unknown_required_feature() {
40964         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40965         *ret_copy = DecodeError_unknown_required_feature();
40966         int64_t ret_ref = tag_ptr(ret_copy, true);
40967         return ret_ref;
40968 }
40969
40970 int64_t  CS_LDK_DecodeError_invalid_value() {
40971         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40972         *ret_copy = DecodeError_invalid_value();
40973         int64_t ret_ref = tag_ptr(ret_copy, true);
40974         return ret_ref;
40975 }
40976
40977 int64_t  CS_LDK_DecodeError_short_read() {
40978         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40979         *ret_copy = DecodeError_short_read();
40980         int64_t ret_ref = tag_ptr(ret_copy, true);
40981         return ret_ref;
40982 }
40983
40984 int64_t  CS_LDK_DecodeError_bad_length_descriptor() {
40985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40986         *ret_copy = DecodeError_bad_length_descriptor();
40987         int64_t ret_ref = tag_ptr(ret_copy, true);
40988         return ret_ref;
40989 }
40990
40991 int64_t  CS_LDK_DecodeError_io(int32_t a) {
40992         LDKIOError a_conv = LDKIOError_from_cs(a);
40993         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
40994         *ret_copy = DecodeError_io(a_conv);
40995         int64_t ret_ref = tag_ptr(ret_copy, true);
40996         return ret_ref;
40997 }
40998
40999 int64_t  CS_LDK_DecodeError_unsupported_compression() {
41000         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
41001         *ret_copy = DecodeError_unsupported_compression();
41002         int64_t ret_ref = tag_ptr(ret_copy, true);
41003         return ret_ref;
41004 }
41005
41006 int64_t  CS_LDK_DecodeError_hash(int64_t o) {
41007         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
41008         int64_t ret_conv = DecodeError_hash(o_conv);
41009         return ret_conv;
41010 }
41011
41012 jboolean  CS_LDK_DecodeError_eq(int64_t a, int64_t b) {
41013         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
41014         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
41015         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
41016         return ret_conv;
41017 }
41018
41019 void  CS_LDK_Init_free(int64_t this_obj) {
41020         LDKInit this_obj_conv;
41021         this_obj_conv.inner = untag_ptr(this_obj);
41022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41024         Init_free(this_obj_conv);
41025 }
41026
41027 int64_t  CS_LDK_Init_get_features(int64_t this_ptr) {
41028         LDKInit this_ptr_conv;
41029         this_ptr_conv.inner = untag_ptr(this_ptr);
41030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41032         this_ptr_conv.is_owned = false;
41033         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
41034         int64_t ret_ref = 0;
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41037         return ret_ref;
41038 }
41039
41040 void  CS_LDK_Init_set_features(int64_t this_ptr, int64_t val) {
41041         LDKInit this_ptr_conv;
41042         this_ptr_conv.inner = untag_ptr(this_ptr);
41043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41045         this_ptr_conv.is_owned = false;
41046         LDKInitFeatures val_conv;
41047         val_conv.inner = untag_ptr(val);
41048         val_conv.is_owned = ptr_is_owned(val);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41050         val_conv = InitFeatures_clone(&val_conv);
41051         Init_set_features(&this_ptr_conv, val_conv);
41052 }
41053
41054 int64_t  CS_LDK_Init_get_networks(int64_t this_ptr) {
41055         LDKInit this_ptr_conv;
41056         this_ptr_conv.inner = untag_ptr(this_ptr);
41057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41059         this_ptr_conv.is_owned = false;
41060         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
41061         *ret_copy = Init_get_networks(&this_ptr_conv);
41062         int64_t ret_ref = tag_ptr(ret_copy, true);
41063         return ret_ref;
41064 }
41065
41066 void  CS_LDK_Init_set_networks(int64_t this_ptr, int64_t val) {
41067         LDKInit this_ptr_conv;
41068         this_ptr_conv.inner = untag_ptr(this_ptr);
41069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41071         this_ptr_conv.is_owned = false;
41072         void* val_ptr = untag_ptr(val);
41073         CHECK_ACCESS(val_ptr);
41074         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
41075         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
41076         Init_set_networks(&this_ptr_conv, val_conv);
41077 }
41078
41079 int64_t  CS_LDK_Init_get_remote_network_address(int64_t this_ptr) {
41080         LDKInit this_ptr_conv;
41081         this_ptr_conv.inner = untag_ptr(this_ptr);
41082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41084         this_ptr_conv.is_owned = false;
41085         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
41086         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
41087         int64_t ret_ref = tag_ptr(ret_copy, true);
41088         return ret_ref;
41089 }
41090
41091 void  CS_LDK_Init_set_remote_network_address(int64_t this_ptr, int64_t val) {
41092         LDKInit this_ptr_conv;
41093         this_ptr_conv.inner = untag_ptr(this_ptr);
41094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41096         this_ptr_conv.is_owned = false;
41097         void* val_ptr = untag_ptr(val);
41098         CHECK_ACCESS(val_ptr);
41099         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
41100         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
41101         Init_set_remote_network_address(&this_ptr_conv, val_conv);
41102 }
41103
41104 int64_t  CS_LDK_Init_new(int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
41105         LDKInitFeatures features_arg_conv;
41106         features_arg_conv.inner = untag_ptr(features_arg);
41107         features_arg_conv.is_owned = ptr_is_owned(features_arg);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41109         features_arg_conv = InitFeatures_clone(&features_arg_conv);
41110         void* networks_arg_ptr = untag_ptr(networks_arg);
41111         CHECK_ACCESS(networks_arg_ptr);
41112         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
41113         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
41114         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
41115         CHECK_ACCESS(remote_network_address_arg_ptr);
41116         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
41117         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
41118         int64_t ret_ref = 0;
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41121         return ret_ref;
41122 }
41123
41124 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
41125         LDKInit ret_var = Init_clone(arg);
41126         int64_t ret_ref = 0;
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41129         return ret_ref;
41130 }
41131 int64_t  CS_LDK_Init_clone_ptr(int64_t arg) {
41132         LDKInit arg_conv;
41133         arg_conv.inner = untag_ptr(arg);
41134         arg_conv.is_owned = ptr_is_owned(arg);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41136         arg_conv.is_owned = false;
41137         int64_t ret_conv = Init_clone_ptr(&arg_conv);
41138         return ret_conv;
41139 }
41140
41141 int64_t  CS_LDK_Init_clone(int64_t orig) {
41142         LDKInit orig_conv;
41143         orig_conv.inner = untag_ptr(orig);
41144         orig_conv.is_owned = ptr_is_owned(orig);
41145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41146         orig_conv.is_owned = false;
41147         LDKInit ret_var = Init_clone(&orig_conv);
41148         int64_t ret_ref = 0;
41149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41151         return ret_ref;
41152 }
41153
41154 int64_t  CS_LDK_Init_hash(int64_t o) {
41155         LDKInit o_conv;
41156         o_conv.inner = untag_ptr(o);
41157         o_conv.is_owned = ptr_is_owned(o);
41158         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41159         o_conv.is_owned = false;
41160         int64_t ret_conv = Init_hash(&o_conv);
41161         return ret_conv;
41162 }
41163
41164 jboolean  CS_LDK_Init_eq(int64_t a, int64_t b) {
41165         LDKInit a_conv;
41166         a_conv.inner = untag_ptr(a);
41167         a_conv.is_owned = ptr_is_owned(a);
41168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41169         a_conv.is_owned = false;
41170         LDKInit b_conv;
41171         b_conv.inner = untag_ptr(b);
41172         b_conv.is_owned = ptr_is_owned(b);
41173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41174         b_conv.is_owned = false;
41175         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
41176         return ret_conv;
41177 }
41178
41179 void  CS_LDK_ErrorMessage_free(int64_t this_obj) {
41180         LDKErrorMessage this_obj_conv;
41181         this_obj_conv.inner = untag_ptr(this_obj);
41182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41184         ErrorMessage_free(this_obj_conv);
41185 }
41186
41187 int8_tArray  CS_LDK_ErrorMessage_get_channel_id(int64_t this_ptr) {
41188         LDKErrorMessage this_ptr_conv;
41189         this_ptr_conv.inner = untag_ptr(this_ptr);
41190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41192         this_ptr_conv.is_owned = false;
41193         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41194         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
41195         return ret_arr;
41196 }
41197
41198 void  CS_LDK_ErrorMessage_set_channel_id(int64_t this_ptr, int8_tArray val) {
41199         LDKErrorMessage this_ptr_conv;
41200         this_ptr_conv.inner = untag_ptr(this_ptr);
41201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41203         this_ptr_conv.is_owned = false;
41204         LDKThirtyTwoBytes val_ref;
41205         CHECK(val->arr_len == 32);
41206         memcpy(val_ref.data, val->elems, 32); FREE(val);
41207         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
41208 }
41209
41210 jstring  CS_LDK_ErrorMessage_get_data(int64_t this_ptr) {
41211         LDKErrorMessage this_ptr_conv;
41212         this_ptr_conv.inner = untag_ptr(this_ptr);
41213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41215         this_ptr_conv.is_owned = false;
41216         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
41217         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
41218         Str_free(ret_str);
41219         return ret_conv;
41220 }
41221
41222 void  CS_LDK_ErrorMessage_set_data(int64_t this_ptr, jstring val) {
41223         LDKErrorMessage this_ptr_conv;
41224         this_ptr_conv.inner = untag_ptr(this_ptr);
41225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41227         this_ptr_conv.is_owned = false;
41228         LDKStr val_conv = str_ref_to_owned_c(val);
41229         ErrorMessage_set_data(&this_ptr_conv, val_conv);
41230 }
41231
41232 int64_t  CS_LDK_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
41233         LDKThirtyTwoBytes channel_id_arg_ref;
41234         CHECK(channel_id_arg->arr_len == 32);
41235         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41236         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
41237         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
41238         int64_t ret_ref = 0;
41239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41241         return ret_ref;
41242 }
41243
41244 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
41245         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
41246         int64_t ret_ref = 0;
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41249         return ret_ref;
41250 }
41251 int64_t  CS_LDK_ErrorMessage_clone_ptr(int64_t arg) {
41252         LDKErrorMessage arg_conv;
41253         arg_conv.inner = untag_ptr(arg);
41254         arg_conv.is_owned = ptr_is_owned(arg);
41255         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41256         arg_conv.is_owned = false;
41257         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
41258         return ret_conv;
41259 }
41260
41261 int64_t  CS_LDK_ErrorMessage_clone(int64_t orig) {
41262         LDKErrorMessage orig_conv;
41263         orig_conv.inner = untag_ptr(orig);
41264         orig_conv.is_owned = ptr_is_owned(orig);
41265         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41266         orig_conv.is_owned = false;
41267         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
41268         int64_t ret_ref = 0;
41269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41271         return ret_ref;
41272 }
41273
41274 int64_t  CS_LDK_ErrorMessage_hash(int64_t o) {
41275         LDKErrorMessage o_conv;
41276         o_conv.inner = untag_ptr(o);
41277         o_conv.is_owned = ptr_is_owned(o);
41278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41279         o_conv.is_owned = false;
41280         int64_t ret_conv = ErrorMessage_hash(&o_conv);
41281         return ret_conv;
41282 }
41283
41284 jboolean  CS_LDK_ErrorMessage_eq(int64_t a, int64_t b) {
41285         LDKErrorMessage a_conv;
41286         a_conv.inner = untag_ptr(a);
41287         a_conv.is_owned = ptr_is_owned(a);
41288         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41289         a_conv.is_owned = false;
41290         LDKErrorMessage b_conv;
41291         b_conv.inner = untag_ptr(b);
41292         b_conv.is_owned = ptr_is_owned(b);
41293         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41294         b_conv.is_owned = false;
41295         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
41296         return ret_conv;
41297 }
41298
41299 void  CS_LDK_WarningMessage_free(int64_t this_obj) {
41300         LDKWarningMessage this_obj_conv;
41301         this_obj_conv.inner = untag_ptr(this_obj);
41302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41304         WarningMessage_free(this_obj_conv);
41305 }
41306
41307 int8_tArray  CS_LDK_WarningMessage_get_channel_id(int64_t this_ptr) {
41308         LDKWarningMessage this_ptr_conv;
41309         this_ptr_conv.inner = untag_ptr(this_ptr);
41310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41312         this_ptr_conv.is_owned = false;
41313         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41314         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
41315         return ret_arr;
41316 }
41317
41318 void  CS_LDK_WarningMessage_set_channel_id(int64_t this_ptr, int8_tArray val) {
41319         LDKWarningMessage this_ptr_conv;
41320         this_ptr_conv.inner = untag_ptr(this_ptr);
41321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41323         this_ptr_conv.is_owned = false;
41324         LDKThirtyTwoBytes val_ref;
41325         CHECK(val->arr_len == 32);
41326         memcpy(val_ref.data, val->elems, 32); FREE(val);
41327         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
41328 }
41329
41330 jstring  CS_LDK_WarningMessage_get_data(int64_t this_ptr) {
41331         LDKWarningMessage this_ptr_conv;
41332         this_ptr_conv.inner = untag_ptr(this_ptr);
41333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41335         this_ptr_conv.is_owned = false;
41336         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
41337         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
41338         Str_free(ret_str);
41339         return ret_conv;
41340 }
41341
41342 void  CS_LDK_WarningMessage_set_data(int64_t this_ptr, jstring val) {
41343         LDKWarningMessage this_ptr_conv;
41344         this_ptr_conv.inner = untag_ptr(this_ptr);
41345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41347         this_ptr_conv.is_owned = false;
41348         LDKStr val_conv = str_ref_to_owned_c(val);
41349         WarningMessage_set_data(&this_ptr_conv, val_conv);
41350 }
41351
41352 int64_t  CS_LDK_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
41353         LDKThirtyTwoBytes channel_id_arg_ref;
41354         CHECK(channel_id_arg->arr_len == 32);
41355         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
41356         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
41357         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
41358         int64_t ret_ref = 0;
41359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41361         return ret_ref;
41362 }
41363
41364 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
41365         LDKWarningMessage ret_var = WarningMessage_clone(arg);
41366         int64_t ret_ref = 0;
41367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41369         return ret_ref;
41370 }
41371 int64_t  CS_LDK_WarningMessage_clone_ptr(int64_t arg) {
41372         LDKWarningMessage arg_conv;
41373         arg_conv.inner = untag_ptr(arg);
41374         arg_conv.is_owned = ptr_is_owned(arg);
41375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41376         arg_conv.is_owned = false;
41377         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
41378         return ret_conv;
41379 }
41380
41381 int64_t  CS_LDK_WarningMessage_clone(int64_t orig) {
41382         LDKWarningMessage orig_conv;
41383         orig_conv.inner = untag_ptr(orig);
41384         orig_conv.is_owned = ptr_is_owned(orig);
41385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41386         orig_conv.is_owned = false;
41387         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
41388         int64_t ret_ref = 0;
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41391         return ret_ref;
41392 }
41393
41394 int64_t  CS_LDK_WarningMessage_hash(int64_t o) {
41395         LDKWarningMessage o_conv;
41396         o_conv.inner = untag_ptr(o);
41397         o_conv.is_owned = ptr_is_owned(o);
41398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41399         o_conv.is_owned = false;
41400         int64_t ret_conv = WarningMessage_hash(&o_conv);
41401         return ret_conv;
41402 }
41403
41404 jboolean  CS_LDK_WarningMessage_eq(int64_t a, int64_t b) {
41405         LDKWarningMessage a_conv;
41406         a_conv.inner = untag_ptr(a);
41407         a_conv.is_owned = ptr_is_owned(a);
41408         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41409         a_conv.is_owned = false;
41410         LDKWarningMessage b_conv;
41411         b_conv.inner = untag_ptr(b);
41412         b_conv.is_owned = ptr_is_owned(b);
41413         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41414         b_conv.is_owned = false;
41415         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
41416         return ret_conv;
41417 }
41418
41419 void  CS_LDK_Ping_free(int64_t this_obj) {
41420         LDKPing this_obj_conv;
41421         this_obj_conv.inner = untag_ptr(this_obj);
41422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41424         Ping_free(this_obj_conv);
41425 }
41426
41427 int16_t  CS_LDK_Ping_get_ponglen(int64_t this_ptr) {
41428         LDKPing this_ptr_conv;
41429         this_ptr_conv.inner = untag_ptr(this_ptr);
41430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41432         this_ptr_conv.is_owned = false;
41433         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
41434         return ret_conv;
41435 }
41436
41437 void  CS_LDK_Ping_set_ponglen(int64_t this_ptr, int16_t val) {
41438         LDKPing this_ptr_conv;
41439         this_ptr_conv.inner = untag_ptr(this_ptr);
41440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41442         this_ptr_conv.is_owned = false;
41443         Ping_set_ponglen(&this_ptr_conv, val);
41444 }
41445
41446 int16_t  CS_LDK_Ping_get_byteslen(int64_t this_ptr) {
41447         LDKPing this_ptr_conv;
41448         this_ptr_conv.inner = untag_ptr(this_ptr);
41449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41451         this_ptr_conv.is_owned = false;
41452         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
41453         return ret_conv;
41454 }
41455
41456 void  CS_LDK_Ping_set_byteslen(int64_t this_ptr, int16_t val) {
41457         LDKPing this_ptr_conv;
41458         this_ptr_conv.inner = untag_ptr(this_ptr);
41459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41461         this_ptr_conv.is_owned = false;
41462         Ping_set_byteslen(&this_ptr_conv, val);
41463 }
41464
41465 int64_t  CS_LDK_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
41466         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
41467         int64_t ret_ref = 0;
41468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41470         return ret_ref;
41471 }
41472
41473 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
41474         LDKPing ret_var = Ping_clone(arg);
41475         int64_t ret_ref = 0;
41476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41478         return ret_ref;
41479 }
41480 int64_t  CS_LDK_Ping_clone_ptr(int64_t arg) {
41481         LDKPing arg_conv;
41482         arg_conv.inner = untag_ptr(arg);
41483         arg_conv.is_owned = ptr_is_owned(arg);
41484         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41485         arg_conv.is_owned = false;
41486         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
41487         return ret_conv;
41488 }
41489
41490 int64_t  CS_LDK_Ping_clone(int64_t orig) {
41491         LDKPing orig_conv;
41492         orig_conv.inner = untag_ptr(orig);
41493         orig_conv.is_owned = ptr_is_owned(orig);
41494         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41495         orig_conv.is_owned = false;
41496         LDKPing ret_var = Ping_clone(&orig_conv);
41497         int64_t ret_ref = 0;
41498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41500         return ret_ref;
41501 }
41502
41503 int64_t  CS_LDK_Ping_hash(int64_t o) {
41504         LDKPing o_conv;
41505         o_conv.inner = untag_ptr(o);
41506         o_conv.is_owned = ptr_is_owned(o);
41507         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41508         o_conv.is_owned = false;
41509         int64_t ret_conv = Ping_hash(&o_conv);
41510         return ret_conv;
41511 }
41512
41513 jboolean  CS_LDK_Ping_eq(int64_t a, int64_t b) {
41514         LDKPing a_conv;
41515         a_conv.inner = untag_ptr(a);
41516         a_conv.is_owned = ptr_is_owned(a);
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41518         a_conv.is_owned = false;
41519         LDKPing b_conv;
41520         b_conv.inner = untag_ptr(b);
41521         b_conv.is_owned = ptr_is_owned(b);
41522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41523         b_conv.is_owned = false;
41524         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
41525         return ret_conv;
41526 }
41527
41528 void  CS_LDK_Pong_free(int64_t this_obj) {
41529         LDKPong this_obj_conv;
41530         this_obj_conv.inner = untag_ptr(this_obj);
41531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41533         Pong_free(this_obj_conv);
41534 }
41535
41536 int16_t  CS_LDK_Pong_get_byteslen(int64_t this_ptr) {
41537         LDKPong this_ptr_conv;
41538         this_ptr_conv.inner = untag_ptr(this_ptr);
41539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41541         this_ptr_conv.is_owned = false;
41542         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
41543         return ret_conv;
41544 }
41545
41546 void  CS_LDK_Pong_set_byteslen(int64_t this_ptr, int16_t val) {
41547         LDKPong this_ptr_conv;
41548         this_ptr_conv.inner = untag_ptr(this_ptr);
41549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41551         this_ptr_conv.is_owned = false;
41552         Pong_set_byteslen(&this_ptr_conv, val);
41553 }
41554
41555 int64_t  CS_LDK_Pong_new(int16_t byteslen_arg) {
41556         LDKPong ret_var = Pong_new(byteslen_arg);
41557         int64_t ret_ref = 0;
41558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41560         return ret_ref;
41561 }
41562
41563 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
41564         LDKPong ret_var = Pong_clone(arg);
41565         int64_t ret_ref = 0;
41566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41568         return ret_ref;
41569 }
41570 int64_t  CS_LDK_Pong_clone_ptr(int64_t arg) {
41571         LDKPong arg_conv;
41572         arg_conv.inner = untag_ptr(arg);
41573         arg_conv.is_owned = ptr_is_owned(arg);
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41575         arg_conv.is_owned = false;
41576         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
41577         return ret_conv;
41578 }
41579
41580 int64_t  CS_LDK_Pong_clone(int64_t orig) {
41581         LDKPong orig_conv;
41582         orig_conv.inner = untag_ptr(orig);
41583         orig_conv.is_owned = ptr_is_owned(orig);
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41585         orig_conv.is_owned = false;
41586         LDKPong ret_var = Pong_clone(&orig_conv);
41587         int64_t ret_ref = 0;
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41590         return ret_ref;
41591 }
41592
41593 int64_t  CS_LDK_Pong_hash(int64_t o) {
41594         LDKPong o_conv;
41595         o_conv.inner = untag_ptr(o);
41596         o_conv.is_owned = ptr_is_owned(o);
41597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41598         o_conv.is_owned = false;
41599         int64_t ret_conv = Pong_hash(&o_conv);
41600         return ret_conv;
41601 }
41602
41603 jboolean  CS_LDK_Pong_eq(int64_t a, int64_t b) {
41604         LDKPong a_conv;
41605         a_conv.inner = untag_ptr(a);
41606         a_conv.is_owned = ptr_is_owned(a);
41607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41608         a_conv.is_owned = false;
41609         LDKPong b_conv;
41610         b_conv.inner = untag_ptr(b);
41611         b_conv.is_owned = ptr_is_owned(b);
41612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41613         b_conv.is_owned = false;
41614         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
41615         return ret_conv;
41616 }
41617
41618 void  CS_LDK_OpenChannel_free(int64_t this_obj) {
41619         LDKOpenChannel this_obj_conv;
41620         this_obj_conv.inner = untag_ptr(this_obj);
41621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41623         OpenChannel_free(this_obj_conv);
41624 }
41625
41626 int8_tArray  CS_LDK_OpenChannel_get_chain_hash(int64_t this_ptr) {
41627         LDKOpenChannel this_ptr_conv;
41628         this_ptr_conv.inner = untag_ptr(this_ptr);
41629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41631         this_ptr_conv.is_owned = false;
41632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41633         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
41634         return ret_arr;
41635 }
41636
41637 void  CS_LDK_OpenChannel_set_chain_hash(int64_t this_ptr, int8_tArray val) {
41638         LDKOpenChannel this_ptr_conv;
41639         this_ptr_conv.inner = untag_ptr(this_ptr);
41640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41642         this_ptr_conv.is_owned = false;
41643         LDKThirtyTwoBytes val_ref;
41644         CHECK(val->arr_len == 32);
41645         memcpy(val_ref.data, val->elems, 32); FREE(val);
41646         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
41647 }
41648
41649 int8_tArray  CS_LDK_OpenChannel_get_temporary_channel_id(int64_t this_ptr) {
41650         LDKOpenChannel this_ptr_conv;
41651         this_ptr_conv.inner = untag_ptr(this_ptr);
41652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41654         this_ptr_conv.is_owned = false;
41655         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41656         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
41657         return ret_arr;
41658 }
41659
41660 void  CS_LDK_OpenChannel_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
41661         LDKOpenChannel this_ptr_conv;
41662         this_ptr_conv.inner = untag_ptr(this_ptr);
41663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41665         this_ptr_conv.is_owned = false;
41666         LDKThirtyTwoBytes val_ref;
41667         CHECK(val->arr_len == 32);
41668         memcpy(val_ref.data, val->elems, 32); FREE(val);
41669         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41670 }
41671
41672 int64_t  CS_LDK_OpenChannel_get_funding_satoshis(int64_t this_ptr) {
41673         LDKOpenChannel this_ptr_conv;
41674         this_ptr_conv.inner = untag_ptr(this_ptr);
41675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41677         this_ptr_conv.is_owned = false;
41678         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
41679         return ret_conv;
41680 }
41681
41682 void  CS_LDK_OpenChannel_set_funding_satoshis(int64_t this_ptr, int64_t val) {
41683         LDKOpenChannel this_ptr_conv;
41684         this_ptr_conv.inner = untag_ptr(this_ptr);
41685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41687         this_ptr_conv.is_owned = false;
41688         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
41689 }
41690
41691 int64_t  CS_LDK_OpenChannel_get_push_msat(int64_t this_ptr) {
41692         LDKOpenChannel this_ptr_conv;
41693         this_ptr_conv.inner = untag_ptr(this_ptr);
41694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41696         this_ptr_conv.is_owned = false;
41697         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
41698         return ret_conv;
41699 }
41700
41701 void  CS_LDK_OpenChannel_set_push_msat(int64_t this_ptr, int64_t val) {
41702         LDKOpenChannel 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         OpenChannel_set_push_msat(&this_ptr_conv, val);
41708 }
41709
41710 int64_t  CS_LDK_OpenChannel_get_dust_limit_satoshis(int64_t this_ptr) {
41711         LDKOpenChannel this_ptr_conv;
41712         this_ptr_conv.inner = untag_ptr(this_ptr);
41713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41715         this_ptr_conv.is_owned = false;
41716         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
41717         return ret_conv;
41718 }
41719
41720 void  CS_LDK_OpenChannel_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
41721         LDKOpenChannel this_ptr_conv;
41722         this_ptr_conv.inner = untag_ptr(this_ptr);
41723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41725         this_ptr_conv.is_owned = false;
41726         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41727 }
41728
41729 int64_t  CS_LDK_OpenChannel_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
41730         LDKOpenChannel this_ptr_conv;
41731         this_ptr_conv.inner = untag_ptr(this_ptr);
41732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41734         this_ptr_conv.is_owned = false;
41735         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41736         return ret_conv;
41737 }
41738
41739 void  CS_LDK_OpenChannel_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
41740         LDKOpenChannel this_ptr_conv;
41741         this_ptr_conv.inner = untag_ptr(this_ptr);
41742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41744         this_ptr_conv.is_owned = false;
41745         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41746 }
41747
41748 int64_t  CS_LDK_OpenChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
41749         LDKOpenChannel this_ptr_conv;
41750         this_ptr_conv.inner = untag_ptr(this_ptr);
41751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41753         this_ptr_conv.is_owned = false;
41754         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41755         return ret_conv;
41756 }
41757
41758 void  CS_LDK_OpenChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
41759         LDKOpenChannel this_ptr_conv;
41760         this_ptr_conv.inner = untag_ptr(this_ptr);
41761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41763         this_ptr_conv.is_owned = false;
41764         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41765 }
41766
41767 int64_t  CS_LDK_OpenChannel_get_htlc_minimum_msat(int64_t this_ptr) {
41768         LDKOpenChannel this_ptr_conv;
41769         this_ptr_conv.inner = untag_ptr(this_ptr);
41770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41772         this_ptr_conv.is_owned = false;
41773         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
41774         return ret_conv;
41775 }
41776
41777 void  CS_LDK_OpenChannel_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
41778         LDKOpenChannel this_ptr_conv;
41779         this_ptr_conv.inner = untag_ptr(this_ptr);
41780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41782         this_ptr_conv.is_owned = false;
41783         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41784 }
41785
41786 int32_t  CS_LDK_OpenChannel_get_feerate_per_kw(int64_t this_ptr) {
41787         LDKOpenChannel this_ptr_conv;
41788         this_ptr_conv.inner = untag_ptr(this_ptr);
41789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41791         this_ptr_conv.is_owned = false;
41792         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
41793         return ret_conv;
41794 }
41795
41796 void  CS_LDK_OpenChannel_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
41797         LDKOpenChannel this_ptr_conv;
41798         this_ptr_conv.inner = untag_ptr(this_ptr);
41799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41801         this_ptr_conv.is_owned = false;
41802         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
41803 }
41804
41805 int16_t  CS_LDK_OpenChannel_get_to_self_delay(int64_t this_ptr) {
41806         LDKOpenChannel this_ptr_conv;
41807         this_ptr_conv.inner = untag_ptr(this_ptr);
41808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41810         this_ptr_conv.is_owned = false;
41811         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
41812         return ret_conv;
41813 }
41814
41815 void  CS_LDK_OpenChannel_set_to_self_delay(int64_t this_ptr, int16_t val) {
41816         LDKOpenChannel this_ptr_conv;
41817         this_ptr_conv.inner = untag_ptr(this_ptr);
41818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41820         this_ptr_conv.is_owned = false;
41821         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
41822 }
41823
41824 int16_t  CS_LDK_OpenChannel_get_max_accepted_htlcs(int64_t this_ptr) {
41825         LDKOpenChannel 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         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
41831         return ret_conv;
41832 }
41833
41834 void  CS_LDK_OpenChannel_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
41835         LDKOpenChannel this_ptr_conv;
41836         this_ptr_conv.inner = untag_ptr(this_ptr);
41837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41839         this_ptr_conv.is_owned = false;
41840         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41841 }
41842
41843 int8_tArray  CS_LDK_OpenChannel_get_funding_pubkey(int64_t this_ptr) {
41844         LDKOpenChannel this_ptr_conv;
41845         this_ptr_conv.inner = untag_ptr(this_ptr);
41846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41848         this_ptr_conv.is_owned = false;
41849         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41850         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
41851         return ret_arr;
41852 }
41853
41854 void  CS_LDK_OpenChannel_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
41855         LDKOpenChannel this_ptr_conv;
41856         this_ptr_conv.inner = untag_ptr(this_ptr);
41857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41859         this_ptr_conv.is_owned = false;
41860         LDKPublicKey val_ref;
41861         CHECK(val->arr_len == 33);
41862         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41863         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41864 }
41865
41866 int8_tArray  CS_LDK_OpenChannel_get_revocation_basepoint(int64_t this_ptr) {
41867         LDKOpenChannel this_ptr_conv;
41868         this_ptr_conv.inner = untag_ptr(this_ptr);
41869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41871         this_ptr_conv.is_owned = false;
41872         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41873         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
41874         return ret_arr;
41875 }
41876
41877 void  CS_LDK_OpenChannel_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
41878         LDKOpenChannel 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         LDKPublicKey val_ref;
41884         CHECK(val->arr_len == 33);
41885         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41886         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41887 }
41888
41889 int8_tArray  CS_LDK_OpenChannel_get_payment_point(int64_t this_ptr) {
41890         LDKOpenChannel 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41896         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
41897         return ret_arr;
41898 }
41899
41900 void  CS_LDK_OpenChannel_set_payment_point(int64_t this_ptr, int8_tArray val) {
41901         LDKOpenChannel this_ptr_conv;
41902         this_ptr_conv.inner = untag_ptr(this_ptr);
41903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41905         this_ptr_conv.is_owned = false;
41906         LDKPublicKey val_ref;
41907         CHECK(val->arr_len == 33);
41908         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41909         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
41910 }
41911
41912 int8_tArray  CS_LDK_OpenChannel_get_delayed_payment_basepoint(int64_t this_ptr) {
41913         LDKOpenChannel this_ptr_conv;
41914         this_ptr_conv.inner = untag_ptr(this_ptr);
41915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41917         this_ptr_conv.is_owned = false;
41918         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41919         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
41920         return ret_arr;
41921 }
41922
41923 void  CS_LDK_OpenChannel_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
41924         LDKOpenChannel this_ptr_conv;
41925         this_ptr_conv.inner = untag_ptr(this_ptr);
41926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41928         this_ptr_conv.is_owned = false;
41929         LDKPublicKey val_ref;
41930         CHECK(val->arr_len == 33);
41931         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41932         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41933 }
41934
41935 int8_tArray  CS_LDK_OpenChannel_get_htlc_basepoint(int64_t this_ptr) {
41936         LDKOpenChannel this_ptr_conv;
41937         this_ptr_conv.inner = untag_ptr(this_ptr);
41938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41940         this_ptr_conv.is_owned = false;
41941         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41942         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
41943         return ret_arr;
41944 }
41945
41946 void  CS_LDK_OpenChannel_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
41947         LDKOpenChannel this_ptr_conv;
41948         this_ptr_conv.inner = untag_ptr(this_ptr);
41949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41951         this_ptr_conv.is_owned = false;
41952         LDKPublicKey val_ref;
41953         CHECK(val->arr_len == 33);
41954         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41955         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41956 }
41957
41958 int8_tArray  CS_LDK_OpenChannel_get_first_per_commitment_point(int64_t this_ptr) {
41959         LDKOpenChannel this_ptr_conv;
41960         this_ptr_conv.inner = untag_ptr(this_ptr);
41961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41963         this_ptr_conv.is_owned = false;
41964         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41965         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
41966         return ret_arr;
41967 }
41968
41969 void  CS_LDK_OpenChannel_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
41970         LDKOpenChannel this_ptr_conv;
41971         this_ptr_conv.inner = untag_ptr(this_ptr);
41972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41974         this_ptr_conv.is_owned = false;
41975         LDKPublicKey val_ref;
41976         CHECK(val->arr_len == 33);
41977         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41978         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41979 }
41980
41981 int8_t  CS_LDK_OpenChannel_get_channel_flags(int64_t this_ptr) {
41982         LDKOpenChannel this_ptr_conv;
41983         this_ptr_conv.inner = untag_ptr(this_ptr);
41984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41986         this_ptr_conv.is_owned = false;
41987         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
41988         return ret_conv;
41989 }
41990
41991 void  CS_LDK_OpenChannel_set_channel_flags(int64_t this_ptr, int8_t val) {
41992         LDKOpenChannel this_ptr_conv;
41993         this_ptr_conv.inner = untag_ptr(this_ptr);
41994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41996         this_ptr_conv.is_owned = false;
41997         OpenChannel_set_channel_flags(&this_ptr_conv, val);
41998 }
41999
42000 int64_t  CS_LDK_OpenChannel_get_shutdown_scriptpubkey(int64_t this_ptr) {
42001         LDKOpenChannel this_ptr_conv;
42002         this_ptr_conv.inner = untag_ptr(this_ptr);
42003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42005         this_ptr_conv.is_owned = false;
42006         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42007         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
42008         int64_t ret_ref = tag_ptr(ret_copy, true);
42009         return ret_ref;
42010 }
42011
42012 void  CS_LDK_OpenChannel_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
42013         LDKOpenChannel this_ptr_conv;
42014         this_ptr_conv.inner = untag_ptr(this_ptr);
42015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42017         this_ptr_conv.is_owned = false;
42018         void* val_ptr = untag_ptr(val);
42019         CHECK_ACCESS(val_ptr);
42020         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42021         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42022         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42023 }
42024
42025 int64_t  CS_LDK_OpenChannel_get_channel_type(int64_t this_ptr) {
42026         LDKOpenChannel this_ptr_conv;
42027         this_ptr_conv.inner = untag_ptr(this_ptr);
42028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42030         this_ptr_conv.is_owned = false;
42031         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
42032         int64_t ret_ref = 0;
42033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42035         return ret_ref;
42036 }
42037
42038 void  CS_LDK_OpenChannel_set_channel_type(int64_t this_ptr, int64_t val) {
42039         LDKOpenChannel this_ptr_conv;
42040         this_ptr_conv.inner = untag_ptr(this_ptr);
42041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42043         this_ptr_conv.is_owned = false;
42044         LDKChannelTypeFeatures val_conv;
42045         val_conv.inner = untag_ptr(val);
42046         val_conv.is_owned = ptr_is_owned(val);
42047         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42048         val_conv = ChannelTypeFeatures_clone(&val_conv);
42049         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
42050 }
42051
42052 int64_t  CS_LDK_OpenChannel_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
42053         LDKThirtyTwoBytes chain_hash_arg_ref;
42054         CHECK(chain_hash_arg->arr_len == 32);
42055         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42056         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42057         CHECK(temporary_channel_id_arg->arr_len == 32);
42058         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42059         LDKPublicKey funding_pubkey_arg_ref;
42060         CHECK(funding_pubkey_arg->arr_len == 33);
42061         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42062         LDKPublicKey revocation_basepoint_arg_ref;
42063         CHECK(revocation_basepoint_arg->arr_len == 33);
42064         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42065         LDKPublicKey payment_point_arg_ref;
42066         CHECK(payment_point_arg->arr_len == 33);
42067         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
42068         LDKPublicKey delayed_payment_basepoint_arg_ref;
42069         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42070         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42071         LDKPublicKey htlc_basepoint_arg_ref;
42072         CHECK(htlc_basepoint_arg->arr_len == 33);
42073         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42074         LDKPublicKey first_per_commitment_point_arg_ref;
42075         CHECK(first_per_commitment_point_arg->arr_len == 33);
42076         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42077         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42078         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42079         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42080         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42081         LDKChannelTypeFeatures channel_type_arg_conv;
42082         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42083         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42084         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42085         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42086         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
42087         int64_t ret_ref = 0;
42088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42090         return ret_ref;
42091 }
42092
42093 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
42094         LDKOpenChannel ret_var = OpenChannel_clone(arg);
42095         int64_t ret_ref = 0;
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42098         return ret_ref;
42099 }
42100 int64_t  CS_LDK_OpenChannel_clone_ptr(int64_t arg) {
42101         LDKOpenChannel arg_conv;
42102         arg_conv.inner = untag_ptr(arg);
42103         arg_conv.is_owned = ptr_is_owned(arg);
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42105         arg_conv.is_owned = false;
42106         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
42107         return ret_conv;
42108 }
42109
42110 int64_t  CS_LDK_OpenChannel_clone(int64_t orig) {
42111         LDKOpenChannel orig_conv;
42112         orig_conv.inner = untag_ptr(orig);
42113         orig_conv.is_owned = ptr_is_owned(orig);
42114         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42115         orig_conv.is_owned = false;
42116         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
42117         int64_t ret_ref = 0;
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42120         return ret_ref;
42121 }
42122
42123 int64_t  CS_LDK_OpenChannel_hash(int64_t o) {
42124         LDKOpenChannel o_conv;
42125         o_conv.inner = untag_ptr(o);
42126         o_conv.is_owned = ptr_is_owned(o);
42127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42128         o_conv.is_owned = false;
42129         int64_t ret_conv = OpenChannel_hash(&o_conv);
42130         return ret_conv;
42131 }
42132
42133 jboolean  CS_LDK_OpenChannel_eq(int64_t a, int64_t b) {
42134         LDKOpenChannel a_conv;
42135         a_conv.inner = untag_ptr(a);
42136         a_conv.is_owned = ptr_is_owned(a);
42137         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42138         a_conv.is_owned = false;
42139         LDKOpenChannel b_conv;
42140         b_conv.inner = untag_ptr(b);
42141         b_conv.is_owned = ptr_is_owned(b);
42142         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42143         b_conv.is_owned = false;
42144         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
42145         return ret_conv;
42146 }
42147
42148 void  CS_LDK_OpenChannelV2_free(int64_t this_obj) {
42149         LDKOpenChannelV2 this_obj_conv;
42150         this_obj_conv.inner = untag_ptr(this_obj);
42151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42153         OpenChannelV2_free(this_obj_conv);
42154 }
42155
42156 int8_tArray  CS_LDK_OpenChannelV2_get_chain_hash(int64_t this_ptr) {
42157         LDKOpenChannelV2 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42163         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
42164         return ret_arr;
42165 }
42166
42167 void  CS_LDK_OpenChannelV2_set_chain_hash(int64_t this_ptr, int8_tArray val) {
42168         LDKOpenChannelV2 this_ptr_conv;
42169         this_ptr_conv.inner = untag_ptr(this_ptr);
42170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42172         this_ptr_conv.is_owned = false;
42173         LDKThirtyTwoBytes val_ref;
42174         CHECK(val->arr_len == 32);
42175         memcpy(val_ref.data, val->elems, 32); FREE(val);
42176         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
42177 }
42178
42179 int8_tArray  CS_LDK_OpenChannelV2_get_temporary_channel_id(int64_t this_ptr) {
42180         LDKOpenChannelV2 this_ptr_conv;
42181         this_ptr_conv.inner = untag_ptr(this_ptr);
42182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42184         this_ptr_conv.is_owned = false;
42185         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42186         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
42187         return ret_arr;
42188 }
42189
42190 void  CS_LDK_OpenChannelV2_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
42191         LDKOpenChannelV2 this_ptr_conv;
42192         this_ptr_conv.inner = untag_ptr(this_ptr);
42193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42195         this_ptr_conv.is_owned = false;
42196         LDKThirtyTwoBytes val_ref;
42197         CHECK(val->arr_len == 32);
42198         memcpy(val_ref.data, val->elems, 32); FREE(val);
42199         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
42200 }
42201
42202 int32_t  CS_LDK_OpenChannelV2_get_funding_feerate_sat_per_1000_weight(int64_t this_ptr) {
42203         LDKOpenChannelV2 this_ptr_conv;
42204         this_ptr_conv.inner = untag_ptr(this_ptr);
42205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42207         this_ptr_conv.is_owned = false;
42208         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
42209         return ret_conv;
42210 }
42211
42212 void  CS_LDK_OpenChannelV2_set_funding_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
42213         LDKOpenChannelV2 this_ptr_conv;
42214         this_ptr_conv.inner = untag_ptr(this_ptr);
42215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42217         this_ptr_conv.is_owned = false;
42218         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42219 }
42220
42221 int32_t  CS_LDK_OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(int64_t this_ptr) {
42222         LDKOpenChannelV2 this_ptr_conv;
42223         this_ptr_conv.inner = untag_ptr(this_ptr);
42224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42226         this_ptr_conv.is_owned = false;
42227         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
42228         return ret_conv;
42229 }
42230
42231 void  CS_LDK_OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
42232         LDKOpenChannelV2 this_ptr_conv;
42233         this_ptr_conv.inner = untag_ptr(this_ptr);
42234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42236         this_ptr_conv.is_owned = false;
42237         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
42238 }
42239
42240 int64_t  CS_LDK_OpenChannelV2_get_funding_satoshis(int64_t this_ptr) {
42241         LDKOpenChannelV2 this_ptr_conv;
42242         this_ptr_conv.inner = untag_ptr(this_ptr);
42243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42245         this_ptr_conv.is_owned = false;
42246         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
42247         return ret_conv;
42248 }
42249
42250 void  CS_LDK_OpenChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
42251         LDKOpenChannelV2 this_ptr_conv;
42252         this_ptr_conv.inner = untag_ptr(this_ptr);
42253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42255         this_ptr_conv.is_owned = false;
42256         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
42257 }
42258
42259 int64_t  CS_LDK_OpenChannelV2_get_dust_limit_satoshis(int64_t this_ptr) {
42260         LDKOpenChannelV2 this_ptr_conv;
42261         this_ptr_conv.inner = untag_ptr(this_ptr);
42262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42264         this_ptr_conv.is_owned = false;
42265         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
42266         return ret_conv;
42267 }
42268
42269 void  CS_LDK_OpenChannelV2_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
42270         LDKOpenChannelV2 this_ptr_conv;
42271         this_ptr_conv.inner = untag_ptr(this_ptr);
42272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42274         this_ptr_conv.is_owned = false;
42275         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
42276 }
42277
42278 int64_t  CS_LDK_OpenChannelV2_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
42279         LDKOpenChannelV2 this_ptr_conv;
42280         this_ptr_conv.inner = untag_ptr(this_ptr);
42281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42283         this_ptr_conv.is_owned = false;
42284         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42285         return ret_conv;
42286 }
42287
42288 void  CS_LDK_OpenChannelV2_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
42289         LDKOpenChannelV2 this_ptr_conv;
42290         this_ptr_conv.inner = untag_ptr(this_ptr);
42291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42293         this_ptr_conv.is_owned = false;
42294         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42295 }
42296
42297 int64_t  CS_LDK_OpenChannelV2_get_htlc_minimum_msat(int64_t this_ptr) {
42298         LDKOpenChannelV2 this_ptr_conv;
42299         this_ptr_conv.inner = untag_ptr(this_ptr);
42300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42302         this_ptr_conv.is_owned = false;
42303         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
42304         return ret_conv;
42305 }
42306
42307 void  CS_LDK_OpenChannelV2_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
42308         LDKOpenChannelV2 this_ptr_conv;
42309         this_ptr_conv.inner = untag_ptr(this_ptr);
42310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42312         this_ptr_conv.is_owned = false;
42313         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
42314 }
42315
42316 int16_t  CS_LDK_OpenChannelV2_get_to_self_delay(int64_t this_ptr) {
42317         LDKOpenChannelV2 this_ptr_conv;
42318         this_ptr_conv.inner = untag_ptr(this_ptr);
42319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42321         this_ptr_conv.is_owned = false;
42322         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
42323         return ret_conv;
42324 }
42325
42326 void  CS_LDK_OpenChannelV2_set_to_self_delay(int64_t this_ptr, int16_t val) {
42327         LDKOpenChannelV2 this_ptr_conv;
42328         this_ptr_conv.inner = untag_ptr(this_ptr);
42329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42331         this_ptr_conv.is_owned = false;
42332         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
42333 }
42334
42335 int16_t  CS_LDK_OpenChannelV2_get_max_accepted_htlcs(int64_t this_ptr) {
42336         LDKOpenChannelV2 this_ptr_conv;
42337         this_ptr_conv.inner = untag_ptr(this_ptr);
42338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42340         this_ptr_conv.is_owned = false;
42341         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
42342         return ret_conv;
42343 }
42344
42345 void  CS_LDK_OpenChannelV2_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
42346         LDKOpenChannelV2 this_ptr_conv;
42347         this_ptr_conv.inner = untag_ptr(this_ptr);
42348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42350         this_ptr_conv.is_owned = false;
42351         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
42352 }
42353
42354 int32_t  CS_LDK_OpenChannelV2_get_locktime(int64_t this_ptr) {
42355         LDKOpenChannelV2 this_ptr_conv;
42356         this_ptr_conv.inner = untag_ptr(this_ptr);
42357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359         this_ptr_conv.is_owned = false;
42360         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
42361         return ret_conv;
42362 }
42363
42364 void  CS_LDK_OpenChannelV2_set_locktime(int64_t this_ptr, int32_t val) {
42365         LDKOpenChannelV2 this_ptr_conv;
42366         this_ptr_conv.inner = untag_ptr(this_ptr);
42367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42369         this_ptr_conv.is_owned = false;
42370         OpenChannelV2_set_locktime(&this_ptr_conv, val);
42371 }
42372
42373 int8_tArray  CS_LDK_OpenChannelV2_get_funding_pubkey(int64_t this_ptr) {
42374         LDKOpenChannelV2 this_ptr_conv;
42375         this_ptr_conv.inner = untag_ptr(this_ptr);
42376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42378         this_ptr_conv.is_owned = false;
42379         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42380         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42381         return ret_arr;
42382 }
42383
42384 void  CS_LDK_OpenChannelV2_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
42385         LDKOpenChannelV2 this_ptr_conv;
42386         this_ptr_conv.inner = untag_ptr(this_ptr);
42387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42389         this_ptr_conv.is_owned = false;
42390         LDKPublicKey val_ref;
42391         CHECK(val->arr_len == 33);
42392         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42393         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
42394 }
42395
42396 int8_tArray  CS_LDK_OpenChannelV2_get_revocation_basepoint(int64_t this_ptr) {
42397         LDKOpenChannelV2 this_ptr_conv;
42398         this_ptr_conv.inner = untag_ptr(this_ptr);
42399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42401         this_ptr_conv.is_owned = false;
42402         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42403         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42404         return ret_arr;
42405 }
42406
42407 void  CS_LDK_OpenChannelV2_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
42408         LDKOpenChannelV2 this_ptr_conv;
42409         this_ptr_conv.inner = untag_ptr(this_ptr);
42410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42412         this_ptr_conv.is_owned = false;
42413         LDKPublicKey val_ref;
42414         CHECK(val->arr_len == 33);
42415         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42416         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
42417 }
42418
42419 int8_tArray  CS_LDK_OpenChannelV2_get_payment_basepoint(int64_t this_ptr) {
42420         LDKOpenChannelV2 this_ptr_conv;
42421         this_ptr_conv.inner = untag_ptr(this_ptr);
42422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42424         this_ptr_conv.is_owned = false;
42425         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42426         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42427         return ret_arr;
42428 }
42429
42430 void  CS_LDK_OpenChannelV2_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42431         LDKOpenChannelV2 this_ptr_conv;
42432         this_ptr_conv.inner = untag_ptr(this_ptr);
42433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42435         this_ptr_conv.is_owned = false;
42436         LDKPublicKey val_ref;
42437         CHECK(val->arr_len == 33);
42438         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42439         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
42440 }
42441
42442 int8_tArray  CS_LDK_OpenChannelV2_get_delayed_payment_basepoint(int64_t this_ptr) {
42443         LDKOpenChannelV2 this_ptr_conv;
42444         this_ptr_conv.inner = untag_ptr(this_ptr);
42445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42447         this_ptr_conv.is_owned = false;
42448         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42449         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42450         return ret_arr;
42451 }
42452
42453 void  CS_LDK_OpenChannelV2_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42454         LDKOpenChannelV2 this_ptr_conv;
42455         this_ptr_conv.inner = untag_ptr(this_ptr);
42456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42458         this_ptr_conv.is_owned = false;
42459         LDKPublicKey val_ref;
42460         CHECK(val->arr_len == 33);
42461         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42462         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42463 }
42464
42465 int8_tArray  CS_LDK_OpenChannelV2_get_htlc_basepoint(int64_t this_ptr) {
42466         LDKOpenChannelV2 this_ptr_conv;
42467         this_ptr_conv.inner = untag_ptr(this_ptr);
42468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42470         this_ptr_conv.is_owned = false;
42471         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42472         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42473         return ret_arr;
42474 }
42475
42476 void  CS_LDK_OpenChannelV2_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
42477         LDKOpenChannelV2 this_ptr_conv;
42478         this_ptr_conv.inner = untag_ptr(this_ptr);
42479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42481         this_ptr_conv.is_owned = false;
42482         LDKPublicKey val_ref;
42483         CHECK(val->arr_len == 33);
42484         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42485         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
42486 }
42487
42488 int8_tArray  CS_LDK_OpenChannelV2_get_first_per_commitment_point(int64_t this_ptr) {
42489         LDKOpenChannelV2 this_ptr_conv;
42490         this_ptr_conv.inner = untag_ptr(this_ptr);
42491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42493         this_ptr_conv.is_owned = false;
42494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42495         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42496         return ret_arr;
42497 }
42498
42499 void  CS_LDK_OpenChannelV2_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
42500         LDKOpenChannelV2 this_ptr_conv;
42501         this_ptr_conv.inner = untag_ptr(this_ptr);
42502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42504         this_ptr_conv.is_owned = false;
42505         LDKPublicKey val_ref;
42506         CHECK(val->arr_len == 33);
42507         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42508         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
42509 }
42510
42511 int8_tArray  CS_LDK_OpenChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
42512         LDKOpenChannelV2 this_ptr_conv;
42513         this_ptr_conv.inner = untag_ptr(this_ptr);
42514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42516         this_ptr_conv.is_owned = false;
42517         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42518         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
42519         return ret_arr;
42520 }
42521
42522 void  CS_LDK_OpenChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
42523         LDKOpenChannelV2 this_ptr_conv;
42524         this_ptr_conv.inner = untag_ptr(this_ptr);
42525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42527         this_ptr_conv.is_owned = false;
42528         LDKPublicKey val_ref;
42529         CHECK(val->arr_len == 33);
42530         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42531         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
42532 }
42533
42534 int8_t  CS_LDK_OpenChannelV2_get_channel_flags(int64_t this_ptr) {
42535         LDKOpenChannelV2 this_ptr_conv;
42536         this_ptr_conv.inner = untag_ptr(this_ptr);
42537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42539         this_ptr_conv.is_owned = false;
42540         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
42541         return ret_conv;
42542 }
42543
42544 void  CS_LDK_OpenChannelV2_set_channel_flags(int64_t this_ptr, int8_t val) {
42545         LDKOpenChannelV2 this_ptr_conv;
42546         this_ptr_conv.inner = untag_ptr(this_ptr);
42547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42549         this_ptr_conv.is_owned = false;
42550         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
42551 }
42552
42553 int64_t  CS_LDK_OpenChannelV2_get_shutdown_scriptpubkey(int64_t this_ptr) {
42554         LDKOpenChannelV2 this_ptr_conv;
42555         this_ptr_conv.inner = untag_ptr(this_ptr);
42556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42558         this_ptr_conv.is_owned = false;
42559         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
42560         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
42561         int64_t ret_ref = tag_ptr(ret_copy, true);
42562         return ret_ref;
42563 }
42564
42565 void  CS_LDK_OpenChannelV2_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
42566         LDKOpenChannelV2 this_ptr_conv;
42567         this_ptr_conv.inner = untag_ptr(this_ptr);
42568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42570         this_ptr_conv.is_owned = false;
42571         void* val_ptr = untag_ptr(val);
42572         CHECK_ACCESS(val_ptr);
42573         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
42574         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
42575         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
42576 }
42577
42578 int64_t  CS_LDK_OpenChannelV2_get_channel_type(int64_t this_ptr) {
42579         LDKOpenChannelV2 this_ptr_conv;
42580         this_ptr_conv.inner = untag_ptr(this_ptr);
42581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42583         this_ptr_conv.is_owned = false;
42584         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
42585         int64_t ret_ref = 0;
42586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42588         return ret_ref;
42589 }
42590
42591 void  CS_LDK_OpenChannelV2_set_channel_type(int64_t this_ptr, int64_t val) {
42592         LDKOpenChannelV2 this_ptr_conv;
42593         this_ptr_conv.inner = untag_ptr(this_ptr);
42594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42596         this_ptr_conv.is_owned = false;
42597         LDKChannelTypeFeatures val_conv;
42598         val_conv.inner = untag_ptr(val);
42599         val_conv.is_owned = ptr_is_owned(val);
42600         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42601         val_conv = ChannelTypeFeatures_clone(&val_conv);
42602         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
42603 }
42604
42605 int32_t  CS_LDK_OpenChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
42606         LDKOpenChannelV2 this_ptr_conv;
42607         this_ptr_conv.inner = untag_ptr(this_ptr);
42608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42610         this_ptr_conv.is_owned = false;
42611         int32_t ret_conv = LDKCOption_NoneZ_to_cs(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
42612         return ret_conv;
42613 }
42614
42615 void  CS_LDK_OpenChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
42616         LDKOpenChannelV2 this_ptr_conv;
42617         this_ptr_conv.inner = untag_ptr(this_ptr);
42618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42620         this_ptr_conv.is_owned = false;
42621         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
42622         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
42623 }
42624
42625 int64_t  CS_LDK_OpenChannelV2_new(int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, int32_t require_confirmed_inputs_arg) {
42626         LDKThirtyTwoBytes chain_hash_arg_ref;
42627         CHECK(chain_hash_arg->arr_len == 32);
42628         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42629         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42630         CHECK(temporary_channel_id_arg->arr_len == 32);
42631         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
42632         LDKPublicKey funding_pubkey_arg_ref;
42633         CHECK(funding_pubkey_arg->arr_len == 33);
42634         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
42635         LDKPublicKey revocation_basepoint_arg_ref;
42636         CHECK(revocation_basepoint_arg->arr_len == 33);
42637         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
42638         LDKPublicKey payment_basepoint_arg_ref;
42639         CHECK(payment_basepoint_arg->arr_len == 33);
42640         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
42641         LDKPublicKey delayed_payment_basepoint_arg_ref;
42642         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
42643         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
42644         LDKPublicKey htlc_basepoint_arg_ref;
42645         CHECK(htlc_basepoint_arg->arr_len == 33);
42646         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
42647         LDKPublicKey first_per_commitment_point_arg_ref;
42648         CHECK(first_per_commitment_point_arg->arr_len == 33);
42649         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
42650         LDKPublicKey second_per_commitment_point_arg_ref;
42651         CHECK(second_per_commitment_point_arg->arr_len == 33);
42652         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
42653         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42654         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42655         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
42656         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
42657         LDKChannelTypeFeatures channel_type_arg_conv;
42658         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42659         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42661         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42662         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
42663         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
42664         int64_t ret_ref = 0;
42665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42667         return ret_ref;
42668 }
42669
42670 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
42671         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
42672         int64_t ret_ref = 0;
42673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42675         return ret_ref;
42676 }
42677 int64_t  CS_LDK_OpenChannelV2_clone_ptr(int64_t arg) {
42678         LDKOpenChannelV2 arg_conv;
42679         arg_conv.inner = untag_ptr(arg);
42680         arg_conv.is_owned = ptr_is_owned(arg);
42681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42682         arg_conv.is_owned = false;
42683         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
42684         return ret_conv;
42685 }
42686
42687 int64_t  CS_LDK_OpenChannelV2_clone(int64_t orig) {
42688         LDKOpenChannelV2 orig_conv;
42689         orig_conv.inner = untag_ptr(orig);
42690         orig_conv.is_owned = ptr_is_owned(orig);
42691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42692         orig_conv.is_owned = false;
42693         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
42694         int64_t ret_ref = 0;
42695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42697         return ret_ref;
42698 }
42699
42700 int64_t  CS_LDK_OpenChannelV2_hash(int64_t o) {
42701         LDKOpenChannelV2 o_conv;
42702         o_conv.inner = untag_ptr(o);
42703         o_conv.is_owned = ptr_is_owned(o);
42704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42705         o_conv.is_owned = false;
42706         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
42707         return ret_conv;
42708 }
42709
42710 jboolean  CS_LDK_OpenChannelV2_eq(int64_t a, int64_t b) {
42711         LDKOpenChannelV2 a_conv;
42712         a_conv.inner = untag_ptr(a);
42713         a_conv.is_owned = ptr_is_owned(a);
42714         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42715         a_conv.is_owned = false;
42716         LDKOpenChannelV2 b_conv;
42717         b_conv.inner = untag_ptr(b);
42718         b_conv.is_owned = ptr_is_owned(b);
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42720         b_conv.is_owned = false;
42721         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
42722         return ret_conv;
42723 }
42724
42725 void  CS_LDK_AcceptChannel_free(int64_t this_obj) {
42726         LDKAcceptChannel this_obj_conv;
42727         this_obj_conv.inner = untag_ptr(this_obj);
42728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42730         AcceptChannel_free(this_obj_conv);
42731 }
42732
42733 int8_tArray  CS_LDK_AcceptChannel_get_temporary_channel_id(int64_t this_ptr) {
42734         LDKAcceptChannel this_ptr_conv;
42735         this_ptr_conv.inner = untag_ptr(this_ptr);
42736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42738         this_ptr_conv.is_owned = false;
42739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42740         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
42741         return ret_arr;
42742 }
42743
42744 void  CS_LDK_AcceptChannel_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
42745         LDKAcceptChannel this_ptr_conv;
42746         this_ptr_conv.inner = untag_ptr(this_ptr);
42747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42749         this_ptr_conv.is_owned = false;
42750         LDKThirtyTwoBytes val_ref;
42751         CHECK(val->arr_len == 32);
42752         memcpy(val_ref.data, val->elems, 32); FREE(val);
42753         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
42754 }
42755
42756 int64_t  CS_LDK_AcceptChannel_get_dust_limit_satoshis(int64_t this_ptr) {
42757         LDKAcceptChannel this_ptr_conv;
42758         this_ptr_conv.inner = untag_ptr(this_ptr);
42759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42761         this_ptr_conv.is_owned = false;
42762         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
42763         return ret_conv;
42764 }
42765
42766 void  CS_LDK_AcceptChannel_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
42767         LDKAcceptChannel this_ptr_conv;
42768         this_ptr_conv.inner = untag_ptr(this_ptr);
42769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42771         this_ptr_conv.is_owned = false;
42772         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
42773 }
42774
42775 int64_t  CS_LDK_AcceptChannel_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
42776         LDKAcceptChannel this_ptr_conv;
42777         this_ptr_conv.inner = untag_ptr(this_ptr);
42778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42780         this_ptr_conv.is_owned = false;
42781         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
42782         return ret_conv;
42783 }
42784
42785 void  CS_LDK_AcceptChannel_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
42786         LDKAcceptChannel this_ptr_conv;
42787         this_ptr_conv.inner = untag_ptr(this_ptr);
42788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42790         this_ptr_conv.is_owned = false;
42791         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42792 }
42793
42794 int64_t  CS_LDK_AcceptChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
42795         LDKAcceptChannel this_ptr_conv;
42796         this_ptr_conv.inner = untag_ptr(this_ptr);
42797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42799         this_ptr_conv.is_owned = false;
42800         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
42801         return ret_conv;
42802 }
42803
42804 void  CS_LDK_AcceptChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
42805         LDKAcceptChannel this_ptr_conv;
42806         this_ptr_conv.inner = untag_ptr(this_ptr);
42807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42809         this_ptr_conv.is_owned = false;
42810         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
42811 }
42812
42813 int64_t  CS_LDK_AcceptChannel_get_htlc_minimum_msat(int64_t this_ptr) {
42814         LDKAcceptChannel this_ptr_conv;
42815         this_ptr_conv.inner = untag_ptr(this_ptr);
42816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42818         this_ptr_conv.is_owned = false;
42819         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
42820         return ret_conv;
42821 }
42822
42823 void  CS_LDK_AcceptChannel_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
42824         LDKAcceptChannel this_ptr_conv;
42825         this_ptr_conv.inner = untag_ptr(this_ptr);
42826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42828         this_ptr_conv.is_owned = false;
42829         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
42830 }
42831
42832 int32_t  CS_LDK_AcceptChannel_get_minimum_depth(int64_t this_ptr) {
42833         LDKAcceptChannel this_ptr_conv;
42834         this_ptr_conv.inner = untag_ptr(this_ptr);
42835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42837         this_ptr_conv.is_owned = false;
42838         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
42839         return ret_conv;
42840 }
42841
42842 void  CS_LDK_AcceptChannel_set_minimum_depth(int64_t this_ptr, int32_t val) {
42843         LDKAcceptChannel this_ptr_conv;
42844         this_ptr_conv.inner = untag_ptr(this_ptr);
42845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42847         this_ptr_conv.is_owned = false;
42848         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
42849 }
42850
42851 int16_t  CS_LDK_AcceptChannel_get_to_self_delay(int64_t this_ptr) {
42852         LDKAcceptChannel this_ptr_conv;
42853         this_ptr_conv.inner = untag_ptr(this_ptr);
42854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42856         this_ptr_conv.is_owned = false;
42857         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
42858         return ret_conv;
42859 }
42860
42861 void  CS_LDK_AcceptChannel_set_to_self_delay(int64_t this_ptr, int16_t val) {
42862         LDKAcceptChannel this_ptr_conv;
42863         this_ptr_conv.inner = untag_ptr(this_ptr);
42864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42866         this_ptr_conv.is_owned = false;
42867         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
42868 }
42869
42870 int16_t  CS_LDK_AcceptChannel_get_max_accepted_htlcs(int64_t this_ptr) {
42871         LDKAcceptChannel this_ptr_conv;
42872         this_ptr_conv.inner = untag_ptr(this_ptr);
42873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42875         this_ptr_conv.is_owned = false;
42876         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
42877         return ret_conv;
42878 }
42879
42880 void  CS_LDK_AcceptChannel_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
42881         LDKAcceptChannel this_ptr_conv;
42882         this_ptr_conv.inner = untag_ptr(this_ptr);
42883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42885         this_ptr_conv.is_owned = false;
42886         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
42887 }
42888
42889 int8_tArray  CS_LDK_AcceptChannel_get_funding_pubkey(int64_t this_ptr) {
42890         LDKAcceptChannel this_ptr_conv;
42891         this_ptr_conv.inner = untag_ptr(this_ptr);
42892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42894         this_ptr_conv.is_owned = false;
42895         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42896         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
42897         return ret_arr;
42898 }
42899
42900 void  CS_LDK_AcceptChannel_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
42901         LDKAcceptChannel this_ptr_conv;
42902         this_ptr_conv.inner = untag_ptr(this_ptr);
42903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42905         this_ptr_conv.is_owned = false;
42906         LDKPublicKey val_ref;
42907         CHECK(val->arr_len == 33);
42908         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42909         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
42910 }
42911
42912 int8_tArray  CS_LDK_AcceptChannel_get_revocation_basepoint(int64_t this_ptr) {
42913         LDKAcceptChannel this_ptr_conv;
42914         this_ptr_conv.inner = untag_ptr(this_ptr);
42915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42917         this_ptr_conv.is_owned = false;
42918         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42919         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
42920         return ret_arr;
42921 }
42922
42923 void  CS_LDK_AcceptChannel_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
42924         LDKAcceptChannel this_ptr_conv;
42925         this_ptr_conv.inner = untag_ptr(this_ptr);
42926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42928         this_ptr_conv.is_owned = false;
42929         LDKPublicKey val_ref;
42930         CHECK(val->arr_len == 33);
42931         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42932         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
42933 }
42934
42935 int8_tArray  CS_LDK_AcceptChannel_get_payment_point(int64_t this_ptr) {
42936         LDKAcceptChannel this_ptr_conv;
42937         this_ptr_conv.inner = untag_ptr(this_ptr);
42938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42940         this_ptr_conv.is_owned = false;
42941         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42942         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
42943         return ret_arr;
42944 }
42945
42946 void  CS_LDK_AcceptChannel_set_payment_point(int64_t this_ptr, int8_tArray val) {
42947         LDKAcceptChannel this_ptr_conv;
42948         this_ptr_conv.inner = untag_ptr(this_ptr);
42949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42951         this_ptr_conv.is_owned = false;
42952         LDKPublicKey val_ref;
42953         CHECK(val->arr_len == 33);
42954         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42955         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
42956 }
42957
42958 int8_tArray  CS_LDK_AcceptChannel_get_delayed_payment_basepoint(int64_t this_ptr) {
42959         LDKAcceptChannel this_ptr_conv;
42960         this_ptr_conv.inner = untag_ptr(this_ptr);
42961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42963         this_ptr_conv.is_owned = false;
42964         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42965         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
42966         return ret_arr;
42967 }
42968
42969 void  CS_LDK_AcceptChannel_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
42970         LDKAcceptChannel this_ptr_conv;
42971         this_ptr_conv.inner = untag_ptr(this_ptr);
42972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42974         this_ptr_conv.is_owned = false;
42975         LDKPublicKey val_ref;
42976         CHECK(val->arr_len == 33);
42977         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42978         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
42979 }
42980
42981 int8_tArray  CS_LDK_AcceptChannel_get_htlc_basepoint(int64_t this_ptr) {
42982         LDKAcceptChannel this_ptr_conv;
42983         this_ptr_conv.inner = untag_ptr(this_ptr);
42984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42986         this_ptr_conv.is_owned = false;
42987         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42988         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
42989         return ret_arr;
42990 }
42991
42992 void  CS_LDK_AcceptChannel_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
42993         LDKAcceptChannel this_ptr_conv;
42994         this_ptr_conv.inner = untag_ptr(this_ptr);
42995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42997         this_ptr_conv.is_owned = false;
42998         LDKPublicKey val_ref;
42999         CHECK(val->arr_len == 33);
43000         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43001         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
43002 }
43003
43004 int8_tArray  CS_LDK_AcceptChannel_get_first_per_commitment_point(int64_t this_ptr) {
43005         LDKAcceptChannel this_ptr_conv;
43006         this_ptr_conv.inner = untag_ptr(this_ptr);
43007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43009         this_ptr_conv.is_owned = false;
43010         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43011         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43012         return ret_arr;
43013 }
43014
43015 void  CS_LDK_AcceptChannel_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43016         LDKAcceptChannel this_ptr_conv;
43017         this_ptr_conv.inner = untag_ptr(this_ptr);
43018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43020         this_ptr_conv.is_owned = false;
43021         LDKPublicKey val_ref;
43022         CHECK(val->arr_len == 33);
43023         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43024         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43025 }
43026
43027 int64_t  CS_LDK_AcceptChannel_get_shutdown_scriptpubkey(int64_t this_ptr) {
43028         LDKAcceptChannel this_ptr_conv;
43029         this_ptr_conv.inner = untag_ptr(this_ptr);
43030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43032         this_ptr_conv.is_owned = false;
43033         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43034         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
43035         int64_t ret_ref = tag_ptr(ret_copy, true);
43036         return ret_ref;
43037 }
43038
43039 void  CS_LDK_AcceptChannel_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
43040         LDKAcceptChannel this_ptr_conv;
43041         this_ptr_conv.inner = untag_ptr(this_ptr);
43042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43044         this_ptr_conv.is_owned = false;
43045         void* val_ptr = untag_ptr(val);
43046         CHECK_ACCESS(val_ptr);
43047         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43048         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43049         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43050 }
43051
43052 int64_t  CS_LDK_AcceptChannel_get_channel_type(int64_t this_ptr) {
43053         LDKAcceptChannel this_ptr_conv;
43054         this_ptr_conv.inner = untag_ptr(this_ptr);
43055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43057         this_ptr_conv.is_owned = false;
43058         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
43059         int64_t ret_ref = 0;
43060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43062         return ret_ref;
43063 }
43064
43065 void  CS_LDK_AcceptChannel_set_channel_type(int64_t this_ptr, int64_t val) {
43066         LDKAcceptChannel this_ptr_conv;
43067         this_ptr_conv.inner = untag_ptr(this_ptr);
43068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43070         this_ptr_conv.is_owned = false;
43071         LDKChannelTypeFeatures val_conv;
43072         val_conv.inner = untag_ptr(val);
43073         val_conv.is_owned = ptr_is_owned(val);
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43075         val_conv = ChannelTypeFeatures_clone(&val_conv);
43076         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
43077 }
43078
43079 int64_t  CS_LDK_AcceptChannel_new(int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
43080         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43081         CHECK(temporary_channel_id_arg->arr_len == 32);
43082         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43083         LDKPublicKey funding_pubkey_arg_ref;
43084         CHECK(funding_pubkey_arg->arr_len == 33);
43085         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43086         LDKPublicKey revocation_basepoint_arg_ref;
43087         CHECK(revocation_basepoint_arg->arr_len == 33);
43088         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43089         LDKPublicKey payment_point_arg_ref;
43090         CHECK(payment_point_arg->arr_len == 33);
43091         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
43092         LDKPublicKey delayed_payment_basepoint_arg_ref;
43093         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43094         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43095         LDKPublicKey htlc_basepoint_arg_ref;
43096         CHECK(htlc_basepoint_arg->arr_len == 33);
43097         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43098         LDKPublicKey first_per_commitment_point_arg_ref;
43099         CHECK(first_per_commitment_point_arg->arr_len == 33);
43100         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43101         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43102         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43103         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43104         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43105         LDKChannelTypeFeatures channel_type_arg_conv;
43106         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43107         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43108         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43109         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43110         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
43111         int64_t ret_ref = 0;
43112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43114         return ret_ref;
43115 }
43116
43117 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
43118         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
43119         int64_t ret_ref = 0;
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43122         return ret_ref;
43123 }
43124 int64_t  CS_LDK_AcceptChannel_clone_ptr(int64_t arg) {
43125         LDKAcceptChannel arg_conv;
43126         arg_conv.inner = untag_ptr(arg);
43127         arg_conv.is_owned = ptr_is_owned(arg);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43129         arg_conv.is_owned = false;
43130         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
43131         return ret_conv;
43132 }
43133
43134 int64_t  CS_LDK_AcceptChannel_clone(int64_t orig) {
43135         LDKAcceptChannel orig_conv;
43136         orig_conv.inner = untag_ptr(orig);
43137         orig_conv.is_owned = ptr_is_owned(orig);
43138         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43139         orig_conv.is_owned = false;
43140         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
43141         int64_t ret_ref = 0;
43142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43144         return ret_ref;
43145 }
43146
43147 int64_t  CS_LDK_AcceptChannel_hash(int64_t o) {
43148         LDKAcceptChannel o_conv;
43149         o_conv.inner = untag_ptr(o);
43150         o_conv.is_owned = ptr_is_owned(o);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43152         o_conv.is_owned = false;
43153         int64_t ret_conv = AcceptChannel_hash(&o_conv);
43154         return ret_conv;
43155 }
43156
43157 jboolean  CS_LDK_AcceptChannel_eq(int64_t a, int64_t b) {
43158         LDKAcceptChannel a_conv;
43159         a_conv.inner = untag_ptr(a);
43160         a_conv.is_owned = ptr_is_owned(a);
43161         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43162         a_conv.is_owned = false;
43163         LDKAcceptChannel b_conv;
43164         b_conv.inner = untag_ptr(b);
43165         b_conv.is_owned = ptr_is_owned(b);
43166         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43167         b_conv.is_owned = false;
43168         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
43169         return ret_conv;
43170 }
43171
43172 void  CS_LDK_AcceptChannelV2_free(int64_t this_obj) {
43173         LDKAcceptChannelV2 this_obj_conv;
43174         this_obj_conv.inner = untag_ptr(this_obj);
43175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43177         AcceptChannelV2_free(this_obj_conv);
43178 }
43179
43180 int8_tArray  CS_LDK_AcceptChannelV2_get_temporary_channel_id(int64_t this_ptr) {
43181         LDKAcceptChannelV2 this_ptr_conv;
43182         this_ptr_conv.inner = untag_ptr(this_ptr);
43183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43185         this_ptr_conv.is_owned = false;
43186         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43187         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
43188         return ret_arr;
43189 }
43190
43191 void  CS_LDK_AcceptChannelV2_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
43192         LDKAcceptChannelV2 this_ptr_conv;
43193         this_ptr_conv.inner = untag_ptr(this_ptr);
43194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43196         this_ptr_conv.is_owned = false;
43197         LDKThirtyTwoBytes val_ref;
43198         CHECK(val->arr_len == 32);
43199         memcpy(val_ref.data, val->elems, 32); FREE(val);
43200         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
43201 }
43202
43203 int64_t  CS_LDK_AcceptChannelV2_get_funding_satoshis(int64_t this_ptr) {
43204         LDKAcceptChannelV2 this_ptr_conv;
43205         this_ptr_conv.inner = untag_ptr(this_ptr);
43206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43208         this_ptr_conv.is_owned = false;
43209         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
43210         return ret_conv;
43211 }
43212
43213 void  CS_LDK_AcceptChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
43214         LDKAcceptChannelV2 this_ptr_conv;
43215         this_ptr_conv.inner = untag_ptr(this_ptr);
43216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43218         this_ptr_conv.is_owned = false;
43219         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
43220 }
43221
43222 int64_t  CS_LDK_AcceptChannelV2_get_dust_limit_satoshis(int64_t this_ptr) {
43223         LDKAcceptChannelV2 this_ptr_conv;
43224         this_ptr_conv.inner = untag_ptr(this_ptr);
43225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43227         this_ptr_conv.is_owned = false;
43228         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
43229         return ret_conv;
43230 }
43231
43232 void  CS_LDK_AcceptChannelV2_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
43233         LDKAcceptChannelV2 this_ptr_conv;
43234         this_ptr_conv.inner = untag_ptr(this_ptr);
43235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43237         this_ptr_conv.is_owned = false;
43238         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
43239 }
43240
43241 int64_t  CS_LDK_AcceptChannelV2_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
43242         LDKAcceptChannelV2 this_ptr_conv;
43243         this_ptr_conv.inner = untag_ptr(this_ptr);
43244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43246         this_ptr_conv.is_owned = false;
43247         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
43248         return ret_conv;
43249 }
43250
43251 void  CS_LDK_AcceptChannelV2_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
43252         LDKAcceptChannelV2 this_ptr_conv;
43253         this_ptr_conv.inner = untag_ptr(this_ptr);
43254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43256         this_ptr_conv.is_owned = false;
43257         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
43258 }
43259
43260 int64_t  CS_LDK_AcceptChannelV2_get_htlc_minimum_msat(int64_t this_ptr) {
43261         LDKAcceptChannelV2 this_ptr_conv;
43262         this_ptr_conv.inner = untag_ptr(this_ptr);
43263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43265         this_ptr_conv.is_owned = false;
43266         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
43267         return ret_conv;
43268 }
43269
43270 void  CS_LDK_AcceptChannelV2_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
43271         LDKAcceptChannelV2 this_ptr_conv;
43272         this_ptr_conv.inner = untag_ptr(this_ptr);
43273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43275         this_ptr_conv.is_owned = false;
43276         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
43277 }
43278
43279 int32_t  CS_LDK_AcceptChannelV2_get_minimum_depth(int64_t this_ptr) {
43280         LDKAcceptChannelV2 this_ptr_conv;
43281         this_ptr_conv.inner = untag_ptr(this_ptr);
43282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43284         this_ptr_conv.is_owned = false;
43285         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
43286         return ret_conv;
43287 }
43288
43289 void  CS_LDK_AcceptChannelV2_set_minimum_depth(int64_t this_ptr, int32_t val) {
43290         LDKAcceptChannelV2 this_ptr_conv;
43291         this_ptr_conv.inner = untag_ptr(this_ptr);
43292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43294         this_ptr_conv.is_owned = false;
43295         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
43296 }
43297
43298 int16_t  CS_LDK_AcceptChannelV2_get_to_self_delay(int64_t this_ptr) {
43299         LDKAcceptChannelV2 this_ptr_conv;
43300         this_ptr_conv.inner = untag_ptr(this_ptr);
43301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43303         this_ptr_conv.is_owned = false;
43304         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
43305         return ret_conv;
43306 }
43307
43308 void  CS_LDK_AcceptChannelV2_set_to_self_delay(int64_t this_ptr, int16_t val) {
43309         LDKAcceptChannelV2 this_ptr_conv;
43310         this_ptr_conv.inner = untag_ptr(this_ptr);
43311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43313         this_ptr_conv.is_owned = false;
43314         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
43315 }
43316
43317 int16_t  CS_LDK_AcceptChannelV2_get_max_accepted_htlcs(int64_t this_ptr) {
43318         LDKAcceptChannelV2 this_ptr_conv;
43319         this_ptr_conv.inner = untag_ptr(this_ptr);
43320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43322         this_ptr_conv.is_owned = false;
43323         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
43324         return ret_conv;
43325 }
43326
43327 void  CS_LDK_AcceptChannelV2_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
43328         LDKAcceptChannelV2 this_ptr_conv;
43329         this_ptr_conv.inner = untag_ptr(this_ptr);
43330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43332         this_ptr_conv.is_owned = false;
43333         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
43334 }
43335
43336 int8_tArray  CS_LDK_AcceptChannelV2_get_funding_pubkey(int64_t this_ptr) {
43337         LDKAcceptChannelV2 this_ptr_conv;
43338         this_ptr_conv.inner = untag_ptr(this_ptr);
43339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43341         this_ptr_conv.is_owned = false;
43342         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43343         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
43344         return ret_arr;
43345 }
43346
43347 void  CS_LDK_AcceptChannelV2_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
43348         LDKAcceptChannelV2 this_ptr_conv;
43349         this_ptr_conv.inner = untag_ptr(this_ptr);
43350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43352         this_ptr_conv.is_owned = false;
43353         LDKPublicKey val_ref;
43354         CHECK(val->arr_len == 33);
43355         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43356         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
43357 }
43358
43359 int8_tArray  CS_LDK_AcceptChannelV2_get_revocation_basepoint(int64_t this_ptr) {
43360         LDKAcceptChannelV2 this_ptr_conv;
43361         this_ptr_conv.inner = untag_ptr(this_ptr);
43362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43364         this_ptr_conv.is_owned = false;
43365         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43366         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
43367         return ret_arr;
43368 }
43369
43370 void  CS_LDK_AcceptChannelV2_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
43371         LDKAcceptChannelV2 this_ptr_conv;
43372         this_ptr_conv.inner = untag_ptr(this_ptr);
43373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43375         this_ptr_conv.is_owned = false;
43376         LDKPublicKey val_ref;
43377         CHECK(val->arr_len == 33);
43378         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43379         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
43380 }
43381
43382 int8_tArray  CS_LDK_AcceptChannelV2_get_payment_basepoint(int64_t this_ptr) {
43383         LDKAcceptChannelV2 this_ptr_conv;
43384         this_ptr_conv.inner = untag_ptr(this_ptr);
43385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43387         this_ptr_conv.is_owned = false;
43388         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43389         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43390         return ret_arr;
43391 }
43392
43393 void  CS_LDK_AcceptChannelV2_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
43394         LDKAcceptChannelV2 this_ptr_conv;
43395         this_ptr_conv.inner = untag_ptr(this_ptr);
43396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43398         this_ptr_conv.is_owned = false;
43399         LDKPublicKey val_ref;
43400         CHECK(val->arr_len == 33);
43401         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43402         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
43403 }
43404
43405 int8_tArray  CS_LDK_AcceptChannelV2_get_delayed_payment_basepoint(int64_t this_ptr) {
43406         LDKAcceptChannelV2 this_ptr_conv;
43407         this_ptr_conv.inner = untag_ptr(this_ptr);
43408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43410         this_ptr_conv.is_owned = false;
43411         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43412         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
43413         return ret_arr;
43414 }
43415
43416 void  CS_LDK_AcceptChannelV2_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
43417         LDKAcceptChannelV2 this_ptr_conv;
43418         this_ptr_conv.inner = untag_ptr(this_ptr);
43419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43421         this_ptr_conv.is_owned = false;
43422         LDKPublicKey val_ref;
43423         CHECK(val->arr_len == 33);
43424         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43425         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
43426 }
43427
43428 int8_tArray  CS_LDK_AcceptChannelV2_get_htlc_basepoint(int64_t this_ptr) {
43429         LDKAcceptChannelV2 this_ptr_conv;
43430         this_ptr_conv.inner = untag_ptr(this_ptr);
43431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43433         this_ptr_conv.is_owned = false;
43434         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43435         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
43436         return ret_arr;
43437 }
43438
43439 void  CS_LDK_AcceptChannelV2_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
43440         LDKAcceptChannelV2 this_ptr_conv;
43441         this_ptr_conv.inner = untag_ptr(this_ptr);
43442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43444         this_ptr_conv.is_owned = false;
43445         LDKPublicKey val_ref;
43446         CHECK(val->arr_len == 33);
43447         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43448         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
43449 }
43450
43451 int8_tArray  CS_LDK_AcceptChannelV2_get_first_per_commitment_point(int64_t this_ptr) {
43452         LDKAcceptChannelV2 this_ptr_conv;
43453         this_ptr_conv.inner = untag_ptr(this_ptr);
43454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43456         this_ptr_conv.is_owned = false;
43457         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43458         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43459         return ret_arr;
43460 }
43461
43462 void  CS_LDK_AcceptChannelV2_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43463         LDKAcceptChannelV2 this_ptr_conv;
43464         this_ptr_conv.inner = untag_ptr(this_ptr);
43465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43467         this_ptr_conv.is_owned = false;
43468         LDKPublicKey val_ref;
43469         CHECK(val->arr_len == 33);
43470         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43471         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
43472 }
43473
43474 int8_tArray  CS_LDK_AcceptChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
43475         LDKAcceptChannelV2 this_ptr_conv;
43476         this_ptr_conv.inner = untag_ptr(this_ptr);
43477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43479         this_ptr_conv.is_owned = false;
43480         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43481         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43482         return ret_arr;
43483 }
43484
43485 void  CS_LDK_AcceptChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
43486         LDKAcceptChannelV2 this_ptr_conv;
43487         this_ptr_conv.inner = untag_ptr(this_ptr);
43488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43490         this_ptr_conv.is_owned = false;
43491         LDKPublicKey val_ref;
43492         CHECK(val->arr_len == 33);
43493         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43494         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
43495 }
43496
43497 int64_t  CS_LDK_AcceptChannelV2_get_shutdown_scriptpubkey(int64_t this_ptr) {
43498         LDKAcceptChannelV2 this_ptr_conv;
43499         this_ptr_conv.inner = untag_ptr(this_ptr);
43500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43502         this_ptr_conv.is_owned = false;
43503         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
43504         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
43505         int64_t ret_ref = tag_ptr(ret_copy, true);
43506         return ret_ref;
43507 }
43508
43509 void  CS_LDK_AcceptChannelV2_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
43510         LDKAcceptChannelV2 this_ptr_conv;
43511         this_ptr_conv.inner = untag_ptr(this_ptr);
43512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43514         this_ptr_conv.is_owned = false;
43515         void* val_ptr = untag_ptr(val);
43516         CHECK_ACCESS(val_ptr);
43517         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
43518         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
43519         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
43520 }
43521
43522 int64_t  CS_LDK_AcceptChannelV2_get_channel_type(int64_t this_ptr) {
43523         LDKAcceptChannelV2 this_ptr_conv;
43524         this_ptr_conv.inner = untag_ptr(this_ptr);
43525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43527         this_ptr_conv.is_owned = false;
43528         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
43529         int64_t ret_ref = 0;
43530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43532         return ret_ref;
43533 }
43534
43535 void  CS_LDK_AcceptChannelV2_set_channel_type(int64_t this_ptr, int64_t val) {
43536         LDKAcceptChannelV2 this_ptr_conv;
43537         this_ptr_conv.inner = untag_ptr(this_ptr);
43538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43540         this_ptr_conv.is_owned = false;
43541         LDKChannelTypeFeatures val_conv;
43542         val_conv.inner = untag_ptr(val);
43543         val_conv.is_owned = ptr_is_owned(val);
43544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43545         val_conv = ChannelTypeFeatures_clone(&val_conv);
43546         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
43547 }
43548
43549 int32_t  CS_LDK_AcceptChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
43550         LDKAcceptChannelV2 this_ptr_conv;
43551         this_ptr_conv.inner = untag_ptr(this_ptr);
43552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43554         this_ptr_conv.is_owned = false;
43555         int32_t ret_conv = LDKCOption_NoneZ_to_cs(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
43556         return ret_conv;
43557 }
43558
43559 void  CS_LDK_AcceptChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
43560         LDKAcceptChannelV2 this_ptr_conv;
43561         this_ptr_conv.inner = untag_ptr(this_ptr);
43562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43564         this_ptr_conv.is_owned = false;
43565         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
43566         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
43567 }
43568
43569 int64_t  CS_LDK_AcceptChannelV2_new(int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, int32_t require_confirmed_inputs_arg) {
43570         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43571         CHECK(temporary_channel_id_arg->arr_len == 32);
43572         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43573         LDKPublicKey funding_pubkey_arg_ref;
43574         CHECK(funding_pubkey_arg->arr_len == 33);
43575         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
43576         LDKPublicKey revocation_basepoint_arg_ref;
43577         CHECK(revocation_basepoint_arg->arr_len == 33);
43578         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
43579         LDKPublicKey payment_basepoint_arg_ref;
43580         CHECK(payment_basepoint_arg->arr_len == 33);
43581         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
43582         LDKPublicKey delayed_payment_basepoint_arg_ref;
43583         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
43584         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
43585         LDKPublicKey htlc_basepoint_arg_ref;
43586         CHECK(htlc_basepoint_arg->arr_len == 33);
43587         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
43588         LDKPublicKey first_per_commitment_point_arg_ref;
43589         CHECK(first_per_commitment_point_arg->arr_len == 33);
43590         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
43591         LDKPublicKey second_per_commitment_point_arg_ref;
43592         CHECK(second_per_commitment_point_arg->arr_len == 33);
43593         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
43594         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
43595         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
43596         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
43597         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
43598         LDKChannelTypeFeatures channel_type_arg_conv;
43599         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43600         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43602         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43603         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
43604         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
43605         int64_t ret_ref = 0;
43606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43608         return ret_ref;
43609 }
43610
43611 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
43612         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
43613         int64_t ret_ref = 0;
43614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43616         return ret_ref;
43617 }
43618 int64_t  CS_LDK_AcceptChannelV2_clone_ptr(int64_t arg) {
43619         LDKAcceptChannelV2 arg_conv;
43620         arg_conv.inner = untag_ptr(arg);
43621         arg_conv.is_owned = ptr_is_owned(arg);
43622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43623         arg_conv.is_owned = false;
43624         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
43625         return ret_conv;
43626 }
43627
43628 int64_t  CS_LDK_AcceptChannelV2_clone(int64_t orig) {
43629         LDKAcceptChannelV2 orig_conv;
43630         orig_conv.inner = untag_ptr(orig);
43631         orig_conv.is_owned = ptr_is_owned(orig);
43632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43633         orig_conv.is_owned = false;
43634         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
43635         int64_t ret_ref = 0;
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43638         return ret_ref;
43639 }
43640
43641 int64_t  CS_LDK_AcceptChannelV2_hash(int64_t o) {
43642         LDKAcceptChannelV2 o_conv;
43643         o_conv.inner = untag_ptr(o);
43644         o_conv.is_owned = ptr_is_owned(o);
43645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43646         o_conv.is_owned = false;
43647         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
43648         return ret_conv;
43649 }
43650
43651 jboolean  CS_LDK_AcceptChannelV2_eq(int64_t a, int64_t b) {
43652         LDKAcceptChannelV2 a_conv;
43653         a_conv.inner = untag_ptr(a);
43654         a_conv.is_owned = ptr_is_owned(a);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43656         a_conv.is_owned = false;
43657         LDKAcceptChannelV2 b_conv;
43658         b_conv.inner = untag_ptr(b);
43659         b_conv.is_owned = ptr_is_owned(b);
43660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43661         b_conv.is_owned = false;
43662         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
43663         return ret_conv;
43664 }
43665
43666 void  CS_LDK_FundingCreated_free(int64_t this_obj) {
43667         LDKFundingCreated this_obj_conv;
43668         this_obj_conv.inner = untag_ptr(this_obj);
43669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43671         FundingCreated_free(this_obj_conv);
43672 }
43673
43674 int8_tArray  CS_LDK_FundingCreated_get_temporary_channel_id(int64_t this_ptr) {
43675         LDKFundingCreated this_ptr_conv;
43676         this_ptr_conv.inner = untag_ptr(this_ptr);
43677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43679         this_ptr_conv.is_owned = false;
43680         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43681         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
43682         return ret_arr;
43683 }
43684
43685 void  CS_LDK_FundingCreated_set_temporary_channel_id(int64_t this_ptr, int8_tArray val) {
43686         LDKFundingCreated this_ptr_conv;
43687         this_ptr_conv.inner = untag_ptr(this_ptr);
43688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43690         this_ptr_conv.is_owned = false;
43691         LDKThirtyTwoBytes val_ref;
43692         CHECK(val->arr_len == 32);
43693         memcpy(val_ref.data, val->elems, 32); FREE(val);
43694         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
43695 }
43696
43697 int8_tArray  CS_LDK_FundingCreated_get_funding_txid(int64_t this_ptr) {
43698         LDKFundingCreated this_ptr_conv;
43699         this_ptr_conv.inner = untag_ptr(this_ptr);
43700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43702         this_ptr_conv.is_owned = false;
43703         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43704         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
43705         return ret_arr;
43706 }
43707
43708 void  CS_LDK_FundingCreated_set_funding_txid(int64_t this_ptr, int8_tArray val) {
43709         LDKFundingCreated this_ptr_conv;
43710         this_ptr_conv.inner = untag_ptr(this_ptr);
43711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43713         this_ptr_conv.is_owned = false;
43714         LDKThirtyTwoBytes val_ref;
43715         CHECK(val->arr_len == 32);
43716         memcpy(val_ref.data, val->elems, 32); FREE(val);
43717         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
43718 }
43719
43720 int16_t  CS_LDK_FundingCreated_get_funding_output_index(int64_t this_ptr) {
43721         LDKFundingCreated this_ptr_conv;
43722         this_ptr_conv.inner = untag_ptr(this_ptr);
43723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43725         this_ptr_conv.is_owned = false;
43726         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
43727         return ret_conv;
43728 }
43729
43730 void  CS_LDK_FundingCreated_set_funding_output_index(int64_t this_ptr, int16_t val) {
43731         LDKFundingCreated this_ptr_conv;
43732         this_ptr_conv.inner = untag_ptr(this_ptr);
43733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43735         this_ptr_conv.is_owned = false;
43736         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
43737 }
43738
43739 int8_tArray  CS_LDK_FundingCreated_get_signature(int64_t this_ptr) {
43740         LDKFundingCreated this_ptr_conv;
43741         this_ptr_conv.inner = untag_ptr(this_ptr);
43742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43744         this_ptr_conv.is_owned = false;
43745         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43746         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
43747         return ret_arr;
43748 }
43749
43750 void  CS_LDK_FundingCreated_set_signature(int64_t this_ptr, int8_tArray val) {
43751         LDKFundingCreated this_ptr_conv;
43752         this_ptr_conv.inner = untag_ptr(this_ptr);
43753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43755         this_ptr_conv.is_owned = false;
43756         LDKECDSASignature val_ref;
43757         CHECK(val->arr_len == 64);
43758         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43759         FundingCreated_set_signature(&this_ptr_conv, val_ref);
43760 }
43761
43762 int64_t  CS_LDK_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
43763         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
43764         CHECK(temporary_channel_id_arg->arr_len == 32);
43765         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
43766         LDKThirtyTwoBytes funding_txid_arg_ref;
43767         CHECK(funding_txid_arg->arr_len == 32);
43768         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
43769         LDKECDSASignature signature_arg_ref;
43770         CHECK(signature_arg->arr_len == 64);
43771         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43772         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
43773         int64_t ret_ref = 0;
43774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43776         return ret_ref;
43777 }
43778
43779 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
43780         LDKFundingCreated ret_var = FundingCreated_clone(arg);
43781         int64_t ret_ref = 0;
43782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43784         return ret_ref;
43785 }
43786 int64_t  CS_LDK_FundingCreated_clone_ptr(int64_t arg) {
43787         LDKFundingCreated arg_conv;
43788         arg_conv.inner = untag_ptr(arg);
43789         arg_conv.is_owned = ptr_is_owned(arg);
43790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43791         arg_conv.is_owned = false;
43792         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
43793         return ret_conv;
43794 }
43795
43796 int64_t  CS_LDK_FundingCreated_clone(int64_t orig) {
43797         LDKFundingCreated orig_conv;
43798         orig_conv.inner = untag_ptr(orig);
43799         orig_conv.is_owned = ptr_is_owned(orig);
43800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43801         orig_conv.is_owned = false;
43802         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
43803         int64_t ret_ref = 0;
43804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43806         return ret_ref;
43807 }
43808
43809 int64_t  CS_LDK_FundingCreated_hash(int64_t o) {
43810         LDKFundingCreated o_conv;
43811         o_conv.inner = untag_ptr(o);
43812         o_conv.is_owned = ptr_is_owned(o);
43813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43814         o_conv.is_owned = false;
43815         int64_t ret_conv = FundingCreated_hash(&o_conv);
43816         return ret_conv;
43817 }
43818
43819 jboolean  CS_LDK_FundingCreated_eq(int64_t a, int64_t b) {
43820         LDKFundingCreated a_conv;
43821         a_conv.inner = untag_ptr(a);
43822         a_conv.is_owned = ptr_is_owned(a);
43823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43824         a_conv.is_owned = false;
43825         LDKFundingCreated b_conv;
43826         b_conv.inner = untag_ptr(b);
43827         b_conv.is_owned = ptr_is_owned(b);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43829         b_conv.is_owned = false;
43830         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
43831         return ret_conv;
43832 }
43833
43834 void  CS_LDK_FundingSigned_free(int64_t this_obj) {
43835         LDKFundingSigned this_obj_conv;
43836         this_obj_conv.inner = untag_ptr(this_obj);
43837         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43839         FundingSigned_free(this_obj_conv);
43840 }
43841
43842 int8_tArray  CS_LDK_FundingSigned_get_channel_id(int64_t this_ptr) {
43843         LDKFundingSigned this_ptr_conv;
43844         this_ptr_conv.inner = untag_ptr(this_ptr);
43845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43847         this_ptr_conv.is_owned = false;
43848         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43849         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
43850         return ret_arr;
43851 }
43852
43853 void  CS_LDK_FundingSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
43854         LDKFundingSigned 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         LDKThirtyTwoBytes val_ref;
43860         CHECK(val->arr_len == 32);
43861         memcpy(val_ref.data, val->elems, 32); FREE(val);
43862         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
43863 }
43864
43865 int8_tArray  CS_LDK_FundingSigned_get_signature(int64_t this_ptr) {
43866         LDKFundingSigned this_ptr_conv;
43867         this_ptr_conv.inner = untag_ptr(this_ptr);
43868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43870         this_ptr_conv.is_owned = false;
43871         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
43872         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
43873         return ret_arr;
43874 }
43875
43876 void  CS_LDK_FundingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
43877         LDKFundingSigned this_ptr_conv;
43878         this_ptr_conv.inner = untag_ptr(this_ptr);
43879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43881         this_ptr_conv.is_owned = false;
43882         LDKECDSASignature val_ref;
43883         CHECK(val->arr_len == 64);
43884         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
43885         FundingSigned_set_signature(&this_ptr_conv, val_ref);
43886 }
43887
43888 int64_t  CS_LDK_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
43889         LDKThirtyTwoBytes channel_id_arg_ref;
43890         CHECK(channel_id_arg->arr_len == 32);
43891         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
43892         LDKECDSASignature signature_arg_ref;
43893         CHECK(signature_arg->arr_len == 64);
43894         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
43895         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
43896         int64_t ret_ref = 0;
43897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43899         return ret_ref;
43900 }
43901
43902 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
43903         LDKFundingSigned ret_var = FundingSigned_clone(arg);
43904         int64_t ret_ref = 0;
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43907         return ret_ref;
43908 }
43909 int64_t  CS_LDK_FundingSigned_clone_ptr(int64_t arg) {
43910         LDKFundingSigned arg_conv;
43911         arg_conv.inner = untag_ptr(arg);
43912         arg_conv.is_owned = ptr_is_owned(arg);
43913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43914         arg_conv.is_owned = false;
43915         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
43916         return ret_conv;
43917 }
43918
43919 int64_t  CS_LDK_FundingSigned_clone(int64_t orig) {
43920         LDKFundingSigned orig_conv;
43921         orig_conv.inner = untag_ptr(orig);
43922         orig_conv.is_owned = ptr_is_owned(orig);
43923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43924         orig_conv.is_owned = false;
43925         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
43926         int64_t ret_ref = 0;
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43929         return ret_ref;
43930 }
43931
43932 int64_t  CS_LDK_FundingSigned_hash(int64_t o) {
43933         LDKFundingSigned o_conv;
43934         o_conv.inner = untag_ptr(o);
43935         o_conv.is_owned = ptr_is_owned(o);
43936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43937         o_conv.is_owned = false;
43938         int64_t ret_conv = FundingSigned_hash(&o_conv);
43939         return ret_conv;
43940 }
43941
43942 jboolean  CS_LDK_FundingSigned_eq(int64_t a, int64_t b) {
43943         LDKFundingSigned a_conv;
43944         a_conv.inner = untag_ptr(a);
43945         a_conv.is_owned = ptr_is_owned(a);
43946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43947         a_conv.is_owned = false;
43948         LDKFundingSigned b_conv;
43949         b_conv.inner = untag_ptr(b);
43950         b_conv.is_owned = ptr_is_owned(b);
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43952         b_conv.is_owned = false;
43953         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
43954         return ret_conv;
43955 }
43956
43957 void  CS_LDK_ChannelReady_free(int64_t this_obj) {
43958         LDKChannelReady this_obj_conv;
43959         this_obj_conv.inner = untag_ptr(this_obj);
43960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43962         ChannelReady_free(this_obj_conv);
43963 }
43964
43965 int8_tArray  CS_LDK_ChannelReady_get_channel_id(int64_t this_ptr) {
43966         LDKChannelReady this_ptr_conv;
43967         this_ptr_conv.inner = untag_ptr(this_ptr);
43968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43970         this_ptr_conv.is_owned = false;
43971         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43972         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
43973         return ret_arr;
43974 }
43975
43976 void  CS_LDK_ChannelReady_set_channel_id(int64_t this_ptr, int8_tArray val) {
43977         LDKChannelReady this_ptr_conv;
43978         this_ptr_conv.inner = untag_ptr(this_ptr);
43979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43981         this_ptr_conv.is_owned = false;
43982         LDKThirtyTwoBytes val_ref;
43983         CHECK(val->arr_len == 32);
43984         memcpy(val_ref.data, val->elems, 32); FREE(val);
43985         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
43986 }
43987
43988 int8_tArray  CS_LDK_ChannelReady_get_next_per_commitment_point(int64_t this_ptr) {
43989         LDKChannelReady 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43995         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
43996         return ret_arr;
43997 }
43998
43999 void  CS_LDK_ChannelReady_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
44000         LDKChannelReady this_ptr_conv;
44001         this_ptr_conv.inner = untag_ptr(this_ptr);
44002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44004         this_ptr_conv.is_owned = false;
44005         LDKPublicKey val_ref;
44006         CHECK(val->arr_len == 33);
44007         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44008         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44009 }
44010
44011 int64_t  CS_LDK_ChannelReady_get_short_channel_id_alias(int64_t this_ptr) {
44012         LDKChannelReady this_ptr_conv;
44013         this_ptr_conv.inner = untag_ptr(this_ptr);
44014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44016         this_ptr_conv.is_owned = false;
44017         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44018         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
44019         int64_t ret_ref = tag_ptr(ret_copy, true);
44020         return ret_ref;
44021 }
44022
44023 void  CS_LDK_ChannelReady_set_short_channel_id_alias(int64_t this_ptr, int64_t val) {
44024         LDKChannelReady this_ptr_conv;
44025         this_ptr_conv.inner = untag_ptr(this_ptr);
44026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44028         this_ptr_conv.is_owned = false;
44029         void* val_ptr = untag_ptr(val);
44030         CHECK_ACCESS(val_ptr);
44031         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44032         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44033         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
44034 }
44035
44036 int64_t  CS_LDK_ChannelReady_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
44037         LDKThirtyTwoBytes channel_id_arg_ref;
44038         CHECK(channel_id_arg->arr_len == 32);
44039         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44040         LDKPublicKey next_per_commitment_point_arg_ref;
44041         CHECK(next_per_commitment_point_arg->arr_len == 33);
44042         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
44043         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
44044         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
44045         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
44046         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
44047         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
44048         int64_t ret_ref = 0;
44049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44051         return ret_ref;
44052 }
44053
44054 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
44055         LDKChannelReady ret_var = ChannelReady_clone(arg);
44056         int64_t ret_ref = 0;
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44059         return ret_ref;
44060 }
44061 int64_t  CS_LDK_ChannelReady_clone_ptr(int64_t arg) {
44062         LDKChannelReady arg_conv;
44063         arg_conv.inner = untag_ptr(arg);
44064         arg_conv.is_owned = ptr_is_owned(arg);
44065         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44066         arg_conv.is_owned = false;
44067         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
44068         return ret_conv;
44069 }
44070
44071 int64_t  CS_LDK_ChannelReady_clone(int64_t orig) {
44072         LDKChannelReady orig_conv;
44073         orig_conv.inner = untag_ptr(orig);
44074         orig_conv.is_owned = ptr_is_owned(orig);
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44076         orig_conv.is_owned = false;
44077         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
44078         int64_t ret_ref = 0;
44079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44081         return ret_ref;
44082 }
44083
44084 int64_t  CS_LDK_ChannelReady_hash(int64_t o) {
44085         LDKChannelReady o_conv;
44086         o_conv.inner = untag_ptr(o);
44087         o_conv.is_owned = ptr_is_owned(o);
44088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44089         o_conv.is_owned = false;
44090         int64_t ret_conv = ChannelReady_hash(&o_conv);
44091         return ret_conv;
44092 }
44093
44094 jboolean  CS_LDK_ChannelReady_eq(int64_t a, int64_t b) {
44095         LDKChannelReady a_conv;
44096         a_conv.inner = untag_ptr(a);
44097         a_conv.is_owned = ptr_is_owned(a);
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44099         a_conv.is_owned = false;
44100         LDKChannelReady b_conv;
44101         b_conv.inner = untag_ptr(b);
44102         b_conv.is_owned = ptr_is_owned(b);
44103         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44104         b_conv.is_owned = false;
44105         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
44106         return ret_conv;
44107 }
44108
44109 void  CS_LDK_Stfu_free(int64_t this_obj) {
44110         LDKStfu this_obj_conv;
44111         this_obj_conv.inner = untag_ptr(this_obj);
44112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44114         Stfu_free(this_obj_conv);
44115 }
44116
44117 int8_tArray  CS_LDK_Stfu_get_channel_id(int64_t this_ptr) {
44118         LDKStfu this_ptr_conv;
44119         this_ptr_conv.inner = untag_ptr(this_ptr);
44120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44122         this_ptr_conv.is_owned = false;
44123         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44124         memcpy(ret_arr->elems, *Stfu_get_channel_id(&this_ptr_conv), 32);
44125         return ret_arr;
44126 }
44127
44128 void  CS_LDK_Stfu_set_channel_id(int64_t this_ptr, int8_tArray val) {
44129         LDKStfu this_ptr_conv;
44130         this_ptr_conv.inner = untag_ptr(this_ptr);
44131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44133         this_ptr_conv.is_owned = false;
44134         LDKThirtyTwoBytes val_ref;
44135         CHECK(val->arr_len == 32);
44136         memcpy(val_ref.data, val->elems, 32); FREE(val);
44137         Stfu_set_channel_id(&this_ptr_conv, val_ref);
44138 }
44139
44140 int8_t  CS_LDK_Stfu_get_initiator(int64_t this_ptr) {
44141         LDKStfu this_ptr_conv;
44142         this_ptr_conv.inner = untag_ptr(this_ptr);
44143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44145         this_ptr_conv.is_owned = false;
44146         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
44147         return ret_conv;
44148 }
44149
44150 void  CS_LDK_Stfu_set_initiator(int64_t this_ptr, int8_t val) {
44151         LDKStfu this_ptr_conv;
44152         this_ptr_conv.inner = untag_ptr(this_ptr);
44153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44155         this_ptr_conv.is_owned = false;
44156         Stfu_set_initiator(&this_ptr_conv, val);
44157 }
44158
44159 int64_t  CS_LDK_Stfu_new(int8_tArray channel_id_arg, int8_t initiator_arg) {
44160         LDKThirtyTwoBytes channel_id_arg_ref;
44161         CHECK(channel_id_arg->arr_len == 32);
44162         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44163         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
44164         int64_t ret_ref = 0;
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44167         return ret_ref;
44168 }
44169
44170 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
44171         LDKStfu ret_var = Stfu_clone(arg);
44172         int64_t ret_ref = 0;
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44175         return ret_ref;
44176 }
44177 int64_t  CS_LDK_Stfu_clone_ptr(int64_t arg) {
44178         LDKStfu arg_conv;
44179         arg_conv.inner = untag_ptr(arg);
44180         arg_conv.is_owned = ptr_is_owned(arg);
44181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44182         arg_conv.is_owned = false;
44183         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
44184         return ret_conv;
44185 }
44186
44187 int64_t  CS_LDK_Stfu_clone(int64_t orig) {
44188         LDKStfu orig_conv;
44189         orig_conv.inner = untag_ptr(orig);
44190         orig_conv.is_owned = ptr_is_owned(orig);
44191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44192         orig_conv.is_owned = false;
44193         LDKStfu ret_var = Stfu_clone(&orig_conv);
44194         int64_t ret_ref = 0;
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44197         return ret_ref;
44198 }
44199
44200 jboolean  CS_LDK_Stfu_eq(int64_t a, int64_t b) {
44201         LDKStfu a_conv;
44202         a_conv.inner = untag_ptr(a);
44203         a_conv.is_owned = ptr_is_owned(a);
44204         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44205         a_conv.is_owned = false;
44206         LDKStfu b_conv;
44207         b_conv.inner = untag_ptr(b);
44208         b_conv.is_owned = ptr_is_owned(b);
44209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44210         b_conv.is_owned = false;
44211         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
44212         return ret_conv;
44213 }
44214
44215 void  CS_LDK_Splice_free(int64_t this_obj) {
44216         LDKSplice this_obj_conv;
44217         this_obj_conv.inner = untag_ptr(this_obj);
44218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44220         Splice_free(this_obj_conv);
44221 }
44222
44223 int8_tArray  CS_LDK_Splice_get_channel_id(int64_t this_ptr) {
44224         LDKSplice this_ptr_conv;
44225         this_ptr_conv.inner = untag_ptr(this_ptr);
44226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44228         this_ptr_conv.is_owned = false;
44229         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44230         memcpy(ret_arr->elems, *Splice_get_channel_id(&this_ptr_conv), 32);
44231         return ret_arr;
44232 }
44233
44234 void  CS_LDK_Splice_set_channel_id(int64_t this_ptr, int8_tArray val) {
44235         LDKSplice this_ptr_conv;
44236         this_ptr_conv.inner = untag_ptr(this_ptr);
44237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44239         this_ptr_conv.is_owned = false;
44240         LDKThirtyTwoBytes val_ref;
44241         CHECK(val->arr_len == 32);
44242         memcpy(val_ref.data, val->elems, 32); FREE(val);
44243         Splice_set_channel_id(&this_ptr_conv, val_ref);
44244 }
44245
44246 int8_tArray  CS_LDK_Splice_get_chain_hash(int64_t this_ptr) {
44247         LDKSplice this_ptr_conv;
44248         this_ptr_conv.inner = untag_ptr(this_ptr);
44249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44251         this_ptr_conv.is_owned = false;
44252         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44253         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
44254         return ret_arr;
44255 }
44256
44257 void  CS_LDK_Splice_set_chain_hash(int64_t this_ptr, int8_tArray val) {
44258         LDKSplice this_ptr_conv;
44259         this_ptr_conv.inner = untag_ptr(this_ptr);
44260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44262         this_ptr_conv.is_owned = false;
44263         LDKThirtyTwoBytes val_ref;
44264         CHECK(val->arr_len == 32);
44265         memcpy(val_ref.data, val->elems, 32); FREE(val);
44266         Splice_set_chain_hash(&this_ptr_conv, val_ref);
44267 }
44268
44269 int64_t  CS_LDK_Splice_get_relative_satoshis(int64_t this_ptr) {
44270         LDKSplice this_ptr_conv;
44271         this_ptr_conv.inner = untag_ptr(this_ptr);
44272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44274         this_ptr_conv.is_owned = false;
44275         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
44276         return ret_conv;
44277 }
44278
44279 void  CS_LDK_Splice_set_relative_satoshis(int64_t this_ptr, int64_t val) {
44280         LDKSplice this_ptr_conv;
44281         this_ptr_conv.inner = untag_ptr(this_ptr);
44282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44284         this_ptr_conv.is_owned = false;
44285         Splice_set_relative_satoshis(&this_ptr_conv, val);
44286 }
44287
44288 int32_t  CS_LDK_Splice_get_funding_feerate_perkw(int64_t this_ptr) {
44289         LDKSplice this_ptr_conv;
44290         this_ptr_conv.inner = untag_ptr(this_ptr);
44291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44293         this_ptr_conv.is_owned = false;
44294         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
44295         return ret_conv;
44296 }
44297
44298 void  CS_LDK_Splice_set_funding_feerate_perkw(int64_t this_ptr, int32_t val) {
44299         LDKSplice this_ptr_conv;
44300         this_ptr_conv.inner = untag_ptr(this_ptr);
44301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44303         this_ptr_conv.is_owned = false;
44304         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
44305 }
44306
44307 int32_t  CS_LDK_Splice_get_locktime(int64_t this_ptr) {
44308         LDKSplice this_ptr_conv;
44309         this_ptr_conv.inner = untag_ptr(this_ptr);
44310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44312         this_ptr_conv.is_owned = false;
44313         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
44314         return ret_conv;
44315 }
44316
44317 void  CS_LDK_Splice_set_locktime(int64_t this_ptr, int32_t val) {
44318         LDKSplice this_ptr_conv;
44319         this_ptr_conv.inner = untag_ptr(this_ptr);
44320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44322         this_ptr_conv.is_owned = false;
44323         Splice_set_locktime(&this_ptr_conv, val);
44324 }
44325
44326 int8_tArray  CS_LDK_Splice_get_funding_pubkey(int64_t this_ptr) {
44327         LDKSplice this_ptr_conv;
44328         this_ptr_conv.inner = untag_ptr(this_ptr);
44329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44331         this_ptr_conv.is_owned = false;
44332         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44333         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44334         return ret_arr;
44335 }
44336
44337 void  CS_LDK_Splice_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
44338         LDKSplice this_ptr_conv;
44339         this_ptr_conv.inner = untag_ptr(this_ptr);
44340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44342         this_ptr_conv.is_owned = false;
44343         LDKPublicKey val_ref;
44344         CHECK(val->arr_len == 33);
44345         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44346         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
44347 }
44348
44349 int64_t  CS_LDK_Splice_new(int8_tArray 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) {
44350         LDKThirtyTwoBytes channel_id_arg_ref;
44351         CHECK(channel_id_arg->arr_len == 32);
44352         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44353         LDKThirtyTwoBytes chain_hash_arg_ref;
44354         CHECK(chain_hash_arg->arr_len == 32);
44355         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44356         LDKPublicKey funding_pubkey_arg_ref;
44357         CHECK(funding_pubkey_arg->arr_len == 33);
44358         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44359         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
44360         int64_t ret_ref = 0;
44361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44363         return ret_ref;
44364 }
44365
44366 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
44367         LDKSplice ret_var = Splice_clone(arg);
44368         int64_t ret_ref = 0;
44369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44371         return ret_ref;
44372 }
44373 int64_t  CS_LDK_Splice_clone_ptr(int64_t arg) {
44374         LDKSplice arg_conv;
44375         arg_conv.inner = untag_ptr(arg);
44376         arg_conv.is_owned = ptr_is_owned(arg);
44377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44378         arg_conv.is_owned = false;
44379         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
44380         return ret_conv;
44381 }
44382
44383 int64_t  CS_LDK_Splice_clone(int64_t orig) {
44384         LDKSplice orig_conv;
44385         orig_conv.inner = untag_ptr(orig);
44386         orig_conv.is_owned = ptr_is_owned(orig);
44387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44388         orig_conv.is_owned = false;
44389         LDKSplice ret_var = Splice_clone(&orig_conv);
44390         int64_t ret_ref = 0;
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44393         return ret_ref;
44394 }
44395
44396 jboolean  CS_LDK_Splice_eq(int64_t a, int64_t b) {
44397         LDKSplice a_conv;
44398         a_conv.inner = untag_ptr(a);
44399         a_conv.is_owned = ptr_is_owned(a);
44400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44401         a_conv.is_owned = false;
44402         LDKSplice b_conv;
44403         b_conv.inner = untag_ptr(b);
44404         b_conv.is_owned = ptr_is_owned(b);
44405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44406         b_conv.is_owned = false;
44407         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
44408         return ret_conv;
44409 }
44410
44411 void  CS_LDK_SpliceAck_free(int64_t this_obj) {
44412         LDKSpliceAck this_obj_conv;
44413         this_obj_conv.inner = untag_ptr(this_obj);
44414         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44416         SpliceAck_free(this_obj_conv);
44417 }
44418
44419 int8_tArray  CS_LDK_SpliceAck_get_channel_id(int64_t this_ptr) {
44420         LDKSpliceAck this_ptr_conv;
44421         this_ptr_conv.inner = untag_ptr(this_ptr);
44422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44424         this_ptr_conv.is_owned = false;
44425         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44426         memcpy(ret_arr->elems, *SpliceAck_get_channel_id(&this_ptr_conv), 32);
44427         return ret_arr;
44428 }
44429
44430 void  CS_LDK_SpliceAck_set_channel_id(int64_t this_ptr, int8_tArray val) {
44431         LDKSpliceAck this_ptr_conv;
44432         this_ptr_conv.inner = untag_ptr(this_ptr);
44433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44435         this_ptr_conv.is_owned = false;
44436         LDKThirtyTwoBytes val_ref;
44437         CHECK(val->arr_len == 32);
44438         memcpy(val_ref.data, val->elems, 32); FREE(val);
44439         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
44440 }
44441
44442 int8_tArray  CS_LDK_SpliceAck_get_chain_hash(int64_t this_ptr) {
44443         LDKSpliceAck this_ptr_conv;
44444         this_ptr_conv.inner = untag_ptr(this_ptr);
44445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44447         this_ptr_conv.is_owned = false;
44448         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44449         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
44450         return ret_arr;
44451 }
44452
44453 void  CS_LDK_SpliceAck_set_chain_hash(int64_t this_ptr, int8_tArray val) {
44454         LDKSpliceAck this_ptr_conv;
44455         this_ptr_conv.inner = untag_ptr(this_ptr);
44456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44458         this_ptr_conv.is_owned = false;
44459         LDKThirtyTwoBytes val_ref;
44460         CHECK(val->arr_len == 32);
44461         memcpy(val_ref.data, val->elems, 32); FREE(val);
44462         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
44463 }
44464
44465 int64_t  CS_LDK_SpliceAck_get_relative_satoshis(int64_t this_ptr) {
44466         LDKSpliceAck this_ptr_conv;
44467         this_ptr_conv.inner = untag_ptr(this_ptr);
44468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44470         this_ptr_conv.is_owned = false;
44471         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
44472         return ret_conv;
44473 }
44474
44475 void  CS_LDK_SpliceAck_set_relative_satoshis(int64_t this_ptr, int64_t val) {
44476         LDKSpliceAck this_ptr_conv;
44477         this_ptr_conv.inner = untag_ptr(this_ptr);
44478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44480         this_ptr_conv.is_owned = false;
44481         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
44482 }
44483
44484 int8_tArray  CS_LDK_SpliceAck_get_funding_pubkey(int64_t this_ptr) {
44485         LDKSpliceAck this_ptr_conv;
44486         this_ptr_conv.inner = untag_ptr(this_ptr);
44487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44489         this_ptr_conv.is_owned = false;
44490         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44491         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44492         return ret_arr;
44493 }
44494
44495 void  CS_LDK_SpliceAck_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
44496         LDKSpliceAck this_ptr_conv;
44497         this_ptr_conv.inner = untag_ptr(this_ptr);
44498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44500         this_ptr_conv.is_owned = false;
44501         LDKPublicKey val_ref;
44502         CHECK(val->arr_len == 33);
44503         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44504         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
44505 }
44506
44507 int64_t  CS_LDK_SpliceAck_new(int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
44508         LDKThirtyTwoBytes channel_id_arg_ref;
44509         CHECK(channel_id_arg->arr_len == 32);
44510         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44511         LDKThirtyTwoBytes chain_hash_arg_ref;
44512         CHECK(chain_hash_arg->arr_len == 32);
44513         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
44514         LDKPublicKey funding_pubkey_arg_ref;
44515         CHECK(funding_pubkey_arg->arr_len == 33);
44516         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
44517         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
44518         int64_t ret_ref = 0;
44519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44521         return ret_ref;
44522 }
44523
44524 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
44525         LDKSpliceAck ret_var = SpliceAck_clone(arg);
44526         int64_t ret_ref = 0;
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44529         return ret_ref;
44530 }
44531 int64_t  CS_LDK_SpliceAck_clone_ptr(int64_t arg) {
44532         LDKSpliceAck arg_conv;
44533         arg_conv.inner = untag_ptr(arg);
44534         arg_conv.is_owned = ptr_is_owned(arg);
44535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44536         arg_conv.is_owned = false;
44537         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
44538         return ret_conv;
44539 }
44540
44541 int64_t  CS_LDK_SpliceAck_clone(int64_t orig) {
44542         LDKSpliceAck orig_conv;
44543         orig_conv.inner = untag_ptr(orig);
44544         orig_conv.is_owned = ptr_is_owned(orig);
44545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44546         orig_conv.is_owned = false;
44547         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
44548         int64_t ret_ref = 0;
44549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44551         return ret_ref;
44552 }
44553
44554 jboolean  CS_LDK_SpliceAck_eq(int64_t a, int64_t b) {
44555         LDKSpliceAck a_conv;
44556         a_conv.inner = untag_ptr(a);
44557         a_conv.is_owned = ptr_is_owned(a);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44559         a_conv.is_owned = false;
44560         LDKSpliceAck b_conv;
44561         b_conv.inner = untag_ptr(b);
44562         b_conv.is_owned = ptr_is_owned(b);
44563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44564         b_conv.is_owned = false;
44565         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
44566         return ret_conv;
44567 }
44568
44569 void  CS_LDK_SpliceLocked_free(int64_t this_obj) {
44570         LDKSpliceLocked this_obj_conv;
44571         this_obj_conv.inner = untag_ptr(this_obj);
44572         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44574         SpliceLocked_free(this_obj_conv);
44575 }
44576
44577 int8_tArray  CS_LDK_SpliceLocked_get_channel_id(int64_t this_ptr) {
44578         LDKSpliceLocked this_ptr_conv;
44579         this_ptr_conv.inner = untag_ptr(this_ptr);
44580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44582         this_ptr_conv.is_owned = false;
44583         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44584         memcpy(ret_arr->elems, *SpliceLocked_get_channel_id(&this_ptr_conv), 32);
44585         return ret_arr;
44586 }
44587
44588 void  CS_LDK_SpliceLocked_set_channel_id(int64_t this_ptr, int8_tArray val) {
44589         LDKSpliceLocked this_ptr_conv;
44590         this_ptr_conv.inner = untag_ptr(this_ptr);
44591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44593         this_ptr_conv.is_owned = false;
44594         LDKThirtyTwoBytes val_ref;
44595         CHECK(val->arr_len == 32);
44596         memcpy(val_ref.data, val->elems, 32); FREE(val);
44597         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
44598 }
44599
44600 int64_t  CS_LDK_SpliceLocked_new(int8_tArray channel_id_arg) {
44601         LDKThirtyTwoBytes channel_id_arg_ref;
44602         CHECK(channel_id_arg->arr_len == 32);
44603         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44604         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
44605         int64_t ret_ref = 0;
44606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44608         return ret_ref;
44609 }
44610
44611 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
44612         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
44613         int64_t ret_ref = 0;
44614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44616         return ret_ref;
44617 }
44618 int64_t  CS_LDK_SpliceLocked_clone_ptr(int64_t arg) {
44619         LDKSpliceLocked arg_conv;
44620         arg_conv.inner = untag_ptr(arg);
44621         arg_conv.is_owned = ptr_is_owned(arg);
44622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44623         arg_conv.is_owned = false;
44624         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
44625         return ret_conv;
44626 }
44627
44628 int64_t  CS_LDK_SpliceLocked_clone(int64_t orig) {
44629         LDKSpliceLocked orig_conv;
44630         orig_conv.inner = untag_ptr(orig);
44631         orig_conv.is_owned = ptr_is_owned(orig);
44632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44633         orig_conv.is_owned = false;
44634         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
44635         int64_t ret_ref = 0;
44636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44638         return ret_ref;
44639 }
44640
44641 jboolean  CS_LDK_SpliceLocked_eq(int64_t a, int64_t b) {
44642         LDKSpliceLocked a_conv;
44643         a_conv.inner = untag_ptr(a);
44644         a_conv.is_owned = ptr_is_owned(a);
44645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44646         a_conv.is_owned = false;
44647         LDKSpliceLocked b_conv;
44648         b_conv.inner = untag_ptr(b);
44649         b_conv.is_owned = ptr_is_owned(b);
44650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44651         b_conv.is_owned = false;
44652         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
44653         return ret_conv;
44654 }
44655
44656 void  CS_LDK_TxAddInput_free(int64_t this_obj) {
44657         LDKTxAddInput this_obj_conv;
44658         this_obj_conv.inner = untag_ptr(this_obj);
44659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44661         TxAddInput_free(this_obj_conv);
44662 }
44663
44664 int8_tArray  CS_LDK_TxAddInput_get_channel_id(int64_t this_ptr) {
44665         LDKTxAddInput this_ptr_conv;
44666         this_ptr_conv.inner = untag_ptr(this_ptr);
44667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44669         this_ptr_conv.is_owned = false;
44670         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44671         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
44672         return ret_arr;
44673 }
44674
44675 void  CS_LDK_TxAddInput_set_channel_id(int64_t this_ptr, int8_tArray val) {
44676         LDKTxAddInput this_ptr_conv;
44677         this_ptr_conv.inner = untag_ptr(this_ptr);
44678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44680         this_ptr_conv.is_owned = false;
44681         LDKThirtyTwoBytes val_ref;
44682         CHECK(val->arr_len == 32);
44683         memcpy(val_ref.data, val->elems, 32); FREE(val);
44684         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
44685 }
44686
44687 int64_t  CS_LDK_TxAddInput_get_serial_id(int64_t this_ptr) {
44688         LDKTxAddInput this_ptr_conv;
44689         this_ptr_conv.inner = untag_ptr(this_ptr);
44690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44692         this_ptr_conv.is_owned = false;
44693         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
44694         return ret_conv;
44695 }
44696
44697 void  CS_LDK_TxAddInput_set_serial_id(int64_t this_ptr, int64_t val) {
44698         LDKTxAddInput this_ptr_conv;
44699         this_ptr_conv.inner = untag_ptr(this_ptr);
44700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44702         this_ptr_conv.is_owned = false;
44703         TxAddInput_set_serial_id(&this_ptr_conv, val);
44704 }
44705
44706 int64_t  CS_LDK_TxAddInput_get_prevtx(int64_t this_ptr) {
44707         LDKTxAddInput this_ptr_conv;
44708         this_ptr_conv.inner = untag_ptr(this_ptr);
44709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44711         this_ptr_conv.is_owned = false;
44712         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
44713         int64_t ret_ref = 0;
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44716         return ret_ref;
44717 }
44718
44719 void  CS_LDK_TxAddInput_set_prevtx(int64_t this_ptr, int64_t val) {
44720         LDKTxAddInput this_ptr_conv;
44721         this_ptr_conv.inner = untag_ptr(this_ptr);
44722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44724         this_ptr_conv.is_owned = false;
44725         LDKTransactionU16LenLimited val_conv;
44726         val_conv.inner = untag_ptr(val);
44727         val_conv.is_owned = ptr_is_owned(val);
44728         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44729         val_conv = TransactionU16LenLimited_clone(&val_conv);
44730         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
44731 }
44732
44733 int32_t  CS_LDK_TxAddInput_get_prevtx_out(int64_t this_ptr) {
44734         LDKTxAddInput this_ptr_conv;
44735         this_ptr_conv.inner = untag_ptr(this_ptr);
44736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44738         this_ptr_conv.is_owned = false;
44739         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
44740         return ret_conv;
44741 }
44742
44743 void  CS_LDK_TxAddInput_set_prevtx_out(int64_t this_ptr, int32_t val) {
44744         LDKTxAddInput this_ptr_conv;
44745         this_ptr_conv.inner = untag_ptr(this_ptr);
44746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44748         this_ptr_conv.is_owned = false;
44749         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
44750 }
44751
44752 int32_t  CS_LDK_TxAddInput_get_sequence(int64_t this_ptr) {
44753         LDKTxAddInput this_ptr_conv;
44754         this_ptr_conv.inner = untag_ptr(this_ptr);
44755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44757         this_ptr_conv.is_owned = false;
44758         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
44759         return ret_conv;
44760 }
44761
44762 void  CS_LDK_TxAddInput_set_sequence(int64_t this_ptr, int32_t val) {
44763         LDKTxAddInput this_ptr_conv;
44764         this_ptr_conv.inner = untag_ptr(this_ptr);
44765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44767         this_ptr_conv.is_owned = false;
44768         TxAddInput_set_sequence(&this_ptr_conv, val);
44769 }
44770
44771 int64_t  CS_LDK_TxAddInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
44772         LDKThirtyTwoBytes channel_id_arg_ref;
44773         CHECK(channel_id_arg->arr_len == 32);
44774         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44775         LDKTransactionU16LenLimited prevtx_arg_conv;
44776         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
44777         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
44778         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
44779         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
44780         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
44781         int64_t ret_ref = 0;
44782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44784         return ret_ref;
44785 }
44786
44787 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
44788         LDKTxAddInput ret_var = TxAddInput_clone(arg);
44789         int64_t ret_ref = 0;
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44792         return ret_ref;
44793 }
44794 int64_t  CS_LDK_TxAddInput_clone_ptr(int64_t arg) {
44795         LDKTxAddInput arg_conv;
44796         arg_conv.inner = untag_ptr(arg);
44797         arg_conv.is_owned = ptr_is_owned(arg);
44798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44799         arg_conv.is_owned = false;
44800         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
44801         return ret_conv;
44802 }
44803
44804 int64_t  CS_LDK_TxAddInput_clone(int64_t orig) {
44805         LDKTxAddInput orig_conv;
44806         orig_conv.inner = untag_ptr(orig);
44807         orig_conv.is_owned = ptr_is_owned(orig);
44808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44809         orig_conv.is_owned = false;
44810         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
44811         int64_t ret_ref = 0;
44812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44814         return ret_ref;
44815 }
44816
44817 int64_t  CS_LDK_TxAddInput_hash(int64_t o) {
44818         LDKTxAddInput o_conv;
44819         o_conv.inner = untag_ptr(o);
44820         o_conv.is_owned = ptr_is_owned(o);
44821         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44822         o_conv.is_owned = false;
44823         int64_t ret_conv = TxAddInput_hash(&o_conv);
44824         return ret_conv;
44825 }
44826
44827 jboolean  CS_LDK_TxAddInput_eq(int64_t a, int64_t b) {
44828         LDKTxAddInput a_conv;
44829         a_conv.inner = untag_ptr(a);
44830         a_conv.is_owned = ptr_is_owned(a);
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44832         a_conv.is_owned = false;
44833         LDKTxAddInput b_conv;
44834         b_conv.inner = untag_ptr(b);
44835         b_conv.is_owned = ptr_is_owned(b);
44836         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44837         b_conv.is_owned = false;
44838         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
44839         return ret_conv;
44840 }
44841
44842 void  CS_LDK_TxAddOutput_free(int64_t this_obj) {
44843         LDKTxAddOutput this_obj_conv;
44844         this_obj_conv.inner = untag_ptr(this_obj);
44845         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44847         TxAddOutput_free(this_obj_conv);
44848 }
44849
44850 int8_tArray  CS_LDK_TxAddOutput_get_channel_id(int64_t this_ptr) {
44851         LDKTxAddOutput this_ptr_conv;
44852         this_ptr_conv.inner = untag_ptr(this_ptr);
44853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44855         this_ptr_conv.is_owned = false;
44856         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44857         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
44858         return ret_arr;
44859 }
44860
44861 void  CS_LDK_TxAddOutput_set_channel_id(int64_t this_ptr, int8_tArray val) {
44862         LDKTxAddOutput this_ptr_conv;
44863         this_ptr_conv.inner = untag_ptr(this_ptr);
44864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44866         this_ptr_conv.is_owned = false;
44867         LDKThirtyTwoBytes val_ref;
44868         CHECK(val->arr_len == 32);
44869         memcpy(val_ref.data, val->elems, 32); FREE(val);
44870         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
44871 }
44872
44873 int64_t  CS_LDK_TxAddOutput_get_serial_id(int64_t this_ptr) {
44874         LDKTxAddOutput this_ptr_conv;
44875         this_ptr_conv.inner = untag_ptr(this_ptr);
44876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44878         this_ptr_conv.is_owned = false;
44879         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
44880         return ret_conv;
44881 }
44882
44883 void  CS_LDK_TxAddOutput_set_serial_id(int64_t this_ptr, int64_t val) {
44884         LDKTxAddOutput this_ptr_conv;
44885         this_ptr_conv.inner = untag_ptr(this_ptr);
44886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44888         this_ptr_conv.is_owned = false;
44889         TxAddOutput_set_serial_id(&this_ptr_conv, val);
44890 }
44891
44892 int64_t  CS_LDK_TxAddOutput_get_sats(int64_t this_ptr) {
44893         LDKTxAddOutput this_ptr_conv;
44894         this_ptr_conv.inner = untag_ptr(this_ptr);
44895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44897         this_ptr_conv.is_owned = false;
44898         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
44899         return ret_conv;
44900 }
44901
44902 void  CS_LDK_TxAddOutput_set_sats(int64_t this_ptr, int64_t val) {
44903         LDKTxAddOutput this_ptr_conv;
44904         this_ptr_conv.inner = untag_ptr(this_ptr);
44905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44907         this_ptr_conv.is_owned = false;
44908         TxAddOutput_set_sats(&this_ptr_conv, val);
44909 }
44910
44911 int8_tArray  CS_LDK_TxAddOutput_get_script(int64_t this_ptr) {
44912         LDKTxAddOutput this_ptr_conv;
44913         this_ptr_conv.inner = untag_ptr(this_ptr);
44914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44916         this_ptr_conv.is_owned = false;
44917         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
44918         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44919         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44920         CVec_u8Z_free(ret_var);
44921         return ret_arr;
44922 }
44923
44924 void  CS_LDK_TxAddOutput_set_script(int64_t this_ptr, int8_tArray val) {
44925         LDKTxAddOutput this_ptr_conv;
44926         this_ptr_conv.inner = untag_ptr(this_ptr);
44927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44929         this_ptr_conv.is_owned = false;
44930         LDKCVec_u8Z val_ref;
44931         val_ref.datalen = val->arr_len;
44932         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44933         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
44934         TxAddOutput_set_script(&this_ptr_conv, val_ref);
44935 }
44936
44937 int64_t  CS_LDK_TxAddOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
44938         LDKThirtyTwoBytes channel_id_arg_ref;
44939         CHECK(channel_id_arg->arr_len == 32);
44940         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
44941         LDKCVec_u8Z script_arg_ref;
44942         script_arg_ref.datalen = script_arg->arr_len;
44943         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44944         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
44945         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
44946         int64_t ret_ref = 0;
44947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44949         return ret_ref;
44950 }
44951
44952 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
44953         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
44954         int64_t ret_ref = 0;
44955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44957         return ret_ref;
44958 }
44959 int64_t  CS_LDK_TxAddOutput_clone_ptr(int64_t arg) {
44960         LDKTxAddOutput arg_conv;
44961         arg_conv.inner = untag_ptr(arg);
44962         arg_conv.is_owned = ptr_is_owned(arg);
44963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44964         arg_conv.is_owned = false;
44965         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
44966         return ret_conv;
44967 }
44968
44969 int64_t  CS_LDK_TxAddOutput_clone(int64_t orig) {
44970         LDKTxAddOutput orig_conv;
44971         orig_conv.inner = untag_ptr(orig);
44972         orig_conv.is_owned = ptr_is_owned(orig);
44973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44974         orig_conv.is_owned = false;
44975         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
44976         int64_t ret_ref = 0;
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44979         return ret_ref;
44980 }
44981
44982 int64_t  CS_LDK_TxAddOutput_hash(int64_t o) {
44983         LDKTxAddOutput o_conv;
44984         o_conv.inner = untag_ptr(o);
44985         o_conv.is_owned = ptr_is_owned(o);
44986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44987         o_conv.is_owned = false;
44988         int64_t ret_conv = TxAddOutput_hash(&o_conv);
44989         return ret_conv;
44990 }
44991
44992 jboolean  CS_LDK_TxAddOutput_eq(int64_t a, int64_t b) {
44993         LDKTxAddOutput a_conv;
44994         a_conv.inner = untag_ptr(a);
44995         a_conv.is_owned = ptr_is_owned(a);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44997         a_conv.is_owned = false;
44998         LDKTxAddOutput b_conv;
44999         b_conv.inner = untag_ptr(b);
45000         b_conv.is_owned = ptr_is_owned(b);
45001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45002         b_conv.is_owned = false;
45003         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
45004         return ret_conv;
45005 }
45006
45007 void  CS_LDK_TxRemoveInput_free(int64_t this_obj) {
45008         LDKTxRemoveInput this_obj_conv;
45009         this_obj_conv.inner = untag_ptr(this_obj);
45010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45012         TxRemoveInput_free(this_obj_conv);
45013 }
45014
45015 int8_tArray  CS_LDK_TxRemoveInput_get_channel_id(int64_t this_ptr) {
45016         LDKTxRemoveInput this_ptr_conv;
45017         this_ptr_conv.inner = untag_ptr(this_ptr);
45018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45020         this_ptr_conv.is_owned = false;
45021         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45022         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
45023         return ret_arr;
45024 }
45025
45026 void  CS_LDK_TxRemoveInput_set_channel_id(int64_t this_ptr, int8_tArray val) {
45027         LDKTxRemoveInput this_ptr_conv;
45028         this_ptr_conv.inner = untag_ptr(this_ptr);
45029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45031         this_ptr_conv.is_owned = false;
45032         LDKThirtyTwoBytes val_ref;
45033         CHECK(val->arr_len == 32);
45034         memcpy(val_ref.data, val->elems, 32); FREE(val);
45035         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
45036 }
45037
45038 int64_t  CS_LDK_TxRemoveInput_get_serial_id(int64_t this_ptr) {
45039         LDKTxRemoveInput this_ptr_conv;
45040         this_ptr_conv.inner = untag_ptr(this_ptr);
45041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45043         this_ptr_conv.is_owned = false;
45044         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
45045         return ret_conv;
45046 }
45047
45048 void  CS_LDK_TxRemoveInput_set_serial_id(int64_t this_ptr, int64_t val) {
45049         LDKTxRemoveInput this_ptr_conv;
45050         this_ptr_conv.inner = untag_ptr(this_ptr);
45051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45053         this_ptr_conv.is_owned = false;
45054         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
45055 }
45056
45057 int64_t  CS_LDK_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
45058         LDKThirtyTwoBytes channel_id_arg_ref;
45059         CHECK(channel_id_arg->arr_len == 32);
45060         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45061         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
45062         int64_t ret_ref = 0;
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45065         return ret_ref;
45066 }
45067
45068 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
45069         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
45070         int64_t ret_ref = 0;
45071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45073         return ret_ref;
45074 }
45075 int64_t  CS_LDK_TxRemoveInput_clone_ptr(int64_t arg) {
45076         LDKTxRemoveInput arg_conv;
45077         arg_conv.inner = untag_ptr(arg);
45078         arg_conv.is_owned = ptr_is_owned(arg);
45079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45080         arg_conv.is_owned = false;
45081         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
45082         return ret_conv;
45083 }
45084
45085 int64_t  CS_LDK_TxRemoveInput_clone(int64_t orig) {
45086         LDKTxRemoveInput orig_conv;
45087         orig_conv.inner = untag_ptr(orig);
45088         orig_conv.is_owned = ptr_is_owned(orig);
45089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45090         orig_conv.is_owned = false;
45091         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
45092         int64_t ret_ref = 0;
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45095         return ret_ref;
45096 }
45097
45098 int64_t  CS_LDK_TxRemoveInput_hash(int64_t o) {
45099         LDKTxRemoveInput o_conv;
45100         o_conv.inner = untag_ptr(o);
45101         o_conv.is_owned = ptr_is_owned(o);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45103         o_conv.is_owned = false;
45104         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
45105         return ret_conv;
45106 }
45107
45108 jboolean  CS_LDK_TxRemoveInput_eq(int64_t a, int64_t b) {
45109         LDKTxRemoveInput a_conv;
45110         a_conv.inner = untag_ptr(a);
45111         a_conv.is_owned = ptr_is_owned(a);
45112         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45113         a_conv.is_owned = false;
45114         LDKTxRemoveInput b_conv;
45115         b_conv.inner = untag_ptr(b);
45116         b_conv.is_owned = ptr_is_owned(b);
45117         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45118         b_conv.is_owned = false;
45119         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
45120         return ret_conv;
45121 }
45122
45123 void  CS_LDK_TxRemoveOutput_free(int64_t this_obj) {
45124         LDKTxRemoveOutput this_obj_conv;
45125         this_obj_conv.inner = untag_ptr(this_obj);
45126         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45128         TxRemoveOutput_free(this_obj_conv);
45129 }
45130
45131 int8_tArray  CS_LDK_TxRemoveOutput_get_channel_id(int64_t this_ptr) {
45132         LDKTxRemoveOutput this_ptr_conv;
45133         this_ptr_conv.inner = untag_ptr(this_ptr);
45134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45136         this_ptr_conv.is_owned = false;
45137         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45138         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
45139         return ret_arr;
45140 }
45141
45142 void  CS_LDK_TxRemoveOutput_set_channel_id(int64_t this_ptr, int8_tArray val) {
45143         LDKTxRemoveOutput this_ptr_conv;
45144         this_ptr_conv.inner = untag_ptr(this_ptr);
45145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45147         this_ptr_conv.is_owned = false;
45148         LDKThirtyTwoBytes val_ref;
45149         CHECK(val->arr_len == 32);
45150         memcpy(val_ref.data, val->elems, 32); FREE(val);
45151         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
45152 }
45153
45154 int64_t  CS_LDK_TxRemoveOutput_get_serial_id(int64_t this_ptr) {
45155         LDKTxRemoveOutput this_ptr_conv;
45156         this_ptr_conv.inner = untag_ptr(this_ptr);
45157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45159         this_ptr_conv.is_owned = false;
45160         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
45161         return ret_conv;
45162 }
45163
45164 void  CS_LDK_TxRemoveOutput_set_serial_id(int64_t this_ptr, int64_t val) {
45165         LDKTxRemoveOutput this_ptr_conv;
45166         this_ptr_conv.inner = untag_ptr(this_ptr);
45167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45169         this_ptr_conv.is_owned = false;
45170         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
45171 }
45172
45173 int64_t  CS_LDK_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
45174         LDKThirtyTwoBytes channel_id_arg_ref;
45175         CHECK(channel_id_arg->arr_len == 32);
45176         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45177         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
45178         int64_t ret_ref = 0;
45179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45181         return ret_ref;
45182 }
45183
45184 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
45185         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
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 int64_t  CS_LDK_TxRemoveOutput_clone_ptr(int64_t arg) {
45192         LDKTxRemoveOutput arg_conv;
45193         arg_conv.inner = untag_ptr(arg);
45194         arg_conv.is_owned = ptr_is_owned(arg);
45195         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45196         arg_conv.is_owned = false;
45197         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
45198         return ret_conv;
45199 }
45200
45201 int64_t  CS_LDK_TxRemoveOutput_clone(int64_t orig) {
45202         LDKTxRemoveOutput orig_conv;
45203         orig_conv.inner = untag_ptr(orig);
45204         orig_conv.is_owned = ptr_is_owned(orig);
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45206         orig_conv.is_owned = false;
45207         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
45208         int64_t ret_ref = 0;
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45211         return ret_ref;
45212 }
45213
45214 int64_t  CS_LDK_TxRemoveOutput_hash(int64_t o) {
45215         LDKTxRemoveOutput o_conv;
45216         o_conv.inner = untag_ptr(o);
45217         o_conv.is_owned = ptr_is_owned(o);
45218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45219         o_conv.is_owned = false;
45220         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
45221         return ret_conv;
45222 }
45223
45224 jboolean  CS_LDK_TxRemoveOutput_eq(int64_t a, int64_t b) {
45225         LDKTxRemoveOutput a_conv;
45226         a_conv.inner = untag_ptr(a);
45227         a_conv.is_owned = ptr_is_owned(a);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45229         a_conv.is_owned = false;
45230         LDKTxRemoveOutput b_conv;
45231         b_conv.inner = untag_ptr(b);
45232         b_conv.is_owned = ptr_is_owned(b);
45233         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45234         b_conv.is_owned = false;
45235         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
45236         return ret_conv;
45237 }
45238
45239 void  CS_LDK_TxComplete_free(int64_t this_obj) {
45240         LDKTxComplete this_obj_conv;
45241         this_obj_conv.inner = untag_ptr(this_obj);
45242         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45244         TxComplete_free(this_obj_conv);
45245 }
45246
45247 int8_tArray  CS_LDK_TxComplete_get_channel_id(int64_t this_ptr) {
45248         LDKTxComplete this_ptr_conv;
45249         this_ptr_conv.inner = untag_ptr(this_ptr);
45250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45252         this_ptr_conv.is_owned = false;
45253         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45254         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
45255         return ret_arr;
45256 }
45257
45258 void  CS_LDK_TxComplete_set_channel_id(int64_t this_ptr, int8_tArray val) {
45259         LDKTxComplete this_ptr_conv;
45260         this_ptr_conv.inner = untag_ptr(this_ptr);
45261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45263         this_ptr_conv.is_owned = false;
45264         LDKThirtyTwoBytes val_ref;
45265         CHECK(val->arr_len == 32);
45266         memcpy(val_ref.data, val->elems, 32); FREE(val);
45267         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
45268 }
45269
45270 int64_t  CS_LDK_TxComplete_new(int8_tArray channel_id_arg) {
45271         LDKThirtyTwoBytes channel_id_arg_ref;
45272         CHECK(channel_id_arg->arr_len == 32);
45273         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45274         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
45275         int64_t ret_ref = 0;
45276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45278         return ret_ref;
45279 }
45280
45281 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
45282         LDKTxComplete ret_var = TxComplete_clone(arg);
45283         int64_t ret_ref = 0;
45284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45286         return ret_ref;
45287 }
45288 int64_t  CS_LDK_TxComplete_clone_ptr(int64_t arg) {
45289         LDKTxComplete arg_conv;
45290         arg_conv.inner = untag_ptr(arg);
45291         arg_conv.is_owned = ptr_is_owned(arg);
45292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45293         arg_conv.is_owned = false;
45294         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
45295         return ret_conv;
45296 }
45297
45298 int64_t  CS_LDK_TxComplete_clone(int64_t orig) {
45299         LDKTxComplete orig_conv;
45300         orig_conv.inner = untag_ptr(orig);
45301         orig_conv.is_owned = ptr_is_owned(orig);
45302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45303         orig_conv.is_owned = false;
45304         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
45305         int64_t ret_ref = 0;
45306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45308         return ret_ref;
45309 }
45310
45311 int64_t  CS_LDK_TxComplete_hash(int64_t o) {
45312         LDKTxComplete o_conv;
45313         o_conv.inner = untag_ptr(o);
45314         o_conv.is_owned = ptr_is_owned(o);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45316         o_conv.is_owned = false;
45317         int64_t ret_conv = TxComplete_hash(&o_conv);
45318         return ret_conv;
45319 }
45320
45321 jboolean  CS_LDK_TxComplete_eq(int64_t a, int64_t b) {
45322         LDKTxComplete a_conv;
45323         a_conv.inner = untag_ptr(a);
45324         a_conv.is_owned = ptr_is_owned(a);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45326         a_conv.is_owned = false;
45327         LDKTxComplete b_conv;
45328         b_conv.inner = untag_ptr(b);
45329         b_conv.is_owned = ptr_is_owned(b);
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45331         b_conv.is_owned = false;
45332         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
45333         return ret_conv;
45334 }
45335
45336 void  CS_LDK_TxSignatures_free(int64_t this_obj) {
45337         LDKTxSignatures this_obj_conv;
45338         this_obj_conv.inner = untag_ptr(this_obj);
45339         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45341         TxSignatures_free(this_obj_conv);
45342 }
45343
45344 int8_tArray  CS_LDK_TxSignatures_get_channel_id(int64_t this_ptr) {
45345         LDKTxSignatures 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45351         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
45352         return ret_arr;
45353 }
45354
45355 void  CS_LDK_TxSignatures_set_channel_id(int64_t this_ptr, int8_tArray val) {
45356         LDKTxSignatures this_ptr_conv;
45357         this_ptr_conv.inner = untag_ptr(this_ptr);
45358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45360         this_ptr_conv.is_owned = false;
45361         LDKThirtyTwoBytes val_ref;
45362         CHECK(val->arr_len == 32);
45363         memcpy(val_ref.data, val->elems, 32); FREE(val);
45364         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
45365 }
45366
45367 int8_tArray  CS_LDK_TxSignatures_get_tx_hash(int64_t this_ptr) {
45368         LDKTxSignatures this_ptr_conv;
45369         this_ptr_conv.inner = untag_ptr(this_ptr);
45370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45372         this_ptr_conv.is_owned = false;
45373         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45374         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
45375         return ret_arr;
45376 }
45377
45378 void  CS_LDK_TxSignatures_set_tx_hash(int64_t this_ptr, int8_tArray val) {
45379         LDKTxSignatures this_ptr_conv;
45380         this_ptr_conv.inner = untag_ptr(this_ptr);
45381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45383         this_ptr_conv.is_owned = false;
45384         LDKThirtyTwoBytes val_ref;
45385         CHECK(val->arr_len == 32);
45386         memcpy(val_ref.data, val->elems, 32); FREE(val);
45387         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
45388 }
45389
45390 ptrArray  CS_LDK_TxSignatures_get_witnesses(int64_t this_ptr) {
45391         LDKTxSignatures this_ptr_conv;
45392         this_ptr_conv.inner = untag_ptr(this_ptr);
45393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45395         this_ptr_conv.is_owned = false;
45396         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
45397         ptrArray ret_arr = NULL;
45398         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
45399         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
45400         for (size_t i = 0; i < ret_var.datalen; i++) {
45401                 LDKWitness ret_conv_8_var = ret_var.data[i];
45402                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
45403                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
45404                 Witness_free(ret_conv_8_var);
45405                 ret_arr_ptr[i] = ret_conv_8_arr;
45406         }
45407         
45408         FREE(ret_var.data);
45409         return ret_arr;
45410 }
45411
45412 void  CS_LDK_TxSignatures_set_witnesses(int64_t this_ptr, ptrArray val) {
45413         LDKTxSignatures this_ptr_conv;
45414         this_ptr_conv.inner = untag_ptr(this_ptr);
45415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45417         this_ptr_conv.is_owned = false;
45418         LDKCVec_WitnessZ val_constr;
45419         val_constr.datalen = val->arr_len;
45420         if (val_constr.datalen > 0)
45421                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45422         else
45423                 val_constr.data = NULL;
45424         int8_tArray* val_vals = (void*) val->elems;
45425         for (size_t i = 0; i < val_constr.datalen; i++) {
45426                 int8_tArray val_conv_8 = val_vals[i];
45427                 LDKWitness val_conv_8_ref;
45428                 val_conv_8_ref.datalen = val_conv_8->arr_len;
45429                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
45430                 memcpy(val_conv_8_ref.data, val_conv_8->elems, val_conv_8_ref.datalen); FREE(val_conv_8);
45431                 val_conv_8_ref.data_is_owned = true;
45432                 val_constr.data[i] = val_conv_8_ref;
45433         }
45434         FREE(val);
45435         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
45436 }
45437
45438 int64_t  CS_LDK_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
45439         LDKThirtyTwoBytes channel_id_arg_ref;
45440         CHECK(channel_id_arg->arr_len == 32);
45441         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45442         LDKThirtyTwoBytes tx_hash_arg_ref;
45443         CHECK(tx_hash_arg->arr_len == 32);
45444         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
45445         LDKCVec_WitnessZ witnesses_arg_constr;
45446         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
45447         if (witnesses_arg_constr.datalen > 0)
45448                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
45449         else
45450                 witnesses_arg_constr.data = NULL;
45451         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
45452         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
45453                 int8_tArray witnesses_arg_conv_8 = witnesses_arg_vals[i];
45454                 LDKWitness witnesses_arg_conv_8_ref;
45455                 witnesses_arg_conv_8_ref.datalen = witnesses_arg_conv_8->arr_len;
45456                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
45457                 memcpy(witnesses_arg_conv_8_ref.data, witnesses_arg_conv_8->elems, witnesses_arg_conv_8_ref.datalen); FREE(witnesses_arg_conv_8);
45458                 witnesses_arg_conv_8_ref.data_is_owned = true;
45459                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
45460         }
45461         FREE(witnesses_arg);
45462         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
45463         int64_t ret_ref = 0;
45464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45466         return ret_ref;
45467 }
45468
45469 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
45470         LDKTxSignatures ret_var = TxSignatures_clone(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 int64_t  CS_LDK_TxSignatures_clone_ptr(int64_t arg) {
45477         LDKTxSignatures arg_conv;
45478         arg_conv.inner = untag_ptr(arg);
45479         arg_conv.is_owned = ptr_is_owned(arg);
45480         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45481         arg_conv.is_owned = false;
45482         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
45483         return ret_conv;
45484 }
45485
45486 int64_t  CS_LDK_TxSignatures_clone(int64_t orig) {
45487         LDKTxSignatures orig_conv;
45488         orig_conv.inner = untag_ptr(orig);
45489         orig_conv.is_owned = ptr_is_owned(orig);
45490         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45491         orig_conv.is_owned = false;
45492         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
45493         int64_t ret_ref = 0;
45494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45496         return ret_ref;
45497 }
45498
45499 int64_t  CS_LDK_TxSignatures_hash(int64_t o) {
45500         LDKTxSignatures o_conv;
45501         o_conv.inner = untag_ptr(o);
45502         o_conv.is_owned = ptr_is_owned(o);
45503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45504         o_conv.is_owned = false;
45505         int64_t ret_conv = TxSignatures_hash(&o_conv);
45506         return ret_conv;
45507 }
45508
45509 jboolean  CS_LDK_TxSignatures_eq(int64_t a, int64_t b) {
45510         LDKTxSignatures a_conv;
45511         a_conv.inner = untag_ptr(a);
45512         a_conv.is_owned = ptr_is_owned(a);
45513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45514         a_conv.is_owned = false;
45515         LDKTxSignatures b_conv;
45516         b_conv.inner = untag_ptr(b);
45517         b_conv.is_owned = ptr_is_owned(b);
45518         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45519         b_conv.is_owned = false;
45520         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
45521         return ret_conv;
45522 }
45523
45524 void  CS_LDK_TxInitRbf_free(int64_t this_obj) {
45525         LDKTxInitRbf this_obj_conv;
45526         this_obj_conv.inner = untag_ptr(this_obj);
45527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45529         TxInitRbf_free(this_obj_conv);
45530 }
45531
45532 int8_tArray  CS_LDK_TxInitRbf_get_channel_id(int64_t this_ptr) {
45533         LDKTxInitRbf this_ptr_conv;
45534         this_ptr_conv.inner = untag_ptr(this_ptr);
45535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45537         this_ptr_conv.is_owned = false;
45538         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45539         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
45540         return ret_arr;
45541 }
45542
45543 void  CS_LDK_TxInitRbf_set_channel_id(int64_t this_ptr, int8_tArray val) {
45544         LDKTxInitRbf this_ptr_conv;
45545         this_ptr_conv.inner = untag_ptr(this_ptr);
45546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45548         this_ptr_conv.is_owned = false;
45549         LDKThirtyTwoBytes val_ref;
45550         CHECK(val->arr_len == 32);
45551         memcpy(val_ref.data, val->elems, 32); FREE(val);
45552         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
45553 }
45554
45555 int32_t  CS_LDK_TxInitRbf_get_locktime(int64_t this_ptr) {
45556         LDKTxInitRbf this_ptr_conv;
45557         this_ptr_conv.inner = untag_ptr(this_ptr);
45558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45560         this_ptr_conv.is_owned = false;
45561         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
45562         return ret_conv;
45563 }
45564
45565 void  CS_LDK_TxInitRbf_set_locktime(int64_t this_ptr, int32_t val) {
45566         LDKTxInitRbf this_ptr_conv;
45567         this_ptr_conv.inner = untag_ptr(this_ptr);
45568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45570         this_ptr_conv.is_owned = false;
45571         TxInitRbf_set_locktime(&this_ptr_conv, val);
45572 }
45573
45574 int32_t  CS_LDK_TxInitRbf_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
45575         LDKTxInitRbf this_ptr_conv;
45576         this_ptr_conv.inner = untag_ptr(this_ptr);
45577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45579         this_ptr_conv.is_owned = false;
45580         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45581         return ret_conv;
45582 }
45583
45584 void  CS_LDK_TxInitRbf_set_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
45585         LDKTxInitRbf this_ptr_conv;
45586         this_ptr_conv.inner = untag_ptr(this_ptr);
45587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45589         this_ptr_conv.is_owned = false;
45590         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
45591 }
45592
45593 int64_t  CS_LDK_TxInitRbf_get_funding_output_contribution(int64_t this_ptr) {
45594         LDKTxInitRbf this_ptr_conv;
45595         this_ptr_conv.inner = untag_ptr(this_ptr);
45596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45598         this_ptr_conv.is_owned = false;
45599         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45600         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
45601         int64_t ret_ref = tag_ptr(ret_copy, true);
45602         return ret_ref;
45603 }
45604
45605 void  CS_LDK_TxInitRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
45606         LDKTxInitRbf this_ptr_conv;
45607         this_ptr_conv.inner = untag_ptr(this_ptr);
45608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45610         this_ptr_conv.is_owned = false;
45611         void* val_ptr = untag_ptr(val);
45612         CHECK_ACCESS(val_ptr);
45613         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45614         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45615         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45616 }
45617
45618 int64_t  CS_LDK_TxInitRbf_new(int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
45619         LDKThirtyTwoBytes channel_id_arg_ref;
45620         CHECK(channel_id_arg->arr_len == 32);
45621         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45622         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45623         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45624         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45625         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45626         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
45627         int64_t ret_ref = 0;
45628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45630         return ret_ref;
45631 }
45632
45633 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
45634         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
45635         int64_t ret_ref = 0;
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45638         return ret_ref;
45639 }
45640 int64_t  CS_LDK_TxInitRbf_clone_ptr(int64_t arg) {
45641         LDKTxInitRbf arg_conv;
45642         arg_conv.inner = untag_ptr(arg);
45643         arg_conv.is_owned = ptr_is_owned(arg);
45644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45645         arg_conv.is_owned = false;
45646         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
45647         return ret_conv;
45648 }
45649
45650 int64_t  CS_LDK_TxInitRbf_clone(int64_t orig) {
45651         LDKTxInitRbf orig_conv;
45652         orig_conv.inner = untag_ptr(orig);
45653         orig_conv.is_owned = ptr_is_owned(orig);
45654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45655         orig_conv.is_owned = false;
45656         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
45657         int64_t ret_ref = 0;
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45660         return ret_ref;
45661 }
45662
45663 int64_t  CS_LDK_TxInitRbf_hash(int64_t o) {
45664         LDKTxInitRbf o_conv;
45665         o_conv.inner = untag_ptr(o);
45666         o_conv.is_owned = ptr_is_owned(o);
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45668         o_conv.is_owned = false;
45669         int64_t ret_conv = TxInitRbf_hash(&o_conv);
45670         return ret_conv;
45671 }
45672
45673 jboolean  CS_LDK_TxInitRbf_eq(int64_t a, int64_t b) {
45674         LDKTxInitRbf a_conv;
45675         a_conv.inner = untag_ptr(a);
45676         a_conv.is_owned = ptr_is_owned(a);
45677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45678         a_conv.is_owned = false;
45679         LDKTxInitRbf b_conv;
45680         b_conv.inner = untag_ptr(b);
45681         b_conv.is_owned = ptr_is_owned(b);
45682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45683         b_conv.is_owned = false;
45684         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
45685         return ret_conv;
45686 }
45687
45688 void  CS_LDK_TxAckRbf_free(int64_t this_obj) {
45689         LDKTxAckRbf this_obj_conv;
45690         this_obj_conv.inner = untag_ptr(this_obj);
45691         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45693         TxAckRbf_free(this_obj_conv);
45694 }
45695
45696 int8_tArray  CS_LDK_TxAckRbf_get_channel_id(int64_t this_ptr) {
45697         LDKTxAckRbf this_ptr_conv;
45698         this_ptr_conv.inner = untag_ptr(this_ptr);
45699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45701         this_ptr_conv.is_owned = false;
45702         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45703         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
45704         return ret_arr;
45705 }
45706
45707 void  CS_LDK_TxAckRbf_set_channel_id(int64_t this_ptr, int8_tArray val) {
45708         LDKTxAckRbf this_ptr_conv;
45709         this_ptr_conv.inner = untag_ptr(this_ptr);
45710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45712         this_ptr_conv.is_owned = false;
45713         LDKThirtyTwoBytes val_ref;
45714         CHECK(val->arr_len == 32);
45715         memcpy(val_ref.data, val->elems, 32); FREE(val);
45716         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
45717 }
45718
45719 int64_t  CS_LDK_TxAckRbf_get_funding_output_contribution(int64_t this_ptr) {
45720         LDKTxAckRbf this_ptr_conv;
45721         this_ptr_conv.inner = untag_ptr(this_ptr);
45722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45724         this_ptr_conv.is_owned = false;
45725         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
45726         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
45727         int64_t ret_ref = tag_ptr(ret_copy, true);
45728         return ret_ref;
45729 }
45730
45731 void  CS_LDK_TxAckRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
45732         LDKTxAckRbf this_ptr_conv;
45733         this_ptr_conv.inner = untag_ptr(this_ptr);
45734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45736         this_ptr_conv.is_owned = false;
45737         void* val_ptr = untag_ptr(val);
45738         CHECK_ACCESS(val_ptr);
45739         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
45740         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
45741         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
45742 }
45743
45744 int64_t  CS_LDK_TxAckRbf_new(int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
45745         LDKThirtyTwoBytes channel_id_arg_ref;
45746         CHECK(channel_id_arg->arr_len == 32);
45747         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45748         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
45749         CHECK_ACCESS(funding_output_contribution_arg_ptr);
45750         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
45751         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
45752         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
45753         int64_t ret_ref = 0;
45754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45756         return ret_ref;
45757 }
45758
45759 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
45760         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
45761         int64_t ret_ref = 0;
45762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45764         return ret_ref;
45765 }
45766 int64_t  CS_LDK_TxAckRbf_clone_ptr(int64_t arg) {
45767         LDKTxAckRbf arg_conv;
45768         arg_conv.inner = untag_ptr(arg);
45769         arg_conv.is_owned = ptr_is_owned(arg);
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45771         arg_conv.is_owned = false;
45772         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
45773         return ret_conv;
45774 }
45775
45776 int64_t  CS_LDK_TxAckRbf_clone(int64_t orig) {
45777         LDKTxAckRbf orig_conv;
45778         orig_conv.inner = untag_ptr(orig);
45779         orig_conv.is_owned = ptr_is_owned(orig);
45780         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45781         orig_conv.is_owned = false;
45782         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
45783         int64_t ret_ref = 0;
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45786         return ret_ref;
45787 }
45788
45789 int64_t  CS_LDK_TxAckRbf_hash(int64_t o) {
45790         LDKTxAckRbf o_conv;
45791         o_conv.inner = untag_ptr(o);
45792         o_conv.is_owned = ptr_is_owned(o);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45794         o_conv.is_owned = false;
45795         int64_t ret_conv = TxAckRbf_hash(&o_conv);
45796         return ret_conv;
45797 }
45798
45799 jboolean  CS_LDK_TxAckRbf_eq(int64_t a, int64_t b) {
45800         LDKTxAckRbf a_conv;
45801         a_conv.inner = untag_ptr(a);
45802         a_conv.is_owned = ptr_is_owned(a);
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45804         a_conv.is_owned = false;
45805         LDKTxAckRbf b_conv;
45806         b_conv.inner = untag_ptr(b);
45807         b_conv.is_owned = ptr_is_owned(b);
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45809         b_conv.is_owned = false;
45810         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
45811         return ret_conv;
45812 }
45813
45814 void  CS_LDK_TxAbort_free(int64_t this_obj) {
45815         LDKTxAbort this_obj_conv;
45816         this_obj_conv.inner = untag_ptr(this_obj);
45817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45819         TxAbort_free(this_obj_conv);
45820 }
45821
45822 int8_tArray  CS_LDK_TxAbort_get_channel_id(int64_t this_ptr) {
45823         LDKTxAbort this_ptr_conv;
45824         this_ptr_conv.inner = untag_ptr(this_ptr);
45825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45827         this_ptr_conv.is_owned = false;
45828         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45829         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
45830         return ret_arr;
45831 }
45832
45833 void  CS_LDK_TxAbort_set_channel_id(int64_t this_ptr, int8_tArray val) {
45834         LDKTxAbort this_ptr_conv;
45835         this_ptr_conv.inner = untag_ptr(this_ptr);
45836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45838         this_ptr_conv.is_owned = false;
45839         LDKThirtyTwoBytes val_ref;
45840         CHECK(val->arr_len == 32);
45841         memcpy(val_ref.data, val->elems, 32); FREE(val);
45842         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
45843 }
45844
45845 int8_tArray  CS_LDK_TxAbort_get_data(int64_t this_ptr) {
45846         LDKTxAbort this_ptr_conv;
45847         this_ptr_conv.inner = untag_ptr(this_ptr);
45848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45850         this_ptr_conv.is_owned = false;
45851         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
45852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45854         CVec_u8Z_free(ret_var);
45855         return ret_arr;
45856 }
45857
45858 void  CS_LDK_TxAbort_set_data(int64_t this_ptr, int8_tArray val) {
45859         LDKTxAbort this_ptr_conv;
45860         this_ptr_conv.inner = untag_ptr(this_ptr);
45861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45863         this_ptr_conv.is_owned = false;
45864         LDKCVec_u8Z val_ref;
45865         val_ref.datalen = val->arr_len;
45866         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45867         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45868         TxAbort_set_data(&this_ptr_conv, val_ref);
45869 }
45870
45871 int64_t  CS_LDK_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
45872         LDKThirtyTwoBytes channel_id_arg_ref;
45873         CHECK(channel_id_arg->arr_len == 32);
45874         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
45875         LDKCVec_u8Z data_arg_ref;
45876         data_arg_ref.datalen = data_arg->arr_len;
45877         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45878         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
45879         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
45880         int64_t ret_ref = 0;
45881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45883         return ret_ref;
45884 }
45885
45886 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
45887         LDKTxAbort ret_var = TxAbort_clone(arg);
45888         int64_t ret_ref = 0;
45889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45891         return ret_ref;
45892 }
45893 int64_t  CS_LDK_TxAbort_clone_ptr(int64_t arg) {
45894         LDKTxAbort arg_conv;
45895         arg_conv.inner = untag_ptr(arg);
45896         arg_conv.is_owned = ptr_is_owned(arg);
45897         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45898         arg_conv.is_owned = false;
45899         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
45900         return ret_conv;
45901 }
45902
45903 int64_t  CS_LDK_TxAbort_clone(int64_t orig) {
45904         LDKTxAbort orig_conv;
45905         orig_conv.inner = untag_ptr(orig);
45906         orig_conv.is_owned = ptr_is_owned(orig);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45908         orig_conv.is_owned = false;
45909         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
45910         int64_t ret_ref = 0;
45911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45913         return ret_ref;
45914 }
45915
45916 int64_t  CS_LDK_TxAbort_hash(int64_t o) {
45917         LDKTxAbort o_conv;
45918         o_conv.inner = untag_ptr(o);
45919         o_conv.is_owned = ptr_is_owned(o);
45920         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45921         o_conv.is_owned = false;
45922         int64_t ret_conv = TxAbort_hash(&o_conv);
45923         return ret_conv;
45924 }
45925
45926 jboolean  CS_LDK_TxAbort_eq(int64_t a, int64_t b) {
45927         LDKTxAbort a_conv;
45928         a_conv.inner = untag_ptr(a);
45929         a_conv.is_owned = ptr_is_owned(a);
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45931         a_conv.is_owned = false;
45932         LDKTxAbort b_conv;
45933         b_conv.inner = untag_ptr(b);
45934         b_conv.is_owned = ptr_is_owned(b);
45935         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45936         b_conv.is_owned = false;
45937         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
45938         return ret_conv;
45939 }
45940
45941 void  CS_LDK_Shutdown_free(int64_t this_obj) {
45942         LDKShutdown this_obj_conv;
45943         this_obj_conv.inner = untag_ptr(this_obj);
45944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45946         Shutdown_free(this_obj_conv);
45947 }
45948
45949 int8_tArray  CS_LDK_Shutdown_get_channel_id(int64_t this_ptr) {
45950         LDKShutdown this_ptr_conv;
45951         this_ptr_conv.inner = untag_ptr(this_ptr);
45952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45954         this_ptr_conv.is_owned = false;
45955         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45956         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
45957         return ret_arr;
45958 }
45959
45960 void  CS_LDK_Shutdown_set_channel_id(int64_t this_ptr, int8_tArray val) {
45961         LDKShutdown this_ptr_conv;
45962         this_ptr_conv.inner = untag_ptr(this_ptr);
45963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45965         this_ptr_conv.is_owned = false;
45966         LDKThirtyTwoBytes val_ref;
45967         CHECK(val->arr_len == 32);
45968         memcpy(val_ref.data, val->elems, 32); FREE(val);
45969         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
45970 }
45971
45972 int8_tArray  CS_LDK_Shutdown_get_scriptpubkey(int64_t this_ptr) {
45973         LDKShutdown this_ptr_conv;
45974         this_ptr_conv.inner = untag_ptr(this_ptr);
45975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45977         this_ptr_conv.is_owned = false;
45978         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
45979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45981         CVec_u8Z_free(ret_var);
45982         return ret_arr;
45983 }
45984
45985 void  CS_LDK_Shutdown_set_scriptpubkey(int64_t this_ptr, int8_tArray val) {
45986         LDKShutdown this_ptr_conv;
45987         this_ptr_conv.inner = untag_ptr(this_ptr);
45988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45990         this_ptr_conv.is_owned = false;
45991         LDKCVec_u8Z val_ref;
45992         val_ref.datalen = val->arr_len;
45993         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45994         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
45995         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
45996 }
45997
45998 int64_t  CS_LDK_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
45999         LDKThirtyTwoBytes channel_id_arg_ref;
46000         CHECK(channel_id_arg->arr_len == 32);
46001         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46002         LDKCVec_u8Z scriptpubkey_arg_ref;
46003         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
46004         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46005         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
46006         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
46007         int64_t ret_ref = 0;
46008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46010         return ret_ref;
46011 }
46012
46013 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
46014         LDKShutdown ret_var = Shutdown_clone(arg);
46015         int64_t ret_ref = 0;
46016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46018         return ret_ref;
46019 }
46020 int64_t  CS_LDK_Shutdown_clone_ptr(int64_t arg) {
46021         LDKShutdown arg_conv;
46022         arg_conv.inner = untag_ptr(arg);
46023         arg_conv.is_owned = ptr_is_owned(arg);
46024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46025         arg_conv.is_owned = false;
46026         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
46027         return ret_conv;
46028 }
46029
46030 int64_t  CS_LDK_Shutdown_clone(int64_t orig) {
46031         LDKShutdown orig_conv;
46032         orig_conv.inner = untag_ptr(orig);
46033         orig_conv.is_owned = ptr_is_owned(orig);
46034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46035         orig_conv.is_owned = false;
46036         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
46037         int64_t ret_ref = 0;
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46040         return ret_ref;
46041 }
46042
46043 int64_t  CS_LDK_Shutdown_hash(int64_t o) {
46044         LDKShutdown o_conv;
46045         o_conv.inner = untag_ptr(o);
46046         o_conv.is_owned = ptr_is_owned(o);
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46048         o_conv.is_owned = false;
46049         int64_t ret_conv = Shutdown_hash(&o_conv);
46050         return ret_conv;
46051 }
46052
46053 jboolean  CS_LDK_Shutdown_eq(int64_t a, int64_t b) {
46054         LDKShutdown a_conv;
46055         a_conv.inner = untag_ptr(a);
46056         a_conv.is_owned = ptr_is_owned(a);
46057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46058         a_conv.is_owned = false;
46059         LDKShutdown b_conv;
46060         b_conv.inner = untag_ptr(b);
46061         b_conv.is_owned = ptr_is_owned(b);
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46063         b_conv.is_owned = false;
46064         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
46065         return ret_conv;
46066 }
46067
46068 void  CS_LDK_ClosingSignedFeeRange_free(int64_t this_obj) {
46069         LDKClosingSignedFeeRange this_obj_conv;
46070         this_obj_conv.inner = untag_ptr(this_obj);
46071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46073         ClosingSignedFeeRange_free(this_obj_conv);
46074 }
46075
46076 int64_t  CS_LDK_ClosingSignedFeeRange_get_min_fee_satoshis(int64_t this_ptr) {
46077         LDKClosingSignedFeeRange this_ptr_conv;
46078         this_ptr_conv.inner = untag_ptr(this_ptr);
46079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46081         this_ptr_conv.is_owned = false;
46082         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
46083         return ret_conv;
46084 }
46085
46086 void  CS_LDK_ClosingSignedFeeRange_set_min_fee_satoshis(int64_t this_ptr, int64_t val) {
46087         LDKClosingSignedFeeRange this_ptr_conv;
46088         this_ptr_conv.inner = untag_ptr(this_ptr);
46089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46091         this_ptr_conv.is_owned = false;
46092         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
46093 }
46094
46095 int64_t  CS_LDK_ClosingSignedFeeRange_get_max_fee_satoshis(int64_t this_ptr) {
46096         LDKClosingSignedFeeRange this_ptr_conv;
46097         this_ptr_conv.inner = untag_ptr(this_ptr);
46098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46100         this_ptr_conv.is_owned = false;
46101         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
46102         return ret_conv;
46103 }
46104
46105 void  CS_LDK_ClosingSignedFeeRange_set_max_fee_satoshis(int64_t this_ptr, int64_t val) {
46106         LDKClosingSignedFeeRange this_ptr_conv;
46107         this_ptr_conv.inner = untag_ptr(this_ptr);
46108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46110         this_ptr_conv.is_owned = false;
46111         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
46112 }
46113
46114 int64_t  CS_LDK_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
46115         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
46116         int64_t ret_ref = 0;
46117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46119         return ret_ref;
46120 }
46121
46122 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
46123         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
46124         int64_t ret_ref = 0;
46125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46127         return ret_ref;
46128 }
46129 int64_t  CS_LDK_ClosingSignedFeeRange_clone_ptr(int64_t arg) {
46130         LDKClosingSignedFeeRange arg_conv;
46131         arg_conv.inner = untag_ptr(arg);
46132         arg_conv.is_owned = ptr_is_owned(arg);
46133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46134         arg_conv.is_owned = false;
46135         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
46136         return ret_conv;
46137 }
46138
46139 int64_t  CS_LDK_ClosingSignedFeeRange_clone(int64_t orig) {
46140         LDKClosingSignedFeeRange orig_conv;
46141         orig_conv.inner = untag_ptr(orig);
46142         orig_conv.is_owned = ptr_is_owned(orig);
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46144         orig_conv.is_owned = false;
46145         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
46146         int64_t ret_ref = 0;
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46149         return ret_ref;
46150 }
46151
46152 int64_t  CS_LDK_ClosingSignedFeeRange_hash(int64_t o) {
46153         LDKClosingSignedFeeRange o_conv;
46154         o_conv.inner = untag_ptr(o);
46155         o_conv.is_owned = ptr_is_owned(o);
46156         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46157         o_conv.is_owned = false;
46158         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
46159         return ret_conv;
46160 }
46161
46162 jboolean  CS_LDK_ClosingSignedFeeRange_eq(int64_t a, int64_t b) {
46163         LDKClosingSignedFeeRange a_conv;
46164         a_conv.inner = untag_ptr(a);
46165         a_conv.is_owned = ptr_is_owned(a);
46166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46167         a_conv.is_owned = false;
46168         LDKClosingSignedFeeRange b_conv;
46169         b_conv.inner = untag_ptr(b);
46170         b_conv.is_owned = ptr_is_owned(b);
46171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46172         b_conv.is_owned = false;
46173         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
46174         return ret_conv;
46175 }
46176
46177 void  CS_LDK_ClosingSigned_free(int64_t this_obj) {
46178         LDKClosingSigned this_obj_conv;
46179         this_obj_conv.inner = untag_ptr(this_obj);
46180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46182         ClosingSigned_free(this_obj_conv);
46183 }
46184
46185 int8_tArray  CS_LDK_ClosingSigned_get_channel_id(int64_t this_ptr) {
46186         LDKClosingSigned this_ptr_conv;
46187         this_ptr_conv.inner = untag_ptr(this_ptr);
46188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46190         this_ptr_conv.is_owned = false;
46191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46192         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
46193         return ret_arr;
46194 }
46195
46196 void  CS_LDK_ClosingSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
46197         LDKClosingSigned this_ptr_conv;
46198         this_ptr_conv.inner = untag_ptr(this_ptr);
46199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46201         this_ptr_conv.is_owned = false;
46202         LDKThirtyTwoBytes val_ref;
46203         CHECK(val->arr_len == 32);
46204         memcpy(val_ref.data, val->elems, 32); FREE(val);
46205         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
46206 }
46207
46208 int64_t  CS_LDK_ClosingSigned_get_fee_satoshis(int64_t this_ptr) {
46209         LDKClosingSigned this_ptr_conv;
46210         this_ptr_conv.inner = untag_ptr(this_ptr);
46211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46213         this_ptr_conv.is_owned = false;
46214         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
46215         return ret_conv;
46216 }
46217
46218 void  CS_LDK_ClosingSigned_set_fee_satoshis(int64_t this_ptr, int64_t val) {
46219         LDKClosingSigned this_ptr_conv;
46220         this_ptr_conv.inner = untag_ptr(this_ptr);
46221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46223         this_ptr_conv.is_owned = false;
46224         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
46225 }
46226
46227 int8_tArray  CS_LDK_ClosingSigned_get_signature(int64_t this_ptr) {
46228         LDKClosingSigned this_ptr_conv;
46229         this_ptr_conv.inner = untag_ptr(this_ptr);
46230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46232         this_ptr_conv.is_owned = false;
46233         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46234         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
46235         return ret_arr;
46236 }
46237
46238 void  CS_LDK_ClosingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
46239         LDKClosingSigned this_ptr_conv;
46240         this_ptr_conv.inner = untag_ptr(this_ptr);
46241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243         this_ptr_conv.is_owned = false;
46244         LDKECDSASignature val_ref;
46245         CHECK(val->arr_len == 64);
46246         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46247         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
46248 }
46249
46250 int64_t  CS_LDK_ClosingSigned_get_fee_range(int64_t this_ptr) {
46251         LDKClosingSigned this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
46257         int64_t ret_ref = 0;
46258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46260         return ret_ref;
46261 }
46262
46263 void  CS_LDK_ClosingSigned_set_fee_range(int64_t this_ptr, int64_t val) {
46264         LDKClosingSigned this_ptr_conv;
46265         this_ptr_conv.inner = untag_ptr(this_ptr);
46266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46268         this_ptr_conv.is_owned = false;
46269         LDKClosingSignedFeeRange val_conv;
46270         val_conv.inner = untag_ptr(val);
46271         val_conv.is_owned = ptr_is_owned(val);
46272         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46273         val_conv = ClosingSignedFeeRange_clone(&val_conv);
46274         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
46275 }
46276
46277 int64_t  CS_LDK_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
46278         LDKThirtyTwoBytes channel_id_arg_ref;
46279         CHECK(channel_id_arg->arr_len == 32);
46280         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46281         LDKECDSASignature signature_arg_ref;
46282         CHECK(signature_arg->arr_len == 64);
46283         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
46284         LDKClosingSignedFeeRange fee_range_arg_conv;
46285         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
46286         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
46287         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
46288         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
46289         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
46290         int64_t ret_ref = 0;
46291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46293         return ret_ref;
46294 }
46295
46296 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
46297         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
46298         int64_t ret_ref = 0;
46299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46301         return ret_ref;
46302 }
46303 int64_t  CS_LDK_ClosingSigned_clone_ptr(int64_t arg) {
46304         LDKClosingSigned arg_conv;
46305         arg_conv.inner = untag_ptr(arg);
46306         arg_conv.is_owned = ptr_is_owned(arg);
46307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46308         arg_conv.is_owned = false;
46309         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
46310         return ret_conv;
46311 }
46312
46313 int64_t  CS_LDK_ClosingSigned_clone(int64_t orig) {
46314         LDKClosingSigned orig_conv;
46315         orig_conv.inner = untag_ptr(orig);
46316         orig_conv.is_owned = ptr_is_owned(orig);
46317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46318         orig_conv.is_owned = false;
46319         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
46320         int64_t ret_ref = 0;
46321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46323         return ret_ref;
46324 }
46325
46326 int64_t  CS_LDK_ClosingSigned_hash(int64_t o) {
46327         LDKClosingSigned o_conv;
46328         o_conv.inner = untag_ptr(o);
46329         o_conv.is_owned = ptr_is_owned(o);
46330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46331         o_conv.is_owned = false;
46332         int64_t ret_conv = ClosingSigned_hash(&o_conv);
46333         return ret_conv;
46334 }
46335
46336 jboolean  CS_LDK_ClosingSigned_eq(int64_t a, int64_t b) {
46337         LDKClosingSigned a_conv;
46338         a_conv.inner = untag_ptr(a);
46339         a_conv.is_owned = ptr_is_owned(a);
46340         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46341         a_conv.is_owned = false;
46342         LDKClosingSigned b_conv;
46343         b_conv.inner = untag_ptr(b);
46344         b_conv.is_owned = ptr_is_owned(b);
46345         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46346         b_conv.is_owned = false;
46347         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
46348         return ret_conv;
46349 }
46350
46351 void  CS_LDK_UpdateAddHTLC_free(int64_t this_obj) {
46352         LDKUpdateAddHTLC this_obj_conv;
46353         this_obj_conv.inner = untag_ptr(this_obj);
46354         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46356         UpdateAddHTLC_free(this_obj_conv);
46357 }
46358
46359 int8_tArray  CS_LDK_UpdateAddHTLC_get_channel_id(int64_t this_ptr) {
46360         LDKUpdateAddHTLC this_ptr_conv;
46361         this_ptr_conv.inner = untag_ptr(this_ptr);
46362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46364         this_ptr_conv.is_owned = false;
46365         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46366         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
46367         return ret_arr;
46368 }
46369
46370 void  CS_LDK_UpdateAddHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46371         LDKUpdateAddHTLC this_ptr_conv;
46372         this_ptr_conv.inner = untag_ptr(this_ptr);
46373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46375         this_ptr_conv.is_owned = false;
46376         LDKThirtyTwoBytes val_ref;
46377         CHECK(val->arr_len == 32);
46378         memcpy(val_ref.data, val->elems, 32); FREE(val);
46379         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
46380 }
46381
46382 int64_t  CS_LDK_UpdateAddHTLC_get_htlc_id(int64_t this_ptr) {
46383         LDKUpdateAddHTLC this_ptr_conv;
46384         this_ptr_conv.inner = untag_ptr(this_ptr);
46385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46387         this_ptr_conv.is_owned = false;
46388         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
46389         return ret_conv;
46390 }
46391
46392 void  CS_LDK_UpdateAddHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46393         LDKUpdateAddHTLC this_ptr_conv;
46394         this_ptr_conv.inner = untag_ptr(this_ptr);
46395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46397         this_ptr_conv.is_owned = false;
46398         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
46399 }
46400
46401 int64_t  CS_LDK_UpdateAddHTLC_get_amount_msat(int64_t this_ptr) {
46402         LDKUpdateAddHTLC this_ptr_conv;
46403         this_ptr_conv.inner = untag_ptr(this_ptr);
46404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46406         this_ptr_conv.is_owned = false;
46407         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
46408         return ret_conv;
46409 }
46410
46411 void  CS_LDK_UpdateAddHTLC_set_amount_msat(int64_t this_ptr, int64_t val) {
46412         LDKUpdateAddHTLC this_ptr_conv;
46413         this_ptr_conv.inner = untag_ptr(this_ptr);
46414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46416         this_ptr_conv.is_owned = false;
46417         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
46418 }
46419
46420 int8_tArray  CS_LDK_UpdateAddHTLC_get_payment_hash(int64_t this_ptr) {
46421         LDKUpdateAddHTLC this_ptr_conv;
46422         this_ptr_conv.inner = untag_ptr(this_ptr);
46423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46425         this_ptr_conv.is_owned = false;
46426         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46427         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
46428         return ret_arr;
46429 }
46430
46431 void  CS_LDK_UpdateAddHTLC_set_payment_hash(int64_t this_ptr, int8_tArray val) {
46432         LDKUpdateAddHTLC this_ptr_conv;
46433         this_ptr_conv.inner = untag_ptr(this_ptr);
46434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46436         this_ptr_conv.is_owned = false;
46437         LDKThirtyTwoBytes val_ref;
46438         CHECK(val->arr_len == 32);
46439         memcpy(val_ref.data, val->elems, 32); FREE(val);
46440         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
46441 }
46442
46443 int32_t  CS_LDK_UpdateAddHTLC_get_cltv_expiry(int64_t this_ptr) {
46444         LDKUpdateAddHTLC this_ptr_conv;
46445         this_ptr_conv.inner = untag_ptr(this_ptr);
46446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46448         this_ptr_conv.is_owned = false;
46449         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
46450         return ret_conv;
46451 }
46452
46453 void  CS_LDK_UpdateAddHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
46454         LDKUpdateAddHTLC this_ptr_conv;
46455         this_ptr_conv.inner = untag_ptr(this_ptr);
46456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46458         this_ptr_conv.is_owned = false;
46459         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
46460 }
46461
46462 int64_t  CS_LDK_UpdateAddHTLC_get_skimmed_fee_msat(int64_t this_ptr) {
46463         LDKUpdateAddHTLC this_ptr_conv;
46464         this_ptr_conv.inner = untag_ptr(this_ptr);
46465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46467         this_ptr_conv.is_owned = false;
46468         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46469         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
46470         int64_t ret_ref = tag_ptr(ret_copy, true);
46471         return ret_ref;
46472 }
46473
46474 void  CS_LDK_UpdateAddHTLC_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
46475         LDKUpdateAddHTLC this_ptr_conv;
46476         this_ptr_conv.inner = untag_ptr(this_ptr);
46477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46479         this_ptr_conv.is_owned = false;
46480         void* val_ptr = untag_ptr(val);
46481         CHECK_ACCESS(val_ptr);
46482         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46483         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46484         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46485 }
46486
46487 int64_t  CS_LDK_UpdateAddHTLC_get_onion_routing_packet(int64_t this_ptr) {
46488         LDKUpdateAddHTLC this_ptr_conv;
46489         this_ptr_conv.inner = untag_ptr(this_ptr);
46490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46492         this_ptr_conv.is_owned = false;
46493         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
46494         int64_t ret_ref = 0;
46495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46497         return ret_ref;
46498 }
46499
46500 void  CS_LDK_UpdateAddHTLC_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
46501         LDKUpdateAddHTLC this_ptr_conv;
46502         this_ptr_conv.inner = untag_ptr(this_ptr);
46503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46505         this_ptr_conv.is_owned = false;
46506         LDKOnionPacket val_conv;
46507         val_conv.inner = untag_ptr(val);
46508         val_conv.is_owned = ptr_is_owned(val);
46509         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46510         val_conv = OnionPacket_clone(&val_conv);
46511         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
46512 }
46513
46514 int8_tArray  CS_LDK_UpdateAddHTLC_get_blinding_point(int64_t this_ptr) {
46515         LDKUpdateAddHTLC this_ptr_conv;
46516         this_ptr_conv.inner = untag_ptr(this_ptr);
46517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46519         this_ptr_conv.is_owned = false;
46520         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46521         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46522         return ret_arr;
46523 }
46524
46525 void  CS_LDK_UpdateAddHTLC_set_blinding_point(int64_t this_ptr, int8_tArray val) {
46526         LDKUpdateAddHTLC this_ptr_conv;
46527         this_ptr_conv.inner = untag_ptr(this_ptr);
46528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46530         this_ptr_conv.is_owned = false;
46531         LDKPublicKey val_ref;
46532         CHECK(val->arr_len == 33);
46533         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46534         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
46535 }
46536
46537 int64_t  CS_LDK_UpdateAddHTLC_new(int8_tArray 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) {
46538         LDKThirtyTwoBytes channel_id_arg_ref;
46539         CHECK(channel_id_arg->arr_len == 32);
46540         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46541         LDKThirtyTwoBytes payment_hash_arg_ref;
46542         CHECK(payment_hash_arg->arr_len == 32);
46543         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
46544         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46545         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46546         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46547         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46548         LDKOnionPacket onion_routing_packet_arg_conv;
46549         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46550         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46551         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46552         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
46553         LDKPublicKey blinding_point_arg_ref;
46554         CHECK(blinding_point_arg->arr_len == 33);
46555         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46556         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, 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);
46557         int64_t ret_ref = 0;
46558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46560         return ret_ref;
46561 }
46562
46563 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
46564         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
46565         int64_t ret_ref = 0;
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46568         return ret_ref;
46569 }
46570 int64_t  CS_LDK_UpdateAddHTLC_clone_ptr(int64_t arg) {
46571         LDKUpdateAddHTLC arg_conv;
46572         arg_conv.inner = untag_ptr(arg);
46573         arg_conv.is_owned = ptr_is_owned(arg);
46574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46575         arg_conv.is_owned = false;
46576         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
46577         return ret_conv;
46578 }
46579
46580 int64_t  CS_LDK_UpdateAddHTLC_clone(int64_t orig) {
46581         LDKUpdateAddHTLC orig_conv;
46582         orig_conv.inner = untag_ptr(orig);
46583         orig_conv.is_owned = ptr_is_owned(orig);
46584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46585         orig_conv.is_owned = false;
46586         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
46587         int64_t ret_ref = 0;
46588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46590         return ret_ref;
46591 }
46592
46593 int64_t  CS_LDK_UpdateAddHTLC_hash(int64_t o) {
46594         LDKUpdateAddHTLC o_conv;
46595         o_conv.inner = untag_ptr(o);
46596         o_conv.is_owned = ptr_is_owned(o);
46597         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46598         o_conv.is_owned = false;
46599         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
46600         return ret_conv;
46601 }
46602
46603 jboolean  CS_LDK_UpdateAddHTLC_eq(int64_t a, int64_t b) {
46604         LDKUpdateAddHTLC a_conv;
46605         a_conv.inner = untag_ptr(a);
46606         a_conv.is_owned = ptr_is_owned(a);
46607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46608         a_conv.is_owned = false;
46609         LDKUpdateAddHTLC b_conv;
46610         b_conv.inner = untag_ptr(b);
46611         b_conv.is_owned = ptr_is_owned(b);
46612         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46613         b_conv.is_owned = false;
46614         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
46615         return ret_conv;
46616 }
46617
46618 void  CS_LDK_OnionMessage_free(int64_t this_obj) {
46619         LDKOnionMessage this_obj_conv;
46620         this_obj_conv.inner = untag_ptr(this_obj);
46621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46623         OnionMessage_free(this_obj_conv);
46624 }
46625
46626 int8_tArray  CS_LDK_OnionMessage_get_blinding_point(int64_t this_ptr) {
46627         LDKOnionMessage this_ptr_conv;
46628         this_ptr_conv.inner = untag_ptr(this_ptr);
46629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46631         this_ptr_conv.is_owned = false;
46632         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
46633         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
46634         return ret_arr;
46635 }
46636
46637 void  CS_LDK_OnionMessage_set_blinding_point(int64_t this_ptr, int8_tArray val) {
46638         LDKOnionMessage this_ptr_conv;
46639         this_ptr_conv.inner = untag_ptr(this_ptr);
46640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46642         this_ptr_conv.is_owned = false;
46643         LDKPublicKey val_ref;
46644         CHECK(val->arr_len == 33);
46645         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
46646         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
46647 }
46648
46649 int64_t  CS_LDK_OnionMessage_get_onion_routing_packet(int64_t this_ptr) {
46650         LDKOnionMessage this_ptr_conv;
46651         this_ptr_conv.inner = untag_ptr(this_ptr);
46652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46654         this_ptr_conv.is_owned = false;
46655         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
46656         int64_t ret_ref = 0;
46657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46659         return ret_ref;
46660 }
46661
46662 void  CS_LDK_OnionMessage_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
46663         LDKOnionMessage this_ptr_conv;
46664         this_ptr_conv.inner = untag_ptr(this_ptr);
46665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46667         this_ptr_conv.is_owned = false;
46668         LDKPacket val_conv;
46669         val_conv.inner = untag_ptr(val);
46670         val_conv.is_owned = ptr_is_owned(val);
46671         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46672         val_conv = Packet_clone(&val_conv);
46673         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
46674 }
46675
46676 int64_t  CS_LDK_OnionMessage_new(int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
46677         LDKPublicKey blinding_point_arg_ref;
46678         CHECK(blinding_point_arg->arr_len == 33);
46679         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
46680         LDKPacket onion_routing_packet_arg_conv;
46681         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
46682         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
46683         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
46684         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
46685         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
46686         int64_t ret_ref = 0;
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46689         return ret_ref;
46690 }
46691
46692 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
46693         LDKOnionMessage ret_var = OnionMessage_clone(arg);
46694         int64_t ret_ref = 0;
46695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46697         return ret_ref;
46698 }
46699 int64_t  CS_LDK_OnionMessage_clone_ptr(int64_t arg) {
46700         LDKOnionMessage arg_conv;
46701         arg_conv.inner = untag_ptr(arg);
46702         arg_conv.is_owned = ptr_is_owned(arg);
46703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46704         arg_conv.is_owned = false;
46705         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
46706         return ret_conv;
46707 }
46708
46709 int64_t  CS_LDK_OnionMessage_clone(int64_t orig) {
46710         LDKOnionMessage orig_conv;
46711         orig_conv.inner = untag_ptr(orig);
46712         orig_conv.is_owned = ptr_is_owned(orig);
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46714         orig_conv.is_owned = false;
46715         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
46716         int64_t ret_ref = 0;
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46719         return ret_ref;
46720 }
46721
46722 int64_t  CS_LDK_OnionMessage_hash(int64_t o) {
46723         LDKOnionMessage o_conv;
46724         o_conv.inner = untag_ptr(o);
46725         o_conv.is_owned = ptr_is_owned(o);
46726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46727         o_conv.is_owned = false;
46728         int64_t ret_conv = OnionMessage_hash(&o_conv);
46729         return ret_conv;
46730 }
46731
46732 jboolean  CS_LDK_OnionMessage_eq(int64_t a, int64_t b) {
46733         LDKOnionMessage a_conv;
46734         a_conv.inner = untag_ptr(a);
46735         a_conv.is_owned = ptr_is_owned(a);
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46737         a_conv.is_owned = false;
46738         LDKOnionMessage b_conv;
46739         b_conv.inner = untag_ptr(b);
46740         b_conv.is_owned = ptr_is_owned(b);
46741         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46742         b_conv.is_owned = false;
46743         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
46744         return ret_conv;
46745 }
46746
46747 void  CS_LDK_UpdateFulfillHTLC_free(int64_t this_obj) {
46748         LDKUpdateFulfillHTLC this_obj_conv;
46749         this_obj_conv.inner = untag_ptr(this_obj);
46750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46752         UpdateFulfillHTLC_free(this_obj_conv);
46753 }
46754
46755 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_channel_id(int64_t this_ptr) {
46756         LDKUpdateFulfillHTLC this_ptr_conv;
46757         this_ptr_conv.inner = untag_ptr(this_ptr);
46758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46760         this_ptr_conv.is_owned = false;
46761         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46762         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
46763         return ret_arr;
46764 }
46765
46766 void  CS_LDK_UpdateFulfillHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46767         LDKUpdateFulfillHTLC this_ptr_conv;
46768         this_ptr_conv.inner = untag_ptr(this_ptr);
46769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46771         this_ptr_conv.is_owned = false;
46772         LDKThirtyTwoBytes val_ref;
46773         CHECK(val->arr_len == 32);
46774         memcpy(val_ref.data, val->elems, 32); FREE(val);
46775         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
46776 }
46777
46778 int64_t  CS_LDK_UpdateFulfillHTLC_get_htlc_id(int64_t this_ptr) {
46779         LDKUpdateFulfillHTLC this_ptr_conv;
46780         this_ptr_conv.inner = untag_ptr(this_ptr);
46781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46783         this_ptr_conv.is_owned = false;
46784         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
46785         return ret_conv;
46786 }
46787
46788 void  CS_LDK_UpdateFulfillHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46789         LDKUpdateFulfillHTLC this_ptr_conv;
46790         this_ptr_conv.inner = untag_ptr(this_ptr);
46791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46793         this_ptr_conv.is_owned = false;
46794         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
46795 }
46796
46797 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_payment_preimage(int64_t this_ptr) {
46798         LDKUpdateFulfillHTLC this_ptr_conv;
46799         this_ptr_conv.inner = untag_ptr(this_ptr);
46800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46802         this_ptr_conv.is_owned = false;
46803         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46804         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
46805         return ret_arr;
46806 }
46807
46808 void  CS_LDK_UpdateFulfillHTLC_set_payment_preimage(int64_t this_ptr, int8_tArray val) {
46809         LDKUpdateFulfillHTLC this_ptr_conv;
46810         this_ptr_conv.inner = untag_ptr(this_ptr);
46811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46813         this_ptr_conv.is_owned = false;
46814         LDKThirtyTwoBytes val_ref;
46815         CHECK(val->arr_len == 32);
46816         memcpy(val_ref.data, val->elems, 32); FREE(val);
46817         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
46818 }
46819
46820 int64_t  CS_LDK_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
46821         LDKThirtyTwoBytes channel_id_arg_ref;
46822         CHECK(channel_id_arg->arr_len == 32);
46823         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
46824         LDKThirtyTwoBytes payment_preimage_arg_ref;
46825         CHECK(payment_preimage_arg->arr_len == 32);
46826         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
46827         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
46828         int64_t ret_ref = 0;
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46831         return ret_ref;
46832 }
46833
46834 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
46835         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
46836         int64_t ret_ref = 0;
46837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46839         return ret_ref;
46840 }
46841 int64_t  CS_LDK_UpdateFulfillHTLC_clone_ptr(int64_t arg) {
46842         LDKUpdateFulfillHTLC arg_conv;
46843         arg_conv.inner = untag_ptr(arg);
46844         arg_conv.is_owned = ptr_is_owned(arg);
46845         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46846         arg_conv.is_owned = false;
46847         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
46848         return ret_conv;
46849 }
46850
46851 int64_t  CS_LDK_UpdateFulfillHTLC_clone(int64_t orig) {
46852         LDKUpdateFulfillHTLC orig_conv;
46853         orig_conv.inner = untag_ptr(orig);
46854         orig_conv.is_owned = ptr_is_owned(orig);
46855         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46856         orig_conv.is_owned = false;
46857         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
46858         int64_t ret_ref = 0;
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46861         return ret_ref;
46862 }
46863
46864 int64_t  CS_LDK_UpdateFulfillHTLC_hash(int64_t o) {
46865         LDKUpdateFulfillHTLC o_conv;
46866         o_conv.inner = untag_ptr(o);
46867         o_conv.is_owned = ptr_is_owned(o);
46868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46869         o_conv.is_owned = false;
46870         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
46871         return ret_conv;
46872 }
46873
46874 jboolean  CS_LDK_UpdateFulfillHTLC_eq(int64_t a, int64_t b) {
46875         LDKUpdateFulfillHTLC a_conv;
46876         a_conv.inner = untag_ptr(a);
46877         a_conv.is_owned = ptr_is_owned(a);
46878         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46879         a_conv.is_owned = false;
46880         LDKUpdateFulfillHTLC b_conv;
46881         b_conv.inner = untag_ptr(b);
46882         b_conv.is_owned = ptr_is_owned(b);
46883         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46884         b_conv.is_owned = false;
46885         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
46886         return ret_conv;
46887 }
46888
46889 void  CS_LDK_UpdateFailHTLC_free(int64_t this_obj) {
46890         LDKUpdateFailHTLC this_obj_conv;
46891         this_obj_conv.inner = untag_ptr(this_obj);
46892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46894         UpdateFailHTLC_free(this_obj_conv);
46895 }
46896
46897 int8_tArray  CS_LDK_UpdateFailHTLC_get_channel_id(int64_t this_ptr) {
46898         LDKUpdateFailHTLC this_ptr_conv;
46899         this_ptr_conv.inner = untag_ptr(this_ptr);
46900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46902         this_ptr_conv.is_owned = false;
46903         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46904         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
46905         return ret_arr;
46906 }
46907
46908 void  CS_LDK_UpdateFailHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
46909         LDKUpdateFailHTLC this_ptr_conv;
46910         this_ptr_conv.inner = untag_ptr(this_ptr);
46911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46913         this_ptr_conv.is_owned = false;
46914         LDKThirtyTwoBytes val_ref;
46915         CHECK(val->arr_len == 32);
46916         memcpy(val_ref.data, val->elems, 32); FREE(val);
46917         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
46918 }
46919
46920 int64_t  CS_LDK_UpdateFailHTLC_get_htlc_id(int64_t this_ptr) {
46921         LDKUpdateFailHTLC this_ptr_conv;
46922         this_ptr_conv.inner = untag_ptr(this_ptr);
46923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46925         this_ptr_conv.is_owned = false;
46926         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
46927         return ret_conv;
46928 }
46929
46930 void  CS_LDK_UpdateFailHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
46931         LDKUpdateFailHTLC this_ptr_conv;
46932         this_ptr_conv.inner = untag_ptr(this_ptr);
46933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46935         this_ptr_conv.is_owned = false;
46936         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
46937 }
46938
46939 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
46940         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
46941         int64_t ret_ref = 0;
46942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46944         return ret_ref;
46945 }
46946 int64_t  CS_LDK_UpdateFailHTLC_clone_ptr(int64_t arg) {
46947         LDKUpdateFailHTLC arg_conv;
46948         arg_conv.inner = untag_ptr(arg);
46949         arg_conv.is_owned = ptr_is_owned(arg);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46951         arg_conv.is_owned = false;
46952         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
46953         return ret_conv;
46954 }
46955
46956 int64_t  CS_LDK_UpdateFailHTLC_clone(int64_t orig) {
46957         LDKUpdateFailHTLC orig_conv;
46958         orig_conv.inner = untag_ptr(orig);
46959         orig_conv.is_owned = ptr_is_owned(orig);
46960         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46961         orig_conv.is_owned = false;
46962         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
46963         int64_t ret_ref = 0;
46964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46966         return ret_ref;
46967 }
46968
46969 int64_t  CS_LDK_UpdateFailHTLC_hash(int64_t o) {
46970         LDKUpdateFailHTLC o_conv;
46971         o_conv.inner = untag_ptr(o);
46972         o_conv.is_owned = ptr_is_owned(o);
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46974         o_conv.is_owned = false;
46975         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
46976         return ret_conv;
46977 }
46978
46979 jboolean  CS_LDK_UpdateFailHTLC_eq(int64_t a, int64_t b) {
46980         LDKUpdateFailHTLC a_conv;
46981         a_conv.inner = untag_ptr(a);
46982         a_conv.is_owned = ptr_is_owned(a);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46984         a_conv.is_owned = false;
46985         LDKUpdateFailHTLC b_conv;
46986         b_conv.inner = untag_ptr(b);
46987         b_conv.is_owned = ptr_is_owned(b);
46988         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46989         b_conv.is_owned = false;
46990         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
46991         return ret_conv;
46992 }
46993
46994 void  CS_LDK_UpdateFailMalformedHTLC_free(int64_t this_obj) {
46995         LDKUpdateFailMalformedHTLC this_obj_conv;
46996         this_obj_conv.inner = untag_ptr(this_obj);
46997         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46999         UpdateFailMalformedHTLC_free(this_obj_conv);
47000 }
47001
47002 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_get_channel_id(int64_t this_ptr) {
47003         LDKUpdateFailMalformedHTLC this_ptr_conv;
47004         this_ptr_conv.inner = untag_ptr(this_ptr);
47005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47007         this_ptr_conv.is_owned = false;
47008         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47009         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
47010         return ret_arr;
47011 }
47012
47013 void  CS_LDK_UpdateFailMalformedHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
47014         LDKUpdateFailMalformedHTLC 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         LDKThirtyTwoBytes val_ref;
47020         CHECK(val->arr_len == 32);
47021         memcpy(val_ref.data, val->elems, 32); FREE(val);
47022         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
47023 }
47024
47025 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_htlc_id(int64_t this_ptr) {
47026         LDKUpdateFailMalformedHTLC this_ptr_conv;
47027         this_ptr_conv.inner = untag_ptr(this_ptr);
47028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47030         this_ptr_conv.is_owned = false;
47031         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
47032         return ret_conv;
47033 }
47034
47035 void  CS_LDK_UpdateFailMalformedHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
47036         LDKUpdateFailMalformedHTLC this_ptr_conv;
47037         this_ptr_conv.inner = untag_ptr(this_ptr);
47038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47040         this_ptr_conv.is_owned = false;
47041         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
47042 }
47043
47044 int16_t  CS_LDK_UpdateFailMalformedHTLC_get_failure_code(int64_t this_ptr) {
47045         LDKUpdateFailMalformedHTLC this_ptr_conv;
47046         this_ptr_conv.inner = untag_ptr(this_ptr);
47047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47049         this_ptr_conv.is_owned = false;
47050         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
47051         return ret_conv;
47052 }
47053
47054 void  CS_LDK_UpdateFailMalformedHTLC_set_failure_code(int64_t this_ptr, int16_t val) {
47055         LDKUpdateFailMalformedHTLC this_ptr_conv;
47056         this_ptr_conv.inner = untag_ptr(this_ptr);
47057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47059         this_ptr_conv.is_owned = false;
47060         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
47061 }
47062
47063 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
47064         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
47065         int64_t ret_ref = 0;
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47068         return ret_ref;
47069 }
47070 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone_ptr(int64_t arg) {
47071         LDKUpdateFailMalformedHTLC arg_conv;
47072         arg_conv.inner = untag_ptr(arg);
47073         arg_conv.is_owned = ptr_is_owned(arg);
47074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47075         arg_conv.is_owned = false;
47076         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
47077         return ret_conv;
47078 }
47079
47080 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone(int64_t orig) {
47081         LDKUpdateFailMalformedHTLC orig_conv;
47082         orig_conv.inner = untag_ptr(orig);
47083         orig_conv.is_owned = ptr_is_owned(orig);
47084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47085         orig_conv.is_owned = false;
47086         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
47087         int64_t ret_ref = 0;
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47090         return ret_ref;
47091 }
47092
47093 int64_t  CS_LDK_UpdateFailMalformedHTLC_hash(int64_t o) {
47094         LDKUpdateFailMalformedHTLC o_conv;
47095         o_conv.inner = untag_ptr(o);
47096         o_conv.is_owned = ptr_is_owned(o);
47097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47098         o_conv.is_owned = false;
47099         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
47100         return ret_conv;
47101 }
47102
47103 jboolean  CS_LDK_UpdateFailMalformedHTLC_eq(int64_t a, int64_t b) {
47104         LDKUpdateFailMalformedHTLC a_conv;
47105         a_conv.inner = untag_ptr(a);
47106         a_conv.is_owned = ptr_is_owned(a);
47107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47108         a_conv.is_owned = false;
47109         LDKUpdateFailMalformedHTLC b_conv;
47110         b_conv.inner = untag_ptr(b);
47111         b_conv.is_owned = ptr_is_owned(b);
47112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47113         b_conv.is_owned = false;
47114         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
47115         return ret_conv;
47116 }
47117
47118 void  CS_LDK_CommitmentSigned_free(int64_t this_obj) {
47119         LDKCommitmentSigned this_obj_conv;
47120         this_obj_conv.inner = untag_ptr(this_obj);
47121         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47123         CommitmentSigned_free(this_obj_conv);
47124 }
47125
47126 int8_tArray  CS_LDK_CommitmentSigned_get_channel_id(int64_t this_ptr) {
47127         LDKCommitmentSigned this_ptr_conv;
47128         this_ptr_conv.inner = untag_ptr(this_ptr);
47129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47131         this_ptr_conv.is_owned = false;
47132         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47133         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
47134         return ret_arr;
47135 }
47136
47137 void  CS_LDK_CommitmentSigned_set_channel_id(int64_t this_ptr, int8_tArray val) {
47138         LDKCommitmentSigned this_ptr_conv;
47139         this_ptr_conv.inner = untag_ptr(this_ptr);
47140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47142         this_ptr_conv.is_owned = false;
47143         LDKThirtyTwoBytes val_ref;
47144         CHECK(val->arr_len == 32);
47145         memcpy(val_ref.data, val->elems, 32); FREE(val);
47146         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
47147 }
47148
47149 int8_tArray  CS_LDK_CommitmentSigned_get_signature(int64_t this_ptr) {
47150         LDKCommitmentSigned this_ptr_conv;
47151         this_ptr_conv.inner = untag_ptr(this_ptr);
47152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47154         this_ptr_conv.is_owned = false;
47155         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47156         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
47157         return ret_arr;
47158 }
47159
47160 void  CS_LDK_CommitmentSigned_set_signature(int64_t this_ptr, int8_tArray val) {
47161         LDKCommitmentSigned this_ptr_conv;
47162         this_ptr_conv.inner = untag_ptr(this_ptr);
47163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47165         this_ptr_conv.is_owned = false;
47166         LDKECDSASignature val_ref;
47167         CHECK(val->arr_len == 64);
47168         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47169         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
47170 }
47171
47172 ptrArray  CS_LDK_CommitmentSigned_get_htlc_signatures(int64_t this_ptr) {
47173         LDKCommitmentSigned this_ptr_conv;
47174         this_ptr_conv.inner = untag_ptr(this_ptr);
47175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47177         this_ptr_conv.is_owned = false;
47178         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
47179         ptrArray ret_arr = NULL;
47180         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
47181         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
47182         for (size_t i = 0; i < ret_var.datalen; i++) {
47183                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
47184                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
47185                 ret_arr_ptr[i] = ret_conv_8_arr;
47186         }
47187         
47188         FREE(ret_var.data);
47189         return ret_arr;
47190 }
47191
47192 void  CS_LDK_CommitmentSigned_set_htlc_signatures(int64_t this_ptr, ptrArray val) {
47193         LDKCommitmentSigned this_ptr_conv;
47194         this_ptr_conv.inner = untag_ptr(this_ptr);
47195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47197         this_ptr_conv.is_owned = false;
47198         LDKCVec_ECDSASignatureZ val_constr;
47199         val_constr.datalen = val->arr_len;
47200         if (val_constr.datalen > 0)
47201                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47202         else
47203                 val_constr.data = NULL;
47204         int8_tArray* val_vals = (void*) val->elems;
47205         for (size_t i = 0; i < val_constr.datalen; i++) {
47206                 int8_tArray val_conv_8 = val_vals[i];
47207                 LDKECDSASignature val_conv_8_ref;
47208                 CHECK(val_conv_8->arr_len == 64);
47209                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
47210                 val_constr.data[i] = val_conv_8_ref;
47211         }
47212         FREE(val);
47213         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
47214 }
47215
47216 int64_t  CS_LDK_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
47217         LDKThirtyTwoBytes channel_id_arg_ref;
47218         CHECK(channel_id_arg->arr_len == 32);
47219         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47220         LDKECDSASignature signature_arg_ref;
47221         CHECK(signature_arg->arr_len == 64);
47222         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
47223         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
47224         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
47225         if (htlc_signatures_arg_constr.datalen > 0)
47226                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
47227         else
47228                 htlc_signatures_arg_constr.data = NULL;
47229         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
47230         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
47231                 int8_tArray htlc_signatures_arg_conv_8 = htlc_signatures_arg_vals[i];
47232                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
47233                 CHECK(htlc_signatures_arg_conv_8->arr_len == 64);
47234                 memcpy(htlc_signatures_arg_conv_8_ref.compact_form, htlc_signatures_arg_conv_8->elems, 64); FREE(htlc_signatures_arg_conv_8);
47235                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
47236         }
47237         FREE(htlc_signatures_arg);
47238         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
47239         int64_t ret_ref = 0;
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47242         return ret_ref;
47243 }
47244
47245 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
47246         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
47247         int64_t ret_ref = 0;
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47250         return ret_ref;
47251 }
47252 int64_t  CS_LDK_CommitmentSigned_clone_ptr(int64_t arg) {
47253         LDKCommitmentSigned arg_conv;
47254         arg_conv.inner = untag_ptr(arg);
47255         arg_conv.is_owned = ptr_is_owned(arg);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47257         arg_conv.is_owned = false;
47258         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
47259         return ret_conv;
47260 }
47261
47262 int64_t  CS_LDK_CommitmentSigned_clone(int64_t orig) {
47263         LDKCommitmentSigned orig_conv;
47264         orig_conv.inner = untag_ptr(orig);
47265         orig_conv.is_owned = ptr_is_owned(orig);
47266         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47267         orig_conv.is_owned = false;
47268         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
47269         int64_t ret_ref = 0;
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47272         return ret_ref;
47273 }
47274
47275 int64_t  CS_LDK_CommitmentSigned_hash(int64_t o) {
47276         LDKCommitmentSigned o_conv;
47277         o_conv.inner = untag_ptr(o);
47278         o_conv.is_owned = ptr_is_owned(o);
47279         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47280         o_conv.is_owned = false;
47281         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
47282         return ret_conv;
47283 }
47284
47285 jboolean  CS_LDK_CommitmentSigned_eq(int64_t a, int64_t b) {
47286         LDKCommitmentSigned a_conv;
47287         a_conv.inner = untag_ptr(a);
47288         a_conv.is_owned = ptr_is_owned(a);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47290         a_conv.is_owned = false;
47291         LDKCommitmentSigned b_conv;
47292         b_conv.inner = untag_ptr(b);
47293         b_conv.is_owned = ptr_is_owned(b);
47294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47295         b_conv.is_owned = false;
47296         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
47297         return ret_conv;
47298 }
47299
47300 void  CS_LDK_RevokeAndACK_free(int64_t this_obj) {
47301         LDKRevokeAndACK this_obj_conv;
47302         this_obj_conv.inner = untag_ptr(this_obj);
47303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47305         RevokeAndACK_free(this_obj_conv);
47306 }
47307
47308 int8_tArray  CS_LDK_RevokeAndACK_get_channel_id(int64_t this_ptr) {
47309         LDKRevokeAndACK this_ptr_conv;
47310         this_ptr_conv.inner = untag_ptr(this_ptr);
47311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47313         this_ptr_conv.is_owned = false;
47314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47315         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
47316         return ret_arr;
47317 }
47318
47319 void  CS_LDK_RevokeAndACK_set_channel_id(int64_t this_ptr, int8_tArray val) {
47320         LDKRevokeAndACK this_ptr_conv;
47321         this_ptr_conv.inner = untag_ptr(this_ptr);
47322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47324         this_ptr_conv.is_owned = false;
47325         LDKThirtyTwoBytes val_ref;
47326         CHECK(val->arr_len == 32);
47327         memcpy(val_ref.data, val->elems, 32); FREE(val);
47328         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
47329 }
47330
47331 int8_tArray  CS_LDK_RevokeAndACK_get_per_commitment_secret(int64_t this_ptr) {
47332         LDKRevokeAndACK this_ptr_conv;
47333         this_ptr_conv.inner = untag_ptr(this_ptr);
47334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47336         this_ptr_conv.is_owned = false;
47337         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47338         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
47339         return ret_arr;
47340 }
47341
47342 void  CS_LDK_RevokeAndACK_set_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
47343         LDKRevokeAndACK this_ptr_conv;
47344         this_ptr_conv.inner = untag_ptr(this_ptr);
47345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47347         this_ptr_conv.is_owned = false;
47348         LDKThirtyTwoBytes val_ref;
47349         CHECK(val->arr_len == 32);
47350         memcpy(val_ref.data, val->elems, 32); FREE(val);
47351         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
47352 }
47353
47354 int8_tArray  CS_LDK_RevokeAndACK_get_next_per_commitment_point(int64_t this_ptr) {
47355         LDKRevokeAndACK this_ptr_conv;
47356         this_ptr_conv.inner = untag_ptr(this_ptr);
47357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47359         this_ptr_conv.is_owned = false;
47360         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47361         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47362         return ret_arr;
47363 }
47364
47365 void  CS_LDK_RevokeAndACK_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47366         LDKRevokeAndACK this_ptr_conv;
47367         this_ptr_conv.inner = untag_ptr(this_ptr);
47368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47370         this_ptr_conv.is_owned = false;
47371         LDKPublicKey val_ref;
47372         CHECK(val->arr_len == 33);
47373         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47374         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
47375 }
47376
47377 int64_t  CS_LDK_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
47378         LDKThirtyTwoBytes channel_id_arg_ref;
47379         CHECK(channel_id_arg->arr_len == 32);
47380         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47381         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
47382         CHECK(per_commitment_secret_arg->arr_len == 32);
47383         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
47384         LDKPublicKey next_per_commitment_point_arg_ref;
47385         CHECK(next_per_commitment_point_arg->arr_len == 33);
47386         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
47387         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
47388         int64_t ret_ref = 0;
47389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47391         return ret_ref;
47392 }
47393
47394 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
47395         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
47396         int64_t ret_ref = 0;
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47399         return ret_ref;
47400 }
47401 int64_t  CS_LDK_RevokeAndACK_clone_ptr(int64_t arg) {
47402         LDKRevokeAndACK arg_conv;
47403         arg_conv.inner = untag_ptr(arg);
47404         arg_conv.is_owned = ptr_is_owned(arg);
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47406         arg_conv.is_owned = false;
47407         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
47408         return ret_conv;
47409 }
47410
47411 int64_t  CS_LDK_RevokeAndACK_clone(int64_t orig) {
47412         LDKRevokeAndACK orig_conv;
47413         orig_conv.inner = untag_ptr(orig);
47414         orig_conv.is_owned = ptr_is_owned(orig);
47415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47416         orig_conv.is_owned = false;
47417         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
47418         int64_t ret_ref = 0;
47419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47421         return ret_ref;
47422 }
47423
47424 int64_t  CS_LDK_RevokeAndACK_hash(int64_t o) {
47425         LDKRevokeAndACK o_conv;
47426         o_conv.inner = untag_ptr(o);
47427         o_conv.is_owned = ptr_is_owned(o);
47428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47429         o_conv.is_owned = false;
47430         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
47431         return ret_conv;
47432 }
47433
47434 jboolean  CS_LDK_RevokeAndACK_eq(int64_t a, int64_t b) {
47435         LDKRevokeAndACK a_conv;
47436         a_conv.inner = untag_ptr(a);
47437         a_conv.is_owned = ptr_is_owned(a);
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47439         a_conv.is_owned = false;
47440         LDKRevokeAndACK b_conv;
47441         b_conv.inner = untag_ptr(b);
47442         b_conv.is_owned = ptr_is_owned(b);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47444         b_conv.is_owned = false;
47445         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
47446         return ret_conv;
47447 }
47448
47449 void  CS_LDK_UpdateFee_free(int64_t this_obj) {
47450         LDKUpdateFee this_obj_conv;
47451         this_obj_conv.inner = untag_ptr(this_obj);
47452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47454         UpdateFee_free(this_obj_conv);
47455 }
47456
47457 int8_tArray  CS_LDK_UpdateFee_get_channel_id(int64_t this_ptr) {
47458         LDKUpdateFee this_ptr_conv;
47459         this_ptr_conv.inner = untag_ptr(this_ptr);
47460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47462         this_ptr_conv.is_owned = false;
47463         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47464         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
47465         return ret_arr;
47466 }
47467
47468 void  CS_LDK_UpdateFee_set_channel_id(int64_t this_ptr, int8_tArray val) {
47469         LDKUpdateFee this_ptr_conv;
47470         this_ptr_conv.inner = untag_ptr(this_ptr);
47471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47473         this_ptr_conv.is_owned = false;
47474         LDKThirtyTwoBytes val_ref;
47475         CHECK(val->arr_len == 32);
47476         memcpy(val_ref.data, val->elems, 32); FREE(val);
47477         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
47478 }
47479
47480 int32_t  CS_LDK_UpdateFee_get_feerate_per_kw(int64_t this_ptr) {
47481         LDKUpdateFee this_ptr_conv;
47482         this_ptr_conv.inner = untag_ptr(this_ptr);
47483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47485         this_ptr_conv.is_owned = false;
47486         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
47487         return ret_conv;
47488 }
47489
47490 void  CS_LDK_UpdateFee_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
47491         LDKUpdateFee this_ptr_conv;
47492         this_ptr_conv.inner = untag_ptr(this_ptr);
47493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47495         this_ptr_conv.is_owned = false;
47496         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
47497 }
47498
47499 int64_t  CS_LDK_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
47500         LDKThirtyTwoBytes channel_id_arg_ref;
47501         CHECK(channel_id_arg->arr_len == 32);
47502         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47503         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
47504         int64_t ret_ref = 0;
47505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47507         return ret_ref;
47508 }
47509
47510 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
47511         LDKUpdateFee ret_var = UpdateFee_clone(arg);
47512         int64_t ret_ref = 0;
47513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47515         return ret_ref;
47516 }
47517 int64_t  CS_LDK_UpdateFee_clone_ptr(int64_t arg) {
47518         LDKUpdateFee arg_conv;
47519         arg_conv.inner = untag_ptr(arg);
47520         arg_conv.is_owned = ptr_is_owned(arg);
47521         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47522         arg_conv.is_owned = false;
47523         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
47524         return ret_conv;
47525 }
47526
47527 int64_t  CS_LDK_UpdateFee_clone(int64_t orig) {
47528         LDKUpdateFee orig_conv;
47529         orig_conv.inner = untag_ptr(orig);
47530         orig_conv.is_owned = ptr_is_owned(orig);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47532         orig_conv.is_owned = false;
47533         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
47534         int64_t ret_ref = 0;
47535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47537         return ret_ref;
47538 }
47539
47540 int64_t  CS_LDK_UpdateFee_hash(int64_t o) {
47541         LDKUpdateFee o_conv;
47542         o_conv.inner = untag_ptr(o);
47543         o_conv.is_owned = ptr_is_owned(o);
47544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47545         o_conv.is_owned = false;
47546         int64_t ret_conv = UpdateFee_hash(&o_conv);
47547         return ret_conv;
47548 }
47549
47550 jboolean  CS_LDK_UpdateFee_eq(int64_t a, int64_t b) {
47551         LDKUpdateFee a_conv;
47552         a_conv.inner = untag_ptr(a);
47553         a_conv.is_owned = ptr_is_owned(a);
47554         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47555         a_conv.is_owned = false;
47556         LDKUpdateFee b_conv;
47557         b_conv.inner = untag_ptr(b);
47558         b_conv.is_owned = ptr_is_owned(b);
47559         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47560         b_conv.is_owned = false;
47561         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
47562         return ret_conv;
47563 }
47564
47565 void  CS_LDK_ChannelReestablish_free(int64_t this_obj) {
47566         LDKChannelReestablish this_obj_conv;
47567         this_obj_conv.inner = untag_ptr(this_obj);
47568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47570         ChannelReestablish_free(this_obj_conv);
47571 }
47572
47573 int8_tArray  CS_LDK_ChannelReestablish_get_channel_id(int64_t this_ptr) {
47574         LDKChannelReestablish this_ptr_conv;
47575         this_ptr_conv.inner = untag_ptr(this_ptr);
47576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47578         this_ptr_conv.is_owned = false;
47579         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47580         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
47581         return ret_arr;
47582 }
47583
47584 void  CS_LDK_ChannelReestablish_set_channel_id(int64_t this_ptr, int8_tArray val) {
47585         LDKChannelReestablish this_ptr_conv;
47586         this_ptr_conv.inner = untag_ptr(this_ptr);
47587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47589         this_ptr_conv.is_owned = false;
47590         LDKThirtyTwoBytes val_ref;
47591         CHECK(val->arr_len == 32);
47592         memcpy(val_ref.data, val->elems, 32); FREE(val);
47593         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
47594 }
47595
47596 int64_t  CS_LDK_ChannelReestablish_get_next_local_commitment_number(int64_t this_ptr) {
47597         LDKChannelReestablish this_ptr_conv;
47598         this_ptr_conv.inner = untag_ptr(this_ptr);
47599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47601         this_ptr_conv.is_owned = false;
47602         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
47603         return ret_conv;
47604 }
47605
47606 void  CS_LDK_ChannelReestablish_set_next_local_commitment_number(int64_t this_ptr, int64_t val) {
47607         LDKChannelReestablish this_ptr_conv;
47608         this_ptr_conv.inner = untag_ptr(this_ptr);
47609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47611         this_ptr_conv.is_owned = false;
47612         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
47613 }
47614
47615 int64_t  CS_LDK_ChannelReestablish_get_next_remote_commitment_number(int64_t this_ptr) {
47616         LDKChannelReestablish this_ptr_conv;
47617         this_ptr_conv.inner = untag_ptr(this_ptr);
47618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47620         this_ptr_conv.is_owned = false;
47621         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
47622         return ret_conv;
47623 }
47624
47625 void  CS_LDK_ChannelReestablish_set_next_remote_commitment_number(int64_t this_ptr, int64_t val) {
47626         LDKChannelReestablish this_ptr_conv;
47627         this_ptr_conv.inner = untag_ptr(this_ptr);
47628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47630         this_ptr_conv.is_owned = false;
47631         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
47632 }
47633
47634 int8_tArray  CS_LDK_ChannelReestablish_get_your_last_per_commitment_secret(int64_t this_ptr) {
47635         LDKChannelReestablish this_ptr_conv;
47636         this_ptr_conv.inner = untag_ptr(this_ptr);
47637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47639         this_ptr_conv.is_owned = false;
47640         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47641         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
47642         return ret_arr;
47643 }
47644
47645 void  CS_LDK_ChannelReestablish_set_your_last_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
47646         LDKChannelReestablish this_ptr_conv;
47647         this_ptr_conv.inner = untag_ptr(this_ptr);
47648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47650         this_ptr_conv.is_owned = false;
47651         LDKThirtyTwoBytes val_ref;
47652         CHECK(val->arr_len == 32);
47653         memcpy(val_ref.data, val->elems, 32); FREE(val);
47654         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
47655 }
47656
47657 int8_tArray  CS_LDK_ChannelReestablish_get_my_current_per_commitment_point(int64_t this_ptr) {
47658         LDKChannelReestablish this_ptr_conv;
47659         this_ptr_conv.inner = untag_ptr(this_ptr);
47660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47662         this_ptr_conv.is_owned = false;
47663         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47664         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47665         return ret_arr;
47666 }
47667
47668 void  CS_LDK_ChannelReestablish_set_my_current_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47669         LDKChannelReestablish this_ptr_conv;
47670         this_ptr_conv.inner = untag_ptr(this_ptr);
47671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47673         this_ptr_conv.is_owned = false;
47674         LDKPublicKey val_ref;
47675         CHECK(val->arr_len == 33);
47676         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47677         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
47678 }
47679
47680 int64_t  CS_LDK_ChannelReestablish_get_next_funding_txid(int64_t this_ptr) {
47681         LDKChannelReestablish 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         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
47687         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
47688         int64_t ret_ref = tag_ptr(ret_copy, true);
47689         return ret_ref;
47690 }
47691
47692 void  CS_LDK_ChannelReestablish_set_next_funding_txid(int64_t this_ptr, int64_t val) {
47693         LDKChannelReestablish this_ptr_conv;
47694         this_ptr_conv.inner = untag_ptr(this_ptr);
47695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47697         this_ptr_conv.is_owned = false;
47698         void* val_ptr = untag_ptr(val);
47699         CHECK_ACCESS(val_ptr);
47700         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
47701         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
47702         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
47703 }
47704
47705 int64_t  CS_LDK_ChannelReestablish_new(int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
47706         LDKThirtyTwoBytes channel_id_arg_ref;
47707         CHECK(channel_id_arg->arr_len == 32);
47708         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47709         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
47710         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
47711         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
47712         LDKPublicKey my_current_per_commitment_point_arg_ref;
47713         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
47714         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);
47715         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
47716         CHECK_ACCESS(next_funding_txid_arg_ptr);
47717         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
47718         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
47719         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
47720         int64_t ret_ref = 0;
47721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47723         return ret_ref;
47724 }
47725
47726 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
47727         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
47728         int64_t ret_ref = 0;
47729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47731         return ret_ref;
47732 }
47733 int64_t  CS_LDK_ChannelReestablish_clone_ptr(int64_t arg) {
47734         LDKChannelReestablish arg_conv;
47735         arg_conv.inner = untag_ptr(arg);
47736         arg_conv.is_owned = ptr_is_owned(arg);
47737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47738         arg_conv.is_owned = false;
47739         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
47740         return ret_conv;
47741 }
47742
47743 int64_t  CS_LDK_ChannelReestablish_clone(int64_t orig) {
47744         LDKChannelReestablish orig_conv;
47745         orig_conv.inner = untag_ptr(orig);
47746         orig_conv.is_owned = ptr_is_owned(orig);
47747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47748         orig_conv.is_owned = false;
47749         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
47750         int64_t ret_ref = 0;
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47753         return ret_ref;
47754 }
47755
47756 int64_t  CS_LDK_ChannelReestablish_hash(int64_t o) {
47757         LDKChannelReestablish o_conv;
47758         o_conv.inner = untag_ptr(o);
47759         o_conv.is_owned = ptr_is_owned(o);
47760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47761         o_conv.is_owned = false;
47762         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
47763         return ret_conv;
47764 }
47765
47766 jboolean  CS_LDK_ChannelReestablish_eq(int64_t a, int64_t b) {
47767         LDKChannelReestablish a_conv;
47768         a_conv.inner = untag_ptr(a);
47769         a_conv.is_owned = ptr_is_owned(a);
47770         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47771         a_conv.is_owned = false;
47772         LDKChannelReestablish b_conv;
47773         b_conv.inner = untag_ptr(b);
47774         b_conv.is_owned = ptr_is_owned(b);
47775         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47776         b_conv.is_owned = false;
47777         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
47778         return ret_conv;
47779 }
47780
47781 void  CS_LDK_AnnouncementSignatures_free(int64_t this_obj) {
47782         LDKAnnouncementSignatures this_obj_conv;
47783         this_obj_conv.inner = untag_ptr(this_obj);
47784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47786         AnnouncementSignatures_free(this_obj_conv);
47787 }
47788
47789 int8_tArray  CS_LDK_AnnouncementSignatures_get_channel_id(int64_t this_ptr) {
47790         LDKAnnouncementSignatures this_ptr_conv;
47791         this_ptr_conv.inner = untag_ptr(this_ptr);
47792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47794         this_ptr_conv.is_owned = false;
47795         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47796         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
47797         return ret_arr;
47798 }
47799
47800 void  CS_LDK_AnnouncementSignatures_set_channel_id(int64_t this_ptr, int8_tArray val) {
47801         LDKAnnouncementSignatures this_ptr_conv;
47802         this_ptr_conv.inner = untag_ptr(this_ptr);
47803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47805         this_ptr_conv.is_owned = false;
47806         LDKThirtyTwoBytes val_ref;
47807         CHECK(val->arr_len == 32);
47808         memcpy(val_ref.data, val->elems, 32); FREE(val);
47809         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
47810 }
47811
47812 int64_t  CS_LDK_AnnouncementSignatures_get_short_channel_id(int64_t this_ptr) {
47813         LDKAnnouncementSignatures this_ptr_conv;
47814         this_ptr_conv.inner = untag_ptr(this_ptr);
47815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47817         this_ptr_conv.is_owned = false;
47818         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
47819         return ret_conv;
47820 }
47821
47822 void  CS_LDK_AnnouncementSignatures_set_short_channel_id(int64_t this_ptr, int64_t val) {
47823         LDKAnnouncementSignatures this_ptr_conv;
47824         this_ptr_conv.inner = untag_ptr(this_ptr);
47825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47827         this_ptr_conv.is_owned = false;
47828         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
47829 }
47830
47831 int8_tArray  CS_LDK_AnnouncementSignatures_get_node_signature(int64_t this_ptr) {
47832         LDKAnnouncementSignatures this_ptr_conv;
47833         this_ptr_conv.inner = untag_ptr(this_ptr);
47834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47836         this_ptr_conv.is_owned = false;
47837         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47838         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
47839         return ret_arr;
47840 }
47841
47842 void  CS_LDK_AnnouncementSignatures_set_node_signature(int64_t this_ptr, int8_tArray val) {
47843         LDKAnnouncementSignatures this_ptr_conv;
47844         this_ptr_conv.inner = untag_ptr(this_ptr);
47845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47847         this_ptr_conv.is_owned = false;
47848         LDKECDSASignature val_ref;
47849         CHECK(val->arr_len == 64);
47850         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47851         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
47852 }
47853
47854 int8_tArray  CS_LDK_AnnouncementSignatures_get_bitcoin_signature(int64_t this_ptr) {
47855         LDKAnnouncementSignatures this_ptr_conv;
47856         this_ptr_conv.inner = untag_ptr(this_ptr);
47857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47859         this_ptr_conv.is_owned = false;
47860         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
47861         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
47862         return ret_arr;
47863 }
47864
47865 void  CS_LDK_AnnouncementSignatures_set_bitcoin_signature(int64_t this_ptr, int8_tArray val) {
47866         LDKAnnouncementSignatures this_ptr_conv;
47867         this_ptr_conv.inner = untag_ptr(this_ptr);
47868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47870         this_ptr_conv.is_owned = false;
47871         LDKECDSASignature val_ref;
47872         CHECK(val->arr_len == 64);
47873         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
47874         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
47875 }
47876
47877 int64_t  CS_LDK_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
47878         LDKThirtyTwoBytes channel_id_arg_ref;
47879         CHECK(channel_id_arg->arr_len == 32);
47880         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
47881         LDKECDSASignature node_signature_arg_ref;
47882         CHECK(node_signature_arg->arr_len == 64);
47883         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
47884         LDKECDSASignature bitcoin_signature_arg_ref;
47885         CHECK(bitcoin_signature_arg->arr_len == 64);
47886         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
47887         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
47888         int64_t ret_ref = 0;
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47891         return ret_ref;
47892 }
47893
47894 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
47895         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
47896         int64_t ret_ref = 0;
47897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47899         return ret_ref;
47900 }
47901 int64_t  CS_LDK_AnnouncementSignatures_clone_ptr(int64_t arg) {
47902         LDKAnnouncementSignatures arg_conv;
47903         arg_conv.inner = untag_ptr(arg);
47904         arg_conv.is_owned = ptr_is_owned(arg);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47906         arg_conv.is_owned = false;
47907         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
47908         return ret_conv;
47909 }
47910
47911 int64_t  CS_LDK_AnnouncementSignatures_clone(int64_t orig) {
47912         LDKAnnouncementSignatures orig_conv;
47913         orig_conv.inner = untag_ptr(orig);
47914         orig_conv.is_owned = ptr_is_owned(orig);
47915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47916         orig_conv.is_owned = false;
47917         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
47918         int64_t ret_ref = 0;
47919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47921         return ret_ref;
47922 }
47923
47924 int64_t  CS_LDK_AnnouncementSignatures_hash(int64_t o) {
47925         LDKAnnouncementSignatures o_conv;
47926         o_conv.inner = untag_ptr(o);
47927         o_conv.is_owned = ptr_is_owned(o);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47929         o_conv.is_owned = false;
47930         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
47931         return ret_conv;
47932 }
47933
47934 jboolean  CS_LDK_AnnouncementSignatures_eq(int64_t a, int64_t b) {
47935         LDKAnnouncementSignatures 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         LDKAnnouncementSignatures 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 = AnnouncementSignatures_eq(&a_conv, &b_conv);
47946         return ret_conv;
47947 }
47948
47949 void  CS_LDK_SocketAddress_free(int64_t this_ptr) {
47950         if (!ptr_is_owned(this_ptr)) return;
47951         void* this_ptr_ptr = untag_ptr(this_ptr);
47952         CHECK_ACCESS(this_ptr_ptr);
47953         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
47954         FREE(untag_ptr(this_ptr));
47955         SocketAddress_free(this_ptr_conv);
47956 }
47957
47958 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
47959         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47960         *ret_copy = SocketAddress_clone(arg);
47961         int64_t ret_ref = tag_ptr(ret_copy, true);
47962         return ret_ref;
47963 }
47964 int64_t  CS_LDK_SocketAddress_clone_ptr(int64_t arg) {
47965         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
47966         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
47967         return ret_conv;
47968 }
47969
47970 int64_t  CS_LDK_SocketAddress_clone(int64_t orig) {
47971         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
47972         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47973         *ret_copy = SocketAddress_clone(orig_conv);
47974         int64_t ret_ref = tag_ptr(ret_copy, true);
47975         return ret_ref;
47976 }
47977
47978 int64_t  CS_LDK_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
47979         LDKFourBytes addr_ref;
47980         CHECK(addr->arr_len == 4);
47981         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
47982         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47983         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
47984         int64_t ret_ref = tag_ptr(ret_copy, true);
47985         return ret_ref;
47986 }
47987
47988 int64_t  CS_LDK_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
47989         LDKSixteenBytes addr_ref;
47990         CHECK(addr->arr_len == 16);
47991         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
47992         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
47993         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
47994         int64_t ret_ref = tag_ptr(ret_copy, true);
47995         return ret_ref;
47996 }
47997
47998 int64_t  CS_LDK_SocketAddress_onion_v2(int8_tArray a) {
47999         LDKTwelveBytes a_ref;
48000         CHECK(a->arr_len == 12);
48001         memcpy(a_ref.data, a->elems, 12); FREE(a);
48002         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48003         *ret_copy = SocketAddress_onion_v2(a_ref);
48004         int64_t ret_ref = tag_ptr(ret_copy, true);
48005         return ret_ref;
48006 }
48007
48008 int64_t  CS_LDK_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
48009         LDKThirtyTwoBytes ed25519_pubkey_ref;
48010         CHECK(ed25519_pubkey->arr_len == 32);
48011         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
48012         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48013         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
48014         int64_t ret_ref = tag_ptr(ret_copy, true);
48015         return ret_ref;
48016 }
48017
48018 int64_t  CS_LDK_SocketAddress_hostname(int64_t hostname, int16_t port) {
48019         LDKHostname hostname_conv;
48020         hostname_conv.inner = untag_ptr(hostname);
48021         hostname_conv.is_owned = ptr_is_owned(hostname);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
48023         hostname_conv = Hostname_clone(&hostname_conv);
48024         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48025         *ret_copy = SocketAddress_hostname(hostname_conv, port);
48026         int64_t ret_ref = tag_ptr(ret_copy, true);
48027         return ret_ref;
48028 }
48029
48030 int64_t  CS_LDK_SocketAddress_hash(int64_t o) {
48031         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48032         int64_t ret_conv = SocketAddress_hash(o_conv);
48033         return ret_conv;
48034 }
48035
48036 jboolean  CS_LDK_SocketAddress_eq(int64_t a, int64_t b) {
48037         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
48038         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
48039         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
48040         return ret_conv;
48041 }
48042
48043 int8_tArray  CS_LDK_SocketAddress_write(int64_t obj) {
48044         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
48045         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
48046         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48047         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48048         CVec_u8Z_free(ret_var);
48049         return ret_arr;
48050 }
48051
48052 int64_t  CS_LDK_SocketAddress_read(int8_tArray ser) {
48053         LDKu8slice ser_ref;
48054         ser_ref.datalen = ser->arr_len;
48055         ser_ref.data = ser->elems;
48056         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
48057         *ret_conv = SocketAddress_read(ser_ref);
48058         FREE(ser);
48059         return tag_ptr(ret_conv, true);
48060 }
48061
48062 int32_t  CS_LDK_SocketAddressParseError_clone(int64_t orig) {
48063         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
48064         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_clone(orig_conv));
48065         return ret_conv;
48066 }
48067
48068 int32_t  CS_LDK_SocketAddressParseError_socket_addr_parse() {
48069         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_socket_addr_parse());
48070         return ret_conv;
48071 }
48072
48073 int32_t  CS_LDK_SocketAddressParseError_invalid_input() {
48074         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_input());
48075         return ret_conv;
48076 }
48077
48078 int32_t  CS_LDK_SocketAddressParseError_invalid_port() {
48079         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_port());
48080         return ret_conv;
48081 }
48082
48083 int32_t  CS_LDK_SocketAddressParseError_invalid_onion_v3() {
48084         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_onion_v3());
48085         return ret_conv;
48086 }
48087
48088 int64_t  CS_LDK_SocketAddressParseError_hash(int64_t o) {
48089         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
48090         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
48091         return ret_conv;
48092 }
48093
48094 jboolean  CS_LDK_SocketAddressParseError_eq(int64_t a, int64_t b) {
48095         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
48096         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
48097         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
48098         return ret_conv;
48099 }
48100
48101 int64_t  CS_LDK_parse_onion_address(jstring host, int16_t port) {
48102         LDKStr host_conv = str_ref_to_owned_c(host);
48103         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48104         *ret_conv = parse_onion_address(host_conv, port);
48105         return tag_ptr(ret_conv, true);
48106 }
48107
48108 jstring  CS_LDK_SocketAddress_to_str(int64_t o) {
48109         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
48110         LDKStr ret_str = SocketAddress_to_str(o_conv);
48111         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
48112         Str_free(ret_str);
48113         return ret_conv;
48114 }
48115
48116 int64_t  CS_LDK_SocketAddress_from_str(jstring s) {
48117         LDKStr s_conv = str_ref_to_owned_c(s);
48118         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
48119         *ret_conv = SocketAddress_from_str(s_conv);
48120         return tag_ptr(ret_conv, true);
48121 }
48122
48123 void  CS_LDK_UnsignedGossipMessage_free(int64_t this_ptr) {
48124         if (!ptr_is_owned(this_ptr)) return;
48125         void* this_ptr_ptr = untag_ptr(this_ptr);
48126         CHECK_ACCESS(this_ptr_ptr);
48127         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
48128         FREE(untag_ptr(this_ptr));
48129         UnsignedGossipMessage_free(this_ptr_conv);
48130 }
48131
48132 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
48133         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48134         *ret_copy = UnsignedGossipMessage_clone(arg);
48135         int64_t ret_ref = tag_ptr(ret_copy, true);
48136         return ret_ref;
48137 }
48138 int64_t  CS_LDK_UnsignedGossipMessage_clone_ptr(int64_t arg) {
48139         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
48140         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
48141         return ret_conv;
48142 }
48143
48144 int64_t  CS_LDK_UnsignedGossipMessage_clone(int64_t orig) {
48145         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
48146         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48147         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
48148         int64_t ret_ref = tag_ptr(ret_copy, true);
48149         return ret_ref;
48150 }
48151
48152 int64_t  CS_LDK_UnsignedGossipMessage_channel_announcement(int64_t a) {
48153         LDKUnsignedChannelAnnouncement a_conv;
48154         a_conv.inner = untag_ptr(a);
48155         a_conv.is_owned = ptr_is_owned(a);
48156         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48157         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
48158         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48159         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
48160         int64_t ret_ref = tag_ptr(ret_copy, true);
48161         return ret_ref;
48162 }
48163
48164 int64_t  CS_LDK_UnsignedGossipMessage_channel_update(int64_t a) {
48165         LDKUnsignedChannelUpdate a_conv;
48166         a_conv.inner = untag_ptr(a);
48167         a_conv.is_owned = ptr_is_owned(a);
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48169         a_conv = UnsignedChannelUpdate_clone(&a_conv);
48170         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48171         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
48172         int64_t ret_ref = tag_ptr(ret_copy, true);
48173         return ret_ref;
48174 }
48175
48176 int64_t  CS_LDK_UnsignedGossipMessage_node_announcement(int64_t a) {
48177         LDKUnsignedNodeAnnouncement a_conv;
48178         a_conv.inner = untag_ptr(a);
48179         a_conv.is_owned = ptr_is_owned(a);
48180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48181         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
48182         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
48183         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
48184         int64_t ret_ref = tag_ptr(ret_copy, true);
48185         return ret_ref;
48186 }
48187
48188 int8_tArray  CS_LDK_UnsignedGossipMessage_write(int64_t obj) {
48189         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
48190         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
48191         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48192         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48193         CVec_u8Z_free(ret_var);
48194         return ret_arr;
48195 }
48196
48197 void  CS_LDK_UnsignedNodeAnnouncement_free(int64_t this_obj) {
48198         LDKUnsignedNodeAnnouncement this_obj_conv;
48199         this_obj_conv.inner = untag_ptr(this_obj);
48200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48202         UnsignedNodeAnnouncement_free(this_obj_conv);
48203 }
48204
48205 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_features(int64_t this_ptr) {
48206         LDKUnsignedNodeAnnouncement this_ptr_conv;
48207         this_ptr_conv.inner = untag_ptr(this_ptr);
48208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48210         this_ptr_conv.is_owned = false;
48211         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
48212         int64_t ret_ref = 0;
48213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48215         return ret_ref;
48216 }
48217
48218 void  CS_LDK_UnsignedNodeAnnouncement_set_features(int64_t this_ptr, int64_t val) {
48219         LDKUnsignedNodeAnnouncement this_ptr_conv;
48220         this_ptr_conv.inner = untag_ptr(this_ptr);
48221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48223         this_ptr_conv.is_owned = false;
48224         LDKNodeFeatures val_conv;
48225         val_conv.inner = untag_ptr(val);
48226         val_conv.is_owned = ptr_is_owned(val);
48227         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48228         val_conv = NodeFeatures_clone(&val_conv);
48229         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
48230 }
48231
48232 int32_t  CS_LDK_UnsignedNodeAnnouncement_get_timestamp(int64_t this_ptr) {
48233         LDKUnsignedNodeAnnouncement this_ptr_conv;
48234         this_ptr_conv.inner = untag_ptr(this_ptr);
48235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48237         this_ptr_conv.is_owned = false;
48238         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
48239         return ret_conv;
48240 }
48241
48242 void  CS_LDK_UnsignedNodeAnnouncement_set_timestamp(int64_t this_ptr, int32_t val) {
48243         LDKUnsignedNodeAnnouncement this_ptr_conv;
48244         this_ptr_conv.inner = untag_ptr(this_ptr);
48245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48247         this_ptr_conv.is_owned = false;
48248         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
48249 }
48250
48251 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_node_id(int64_t this_ptr) {
48252         LDKUnsignedNodeAnnouncement 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         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
48258         int64_t ret_ref = 0;
48259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48261         return ret_ref;
48262 }
48263
48264 void  CS_LDK_UnsignedNodeAnnouncement_set_node_id(int64_t this_ptr, int64_t val) {
48265         LDKUnsignedNodeAnnouncement this_ptr_conv;
48266         this_ptr_conv.inner = untag_ptr(this_ptr);
48267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48269         this_ptr_conv.is_owned = false;
48270         LDKNodeId val_conv;
48271         val_conv.inner = untag_ptr(val);
48272         val_conv.is_owned = ptr_is_owned(val);
48273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48274         val_conv = NodeId_clone(&val_conv);
48275         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
48276 }
48277
48278 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_rgb(int64_t this_ptr) {
48279         LDKUnsignedNodeAnnouncement this_ptr_conv;
48280         this_ptr_conv.inner = untag_ptr(this_ptr);
48281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48283         this_ptr_conv.is_owned = false;
48284         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
48285         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
48286         return ret_arr;
48287 }
48288
48289 void  CS_LDK_UnsignedNodeAnnouncement_set_rgb(int64_t this_ptr, int8_tArray val) {
48290         LDKUnsignedNodeAnnouncement this_ptr_conv;
48291         this_ptr_conv.inner = untag_ptr(this_ptr);
48292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48294         this_ptr_conv.is_owned = false;
48295         LDKThreeBytes val_ref;
48296         CHECK(val->arr_len == 3);
48297         memcpy(val_ref.data, val->elems, 3); FREE(val);
48298         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
48299 }
48300
48301 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_alias(int64_t this_ptr) {
48302         LDKUnsignedNodeAnnouncement this_ptr_conv;
48303         this_ptr_conv.inner = untag_ptr(this_ptr);
48304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48306         this_ptr_conv.is_owned = false;
48307         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
48308         int64_t ret_ref = 0;
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48311         return ret_ref;
48312 }
48313
48314 void  CS_LDK_UnsignedNodeAnnouncement_set_alias(int64_t this_ptr, int64_t val) {
48315         LDKUnsignedNodeAnnouncement this_ptr_conv;
48316         this_ptr_conv.inner = untag_ptr(this_ptr);
48317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48319         this_ptr_conv.is_owned = false;
48320         LDKNodeAlias val_conv;
48321         val_conv.inner = untag_ptr(val);
48322         val_conv.is_owned = ptr_is_owned(val);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48324         val_conv = NodeAlias_clone(&val_conv);
48325         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
48326 }
48327
48328 int64_tArray  CS_LDK_UnsignedNodeAnnouncement_get_addresses(int64_t this_ptr) {
48329         LDKUnsignedNodeAnnouncement this_ptr_conv;
48330         this_ptr_conv.inner = untag_ptr(this_ptr);
48331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48333         this_ptr_conv.is_owned = false;
48334         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
48335         int64_tArray ret_arr = NULL;
48336         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
48337         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
48338         for (size_t p = 0; p < ret_var.datalen; p++) {
48339                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
48340                 *ret_conv_15_copy = ret_var.data[p];
48341                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
48342                 ret_arr_ptr[p] = ret_conv_15_ref;
48343         }
48344         
48345         FREE(ret_var.data);
48346         return ret_arr;
48347 }
48348
48349 void  CS_LDK_UnsignedNodeAnnouncement_set_addresses(int64_t this_ptr, int64_tArray val) {
48350         LDKUnsignedNodeAnnouncement this_ptr_conv;
48351         this_ptr_conv.inner = untag_ptr(this_ptr);
48352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48354         this_ptr_conv.is_owned = false;
48355         LDKCVec_SocketAddressZ val_constr;
48356         val_constr.datalen = val->arr_len;
48357         if (val_constr.datalen > 0)
48358                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
48359         else
48360                 val_constr.data = NULL;
48361         int64_t* val_vals = val->elems;
48362         for (size_t p = 0; p < val_constr.datalen; p++) {
48363                 int64_t val_conv_15 = val_vals[p];
48364                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
48365                 CHECK_ACCESS(val_conv_15_ptr);
48366                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
48367                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
48368                 val_constr.data[p] = val_conv_15_conv;
48369         }
48370         FREE(val);
48371         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
48372 }
48373
48374 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
48375         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
48376         int64_t ret_ref = 0;
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48379         return ret_ref;
48380 }
48381 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone_ptr(int64_t arg) {
48382         LDKUnsignedNodeAnnouncement arg_conv;
48383         arg_conv.inner = untag_ptr(arg);
48384         arg_conv.is_owned = ptr_is_owned(arg);
48385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48386         arg_conv.is_owned = false;
48387         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
48388         return ret_conv;
48389 }
48390
48391 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone(int64_t orig) {
48392         LDKUnsignedNodeAnnouncement orig_conv;
48393         orig_conv.inner = untag_ptr(orig);
48394         orig_conv.is_owned = ptr_is_owned(orig);
48395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48396         orig_conv.is_owned = false;
48397         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
48398         int64_t ret_ref = 0;
48399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48401         return ret_ref;
48402 }
48403
48404 int64_t  CS_LDK_UnsignedNodeAnnouncement_hash(int64_t o) {
48405         LDKUnsignedNodeAnnouncement o_conv;
48406         o_conv.inner = untag_ptr(o);
48407         o_conv.is_owned = ptr_is_owned(o);
48408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48409         o_conv.is_owned = false;
48410         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
48411         return ret_conv;
48412 }
48413
48414 jboolean  CS_LDK_UnsignedNodeAnnouncement_eq(int64_t a, int64_t b) {
48415         LDKUnsignedNodeAnnouncement a_conv;
48416         a_conv.inner = untag_ptr(a);
48417         a_conv.is_owned = ptr_is_owned(a);
48418         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48419         a_conv.is_owned = false;
48420         LDKUnsignedNodeAnnouncement b_conv;
48421         b_conv.inner = untag_ptr(b);
48422         b_conv.is_owned = ptr_is_owned(b);
48423         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48424         b_conv.is_owned = false;
48425         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
48426         return ret_conv;
48427 }
48428
48429 void  CS_LDK_NodeAnnouncement_free(int64_t this_obj) {
48430         LDKNodeAnnouncement this_obj_conv;
48431         this_obj_conv.inner = untag_ptr(this_obj);
48432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48434         NodeAnnouncement_free(this_obj_conv);
48435 }
48436
48437 int8_tArray  CS_LDK_NodeAnnouncement_get_signature(int64_t this_ptr) {
48438         LDKNodeAnnouncement this_ptr_conv;
48439         this_ptr_conv.inner = untag_ptr(this_ptr);
48440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48442         this_ptr_conv.is_owned = false;
48443         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48444         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
48445         return ret_arr;
48446 }
48447
48448 void  CS_LDK_NodeAnnouncement_set_signature(int64_t this_ptr, int8_tArray val) {
48449         LDKNodeAnnouncement this_ptr_conv;
48450         this_ptr_conv.inner = untag_ptr(this_ptr);
48451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48453         this_ptr_conv.is_owned = false;
48454         LDKECDSASignature val_ref;
48455         CHECK(val->arr_len == 64);
48456         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48457         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
48458 }
48459
48460 int64_t  CS_LDK_NodeAnnouncement_get_contents(int64_t this_ptr) {
48461         LDKNodeAnnouncement this_ptr_conv;
48462         this_ptr_conv.inner = untag_ptr(this_ptr);
48463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48465         this_ptr_conv.is_owned = false;
48466         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
48467         int64_t ret_ref = 0;
48468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48470         return ret_ref;
48471 }
48472
48473 void  CS_LDK_NodeAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
48474         LDKNodeAnnouncement this_ptr_conv;
48475         this_ptr_conv.inner = untag_ptr(this_ptr);
48476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48478         this_ptr_conv.is_owned = false;
48479         LDKUnsignedNodeAnnouncement val_conv;
48480         val_conv.inner = untag_ptr(val);
48481         val_conv.is_owned = ptr_is_owned(val);
48482         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48483         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
48484         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
48485 }
48486
48487 int64_t  CS_LDK_NodeAnnouncement_new(int8_tArray signature_arg, int64_t contents_arg) {
48488         LDKECDSASignature signature_arg_ref;
48489         CHECK(signature_arg->arr_len == 64);
48490         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48491         LDKUnsignedNodeAnnouncement contents_arg_conv;
48492         contents_arg_conv.inner = untag_ptr(contents_arg);
48493         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
48494         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
48495         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
48496         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
48497         int64_t ret_ref = 0;
48498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48500         return ret_ref;
48501 }
48502
48503 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
48504         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
48505         int64_t ret_ref = 0;
48506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48508         return ret_ref;
48509 }
48510 int64_t  CS_LDK_NodeAnnouncement_clone_ptr(int64_t arg) {
48511         LDKNodeAnnouncement arg_conv;
48512         arg_conv.inner = untag_ptr(arg);
48513         arg_conv.is_owned = ptr_is_owned(arg);
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48515         arg_conv.is_owned = false;
48516         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
48517         return ret_conv;
48518 }
48519
48520 int64_t  CS_LDK_NodeAnnouncement_clone(int64_t orig) {
48521         LDKNodeAnnouncement orig_conv;
48522         orig_conv.inner = untag_ptr(orig);
48523         orig_conv.is_owned = ptr_is_owned(orig);
48524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48525         orig_conv.is_owned = false;
48526         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
48527         int64_t ret_ref = 0;
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48530         return ret_ref;
48531 }
48532
48533 int64_t  CS_LDK_NodeAnnouncement_hash(int64_t o) {
48534         LDKNodeAnnouncement o_conv;
48535         o_conv.inner = untag_ptr(o);
48536         o_conv.is_owned = ptr_is_owned(o);
48537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48538         o_conv.is_owned = false;
48539         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
48540         return ret_conv;
48541 }
48542
48543 jboolean  CS_LDK_NodeAnnouncement_eq(int64_t a, int64_t b) {
48544         LDKNodeAnnouncement a_conv;
48545         a_conv.inner = untag_ptr(a);
48546         a_conv.is_owned = ptr_is_owned(a);
48547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48548         a_conv.is_owned = false;
48549         LDKNodeAnnouncement b_conv;
48550         b_conv.inner = untag_ptr(b);
48551         b_conv.is_owned = ptr_is_owned(b);
48552         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48553         b_conv.is_owned = false;
48554         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
48555         return ret_conv;
48556 }
48557
48558 void  CS_LDK_UnsignedChannelAnnouncement_free(int64_t this_obj) {
48559         LDKUnsignedChannelAnnouncement this_obj_conv;
48560         this_obj_conv.inner = untag_ptr(this_obj);
48561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48563         UnsignedChannelAnnouncement_free(this_obj_conv);
48564 }
48565
48566 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_features(int64_t this_ptr) {
48567         LDKUnsignedChannelAnnouncement this_ptr_conv;
48568         this_ptr_conv.inner = untag_ptr(this_ptr);
48569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48571         this_ptr_conv.is_owned = false;
48572         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
48573         int64_t ret_ref = 0;
48574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48576         return ret_ref;
48577 }
48578
48579 void  CS_LDK_UnsignedChannelAnnouncement_set_features(int64_t this_ptr, int64_t val) {
48580         LDKUnsignedChannelAnnouncement this_ptr_conv;
48581         this_ptr_conv.inner = untag_ptr(this_ptr);
48582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48584         this_ptr_conv.is_owned = false;
48585         LDKChannelFeatures val_conv;
48586         val_conv.inner = untag_ptr(val);
48587         val_conv.is_owned = ptr_is_owned(val);
48588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48589         val_conv = ChannelFeatures_clone(&val_conv);
48590         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
48591 }
48592
48593 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_chain_hash(int64_t this_ptr) {
48594         LDKUnsignedChannelAnnouncement this_ptr_conv;
48595         this_ptr_conv.inner = untag_ptr(this_ptr);
48596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48598         this_ptr_conv.is_owned = false;
48599         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48600         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
48601         return ret_arr;
48602 }
48603
48604 void  CS_LDK_UnsignedChannelAnnouncement_set_chain_hash(int64_t this_ptr, int8_tArray val) {
48605         LDKUnsignedChannelAnnouncement 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         LDKThirtyTwoBytes val_ref;
48611         CHECK(val->arr_len == 32);
48612         memcpy(val_ref.data, val->elems, 32); FREE(val);
48613         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
48614 }
48615
48616 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_short_channel_id(int64_t this_ptr) {
48617         LDKUnsignedChannelAnnouncement this_ptr_conv;
48618         this_ptr_conv.inner = untag_ptr(this_ptr);
48619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48621         this_ptr_conv.is_owned = false;
48622         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
48623         return ret_conv;
48624 }
48625
48626 void  CS_LDK_UnsignedChannelAnnouncement_set_short_channel_id(int64_t this_ptr, int64_t val) {
48627         LDKUnsignedChannelAnnouncement this_ptr_conv;
48628         this_ptr_conv.inner = untag_ptr(this_ptr);
48629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48631         this_ptr_conv.is_owned = false;
48632         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
48633 }
48634
48635 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_1(int64_t this_ptr) {
48636         LDKUnsignedChannelAnnouncement this_ptr_conv;
48637         this_ptr_conv.inner = untag_ptr(this_ptr);
48638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48640         this_ptr_conv.is_owned = false;
48641         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
48642         int64_t ret_ref = 0;
48643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48645         return ret_ref;
48646 }
48647
48648 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_1(int64_t this_ptr, int64_t val) {
48649         LDKUnsignedChannelAnnouncement this_ptr_conv;
48650         this_ptr_conv.inner = untag_ptr(this_ptr);
48651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48653         this_ptr_conv.is_owned = false;
48654         LDKNodeId val_conv;
48655         val_conv.inner = untag_ptr(val);
48656         val_conv.is_owned = ptr_is_owned(val);
48657         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48658         val_conv = NodeId_clone(&val_conv);
48659         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
48660 }
48661
48662 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_2(int64_t this_ptr) {
48663         LDKUnsignedChannelAnnouncement this_ptr_conv;
48664         this_ptr_conv.inner = untag_ptr(this_ptr);
48665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48667         this_ptr_conv.is_owned = false;
48668         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
48669         int64_t ret_ref = 0;
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48672         return ret_ref;
48673 }
48674
48675 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_2(int64_t this_ptr, int64_t val) {
48676         LDKUnsignedChannelAnnouncement this_ptr_conv;
48677         this_ptr_conv.inner = untag_ptr(this_ptr);
48678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48680         this_ptr_conv.is_owned = false;
48681         LDKNodeId val_conv;
48682         val_conv.inner = untag_ptr(val);
48683         val_conv.is_owned = ptr_is_owned(val);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48685         val_conv = NodeId_clone(&val_conv);
48686         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
48687 }
48688
48689 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_1(int64_t this_ptr) {
48690         LDKUnsignedChannelAnnouncement this_ptr_conv;
48691         this_ptr_conv.inner = untag_ptr(this_ptr);
48692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48694         this_ptr_conv.is_owned = false;
48695         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
48696         int64_t ret_ref = 0;
48697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48699         return ret_ref;
48700 }
48701
48702 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_1(int64_t this_ptr, int64_t val) {
48703         LDKUnsignedChannelAnnouncement this_ptr_conv;
48704         this_ptr_conv.inner = untag_ptr(this_ptr);
48705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48707         this_ptr_conv.is_owned = false;
48708         LDKNodeId val_conv;
48709         val_conv.inner = untag_ptr(val);
48710         val_conv.is_owned = ptr_is_owned(val);
48711         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48712         val_conv = NodeId_clone(&val_conv);
48713         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
48714 }
48715
48716 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_2(int64_t this_ptr) {
48717         LDKUnsignedChannelAnnouncement this_ptr_conv;
48718         this_ptr_conv.inner = untag_ptr(this_ptr);
48719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48721         this_ptr_conv.is_owned = false;
48722         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
48723         int64_t ret_ref = 0;
48724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48726         return ret_ref;
48727 }
48728
48729 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_2(int64_t this_ptr, int64_t val) {
48730         LDKUnsignedChannelAnnouncement this_ptr_conv;
48731         this_ptr_conv.inner = untag_ptr(this_ptr);
48732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48734         this_ptr_conv.is_owned = false;
48735         LDKNodeId val_conv;
48736         val_conv.inner = untag_ptr(val);
48737         val_conv.is_owned = ptr_is_owned(val);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48739         val_conv = NodeId_clone(&val_conv);
48740         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
48741 }
48742
48743 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_excess_data(int64_t this_ptr) {
48744         LDKUnsignedChannelAnnouncement this_ptr_conv;
48745         this_ptr_conv.inner = untag_ptr(this_ptr);
48746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48748         this_ptr_conv.is_owned = false;
48749         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
48750         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
48751         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
48752         CVec_u8Z_free(ret_var);
48753         return ret_arr;
48754 }
48755
48756 void  CS_LDK_UnsignedChannelAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
48757         LDKUnsignedChannelAnnouncement this_ptr_conv;
48758         this_ptr_conv.inner = untag_ptr(this_ptr);
48759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48761         this_ptr_conv.is_owned = false;
48762         LDKCVec_u8Z val_ref;
48763         val_ref.datalen = val->arr_len;
48764         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
48765         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
48766         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
48767 }
48768
48769 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) {
48770         LDKChannelFeatures features_arg_conv;
48771         features_arg_conv.inner = untag_ptr(features_arg);
48772         features_arg_conv.is_owned = ptr_is_owned(features_arg);
48773         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
48774         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
48775         LDKThirtyTwoBytes chain_hash_arg_ref;
48776         CHECK(chain_hash_arg->arr_len == 32);
48777         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
48778         LDKNodeId node_id_1_arg_conv;
48779         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
48780         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
48781         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
48782         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
48783         LDKNodeId node_id_2_arg_conv;
48784         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
48785         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
48786         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
48787         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
48788         LDKNodeId bitcoin_key_1_arg_conv;
48789         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
48790         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
48791         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
48792         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
48793         LDKNodeId bitcoin_key_2_arg_conv;
48794         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
48795         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
48796         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
48797         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
48798         LDKCVec_u8Z excess_data_arg_ref;
48799         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
48800         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
48801         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
48802         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);
48803         int64_t ret_ref = 0;
48804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48806         return ret_ref;
48807 }
48808
48809 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
48810         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
48811         int64_t ret_ref = 0;
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48814         return ret_ref;
48815 }
48816 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone_ptr(int64_t arg) {
48817         LDKUnsignedChannelAnnouncement arg_conv;
48818         arg_conv.inner = untag_ptr(arg);
48819         arg_conv.is_owned = ptr_is_owned(arg);
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48821         arg_conv.is_owned = false;
48822         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
48823         return ret_conv;
48824 }
48825
48826 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone(int64_t orig) {
48827         LDKUnsignedChannelAnnouncement orig_conv;
48828         orig_conv.inner = untag_ptr(orig);
48829         orig_conv.is_owned = ptr_is_owned(orig);
48830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48831         orig_conv.is_owned = false;
48832         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
48833         int64_t ret_ref = 0;
48834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48836         return ret_ref;
48837 }
48838
48839 int64_t  CS_LDK_UnsignedChannelAnnouncement_hash(int64_t o) {
48840         LDKUnsignedChannelAnnouncement o_conv;
48841         o_conv.inner = untag_ptr(o);
48842         o_conv.is_owned = ptr_is_owned(o);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48844         o_conv.is_owned = false;
48845         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
48846         return ret_conv;
48847 }
48848
48849 jboolean  CS_LDK_UnsignedChannelAnnouncement_eq(int64_t a, int64_t b) {
48850         LDKUnsignedChannelAnnouncement a_conv;
48851         a_conv.inner = untag_ptr(a);
48852         a_conv.is_owned = ptr_is_owned(a);
48853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48854         a_conv.is_owned = false;
48855         LDKUnsignedChannelAnnouncement b_conv;
48856         b_conv.inner = untag_ptr(b);
48857         b_conv.is_owned = ptr_is_owned(b);
48858         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48859         b_conv.is_owned = false;
48860         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
48861         return ret_conv;
48862 }
48863
48864 void  CS_LDK_ChannelAnnouncement_free(int64_t this_obj) {
48865         LDKChannelAnnouncement this_obj_conv;
48866         this_obj_conv.inner = untag_ptr(this_obj);
48867         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48869         ChannelAnnouncement_free(this_obj_conv);
48870 }
48871
48872 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_1(int64_t this_ptr) {
48873         LDKChannelAnnouncement this_ptr_conv;
48874         this_ptr_conv.inner = untag_ptr(this_ptr);
48875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48877         this_ptr_conv.is_owned = false;
48878         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48879         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
48880         return ret_arr;
48881 }
48882
48883 void  CS_LDK_ChannelAnnouncement_set_node_signature_1(int64_t this_ptr, int8_tArray val) {
48884         LDKChannelAnnouncement this_ptr_conv;
48885         this_ptr_conv.inner = untag_ptr(this_ptr);
48886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48888         this_ptr_conv.is_owned = false;
48889         LDKECDSASignature val_ref;
48890         CHECK(val->arr_len == 64);
48891         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48892         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
48893 }
48894
48895 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_2(int64_t this_ptr) {
48896         LDKChannelAnnouncement this_ptr_conv;
48897         this_ptr_conv.inner = untag_ptr(this_ptr);
48898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48900         this_ptr_conv.is_owned = false;
48901         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48902         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
48903         return ret_arr;
48904 }
48905
48906 void  CS_LDK_ChannelAnnouncement_set_node_signature_2(int64_t this_ptr, int8_tArray val) {
48907         LDKChannelAnnouncement this_ptr_conv;
48908         this_ptr_conv.inner = untag_ptr(this_ptr);
48909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48911         this_ptr_conv.is_owned = false;
48912         LDKECDSASignature val_ref;
48913         CHECK(val->arr_len == 64);
48914         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48915         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
48916 }
48917
48918 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_1(int64_t this_ptr) {
48919         LDKChannelAnnouncement this_ptr_conv;
48920         this_ptr_conv.inner = untag_ptr(this_ptr);
48921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48923         this_ptr_conv.is_owned = false;
48924         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48925         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
48926         return ret_arr;
48927 }
48928
48929 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_1(int64_t this_ptr, int8_tArray val) {
48930         LDKChannelAnnouncement this_ptr_conv;
48931         this_ptr_conv.inner = untag_ptr(this_ptr);
48932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48934         this_ptr_conv.is_owned = false;
48935         LDKECDSASignature val_ref;
48936         CHECK(val->arr_len == 64);
48937         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48938         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
48939 }
48940
48941 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_2(int64_t this_ptr) {
48942         LDKChannelAnnouncement this_ptr_conv;
48943         this_ptr_conv.inner = untag_ptr(this_ptr);
48944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48946         this_ptr_conv.is_owned = false;
48947         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48948         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
48949         return ret_arr;
48950 }
48951
48952 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_2(int64_t this_ptr, int8_tArray val) {
48953         LDKChannelAnnouncement this_ptr_conv;
48954         this_ptr_conv.inner = untag_ptr(this_ptr);
48955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48957         this_ptr_conv.is_owned = false;
48958         LDKECDSASignature val_ref;
48959         CHECK(val->arr_len == 64);
48960         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48961         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
48962 }
48963
48964 int64_t  CS_LDK_ChannelAnnouncement_get_contents(int64_t this_ptr) {
48965         LDKChannelAnnouncement this_ptr_conv;
48966         this_ptr_conv.inner = untag_ptr(this_ptr);
48967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48969         this_ptr_conv.is_owned = false;
48970         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
48971         int64_t ret_ref = 0;
48972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48974         return ret_ref;
48975 }
48976
48977 void  CS_LDK_ChannelAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
48978         LDKChannelAnnouncement this_ptr_conv;
48979         this_ptr_conv.inner = untag_ptr(this_ptr);
48980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48982         this_ptr_conv.is_owned = false;
48983         LDKUnsignedChannelAnnouncement val_conv;
48984         val_conv.inner = untag_ptr(val);
48985         val_conv.is_owned = ptr_is_owned(val);
48986         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48987         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
48988         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
48989 }
48990
48991 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) {
48992         LDKECDSASignature node_signature_1_arg_ref;
48993         CHECK(node_signature_1_arg->arr_len == 64);
48994         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
48995         LDKECDSASignature node_signature_2_arg_ref;
48996         CHECK(node_signature_2_arg->arr_len == 64);
48997         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
48998         LDKECDSASignature bitcoin_signature_1_arg_ref;
48999         CHECK(bitcoin_signature_1_arg->arr_len == 64);
49000         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
49001         LDKECDSASignature bitcoin_signature_2_arg_ref;
49002         CHECK(bitcoin_signature_2_arg->arr_len == 64);
49003         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
49004         LDKUnsignedChannelAnnouncement contents_arg_conv;
49005         contents_arg_conv.inner = untag_ptr(contents_arg);
49006         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49007         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49008         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
49009         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);
49010         int64_t ret_ref = 0;
49011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49013         return ret_ref;
49014 }
49015
49016 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
49017         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
49018         int64_t ret_ref = 0;
49019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49021         return ret_ref;
49022 }
49023 int64_t  CS_LDK_ChannelAnnouncement_clone_ptr(int64_t arg) {
49024         LDKChannelAnnouncement arg_conv;
49025         arg_conv.inner = untag_ptr(arg);
49026         arg_conv.is_owned = ptr_is_owned(arg);
49027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49028         arg_conv.is_owned = false;
49029         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
49030         return ret_conv;
49031 }
49032
49033 int64_t  CS_LDK_ChannelAnnouncement_clone(int64_t orig) {
49034         LDKChannelAnnouncement orig_conv;
49035         orig_conv.inner = untag_ptr(orig);
49036         orig_conv.is_owned = ptr_is_owned(orig);
49037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49038         orig_conv.is_owned = false;
49039         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
49040         int64_t ret_ref = 0;
49041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49043         return ret_ref;
49044 }
49045
49046 int64_t  CS_LDK_ChannelAnnouncement_hash(int64_t o) {
49047         LDKChannelAnnouncement o_conv;
49048         o_conv.inner = untag_ptr(o);
49049         o_conv.is_owned = ptr_is_owned(o);
49050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49051         o_conv.is_owned = false;
49052         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
49053         return ret_conv;
49054 }
49055
49056 jboolean  CS_LDK_ChannelAnnouncement_eq(int64_t a, int64_t b) {
49057         LDKChannelAnnouncement a_conv;
49058         a_conv.inner = untag_ptr(a);
49059         a_conv.is_owned = ptr_is_owned(a);
49060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49061         a_conv.is_owned = false;
49062         LDKChannelAnnouncement b_conv;
49063         b_conv.inner = untag_ptr(b);
49064         b_conv.is_owned = ptr_is_owned(b);
49065         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49066         b_conv.is_owned = false;
49067         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
49068         return ret_conv;
49069 }
49070
49071 void  CS_LDK_UnsignedChannelUpdate_free(int64_t this_obj) {
49072         LDKUnsignedChannelUpdate this_obj_conv;
49073         this_obj_conv.inner = untag_ptr(this_obj);
49074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49076         UnsignedChannelUpdate_free(this_obj_conv);
49077 }
49078
49079 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_chain_hash(int64_t this_ptr) {
49080         LDKUnsignedChannelUpdate this_ptr_conv;
49081         this_ptr_conv.inner = untag_ptr(this_ptr);
49082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49084         this_ptr_conv.is_owned = false;
49085         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49086         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
49087         return ret_arr;
49088 }
49089
49090 void  CS_LDK_UnsignedChannelUpdate_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49091         LDKUnsignedChannelUpdate this_ptr_conv;
49092         this_ptr_conv.inner = untag_ptr(this_ptr);
49093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49095         this_ptr_conv.is_owned = false;
49096         LDKThirtyTwoBytes val_ref;
49097         CHECK(val->arr_len == 32);
49098         memcpy(val_ref.data, val->elems, 32); FREE(val);
49099         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
49100 }
49101
49102 int64_t  CS_LDK_UnsignedChannelUpdate_get_short_channel_id(int64_t this_ptr) {
49103         LDKUnsignedChannelUpdate this_ptr_conv;
49104         this_ptr_conv.inner = untag_ptr(this_ptr);
49105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49107         this_ptr_conv.is_owned = false;
49108         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
49109         return ret_conv;
49110 }
49111
49112 void  CS_LDK_UnsignedChannelUpdate_set_short_channel_id(int64_t this_ptr, int64_t val) {
49113         LDKUnsignedChannelUpdate this_ptr_conv;
49114         this_ptr_conv.inner = untag_ptr(this_ptr);
49115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49117         this_ptr_conv.is_owned = false;
49118         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
49119 }
49120
49121 int32_t  CS_LDK_UnsignedChannelUpdate_get_timestamp(int64_t this_ptr) {
49122         LDKUnsignedChannelUpdate this_ptr_conv;
49123         this_ptr_conv.inner = untag_ptr(this_ptr);
49124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49126         this_ptr_conv.is_owned = false;
49127         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
49128         return ret_conv;
49129 }
49130
49131 void  CS_LDK_UnsignedChannelUpdate_set_timestamp(int64_t this_ptr, int32_t val) {
49132         LDKUnsignedChannelUpdate this_ptr_conv;
49133         this_ptr_conv.inner = untag_ptr(this_ptr);
49134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49136         this_ptr_conv.is_owned = false;
49137         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
49138 }
49139
49140 int8_t  CS_LDK_UnsignedChannelUpdate_get_flags(int64_t this_ptr) {
49141         LDKUnsignedChannelUpdate this_ptr_conv;
49142         this_ptr_conv.inner = untag_ptr(this_ptr);
49143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49145         this_ptr_conv.is_owned = false;
49146         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
49147         return ret_conv;
49148 }
49149
49150 void  CS_LDK_UnsignedChannelUpdate_set_flags(int64_t this_ptr, int8_t val) {
49151         LDKUnsignedChannelUpdate this_ptr_conv;
49152         this_ptr_conv.inner = untag_ptr(this_ptr);
49153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49155         this_ptr_conv.is_owned = false;
49156         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
49157 }
49158
49159 int16_t  CS_LDK_UnsignedChannelUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
49160         LDKUnsignedChannelUpdate this_ptr_conv;
49161         this_ptr_conv.inner = untag_ptr(this_ptr);
49162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49164         this_ptr_conv.is_owned = false;
49165         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
49166         return ret_conv;
49167 }
49168
49169 void  CS_LDK_UnsignedChannelUpdate_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
49170         LDKUnsignedChannelUpdate this_ptr_conv;
49171         this_ptr_conv.inner = untag_ptr(this_ptr);
49172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49174         this_ptr_conv.is_owned = false;
49175         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
49176 }
49177
49178 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_minimum_msat(int64_t this_ptr) {
49179         LDKUnsignedChannelUpdate this_ptr_conv;
49180         this_ptr_conv.inner = untag_ptr(this_ptr);
49181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49183         this_ptr_conv.is_owned = false;
49184         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
49185         return ret_conv;
49186 }
49187
49188 void  CS_LDK_UnsignedChannelUpdate_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
49189         LDKUnsignedChannelUpdate this_ptr_conv;
49190         this_ptr_conv.inner = untag_ptr(this_ptr);
49191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49193         this_ptr_conv.is_owned = false;
49194         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
49195 }
49196
49197 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_maximum_msat(int64_t this_ptr) {
49198         LDKUnsignedChannelUpdate this_ptr_conv;
49199         this_ptr_conv.inner = untag_ptr(this_ptr);
49200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49202         this_ptr_conv.is_owned = false;
49203         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
49204         return ret_conv;
49205 }
49206
49207 void  CS_LDK_UnsignedChannelUpdate_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
49208         LDKUnsignedChannelUpdate this_ptr_conv;
49209         this_ptr_conv.inner = untag_ptr(this_ptr);
49210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49212         this_ptr_conv.is_owned = false;
49213         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
49214 }
49215
49216 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_base_msat(int64_t this_ptr) {
49217         LDKUnsignedChannelUpdate this_ptr_conv;
49218         this_ptr_conv.inner = untag_ptr(this_ptr);
49219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49221         this_ptr_conv.is_owned = false;
49222         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
49223         return ret_conv;
49224 }
49225
49226 void  CS_LDK_UnsignedChannelUpdate_set_fee_base_msat(int64_t this_ptr, int32_t val) {
49227         LDKUnsignedChannelUpdate this_ptr_conv;
49228         this_ptr_conv.inner = untag_ptr(this_ptr);
49229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49231         this_ptr_conv.is_owned = false;
49232         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
49233 }
49234
49235 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_proportional_millionths(int64_t this_ptr) {
49236         LDKUnsignedChannelUpdate this_ptr_conv;
49237         this_ptr_conv.inner = untag_ptr(this_ptr);
49238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49240         this_ptr_conv.is_owned = false;
49241         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
49242         return ret_conv;
49243 }
49244
49245 void  CS_LDK_UnsignedChannelUpdate_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
49246         LDKUnsignedChannelUpdate this_ptr_conv;
49247         this_ptr_conv.inner = untag_ptr(this_ptr);
49248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49250         this_ptr_conv.is_owned = false;
49251         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
49252 }
49253
49254 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_excess_data(int64_t this_ptr) {
49255         LDKUnsignedChannelUpdate this_ptr_conv;
49256         this_ptr_conv.inner = untag_ptr(this_ptr);
49257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49259         this_ptr_conv.is_owned = false;
49260         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
49261         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49262         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49263         CVec_u8Z_free(ret_var);
49264         return ret_arr;
49265 }
49266
49267 void  CS_LDK_UnsignedChannelUpdate_set_excess_data(int64_t this_ptr, int8_tArray val) {
49268         LDKUnsignedChannelUpdate this_ptr_conv;
49269         this_ptr_conv.inner = untag_ptr(this_ptr);
49270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49272         this_ptr_conv.is_owned = false;
49273         LDKCVec_u8Z val_ref;
49274         val_ref.datalen = val->arr_len;
49275         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49276         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49277         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
49278 }
49279
49280 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) {
49281         LDKThirtyTwoBytes chain_hash_arg_ref;
49282         CHECK(chain_hash_arg->arr_len == 32);
49283         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49284         LDKCVec_u8Z excess_data_arg_ref;
49285         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
49286         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49287         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
49288         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);
49289         int64_t ret_ref = 0;
49290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49292         return ret_ref;
49293 }
49294
49295 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
49296         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
49297         int64_t ret_ref = 0;
49298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49300         return ret_ref;
49301 }
49302 int64_t  CS_LDK_UnsignedChannelUpdate_clone_ptr(int64_t arg) {
49303         LDKUnsignedChannelUpdate arg_conv;
49304         arg_conv.inner = untag_ptr(arg);
49305         arg_conv.is_owned = ptr_is_owned(arg);
49306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49307         arg_conv.is_owned = false;
49308         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
49309         return ret_conv;
49310 }
49311
49312 int64_t  CS_LDK_UnsignedChannelUpdate_clone(int64_t orig) {
49313         LDKUnsignedChannelUpdate orig_conv;
49314         orig_conv.inner = untag_ptr(orig);
49315         orig_conv.is_owned = ptr_is_owned(orig);
49316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49317         orig_conv.is_owned = false;
49318         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
49319         int64_t ret_ref = 0;
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49322         return ret_ref;
49323 }
49324
49325 int64_t  CS_LDK_UnsignedChannelUpdate_hash(int64_t o) {
49326         LDKUnsignedChannelUpdate o_conv;
49327         o_conv.inner = untag_ptr(o);
49328         o_conv.is_owned = ptr_is_owned(o);
49329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49330         o_conv.is_owned = false;
49331         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
49332         return ret_conv;
49333 }
49334
49335 jboolean  CS_LDK_UnsignedChannelUpdate_eq(int64_t a, int64_t b) {
49336         LDKUnsignedChannelUpdate a_conv;
49337         a_conv.inner = untag_ptr(a);
49338         a_conv.is_owned = ptr_is_owned(a);
49339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49340         a_conv.is_owned = false;
49341         LDKUnsignedChannelUpdate b_conv;
49342         b_conv.inner = untag_ptr(b);
49343         b_conv.is_owned = ptr_is_owned(b);
49344         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49345         b_conv.is_owned = false;
49346         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
49347         return ret_conv;
49348 }
49349
49350 void  CS_LDK_ChannelUpdate_free(int64_t this_obj) {
49351         LDKChannelUpdate this_obj_conv;
49352         this_obj_conv.inner = untag_ptr(this_obj);
49353         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49355         ChannelUpdate_free(this_obj_conv);
49356 }
49357
49358 int8_tArray  CS_LDK_ChannelUpdate_get_signature(int64_t this_ptr) {
49359         LDKChannelUpdate this_ptr_conv;
49360         this_ptr_conv.inner = untag_ptr(this_ptr);
49361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49363         this_ptr_conv.is_owned = false;
49364         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
49365         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
49366         return ret_arr;
49367 }
49368
49369 void  CS_LDK_ChannelUpdate_set_signature(int64_t this_ptr, int8_tArray val) {
49370         LDKChannelUpdate this_ptr_conv;
49371         this_ptr_conv.inner = untag_ptr(this_ptr);
49372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49374         this_ptr_conv.is_owned = false;
49375         LDKECDSASignature val_ref;
49376         CHECK(val->arr_len == 64);
49377         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
49378         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
49379 }
49380
49381 int64_t  CS_LDK_ChannelUpdate_get_contents(int64_t this_ptr) {
49382         LDKChannelUpdate this_ptr_conv;
49383         this_ptr_conv.inner = untag_ptr(this_ptr);
49384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49386         this_ptr_conv.is_owned = false;
49387         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
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
49394 void  CS_LDK_ChannelUpdate_set_contents(int64_t this_ptr, int64_t val) {
49395         LDKChannelUpdate this_ptr_conv;
49396         this_ptr_conv.inner = untag_ptr(this_ptr);
49397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49399         this_ptr_conv.is_owned = false;
49400         LDKUnsignedChannelUpdate val_conv;
49401         val_conv.inner = untag_ptr(val);
49402         val_conv.is_owned = ptr_is_owned(val);
49403         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49404         val_conv = UnsignedChannelUpdate_clone(&val_conv);
49405         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
49406 }
49407
49408 int64_t  CS_LDK_ChannelUpdate_new(int8_tArray signature_arg, int64_t contents_arg) {
49409         LDKECDSASignature signature_arg_ref;
49410         CHECK(signature_arg->arr_len == 64);
49411         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
49412         LDKUnsignedChannelUpdate contents_arg_conv;
49413         contents_arg_conv.inner = untag_ptr(contents_arg);
49414         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
49415         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
49416         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
49417         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
49418         int64_t ret_ref = 0;
49419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49421         return ret_ref;
49422 }
49423
49424 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
49425         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
49426         int64_t ret_ref = 0;
49427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49429         return ret_ref;
49430 }
49431 int64_t  CS_LDK_ChannelUpdate_clone_ptr(int64_t arg) {
49432         LDKChannelUpdate arg_conv;
49433         arg_conv.inner = untag_ptr(arg);
49434         arg_conv.is_owned = ptr_is_owned(arg);
49435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49436         arg_conv.is_owned = false;
49437         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
49438         return ret_conv;
49439 }
49440
49441 int64_t  CS_LDK_ChannelUpdate_clone(int64_t orig) {
49442         LDKChannelUpdate orig_conv;
49443         orig_conv.inner = untag_ptr(orig);
49444         orig_conv.is_owned = ptr_is_owned(orig);
49445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49446         orig_conv.is_owned = false;
49447         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
49448         int64_t ret_ref = 0;
49449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49451         return ret_ref;
49452 }
49453
49454 int64_t  CS_LDK_ChannelUpdate_hash(int64_t o) {
49455         LDKChannelUpdate o_conv;
49456         o_conv.inner = untag_ptr(o);
49457         o_conv.is_owned = ptr_is_owned(o);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49459         o_conv.is_owned = false;
49460         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
49461         return ret_conv;
49462 }
49463
49464 jboolean  CS_LDK_ChannelUpdate_eq(int64_t a, int64_t b) {
49465         LDKChannelUpdate a_conv;
49466         a_conv.inner = untag_ptr(a);
49467         a_conv.is_owned = ptr_is_owned(a);
49468         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49469         a_conv.is_owned = false;
49470         LDKChannelUpdate b_conv;
49471         b_conv.inner = untag_ptr(b);
49472         b_conv.is_owned = ptr_is_owned(b);
49473         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49474         b_conv.is_owned = false;
49475         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
49476         return ret_conv;
49477 }
49478
49479 void  CS_LDK_QueryChannelRange_free(int64_t this_obj) {
49480         LDKQueryChannelRange this_obj_conv;
49481         this_obj_conv.inner = untag_ptr(this_obj);
49482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49484         QueryChannelRange_free(this_obj_conv);
49485 }
49486
49487 int8_tArray  CS_LDK_QueryChannelRange_get_chain_hash(int64_t this_ptr) {
49488         LDKQueryChannelRange this_ptr_conv;
49489         this_ptr_conv.inner = untag_ptr(this_ptr);
49490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49492         this_ptr_conv.is_owned = false;
49493         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49494         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
49495         return ret_arr;
49496 }
49497
49498 void  CS_LDK_QueryChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49499         LDKQueryChannelRange this_ptr_conv;
49500         this_ptr_conv.inner = untag_ptr(this_ptr);
49501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49503         this_ptr_conv.is_owned = false;
49504         LDKThirtyTwoBytes val_ref;
49505         CHECK(val->arr_len == 32);
49506         memcpy(val_ref.data, val->elems, 32); FREE(val);
49507         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49508 }
49509
49510 int32_t  CS_LDK_QueryChannelRange_get_first_blocknum(int64_t this_ptr) {
49511         LDKQueryChannelRange this_ptr_conv;
49512         this_ptr_conv.inner = untag_ptr(this_ptr);
49513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49515         this_ptr_conv.is_owned = false;
49516         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
49517         return ret_conv;
49518 }
49519
49520 void  CS_LDK_QueryChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
49521         LDKQueryChannelRange this_ptr_conv;
49522         this_ptr_conv.inner = untag_ptr(this_ptr);
49523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49525         this_ptr_conv.is_owned = false;
49526         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
49527 }
49528
49529 int32_t  CS_LDK_QueryChannelRange_get_number_of_blocks(int64_t this_ptr) {
49530         LDKQueryChannelRange this_ptr_conv;
49531         this_ptr_conv.inner = untag_ptr(this_ptr);
49532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49534         this_ptr_conv.is_owned = false;
49535         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
49536         return ret_conv;
49537 }
49538
49539 void  CS_LDK_QueryChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
49540         LDKQueryChannelRange this_ptr_conv;
49541         this_ptr_conv.inner = untag_ptr(this_ptr);
49542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49544         this_ptr_conv.is_owned = false;
49545         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49546 }
49547
49548 int64_t  CS_LDK_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
49549         LDKThirtyTwoBytes chain_hash_arg_ref;
49550         CHECK(chain_hash_arg->arr_len == 32);
49551         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49552         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
49553         int64_t ret_ref = 0;
49554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49556         return ret_ref;
49557 }
49558
49559 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
49560         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
49561         int64_t ret_ref = 0;
49562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49564         return ret_ref;
49565 }
49566 int64_t  CS_LDK_QueryChannelRange_clone_ptr(int64_t arg) {
49567         LDKQueryChannelRange arg_conv;
49568         arg_conv.inner = untag_ptr(arg);
49569         arg_conv.is_owned = ptr_is_owned(arg);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49571         arg_conv.is_owned = false;
49572         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
49573         return ret_conv;
49574 }
49575
49576 int64_t  CS_LDK_QueryChannelRange_clone(int64_t orig) {
49577         LDKQueryChannelRange orig_conv;
49578         orig_conv.inner = untag_ptr(orig);
49579         orig_conv.is_owned = ptr_is_owned(orig);
49580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49581         orig_conv.is_owned = false;
49582         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
49583         int64_t ret_ref = 0;
49584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49586         return ret_ref;
49587 }
49588
49589 int64_t  CS_LDK_QueryChannelRange_hash(int64_t o) {
49590         LDKQueryChannelRange o_conv;
49591         o_conv.inner = untag_ptr(o);
49592         o_conv.is_owned = ptr_is_owned(o);
49593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49594         o_conv.is_owned = false;
49595         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
49596         return ret_conv;
49597 }
49598
49599 jboolean  CS_LDK_QueryChannelRange_eq(int64_t a, int64_t b) {
49600         LDKQueryChannelRange a_conv;
49601         a_conv.inner = untag_ptr(a);
49602         a_conv.is_owned = ptr_is_owned(a);
49603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49604         a_conv.is_owned = false;
49605         LDKQueryChannelRange b_conv;
49606         b_conv.inner = untag_ptr(b);
49607         b_conv.is_owned = ptr_is_owned(b);
49608         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49609         b_conv.is_owned = false;
49610         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
49611         return ret_conv;
49612 }
49613
49614 void  CS_LDK_ReplyChannelRange_free(int64_t this_obj) {
49615         LDKReplyChannelRange this_obj_conv;
49616         this_obj_conv.inner = untag_ptr(this_obj);
49617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49619         ReplyChannelRange_free(this_obj_conv);
49620 }
49621
49622 int8_tArray  CS_LDK_ReplyChannelRange_get_chain_hash(int64_t this_ptr) {
49623         LDKReplyChannelRange 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49629         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
49630         return ret_arr;
49631 }
49632
49633 void  CS_LDK_ReplyChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49634         LDKReplyChannelRange this_ptr_conv;
49635         this_ptr_conv.inner = untag_ptr(this_ptr);
49636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49638         this_ptr_conv.is_owned = false;
49639         LDKThirtyTwoBytes val_ref;
49640         CHECK(val->arr_len == 32);
49641         memcpy(val_ref.data, val->elems, 32); FREE(val);
49642         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
49643 }
49644
49645 int32_t  CS_LDK_ReplyChannelRange_get_first_blocknum(int64_t this_ptr) {
49646         LDKReplyChannelRange this_ptr_conv;
49647         this_ptr_conv.inner = untag_ptr(this_ptr);
49648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49650         this_ptr_conv.is_owned = false;
49651         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
49652         return ret_conv;
49653 }
49654
49655 void  CS_LDK_ReplyChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
49656         LDKReplyChannelRange this_ptr_conv;
49657         this_ptr_conv.inner = untag_ptr(this_ptr);
49658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49660         this_ptr_conv.is_owned = false;
49661         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
49662 }
49663
49664 int32_t  CS_LDK_ReplyChannelRange_get_number_of_blocks(int64_t this_ptr) {
49665         LDKReplyChannelRange this_ptr_conv;
49666         this_ptr_conv.inner = untag_ptr(this_ptr);
49667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49669         this_ptr_conv.is_owned = false;
49670         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
49671         return ret_conv;
49672 }
49673
49674 void  CS_LDK_ReplyChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
49675         LDKReplyChannelRange this_ptr_conv;
49676         this_ptr_conv.inner = untag_ptr(this_ptr);
49677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49679         this_ptr_conv.is_owned = false;
49680         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
49681 }
49682
49683 jboolean  CS_LDK_ReplyChannelRange_get_sync_complete(int64_t this_ptr) {
49684         LDKReplyChannelRange this_ptr_conv;
49685         this_ptr_conv.inner = untag_ptr(this_ptr);
49686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49688         this_ptr_conv.is_owned = false;
49689         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
49690         return ret_conv;
49691 }
49692
49693 void  CS_LDK_ReplyChannelRange_set_sync_complete(int64_t this_ptr, jboolean val) {
49694         LDKReplyChannelRange this_ptr_conv;
49695         this_ptr_conv.inner = untag_ptr(this_ptr);
49696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49698         this_ptr_conv.is_owned = false;
49699         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
49700 }
49701
49702 int64_tArray  CS_LDK_ReplyChannelRange_get_short_channel_ids(int64_t this_ptr) {
49703         LDKReplyChannelRange this_ptr_conv;
49704         this_ptr_conv.inner = untag_ptr(this_ptr);
49705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49707         this_ptr_conv.is_owned = false;
49708         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
49709         int64_tArray ret_arr = NULL;
49710         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49711         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49712         for (size_t g = 0; g < ret_var.datalen; g++) {
49713                 int64_t ret_conv_6_conv = ret_var.data[g];
49714                 ret_arr_ptr[g] = ret_conv_6_conv;
49715         }
49716         
49717         FREE(ret_var.data);
49718         return ret_arr;
49719 }
49720
49721 void  CS_LDK_ReplyChannelRange_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
49722         LDKReplyChannelRange this_ptr_conv;
49723         this_ptr_conv.inner = untag_ptr(this_ptr);
49724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49726         this_ptr_conv.is_owned = false;
49727         LDKCVec_u64Z val_constr;
49728         val_constr.datalen = val->arr_len;
49729         if (val_constr.datalen > 0)
49730                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49731         else
49732                 val_constr.data = NULL;
49733         int64_t* val_vals = val->elems;
49734         for (size_t g = 0; g < val_constr.datalen; g++) {
49735                 int64_t val_conv_6 = val_vals[g];
49736                 val_constr.data[g] = val_conv_6;
49737         }
49738         FREE(val);
49739         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
49740 }
49741
49742 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) {
49743         LDKThirtyTwoBytes chain_hash_arg_ref;
49744         CHECK(chain_hash_arg->arr_len == 32);
49745         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49746         LDKCVec_u64Z short_channel_ids_arg_constr;
49747         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49748         if (short_channel_ids_arg_constr.datalen > 0)
49749                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49750         else
49751                 short_channel_ids_arg_constr.data = NULL;
49752         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49753         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49754                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49755                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49756         }
49757         FREE(short_channel_ids_arg);
49758         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
49759         int64_t ret_ref = 0;
49760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49762         return ret_ref;
49763 }
49764
49765 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
49766         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
49767         int64_t ret_ref = 0;
49768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49770         return ret_ref;
49771 }
49772 int64_t  CS_LDK_ReplyChannelRange_clone_ptr(int64_t arg) {
49773         LDKReplyChannelRange arg_conv;
49774         arg_conv.inner = untag_ptr(arg);
49775         arg_conv.is_owned = ptr_is_owned(arg);
49776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49777         arg_conv.is_owned = false;
49778         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
49779         return ret_conv;
49780 }
49781
49782 int64_t  CS_LDK_ReplyChannelRange_clone(int64_t orig) {
49783         LDKReplyChannelRange orig_conv;
49784         orig_conv.inner = untag_ptr(orig);
49785         orig_conv.is_owned = ptr_is_owned(orig);
49786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49787         orig_conv.is_owned = false;
49788         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
49789         int64_t ret_ref = 0;
49790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49792         return ret_ref;
49793 }
49794
49795 int64_t  CS_LDK_ReplyChannelRange_hash(int64_t o) {
49796         LDKReplyChannelRange o_conv;
49797         o_conv.inner = untag_ptr(o);
49798         o_conv.is_owned = ptr_is_owned(o);
49799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49800         o_conv.is_owned = false;
49801         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
49802         return ret_conv;
49803 }
49804
49805 jboolean  CS_LDK_ReplyChannelRange_eq(int64_t a, int64_t b) {
49806         LDKReplyChannelRange a_conv;
49807         a_conv.inner = untag_ptr(a);
49808         a_conv.is_owned = ptr_is_owned(a);
49809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49810         a_conv.is_owned = false;
49811         LDKReplyChannelRange b_conv;
49812         b_conv.inner = untag_ptr(b);
49813         b_conv.is_owned = ptr_is_owned(b);
49814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49815         b_conv.is_owned = false;
49816         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
49817         return ret_conv;
49818 }
49819
49820 void  CS_LDK_QueryShortChannelIds_free(int64_t this_obj) {
49821         LDKQueryShortChannelIds this_obj_conv;
49822         this_obj_conv.inner = untag_ptr(this_obj);
49823         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49825         QueryShortChannelIds_free(this_obj_conv);
49826 }
49827
49828 int8_tArray  CS_LDK_QueryShortChannelIds_get_chain_hash(int64_t this_ptr) {
49829         LDKQueryShortChannelIds this_ptr_conv;
49830         this_ptr_conv.inner = untag_ptr(this_ptr);
49831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49833         this_ptr_conv.is_owned = false;
49834         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49835         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
49836         return ret_arr;
49837 }
49838
49839 void  CS_LDK_QueryShortChannelIds_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49840         LDKQueryShortChannelIds this_ptr_conv;
49841         this_ptr_conv.inner = untag_ptr(this_ptr);
49842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49844         this_ptr_conv.is_owned = false;
49845         LDKThirtyTwoBytes val_ref;
49846         CHECK(val->arr_len == 32);
49847         memcpy(val_ref.data, val->elems, 32); FREE(val);
49848         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
49849 }
49850
49851 int64_tArray  CS_LDK_QueryShortChannelIds_get_short_channel_ids(int64_t this_ptr) {
49852         LDKQueryShortChannelIds 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         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
49858         int64_tArray ret_arr = NULL;
49859         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
49860         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
49861         for (size_t g = 0; g < ret_var.datalen; g++) {
49862                 int64_t ret_conv_6_conv = ret_var.data[g];
49863                 ret_arr_ptr[g] = ret_conv_6_conv;
49864         }
49865         
49866         FREE(ret_var.data);
49867         return ret_arr;
49868 }
49869
49870 void  CS_LDK_QueryShortChannelIds_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
49871         LDKQueryShortChannelIds 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         LDKCVec_u64Z val_constr;
49877         val_constr.datalen = val->arr_len;
49878         if (val_constr.datalen > 0)
49879                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49880         else
49881                 val_constr.data = NULL;
49882         int64_t* val_vals = val->elems;
49883         for (size_t g = 0; g < val_constr.datalen; g++) {
49884                 int64_t val_conv_6 = val_vals[g];
49885                 val_constr.data[g] = val_conv_6;
49886         }
49887         FREE(val);
49888         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
49889 }
49890
49891 int64_t  CS_LDK_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
49892         LDKThirtyTwoBytes chain_hash_arg_ref;
49893         CHECK(chain_hash_arg->arr_len == 32);
49894         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49895         LDKCVec_u64Z short_channel_ids_arg_constr;
49896         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
49897         if (short_channel_ids_arg_constr.datalen > 0)
49898                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
49899         else
49900                 short_channel_ids_arg_constr.data = NULL;
49901         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
49902         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
49903                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
49904                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
49905         }
49906         FREE(short_channel_ids_arg);
49907         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
49908         int64_t ret_ref = 0;
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49911         return ret_ref;
49912 }
49913
49914 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
49915         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
49916         int64_t ret_ref = 0;
49917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49919         return ret_ref;
49920 }
49921 int64_t  CS_LDK_QueryShortChannelIds_clone_ptr(int64_t arg) {
49922         LDKQueryShortChannelIds arg_conv;
49923         arg_conv.inner = untag_ptr(arg);
49924         arg_conv.is_owned = ptr_is_owned(arg);
49925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49926         arg_conv.is_owned = false;
49927         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
49928         return ret_conv;
49929 }
49930
49931 int64_t  CS_LDK_QueryShortChannelIds_clone(int64_t orig) {
49932         LDKQueryShortChannelIds orig_conv;
49933         orig_conv.inner = untag_ptr(orig);
49934         orig_conv.is_owned = ptr_is_owned(orig);
49935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49936         orig_conv.is_owned = false;
49937         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
49938         int64_t ret_ref = 0;
49939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49941         return ret_ref;
49942 }
49943
49944 int64_t  CS_LDK_QueryShortChannelIds_hash(int64_t o) {
49945         LDKQueryShortChannelIds o_conv;
49946         o_conv.inner = untag_ptr(o);
49947         o_conv.is_owned = ptr_is_owned(o);
49948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49949         o_conv.is_owned = false;
49950         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
49951         return ret_conv;
49952 }
49953
49954 jboolean  CS_LDK_QueryShortChannelIds_eq(int64_t a, int64_t b) {
49955         LDKQueryShortChannelIds a_conv;
49956         a_conv.inner = untag_ptr(a);
49957         a_conv.is_owned = ptr_is_owned(a);
49958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49959         a_conv.is_owned = false;
49960         LDKQueryShortChannelIds b_conv;
49961         b_conv.inner = untag_ptr(b);
49962         b_conv.is_owned = ptr_is_owned(b);
49963         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49964         b_conv.is_owned = false;
49965         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
49966         return ret_conv;
49967 }
49968
49969 void  CS_LDK_ReplyShortChannelIdsEnd_free(int64_t this_obj) {
49970         LDKReplyShortChannelIdsEnd this_obj_conv;
49971         this_obj_conv.inner = untag_ptr(this_obj);
49972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49974         ReplyShortChannelIdsEnd_free(this_obj_conv);
49975 }
49976
49977 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_get_chain_hash(int64_t this_ptr) {
49978         LDKReplyShortChannelIdsEnd this_ptr_conv;
49979         this_ptr_conv.inner = untag_ptr(this_ptr);
49980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49982         this_ptr_conv.is_owned = false;
49983         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49984         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
49985         return ret_arr;
49986 }
49987
49988 void  CS_LDK_ReplyShortChannelIdsEnd_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49989         LDKReplyShortChannelIdsEnd this_ptr_conv;
49990         this_ptr_conv.inner = untag_ptr(this_ptr);
49991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49993         this_ptr_conv.is_owned = false;
49994         LDKThirtyTwoBytes val_ref;
49995         CHECK(val->arr_len == 32);
49996         memcpy(val_ref.data, val->elems, 32); FREE(val);
49997         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
49998 }
49999
50000 jboolean  CS_LDK_ReplyShortChannelIdsEnd_get_full_information(int64_t this_ptr) {
50001         LDKReplyShortChannelIdsEnd this_ptr_conv;
50002         this_ptr_conv.inner = untag_ptr(this_ptr);
50003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50005         this_ptr_conv.is_owned = false;
50006         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
50007         return ret_conv;
50008 }
50009
50010 void  CS_LDK_ReplyShortChannelIdsEnd_set_full_information(int64_t this_ptr, jboolean val) {
50011         LDKReplyShortChannelIdsEnd this_ptr_conv;
50012         this_ptr_conv.inner = untag_ptr(this_ptr);
50013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50015         this_ptr_conv.is_owned = false;
50016         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
50017 }
50018
50019 int64_t  CS_LDK_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
50020         LDKThirtyTwoBytes chain_hash_arg_ref;
50021         CHECK(chain_hash_arg->arr_len == 32);
50022         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
50023         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
50024         int64_t ret_ref = 0;
50025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50027         return ret_ref;
50028 }
50029
50030 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
50031         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
50032         int64_t ret_ref = 0;
50033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50035         return ret_ref;
50036 }
50037 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone_ptr(int64_t arg) {
50038         LDKReplyShortChannelIdsEnd arg_conv;
50039         arg_conv.inner = untag_ptr(arg);
50040         arg_conv.is_owned = ptr_is_owned(arg);
50041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50042         arg_conv.is_owned = false;
50043         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
50044         return ret_conv;
50045 }
50046
50047 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone(int64_t orig) {
50048         LDKReplyShortChannelIdsEnd orig_conv;
50049         orig_conv.inner = untag_ptr(orig);
50050         orig_conv.is_owned = ptr_is_owned(orig);
50051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50052         orig_conv.is_owned = false;
50053         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
50054         int64_t ret_ref = 0;
50055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50057         return ret_ref;
50058 }
50059
50060 int64_t  CS_LDK_ReplyShortChannelIdsEnd_hash(int64_t o) {
50061         LDKReplyShortChannelIdsEnd o_conv;
50062         o_conv.inner = untag_ptr(o);
50063         o_conv.is_owned = ptr_is_owned(o);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50065         o_conv.is_owned = false;
50066         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
50067         return ret_conv;
50068 }
50069
50070 jboolean  CS_LDK_ReplyShortChannelIdsEnd_eq(int64_t a, int64_t b) {
50071         LDKReplyShortChannelIdsEnd a_conv;
50072         a_conv.inner = untag_ptr(a);
50073         a_conv.is_owned = ptr_is_owned(a);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50075         a_conv.is_owned = false;
50076         LDKReplyShortChannelIdsEnd b_conv;
50077         b_conv.inner = untag_ptr(b);
50078         b_conv.is_owned = ptr_is_owned(b);
50079         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50080         b_conv.is_owned = false;
50081         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
50082         return ret_conv;
50083 }
50084
50085 void  CS_LDK_GossipTimestampFilter_free(int64_t this_obj) {
50086         LDKGossipTimestampFilter this_obj_conv;
50087         this_obj_conv.inner = untag_ptr(this_obj);
50088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50090         GossipTimestampFilter_free(this_obj_conv);
50091 }
50092
50093 int8_tArray  CS_LDK_GossipTimestampFilter_get_chain_hash(int64_t this_ptr) {
50094         LDKGossipTimestampFilter this_ptr_conv;
50095         this_ptr_conv.inner = untag_ptr(this_ptr);
50096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50098         this_ptr_conv.is_owned = false;
50099         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50100         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
50101         return ret_arr;
50102 }
50103
50104 void  CS_LDK_GossipTimestampFilter_set_chain_hash(int64_t this_ptr, int8_tArray val) {
50105         LDKGossipTimestampFilter this_ptr_conv;
50106         this_ptr_conv.inner = untag_ptr(this_ptr);
50107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50109         this_ptr_conv.is_owned = false;
50110         LDKThirtyTwoBytes val_ref;
50111         CHECK(val->arr_len == 32);
50112         memcpy(val_ref.data, val->elems, 32); FREE(val);
50113         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
50114 }
50115
50116 int32_t  CS_LDK_GossipTimestampFilter_get_first_timestamp(int64_t this_ptr) {
50117         LDKGossipTimestampFilter this_ptr_conv;
50118         this_ptr_conv.inner = untag_ptr(this_ptr);
50119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50121         this_ptr_conv.is_owned = false;
50122         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
50123         return ret_conv;
50124 }
50125
50126 void  CS_LDK_GossipTimestampFilter_set_first_timestamp(int64_t this_ptr, int32_t val) {
50127         LDKGossipTimestampFilter this_ptr_conv;
50128         this_ptr_conv.inner = untag_ptr(this_ptr);
50129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50131         this_ptr_conv.is_owned = false;
50132         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
50133 }
50134
50135 int32_t  CS_LDK_GossipTimestampFilter_get_timestamp_range(int64_t this_ptr) {
50136         LDKGossipTimestampFilter this_ptr_conv;
50137         this_ptr_conv.inner = untag_ptr(this_ptr);
50138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50140         this_ptr_conv.is_owned = false;
50141         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
50142         return ret_conv;
50143 }
50144
50145 void  CS_LDK_GossipTimestampFilter_set_timestamp_range(int64_t this_ptr, int32_t val) {
50146         LDKGossipTimestampFilter this_ptr_conv;
50147         this_ptr_conv.inner = untag_ptr(this_ptr);
50148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50150         this_ptr_conv.is_owned = false;
50151         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
50152 }
50153
50154 int64_t  CS_LDK_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
50155         LDKThirtyTwoBytes chain_hash_arg_ref;
50156         CHECK(chain_hash_arg->arr_len == 32);
50157         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
50158         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
50159         int64_t ret_ref = 0;
50160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50162         return ret_ref;
50163 }
50164
50165 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
50166         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
50167         int64_t ret_ref = 0;
50168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50170         return ret_ref;
50171 }
50172 int64_t  CS_LDK_GossipTimestampFilter_clone_ptr(int64_t arg) {
50173         LDKGossipTimestampFilter arg_conv;
50174         arg_conv.inner = untag_ptr(arg);
50175         arg_conv.is_owned = ptr_is_owned(arg);
50176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50177         arg_conv.is_owned = false;
50178         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
50179         return ret_conv;
50180 }
50181
50182 int64_t  CS_LDK_GossipTimestampFilter_clone(int64_t orig) {
50183         LDKGossipTimestampFilter orig_conv;
50184         orig_conv.inner = untag_ptr(orig);
50185         orig_conv.is_owned = ptr_is_owned(orig);
50186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50187         orig_conv.is_owned = false;
50188         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
50189         int64_t ret_ref = 0;
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50192         return ret_ref;
50193 }
50194
50195 int64_t  CS_LDK_GossipTimestampFilter_hash(int64_t o) {
50196         LDKGossipTimestampFilter o_conv;
50197         o_conv.inner = untag_ptr(o);
50198         o_conv.is_owned = ptr_is_owned(o);
50199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50200         o_conv.is_owned = false;
50201         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
50202         return ret_conv;
50203 }
50204
50205 jboolean  CS_LDK_GossipTimestampFilter_eq(int64_t a, int64_t b) {
50206         LDKGossipTimestampFilter a_conv;
50207         a_conv.inner = untag_ptr(a);
50208         a_conv.is_owned = ptr_is_owned(a);
50209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50210         a_conv.is_owned = false;
50211         LDKGossipTimestampFilter b_conv;
50212         b_conv.inner = untag_ptr(b);
50213         b_conv.is_owned = ptr_is_owned(b);
50214         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50215         b_conv.is_owned = false;
50216         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
50217         return ret_conv;
50218 }
50219
50220 void  CS_LDK_ErrorAction_free(int64_t this_ptr) {
50221         if (!ptr_is_owned(this_ptr)) return;
50222         void* this_ptr_ptr = untag_ptr(this_ptr);
50223         CHECK_ACCESS(this_ptr_ptr);
50224         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
50225         FREE(untag_ptr(this_ptr));
50226         ErrorAction_free(this_ptr_conv);
50227 }
50228
50229 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
50230         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50231         *ret_copy = ErrorAction_clone(arg);
50232         int64_t ret_ref = tag_ptr(ret_copy, true);
50233         return ret_ref;
50234 }
50235 int64_t  CS_LDK_ErrorAction_clone_ptr(int64_t arg) {
50236         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
50237         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
50238         return ret_conv;
50239 }
50240
50241 int64_t  CS_LDK_ErrorAction_clone(int64_t orig) {
50242         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
50243         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50244         *ret_copy = ErrorAction_clone(orig_conv);
50245         int64_t ret_ref = tag_ptr(ret_copy, true);
50246         return ret_ref;
50247 }
50248
50249 int64_t  CS_LDK_ErrorAction_disconnect_peer(int64_t msg) {
50250         LDKErrorMessage msg_conv;
50251         msg_conv.inner = untag_ptr(msg);
50252         msg_conv.is_owned = ptr_is_owned(msg);
50253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50254         msg_conv = ErrorMessage_clone(&msg_conv);
50255         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50256         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
50257         int64_t ret_ref = tag_ptr(ret_copy, true);
50258         return ret_ref;
50259 }
50260
50261 int64_t  CS_LDK_ErrorAction_disconnect_peer_with_warning(int64_t msg) {
50262         LDKWarningMessage msg_conv;
50263         msg_conv.inner = untag_ptr(msg);
50264         msg_conv.is_owned = ptr_is_owned(msg);
50265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50266         msg_conv = WarningMessage_clone(&msg_conv);
50267         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50268         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
50269         int64_t ret_ref = tag_ptr(ret_copy, true);
50270         return ret_ref;
50271 }
50272
50273 int64_t  CS_LDK_ErrorAction_ignore_error() {
50274         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50275         *ret_copy = ErrorAction_ignore_error();
50276         int64_t ret_ref = tag_ptr(ret_copy, true);
50277         return ret_ref;
50278 }
50279
50280 int64_t  CS_LDK_ErrorAction_ignore_and_log(int32_t a) {
50281         LDKLevel a_conv = LDKLevel_from_cs(a);
50282         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50283         *ret_copy = ErrorAction_ignore_and_log(a_conv);
50284         int64_t ret_ref = tag_ptr(ret_copy, true);
50285         return ret_ref;
50286 }
50287
50288 int64_t  CS_LDK_ErrorAction_ignore_duplicate_gossip() {
50289         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50290         *ret_copy = ErrorAction_ignore_duplicate_gossip();
50291         int64_t ret_ref = tag_ptr(ret_copy, true);
50292         return ret_ref;
50293 }
50294
50295 int64_t  CS_LDK_ErrorAction_send_error_message(int64_t msg) {
50296         LDKErrorMessage msg_conv;
50297         msg_conv.inner = untag_ptr(msg);
50298         msg_conv.is_owned = ptr_is_owned(msg);
50299         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50300         msg_conv = ErrorMessage_clone(&msg_conv);
50301         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50302         *ret_copy = ErrorAction_send_error_message(msg_conv);
50303         int64_t ret_ref = tag_ptr(ret_copy, true);
50304         return ret_ref;
50305 }
50306
50307 int64_t  CS_LDK_ErrorAction_send_warning_message(int64_t msg, int32_t log_level) {
50308         LDKWarningMessage msg_conv;
50309         msg_conv.inner = untag_ptr(msg);
50310         msg_conv.is_owned = ptr_is_owned(msg);
50311         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
50312         msg_conv = WarningMessage_clone(&msg_conv);
50313         LDKLevel log_level_conv = LDKLevel_from_cs(log_level);
50314         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50315         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
50316         int64_t ret_ref = tag_ptr(ret_copy, true);
50317         return ret_ref;
50318 }
50319
50320 int64_t  CS_LDK_ErrorAction_hash(int64_t o) {
50321         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
50322         int64_t ret_conv = ErrorAction_hash(o_conv);
50323         return ret_conv;
50324 }
50325
50326 void  CS_LDK_LightningError_free(int64_t this_obj) {
50327         LDKLightningError this_obj_conv;
50328         this_obj_conv.inner = untag_ptr(this_obj);
50329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50331         LightningError_free(this_obj_conv);
50332 }
50333
50334 jstring  CS_LDK_LightningError_get_err(int64_t this_ptr) {
50335         LDKLightningError this_ptr_conv;
50336         this_ptr_conv.inner = untag_ptr(this_ptr);
50337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50339         this_ptr_conv.is_owned = false;
50340         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
50341         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
50342         Str_free(ret_str);
50343         return ret_conv;
50344 }
50345
50346 void  CS_LDK_LightningError_set_err(int64_t this_ptr, jstring val) {
50347         LDKLightningError this_ptr_conv;
50348         this_ptr_conv.inner = untag_ptr(this_ptr);
50349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50351         this_ptr_conv.is_owned = false;
50352         LDKStr val_conv = str_ref_to_owned_c(val);
50353         LightningError_set_err(&this_ptr_conv, val_conv);
50354 }
50355
50356 int64_t  CS_LDK_LightningError_get_action(int64_t this_ptr) {
50357         LDKLightningError this_ptr_conv;
50358         this_ptr_conv.inner = untag_ptr(this_ptr);
50359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50361         this_ptr_conv.is_owned = false;
50362         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
50363         *ret_copy = LightningError_get_action(&this_ptr_conv);
50364         int64_t ret_ref = tag_ptr(ret_copy, true);
50365         return ret_ref;
50366 }
50367
50368 void  CS_LDK_LightningError_set_action(int64_t this_ptr, int64_t val) {
50369         LDKLightningError this_ptr_conv;
50370         this_ptr_conv.inner = untag_ptr(this_ptr);
50371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50373         this_ptr_conv.is_owned = false;
50374         void* val_ptr = untag_ptr(val);
50375         CHECK_ACCESS(val_ptr);
50376         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
50377         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
50378         LightningError_set_action(&this_ptr_conv, val_conv);
50379 }
50380
50381 int64_t  CS_LDK_LightningError_new(jstring err_arg, int64_t action_arg) {
50382         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
50383         void* action_arg_ptr = untag_ptr(action_arg);
50384         CHECK_ACCESS(action_arg_ptr);
50385         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
50386         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
50387         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
50388         int64_t ret_ref = 0;
50389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50391         return ret_ref;
50392 }
50393
50394 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
50395         LDKLightningError ret_var = LightningError_clone(arg);
50396         int64_t ret_ref = 0;
50397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50399         return ret_ref;
50400 }
50401 int64_t  CS_LDK_LightningError_clone_ptr(int64_t arg) {
50402         LDKLightningError arg_conv;
50403         arg_conv.inner = untag_ptr(arg);
50404         arg_conv.is_owned = ptr_is_owned(arg);
50405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50406         arg_conv.is_owned = false;
50407         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
50408         return ret_conv;
50409 }
50410
50411 int64_t  CS_LDK_LightningError_clone(int64_t orig) {
50412         LDKLightningError orig_conv;
50413         orig_conv.inner = untag_ptr(orig);
50414         orig_conv.is_owned = ptr_is_owned(orig);
50415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50416         orig_conv.is_owned = false;
50417         LDKLightningError ret_var = LightningError_clone(&orig_conv);
50418         int64_t ret_ref = 0;
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50421         return ret_ref;
50422 }
50423
50424 void  CS_LDK_CommitmentUpdate_free(int64_t this_obj) {
50425         LDKCommitmentUpdate this_obj_conv;
50426         this_obj_conv.inner = untag_ptr(this_obj);
50427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50429         CommitmentUpdate_free(this_obj_conv);
50430 }
50431
50432 int64_tArray  CS_LDK_CommitmentUpdate_get_update_add_htlcs(int64_t this_ptr) {
50433         LDKCommitmentUpdate this_ptr_conv;
50434         this_ptr_conv.inner = untag_ptr(this_ptr);
50435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50437         this_ptr_conv.is_owned = false;
50438         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
50439         int64_tArray ret_arr = NULL;
50440         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50441         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50442         for (size_t p = 0; p < ret_var.datalen; p++) {
50443                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
50444                 int64_t ret_conv_15_ref = 0;
50445                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
50446                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
50447                 ret_arr_ptr[p] = ret_conv_15_ref;
50448         }
50449         
50450         FREE(ret_var.data);
50451         return ret_arr;
50452 }
50453
50454 void  CS_LDK_CommitmentUpdate_set_update_add_htlcs(int64_t this_ptr, int64_tArray val) {
50455         LDKCommitmentUpdate this_ptr_conv;
50456         this_ptr_conv.inner = untag_ptr(this_ptr);
50457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50459         this_ptr_conv.is_owned = false;
50460         LDKCVec_UpdateAddHTLCZ val_constr;
50461         val_constr.datalen = val->arr_len;
50462         if (val_constr.datalen > 0)
50463                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50464         else
50465                 val_constr.data = NULL;
50466         int64_t* val_vals = val->elems;
50467         for (size_t p = 0; p < val_constr.datalen; p++) {
50468                 int64_t val_conv_15 = val_vals[p];
50469                 LDKUpdateAddHTLC val_conv_15_conv;
50470                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
50471                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
50472                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
50473                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
50474                 val_constr.data[p] = val_conv_15_conv;
50475         }
50476         FREE(val);
50477         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
50478 }
50479
50480 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fulfill_htlcs(int64_t this_ptr) {
50481         LDKCommitmentUpdate this_ptr_conv;
50482         this_ptr_conv.inner = untag_ptr(this_ptr);
50483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50485         this_ptr_conv.is_owned = false;
50486         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
50487         int64_tArray ret_arr = NULL;
50488         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50489         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50490         for (size_t t = 0; t < ret_var.datalen; t++) {
50491                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
50492                 int64_t ret_conv_19_ref = 0;
50493                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
50494                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
50495                 ret_arr_ptr[t] = ret_conv_19_ref;
50496         }
50497         
50498         FREE(ret_var.data);
50499         return ret_arr;
50500 }
50501
50502 void  CS_LDK_CommitmentUpdate_set_update_fulfill_htlcs(int64_t this_ptr, int64_tArray val) {
50503         LDKCommitmentUpdate this_ptr_conv;
50504         this_ptr_conv.inner = untag_ptr(this_ptr);
50505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50507         this_ptr_conv.is_owned = false;
50508         LDKCVec_UpdateFulfillHTLCZ val_constr;
50509         val_constr.datalen = val->arr_len;
50510         if (val_constr.datalen > 0)
50511                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50512         else
50513                 val_constr.data = NULL;
50514         int64_t* val_vals = val->elems;
50515         for (size_t t = 0; t < val_constr.datalen; t++) {
50516                 int64_t val_conv_19 = val_vals[t];
50517                 LDKUpdateFulfillHTLC val_conv_19_conv;
50518                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
50519                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
50520                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
50521                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
50522                 val_constr.data[t] = val_conv_19_conv;
50523         }
50524         FREE(val);
50525         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
50526 }
50527
50528 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_htlcs(int64_t this_ptr) {
50529         LDKCommitmentUpdate this_ptr_conv;
50530         this_ptr_conv.inner = untag_ptr(this_ptr);
50531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50533         this_ptr_conv.is_owned = false;
50534         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
50535         int64_tArray ret_arr = NULL;
50536         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50537         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50538         for (size_t q = 0; q < ret_var.datalen; q++) {
50539                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
50540                 int64_t ret_conv_16_ref = 0;
50541                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
50542                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
50543                 ret_arr_ptr[q] = ret_conv_16_ref;
50544         }
50545         
50546         FREE(ret_var.data);
50547         return ret_arr;
50548 }
50549
50550 void  CS_LDK_CommitmentUpdate_set_update_fail_htlcs(int64_t this_ptr, int64_tArray val) {
50551         LDKCommitmentUpdate this_ptr_conv;
50552         this_ptr_conv.inner = untag_ptr(this_ptr);
50553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50555         this_ptr_conv.is_owned = false;
50556         LDKCVec_UpdateFailHTLCZ val_constr;
50557         val_constr.datalen = val->arr_len;
50558         if (val_constr.datalen > 0)
50559                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50560         else
50561                 val_constr.data = NULL;
50562         int64_t* val_vals = val->elems;
50563         for (size_t q = 0; q < val_constr.datalen; q++) {
50564                 int64_t val_conv_16 = val_vals[q];
50565                 LDKUpdateFailHTLC val_conv_16_conv;
50566                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
50567                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
50568                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
50569                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
50570                 val_constr.data[q] = val_conv_16_conv;
50571         }
50572         FREE(val);
50573         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
50574 }
50575
50576 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_malformed_htlcs(int64_t this_ptr) {
50577         LDKCommitmentUpdate this_ptr_conv;
50578         this_ptr_conv.inner = untag_ptr(this_ptr);
50579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50581         this_ptr_conv.is_owned = false;
50582         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
50583         int64_tArray ret_arr = NULL;
50584         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
50585         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
50586         for (size_t z = 0; z < ret_var.datalen; z++) {
50587                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
50588                 int64_t ret_conv_25_ref = 0;
50589                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
50590                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
50591                 ret_arr_ptr[z] = ret_conv_25_ref;
50592         }
50593         
50594         FREE(ret_var.data);
50595         return ret_arr;
50596 }
50597
50598 void  CS_LDK_CommitmentUpdate_set_update_fail_malformed_htlcs(int64_t this_ptr, int64_tArray val) {
50599         LDKCommitmentUpdate this_ptr_conv;
50600         this_ptr_conv.inner = untag_ptr(this_ptr);
50601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50603         this_ptr_conv.is_owned = false;
50604         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
50605         val_constr.datalen = val->arr_len;
50606         if (val_constr.datalen > 0)
50607                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50608         else
50609                 val_constr.data = NULL;
50610         int64_t* val_vals = val->elems;
50611         for (size_t z = 0; z < val_constr.datalen; z++) {
50612                 int64_t val_conv_25 = val_vals[z];
50613                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
50614                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
50615                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
50616                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
50617                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
50618                 val_constr.data[z] = val_conv_25_conv;
50619         }
50620         FREE(val);
50621         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
50622 }
50623
50624 int64_t  CS_LDK_CommitmentUpdate_get_update_fee(int64_t this_ptr) {
50625         LDKCommitmentUpdate this_ptr_conv;
50626         this_ptr_conv.inner = untag_ptr(this_ptr);
50627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50629         this_ptr_conv.is_owned = false;
50630         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
50631         int64_t ret_ref = 0;
50632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50634         return ret_ref;
50635 }
50636
50637 void  CS_LDK_CommitmentUpdate_set_update_fee(int64_t this_ptr, int64_t val) {
50638         LDKCommitmentUpdate this_ptr_conv;
50639         this_ptr_conv.inner = untag_ptr(this_ptr);
50640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50642         this_ptr_conv.is_owned = false;
50643         LDKUpdateFee val_conv;
50644         val_conv.inner = untag_ptr(val);
50645         val_conv.is_owned = ptr_is_owned(val);
50646         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50647         val_conv = UpdateFee_clone(&val_conv);
50648         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
50649 }
50650
50651 int64_t  CS_LDK_CommitmentUpdate_get_commitment_signed(int64_t this_ptr) {
50652         LDKCommitmentUpdate this_ptr_conv;
50653         this_ptr_conv.inner = untag_ptr(this_ptr);
50654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50656         this_ptr_conv.is_owned = false;
50657         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
50658         int64_t ret_ref = 0;
50659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50661         return ret_ref;
50662 }
50663
50664 void  CS_LDK_CommitmentUpdate_set_commitment_signed(int64_t this_ptr, int64_t val) {
50665         LDKCommitmentUpdate this_ptr_conv;
50666         this_ptr_conv.inner = untag_ptr(this_ptr);
50667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50669         this_ptr_conv.is_owned = false;
50670         LDKCommitmentSigned val_conv;
50671         val_conv.inner = untag_ptr(val);
50672         val_conv.is_owned = ptr_is_owned(val);
50673         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50674         val_conv = CommitmentSigned_clone(&val_conv);
50675         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
50676 }
50677
50678 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) {
50679         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
50680         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
50681         if (update_add_htlcs_arg_constr.datalen > 0)
50682                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
50683         else
50684                 update_add_htlcs_arg_constr.data = NULL;
50685         int64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
50686         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
50687                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
50688                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
50689                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
50690                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
50691                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
50692                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
50693                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
50694         }
50695         FREE(update_add_htlcs_arg);
50696         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
50697         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
50698         if (update_fulfill_htlcs_arg_constr.datalen > 0)
50699                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
50700         else
50701                 update_fulfill_htlcs_arg_constr.data = NULL;
50702         int64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
50703         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
50704                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
50705                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
50706                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
50707                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
50708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
50709                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
50710                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
50711         }
50712         FREE(update_fulfill_htlcs_arg);
50713         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
50714         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
50715         if (update_fail_htlcs_arg_constr.datalen > 0)
50716                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
50717         else
50718                 update_fail_htlcs_arg_constr.data = NULL;
50719         int64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
50720         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
50721                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
50722                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
50723                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
50724                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
50725                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
50726                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
50727                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
50728         }
50729         FREE(update_fail_htlcs_arg);
50730         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
50731         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
50732         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
50733                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
50734         else
50735                 update_fail_malformed_htlcs_arg_constr.data = NULL;
50736         int64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
50737         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
50738                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
50739                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
50740                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
50741                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
50742                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
50743                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
50744                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
50745         }
50746         FREE(update_fail_malformed_htlcs_arg);
50747         LDKUpdateFee update_fee_arg_conv;
50748         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
50749         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
50750         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
50751         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
50752         LDKCommitmentSigned commitment_signed_arg_conv;
50753         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
50754         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
50755         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
50756         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
50757         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);
50758         int64_t ret_ref = 0;
50759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50761         return ret_ref;
50762 }
50763
50764 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
50765         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
50766         int64_t ret_ref = 0;
50767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50769         return ret_ref;
50770 }
50771 int64_t  CS_LDK_CommitmentUpdate_clone_ptr(int64_t arg) {
50772         LDKCommitmentUpdate arg_conv;
50773         arg_conv.inner = untag_ptr(arg);
50774         arg_conv.is_owned = ptr_is_owned(arg);
50775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50776         arg_conv.is_owned = false;
50777         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
50778         return ret_conv;
50779 }
50780
50781 int64_t  CS_LDK_CommitmentUpdate_clone(int64_t orig) {
50782         LDKCommitmentUpdate orig_conv;
50783         orig_conv.inner = untag_ptr(orig);
50784         orig_conv.is_owned = ptr_is_owned(orig);
50785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50786         orig_conv.is_owned = false;
50787         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
50788         int64_t ret_ref = 0;
50789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50791         return ret_ref;
50792 }
50793
50794 int64_t  CS_LDK_CommitmentUpdate_hash(int64_t o) {
50795         LDKCommitmentUpdate o_conv;
50796         o_conv.inner = untag_ptr(o);
50797         o_conv.is_owned = ptr_is_owned(o);
50798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50799         o_conv.is_owned = false;
50800         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
50801         return ret_conv;
50802 }
50803
50804 jboolean  CS_LDK_CommitmentUpdate_eq(int64_t a, int64_t b) {
50805         LDKCommitmentUpdate a_conv;
50806         a_conv.inner = untag_ptr(a);
50807         a_conv.is_owned = ptr_is_owned(a);
50808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50809         a_conv.is_owned = false;
50810         LDKCommitmentUpdate b_conv;
50811         b_conv.inner = untag_ptr(b);
50812         b_conv.is_owned = ptr_is_owned(b);
50813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50814         b_conv.is_owned = false;
50815         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
50816         return ret_conv;
50817 }
50818
50819 void  CS_LDK_ChannelMessageHandler_free(int64_t this_ptr) {
50820         if (!ptr_is_owned(this_ptr)) return;
50821         void* this_ptr_ptr = untag_ptr(this_ptr);
50822         CHECK_ACCESS(this_ptr_ptr);
50823         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
50824         FREE(untag_ptr(this_ptr));
50825         ChannelMessageHandler_free(this_ptr_conv);
50826 }
50827
50828 void  CS_LDK_RoutingMessageHandler_free(int64_t this_ptr) {
50829         if (!ptr_is_owned(this_ptr)) return;
50830         void* this_ptr_ptr = untag_ptr(this_ptr);
50831         CHECK_ACCESS(this_ptr_ptr);
50832         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
50833         FREE(untag_ptr(this_ptr));
50834         RoutingMessageHandler_free(this_ptr_conv);
50835 }
50836
50837 void  CS_LDK_OnionMessageHandler_free(int64_t this_ptr) {
50838         if (!ptr_is_owned(this_ptr)) return;
50839         void* this_ptr_ptr = untag_ptr(this_ptr);
50840         CHECK_ACCESS(this_ptr_ptr);
50841         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
50842         FREE(untag_ptr(this_ptr));
50843         OnionMessageHandler_free(this_ptr_conv);
50844 }
50845
50846 void  CS_LDK_FinalOnionHopData_free(int64_t this_obj) {
50847         LDKFinalOnionHopData this_obj_conv;
50848         this_obj_conv.inner = untag_ptr(this_obj);
50849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50851         FinalOnionHopData_free(this_obj_conv);
50852 }
50853
50854 int8_tArray  CS_LDK_FinalOnionHopData_get_payment_secret(int64_t this_ptr) {
50855         LDKFinalOnionHopData this_ptr_conv;
50856         this_ptr_conv.inner = untag_ptr(this_ptr);
50857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50859         this_ptr_conv.is_owned = false;
50860         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50861         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
50862         return ret_arr;
50863 }
50864
50865 void  CS_LDK_FinalOnionHopData_set_payment_secret(int64_t this_ptr, int8_tArray val) {
50866         LDKFinalOnionHopData this_ptr_conv;
50867         this_ptr_conv.inner = untag_ptr(this_ptr);
50868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50870         this_ptr_conv.is_owned = false;
50871         LDKThirtyTwoBytes val_ref;
50872         CHECK(val->arr_len == 32);
50873         memcpy(val_ref.data, val->elems, 32); FREE(val);
50874         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
50875 }
50876
50877 int64_t  CS_LDK_FinalOnionHopData_get_total_msat(int64_t this_ptr) {
50878         LDKFinalOnionHopData this_ptr_conv;
50879         this_ptr_conv.inner = untag_ptr(this_ptr);
50880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50882         this_ptr_conv.is_owned = false;
50883         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
50884         return ret_conv;
50885 }
50886
50887 void  CS_LDK_FinalOnionHopData_set_total_msat(int64_t this_ptr, int64_t val) {
50888         LDKFinalOnionHopData this_ptr_conv;
50889         this_ptr_conv.inner = untag_ptr(this_ptr);
50890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50892         this_ptr_conv.is_owned = false;
50893         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
50894 }
50895
50896 int64_t  CS_LDK_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
50897         LDKThirtyTwoBytes payment_secret_arg_ref;
50898         CHECK(payment_secret_arg->arr_len == 32);
50899         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
50900         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
50901         int64_t ret_ref = 0;
50902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50904         return ret_ref;
50905 }
50906
50907 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
50908         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
50909         int64_t ret_ref = 0;
50910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50912         return ret_ref;
50913 }
50914 int64_t  CS_LDK_FinalOnionHopData_clone_ptr(int64_t arg) {
50915         LDKFinalOnionHopData arg_conv;
50916         arg_conv.inner = untag_ptr(arg);
50917         arg_conv.is_owned = ptr_is_owned(arg);
50918         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50919         arg_conv.is_owned = false;
50920         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
50921         return ret_conv;
50922 }
50923
50924 int64_t  CS_LDK_FinalOnionHopData_clone(int64_t orig) {
50925         LDKFinalOnionHopData orig_conv;
50926         orig_conv.inner = untag_ptr(orig);
50927         orig_conv.is_owned = ptr_is_owned(orig);
50928         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50929         orig_conv.is_owned = false;
50930         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
50931         int64_t ret_ref = 0;
50932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50934         return ret_ref;
50935 }
50936
50937 void  CS_LDK_OnionPacket_free(int64_t this_obj) {
50938         LDKOnionPacket this_obj_conv;
50939         this_obj_conv.inner = untag_ptr(this_obj);
50940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50942         OnionPacket_free(this_obj_conv);
50943 }
50944
50945 int8_t  CS_LDK_OnionPacket_get_version(int64_t this_ptr) {
50946         LDKOnionPacket this_ptr_conv;
50947         this_ptr_conv.inner = untag_ptr(this_ptr);
50948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50950         this_ptr_conv.is_owned = false;
50951         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
50952         return ret_conv;
50953 }
50954
50955 void  CS_LDK_OnionPacket_set_version(int64_t this_ptr, int8_t val) {
50956         LDKOnionPacket this_ptr_conv;
50957         this_ptr_conv.inner = untag_ptr(this_ptr);
50958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50960         this_ptr_conv.is_owned = false;
50961         OnionPacket_set_version(&this_ptr_conv, val);
50962 }
50963
50964 int64_t  CS_LDK_OnionPacket_get_public_key(int64_t this_ptr) {
50965         LDKOnionPacket this_ptr_conv;
50966         this_ptr_conv.inner = untag_ptr(this_ptr);
50967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50969         this_ptr_conv.is_owned = false;
50970         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
50971         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
50972         return tag_ptr(ret_conv, true);
50973 }
50974
50975 void  CS_LDK_OnionPacket_set_public_key(int64_t this_ptr, int64_t val) {
50976         LDKOnionPacket this_ptr_conv;
50977         this_ptr_conv.inner = untag_ptr(this_ptr);
50978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50980         this_ptr_conv.is_owned = false;
50981         void* val_ptr = untag_ptr(val);
50982         CHECK_ACCESS(val_ptr);
50983         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
50984         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
50985         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
50986 }
50987
50988 int8_tArray  CS_LDK_OnionPacket_get_hmac(int64_t this_ptr) {
50989         LDKOnionPacket this_ptr_conv;
50990         this_ptr_conv.inner = untag_ptr(this_ptr);
50991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50993         this_ptr_conv.is_owned = false;
50994         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50995         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
50996         return ret_arr;
50997 }
50998
50999 void  CS_LDK_OnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
51000         LDKOnionPacket this_ptr_conv;
51001         this_ptr_conv.inner = untag_ptr(this_ptr);
51002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51004         this_ptr_conv.is_owned = false;
51005         LDKThirtyTwoBytes val_ref;
51006         CHECK(val->arr_len == 32);
51007         memcpy(val_ref.data, val->elems, 32); FREE(val);
51008         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
51009 }
51010
51011 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
51012         LDKOnionPacket ret_var = OnionPacket_clone(arg);
51013         int64_t ret_ref = 0;
51014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51016         return ret_ref;
51017 }
51018 int64_t  CS_LDK_OnionPacket_clone_ptr(int64_t arg) {
51019         LDKOnionPacket arg_conv;
51020         arg_conv.inner = untag_ptr(arg);
51021         arg_conv.is_owned = ptr_is_owned(arg);
51022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51023         arg_conv.is_owned = false;
51024         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
51025         return ret_conv;
51026 }
51027
51028 int64_t  CS_LDK_OnionPacket_clone(int64_t orig) {
51029         LDKOnionPacket orig_conv;
51030         orig_conv.inner = untag_ptr(orig);
51031         orig_conv.is_owned = ptr_is_owned(orig);
51032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51033         orig_conv.is_owned = false;
51034         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
51035         int64_t ret_ref = 0;
51036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51038         return ret_ref;
51039 }
51040
51041 int64_t  CS_LDK_OnionPacket_hash(int64_t o) {
51042         LDKOnionPacket o_conv;
51043         o_conv.inner = untag_ptr(o);
51044         o_conv.is_owned = ptr_is_owned(o);
51045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51046         o_conv.is_owned = false;
51047         int64_t ret_conv = OnionPacket_hash(&o_conv);
51048         return ret_conv;
51049 }
51050
51051 jboolean  CS_LDK_OnionPacket_eq(int64_t a, int64_t b) {
51052         LDKOnionPacket a_conv;
51053         a_conv.inner = untag_ptr(a);
51054         a_conv.is_owned = ptr_is_owned(a);
51055         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51056         a_conv.is_owned = false;
51057         LDKOnionPacket b_conv;
51058         b_conv.inner = untag_ptr(b);
51059         b_conv.is_owned = ptr_is_owned(b);
51060         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51061         b_conv.is_owned = false;
51062         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
51063         return ret_conv;
51064 }
51065
51066 int8_tArray  CS_LDK_AcceptChannel_write(int64_t obj) {
51067         LDKAcceptChannel obj_conv;
51068         obj_conv.inner = untag_ptr(obj);
51069         obj_conv.is_owned = ptr_is_owned(obj);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51071         obj_conv.is_owned = false;
51072         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
51073         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51074         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51075         CVec_u8Z_free(ret_var);
51076         return ret_arr;
51077 }
51078
51079 int64_t  CS_LDK_AcceptChannel_read(int8_tArray ser) {
51080         LDKu8slice ser_ref;
51081         ser_ref.datalen = ser->arr_len;
51082         ser_ref.data = ser->elems;
51083         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
51084         *ret_conv = AcceptChannel_read(ser_ref);
51085         FREE(ser);
51086         return tag_ptr(ret_conv, true);
51087 }
51088
51089 int8_tArray  CS_LDK_AcceptChannelV2_write(int64_t obj) {
51090         LDKAcceptChannelV2 obj_conv;
51091         obj_conv.inner = untag_ptr(obj);
51092         obj_conv.is_owned = ptr_is_owned(obj);
51093         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51094         obj_conv.is_owned = false;
51095         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
51096         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51097         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51098         CVec_u8Z_free(ret_var);
51099         return ret_arr;
51100 }
51101
51102 int64_t  CS_LDK_AcceptChannelV2_read(int8_tArray ser) {
51103         LDKu8slice ser_ref;
51104         ser_ref.datalen = ser->arr_len;
51105         ser_ref.data = ser->elems;
51106         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
51107         *ret_conv = AcceptChannelV2_read(ser_ref);
51108         FREE(ser);
51109         return tag_ptr(ret_conv, true);
51110 }
51111
51112 int8_tArray  CS_LDK_Stfu_write(int64_t obj) {
51113         LDKStfu obj_conv;
51114         obj_conv.inner = untag_ptr(obj);
51115         obj_conv.is_owned = ptr_is_owned(obj);
51116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51117         obj_conv.is_owned = false;
51118         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
51119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51121         CVec_u8Z_free(ret_var);
51122         return ret_arr;
51123 }
51124
51125 int64_t  CS_LDK_Stfu_read(int8_tArray ser) {
51126         LDKu8slice ser_ref;
51127         ser_ref.datalen = ser->arr_len;
51128         ser_ref.data = ser->elems;
51129         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
51130         *ret_conv = Stfu_read(ser_ref);
51131         FREE(ser);
51132         return tag_ptr(ret_conv, true);
51133 }
51134
51135 int8_tArray  CS_LDK_Splice_write(int64_t obj) {
51136         LDKSplice obj_conv;
51137         obj_conv.inner = untag_ptr(obj);
51138         obj_conv.is_owned = ptr_is_owned(obj);
51139         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51140         obj_conv.is_owned = false;
51141         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
51142         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51143         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51144         CVec_u8Z_free(ret_var);
51145         return ret_arr;
51146 }
51147
51148 int64_t  CS_LDK_Splice_read(int8_tArray ser) {
51149         LDKu8slice ser_ref;
51150         ser_ref.datalen = ser->arr_len;
51151         ser_ref.data = ser->elems;
51152         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
51153         *ret_conv = Splice_read(ser_ref);
51154         FREE(ser);
51155         return tag_ptr(ret_conv, true);
51156 }
51157
51158 int8_tArray  CS_LDK_SpliceAck_write(int64_t obj) {
51159         LDKSpliceAck obj_conv;
51160         obj_conv.inner = untag_ptr(obj);
51161         obj_conv.is_owned = ptr_is_owned(obj);
51162         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51163         obj_conv.is_owned = false;
51164         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
51165         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51166         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51167         CVec_u8Z_free(ret_var);
51168         return ret_arr;
51169 }
51170
51171 int64_t  CS_LDK_SpliceAck_read(int8_tArray ser) {
51172         LDKu8slice ser_ref;
51173         ser_ref.datalen = ser->arr_len;
51174         ser_ref.data = ser->elems;
51175         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
51176         *ret_conv = SpliceAck_read(ser_ref);
51177         FREE(ser);
51178         return tag_ptr(ret_conv, true);
51179 }
51180
51181 int8_tArray  CS_LDK_SpliceLocked_write(int64_t obj) {
51182         LDKSpliceLocked obj_conv;
51183         obj_conv.inner = untag_ptr(obj);
51184         obj_conv.is_owned = ptr_is_owned(obj);
51185         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51186         obj_conv.is_owned = false;
51187         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
51188         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51189         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51190         CVec_u8Z_free(ret_var);
51191         return ret_arr;
51192 }
51193
51194 int64_t  CS_LDK_SpliceLocked_read(int8_tArray ser) {
51195         LDKu8slice ser_ref;
51196         ser_ref.datalen = ser->arr_len;
51197         ser_ref.data = ser->elems;
51198         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
51199         *ret_conv = SpliceLocked_read(ser_ref);
51200         FREE(ser);
51201         return tag_ptr(ret_conv, true);
51202 }
51203
51204 int8_tArray  CS_LDK_TxAddInput_write(int64_t obj) {
51205         LDKTxAddInput obj_conv;
51206         obj_conv.inner = untag_ptr(obj);
51207         obj_conv.is_owned = ptr_is_owned(obj);
51208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51209         obj_conv.is_owned = false;
51210         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
51211         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51212         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51213         CVec_u8Z_free(ret_var);
51214         return ret_arr;
51215 }
51216
51217 int64_t  CS_LDK_TxAddInput_read(int8_tArray ser) {
51218         LDKu8slice ser_ref;
51219         ser_ref.datalen = ser->arr_len;
51220         ser_ref.data = ser->elems;
51221         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
51222         *ret_conv = TxAddInput_read(ser_ref);
51223         FREE(ser);
51224         return tag_ptr(ret_conv, true);
51225 }
51226
51227 int8_tArray  CS_LDK_TxAddOutput_write(int64_t obj) {
51228         LDKTxAddOutput obj_conv;
51229         obj_conv.inner = untag_ptr(obj);
51230         obj_conv.is_owned = ptr_is_owned(obj);
51231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51232         obj_conv.is_owned = false;
51233         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
51234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51236         CVec_u8Z_free(ret_var);
51237         return ret_arr;
51238 }
51239
51240 int64_t  CS_LDK_TxAddOutput_read(int8_tArray ser) {
51241         LDKu8slice ser_ref;
51242         ser_ref.datalen = ser->arr_len;
51243         ser_ref.data = ser->elems;
51244         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
51245         *ret_conv = TxAddOutput_read(ser_ref);
51246         FREE(ser);
51247         return tag_ptr(ret_conv, true);
51248 }
51249
51250 int8_tArray  CS_LDK_TxRemoveInput_write(int64_t obj) {
51251         LDKTxRemoveInput obj_conv;
51252         obj_conv.inner = untag_ptr(obj);
51253         obj_conv.is_owned = ptr_is_owned(obj);
51254         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51255         obj_conv.is_owned = false;
51256         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
51257         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51258         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51259         CVec_u8Z_free(ret_var);
51260         return ret_arr;
51261 }
51262
51263 int64_t  CS_LDK_TxRemoveInput_read(int8_tArray ser) {
51264         LDKu8slice ser_ref;
51265         ser_ref.datalen = ser->arr_len;
51266         ser_ref.data = ser->elems;
51267         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
51268         *ret_conv = TxRemoveInput_read(ser_ref);
51269         FREE(ser);
51270         return tag_ptr(ret_conv, true);
51271 }
51272
51273 int8_tArray  CS_LDK_TxRemoveOutput_write(int64_t obj) {
51274         LDKTxRemoveOutput obj_conv;
51275         obj_conv.inner = untag_ptr(obj);
51276         obj_conv.is_owned = ptr_is_owned(obj);
51277         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51278         obj_conv.is_owned = false;
51279         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
51280         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51281         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51282         CVec_u8Z_free(ret_var);
51283         return ret_arr;
51284 }
51285
51286 int64_t  CS_LDK_TxRemoveOutput_read(int8_tArray ser) {
51287         LDKu8slice ser_ref;
51288         ser_ref.datalen = ser->arr_len;
51289         ser_ref.data = ser->elems;
51290         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
51291         *ret_conv = TxRemoveOutput_read(ser_ref);
51292         FREE(ser);
51293         return tag_ptr(ret_conv, true);
51294 }
51295
51296 int8_tArray  CS_LDK_TxComplete_write(int64_t obj) {
51297         LDKTxComplete obj_conv;
51298         obj_conv.inner = untag_ptr(obj);
51299         obj_conv.is_owned = ptr_is_owned(obj);
51300         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51301         obj_conv.is_owned = false;
51302         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
51303         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51304         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51305         CVec_u8Z_free(ret_var);
51306         return ret_arr;
51307 }
51308
51309 int64_t  CS_LDK_TxComplete_read(int8_tArray ser) {
51310         LDKu8slice ser_ref;
51311         ser_ref.datalen = ser->arr_len;
51312         ser_ref.data = ser->elems;
51313         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
51314         *ret_conv = TxComplete_read(ser_ref);
51315         FREE(ser);
51316         return tag_ptr(ret_conv, true);
51317 }
51318
51319 int8_tArray  CS_LDK_TxSignatures_write(int64_t obj) {
51320         LDKTxSignatures obj_conv;
51321         obj_conv.inner = untag_ptr(obj);
51322         obj_conv.is_owned = ptr_is_owned(obj);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51324         obj_conv.is_owned = false;
51325         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
51326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51328         CVec_u8Z_free(ret_var);
51329         return ret_arr;
51330 }
51331
51332 int64_t  CS_LDK_TxSignatures_read(int8_tArray ser) {
51333         LDKu8slice ser_ref;
51334         ser_ref.datalen = ser->arr_len;
51335         ser_ref.data = ser->elems;
51336         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
51337         *ret_conv = TxSignatures_read(ser_ref);
51338         FREE(ser);
51339         return tag_ptr(ret_conv, true);
51340 }
51341
51342 int8_tArray  CS_LDK_TxInitRbf_write(int64_t obj) {
51343         LDKTxInitRbf obj_conv;
51344         obj_conv.inner = untag_ptr(obj);
51345         obj_conv.is_owned = ptr_is_owned(obj);
51346         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51347         obj_conv.is_owned = false;
51348         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
51349         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51350         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51351         CVec_u8Z_free(ret_var);
51352         return ret_arr;
51353 }
51354
51355 int64_t  CS_LDK_TxInitRbf_read(int8_tArray ser) {
51356         LDKu8slice ser_ref;
51357         ser_ref.datalen = ser->arr_len;
51358         ser_ref.data = ser->elems;
51359         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
51360         *ret_conv = TxInitRbf_read(ser_ref);
51361         FREE(ser);
51362         return tag_ptr(ret_conv, true);
51363 }
51364
51365 int8_tArray  CS_LDK_TxAckRbf_write(int64_t obj) {
51366         LDKTxAckRbf obj_conv;
51367         obj_conv.inner = untag_ptr(obj);
51368         obj_conv.is_owned = ptr_is_owned(obj);
51369         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51370         obj_conv.is_owned = false;
51371         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
51372         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51373         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51374         CVec_u8Z_free(ret_var);
51375         return ret_arr;
51376 }
51377
51378 int64_t  CS_LDK_TxAckRbf_read(int8_tArray ser) {
51379         LDKu8slice ser_ref;
51380         ser_ref.datalen = ser->arr_len;
51381         ser_ref.data = ser->elems;
51382         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
51383         *ret_conv = TxAckRbf_read(ser_ref);
51384         FREE(ser);
51385         return tag_ptr(ret_conv, true);
51386 }
51387
51388 int8_tArray  CS_LDK_TxAbort_write(int64_t obj) {
51389         LDKTxAbort obj_conv;
51390         obj_conv.inner = untag_ptr(obj);
51391         obj_conv.is_owned = ptr_is_owned(obj);
51392         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51393         obj_conv.is_owned = false;
51394         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
51395         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51396         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51397         CVec_u8Z_free(ret_var);
51398         return ret_arr;
51399 }
51400
51401 int64_t  CS_LDK_TxAbort_read(int8_tArray ser) {
51402         LDKu8slice ser_ref;
51403         ser_ref.datalen = ser->arr_len;
51404         ser_ref.data = ser->elems;
51405         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
51406         *ret_conv = TxAbort_read(ser_ref);
51407         FREE(ser);
51408         return tag_ptr(ret_conv, true);
51409 }
51410
51411 int8_tArray  CS_LDK_AnnouncementSignatures_write(int64_t obj) {
51412         LDKAnnouncementSignatures obj_conv;
51413         obj_conv.inner = untag_ptr(obj);
51414         obj_conv.is_owned = ptr_is_owned(obj);
51415         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51416         obj_conv.is_owned = false;
51417         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
51418         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51419         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51420         CVec_u8Z_free(ret_var);
51421         return ret_arr;
51422 }
51423
51424 int64_t  CS_LDK_AnnouncementSignatures_read(int8_tArray ser) {
51425         LDKu8slice ser_ref;
51426         ser_ref.datalen = ser->arr_len;
51427         ser_ref.data = ser->elems;
51428         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
51429         *ret_conv = AnnouncementSignatures_read(ser_ref);
51430         FREE(ser);
51431         return tag_ptr(ret_conv, true);
51432 }
51433
51434 int8_tArray  CS_LDK_ChannelReestablish_write(int64_t obj) {
51435         LDKChannelReestablish obj_conv;
51436         obj_conv.inner = untag_ptr(obj);
51437         obj_conv.is_owned = ptr_is_owned(obj);
51438         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51439         obj_conv.is_owned = false;
51440         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
51441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51443         CVec_u8Z_free(ret_var);
51444         return ret_arr;
51445 }
51446
51447 int64_t  CS_LDK_ChannelReestablish_read(int8_tArray ser) {
51448         LDKu8slice ser_ref;
51449         ser_ref.datalen = ser->arr_len;
51450         ser_ref.data = ser->elems;
51451         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
51452         *ret_conv = ChannelReestablish_read(ser_ref);
51453         FREE(ser);
51454         return tag_ptr(ret_conv, true);
51455 }
51456
51457 int8_tArray  CS_LDK_ClosingSigned_write(int64_t obj) {
51458         LDKClosingSigned obj_conv;
51459         obj_conv.inner = untag_ptr(obj);
51460         obj_conv.is_owned = ptr_is_owned(obj);
51461         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51462         obj_conv.is_owned = false;
51463         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
51464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51466         CVec_u8Z_free(ret_var);
51467         return ret_arr;
51468 }
51469
51470 int64_t  CS_LDK_ClosingSigned_read(int8_tArray ser) {
51471         LDKu8slice ser_ref;
51472         ser_ref.datalen = ser->arr_len;
51473         ser_ref.data = ser->elems;
51474         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
51475         *ret_conv = ClosingSigned_read(ser_ref);
51476         FREE(ser);
51477         return tag_ptr(ret_conv, true);
51478 }
51479
51480 int8_tArray  CS_LDK_ClosingSignedFeeRange_write(int64_t obj) {
51481         LDKClosingSignedFeeRange obj_conv;
51482         obj_conv.inner = untag_ptr(obj);
51483         obj_conv.is_owned = ptr_is_owned(obj);
51484         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51485         obj_conv.is_owned = false;
51486         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
51487         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51488         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51489         CVec_u8Z_free(ret_var);
51490         return ret_arr;
51491 }
51492
51493 int64_t  CS_LDK_ClosingSignedFeeRange_read(int8_tArray ser) {
51494         LDKu8slice ser_ref;
51495         ser_ref.datalen = ser->arr_len;
51496         ser_ref.data = ser->elems;
51497         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
51498         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
51499         FREE(ser);
51500         return tag_ptr(ret_conv, true);
51501 }
51502
51503 int8_tArray  CS_LDK_CommitmentSigned_write(int64_t obj) {
51504         LDKCommitmentSigned obj_conv;
51505         obj_conv.inner = untag_ptr(obj);
51506         obj_conv.is_owned = ptr_is_owned(obj);
51507         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51508         obj_conv.is_owned = false;
51509         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
51510         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51511         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51512         CVec_u8Z_free(ret_var);
51513         return ret_arr;
51514 }
51515
51516 int64_t  CS_LDK_CommitmentSigned_read(int8_tArray ser) {
51517         LDKu8slice ser_ref;
51518         ser_ref.datalen = ser->arr_len;
51519         ser_ref.data = ser->elems;
51520         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
51521         *ret_conv = CommitmentSigned_read(ser_ref);
51522         FREE(ser);
51523         return tag_ptr(ret_conv, true);
51524 }
51525
51526 int8_tArray  CS_LDK_FundingCreated_write(int64_t obj) {
51527         LDKFundingCreated obj_conv;
51528         obj_conv.inner = untag_ptr(obj);
51529         obj_conv.is_owned = ptr_is_owned(obj);
51530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51531         obj_conv.is_owned = false;
51532         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
51533         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51534         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51535         CVec_u8Z_free(ret_var);
51536         return ret_arr;
51537 }
51538
51539 int64_t  CS_LDK_FundingCreated_read(int8_tArray ser) {
51540         LDKu8slice ser_ref;
51541         ser_ref.datalen = ser->arr_len;
51542         ser_ref.data = ser->elems;
51543         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
51544         *ret_conv = FundingCreated_read(ser_ref);
51545         FREE(ser);
51546         return tag_ptr(ret_conv, true);
51547 }
51548
51549 int8_tArray  CS_LDK_FundingSigned_write(int64_t obj) {
51550         LDKFundingSigned obj_conv;
51551         obj_conv.inner = untag_ptr(obj);
51552         obj_conv.is_owned = ptr_is_owned(obj);
51553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51554         obj_conv.is_owned = false;
51555         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
51556         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51557         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51558         CVec_u8Z_free(ret_var);
51559         return ret_arr;
51560 }
51561
51562 int64_t  CS_LDK_FundingSigned_read(int8_tArray ser) {
51563         LDKu8slice ser_ref;
51564         ser_ref.datalen = ser->arr_len;
51565         ser_ref.data = ser->elems;
51566         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
51567         *ret_conv = FundingSigned_read(ser_ref);
51568         FREE(ser);
51569         return tag_ptr(ret_conv, true);
51570 }
51571
51572 int8_tArray  CS_LDK_ChannelReady_write(int64_t obj) {
51573         LDKChannelReady obj_conv;
51574         obj_conv.inner = untag_ptr(obj);
51575         obj_conv.is_owned = ptr_is_owned(obj);
51576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51577         obj_conv.is_owned = false;
51578         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
51579         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51580         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51581         CVec_u8Z_free(ret_var);
51582         return ret_arr;
51583 }
51584
51585 int64_t  CS_LDK_ChannelReady_read(int8_tArray ser) {
51586         LDKu8slice ser_ref;
51587         ser_ref.datalen = ser->arr_len;
51588         ser_ref.data = ser->elems;
51589         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
51590         *ret_conv = ChannelReady_read(ser_ref);
51591         FREE(ser);
51592         return tag_ptr(ret_conv, true);
51593 }
51594
51595 int8_tArray  CS_LDK_Init_write(int64_t obj) {
51596         LDKInit obj_conv;
51597         obj_conv.inner = untag_ptr(obj);
51598         obj_conv.is_owned = ptr_is_owned(obj);
51599         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51600         obj_conv.is_owned = false;
51601         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
51602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51604         CVec_u8Z_free(ret_var);
51605         return ret_arr;
51606 }
51607
51608 int64_t  CS_LDK_Init_read(int8_tArray ser) {
51609         LDKu8slice ser_ref;
51610         ser_ref.datalen = ser->arr_len;
51611         ser_ref.data = ser->elems;
51612         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
51613         *ret_conv = Init_read(ser_ref);
51614         FREE(ser);
51615         return tag_ptr(ret_conv, true);
51616 }
51617
51618 int8_tArray  CS_LDK_OpenChannel_write(int64_t obj) {
51619         LDKOpenChannel obj_conv;
51620         obj_conv.inner = untag_ptr(obj);
51621         obj_conv.is_owned = ptr_is_owned(obj);
51622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51623         obj_conv.is_owned = false;
51624         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
51625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51627         CVec_u8Z_free(ret_var);
51628         return ret_arr;
51629 }
51630
51631 int64_t  CS_LDK_OpenChannel_read(int8_tArray ser) {
51632         LDKu8slice ser_ref;
51633         ser_ref.datalen = ser->arr_len;
51634         ser_ref.data = ser->elems;
51635         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
51636         *ret_conv = OpenChannel_read(ser_ref);
51637         FREE(ser);
51638         return tag_ptr(ret_conv, true);
51639 }
51640
51641 int8_tArray  CS_LDK_OpenChannelV2_write(int64_t obj) {
51642         LDKOpenChannelV2 obj_conv;
51643         obj_conv.inner = untag_ptr(obj);
51644         obj_conv.is_owned = ptr_is_owned(obj);
51645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51646         obj_conv.is_owned = false;
51647         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
51648         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51649         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51650         CVec_u8Z_free(ret_var);
51651         return ret_arr;
51652 }
51653
51654 int64_t  CS_LDK_OpenChannelV2_read(int8_tArray ser) {
51655         LDKu8slice ser_ref;
51656         ser_ref.datalen = ser->arr_len;
51657         ser_ref.data = ser->elems;
51658         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
51659         *ret_conv = OpenChannelV2_read(ser_ref);
51660         FREE(ser);
51661         return tag_ptr(ret_conv, true);
51662 }
51663
51664 int8_tArray  CS_LDK_RevokeAndACK_write(int64_t obj) {
51665         LDKRevokeAndACK obj_conv;
51666         obj_conv.inner = untag_ptr(obj);
51667         obj_conv.is_owned = ptr_is_owned(obj);
51668         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51669         obj_conv.is_owned = false;
51670         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
51671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51673         CVec_u8Z_free(ret_var);
51674         return ret_arr;
51675 }
51676
51677 int64_t  CS_LDK_RevokeAndACK_read(int8_tArray ser) {
51678         LDKu8slice ser_ref;
51679         ser_ref.datalen = ser->arr_len;
51680         ser_ref.data = ser->elems;
51681         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
51682         *ret_conv = RevokeAndACK_read(ser_ref);
51683         FREE(ser);
51684         return tag_ptr(ret_conv, true);
51685 }
51686
51687 int8_tArray  CS_LDK_Shutdown_write(int64_t obj) {
51688         LDKShutdown obj_conv;
51689         obj_conv.inner = untag_ptr(obj);
51690         obj_conv.is_owned = ptr_is_owned(obj);
51691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51692         obj_conv.is_owned = false;
51693         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
51694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51696         CVec_u8Z_free(ret_var);
51697         return ret_arr;
51698 }
51699
51700 int64_t  CS_LDK_Shutdown_read(int8_tArray ser) {
51701         LDKu8slice ser_ref;
51702         ser_ref.datalen = ser->arr_len;
51703         ser_ref.data = ser->elems;
51704         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
51705         *ret_conv = Shutdown_read(ser_ref);
51706         FREE(ser);
51707         return tag_ptr(ret_conv, true);
51708 }
51709
51710 int8_tArray  CS_LDK_UpdateFailHTLC_write(int64_t obj) {
51711         LDKUpdateFailHTLC obj_conv;
51712         obj_conv.inner = untag_ptr(obj);
51713         obj_conv.is_owned = ptr_is_owned(obj);
51714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51715         obj_conv.is_owned = false;
51716         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
51717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51719         CVec_u8Z_free(ret_var);
51720         return ret_arr;
51721 }
51722
51723 int64_t  CS_LDK_UpdateFailHTLC_read(int8_tArray ser) {
51724         LDKu8slice ser_ref;
51725         ser_ref.datalen = ser->arr_len;
51726         ser_ref.data = ser->elems;
51727         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
51728         *ret_conv = UpdateFailHTLC_read(ser_ref);
51729         FREE(ser);
51730         return tag_ptr(ret_conv, true);
51731 }
51732
51733 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_write(int64_t obj) {
51734         LDKUpdateFailMalformedHTLC obj_conv;
51735         obj_conv.inner = untag_ptr(obj);
51736         obj_conv.is_owned = ptr_is_owned(obj);
51737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51738         obj_conv.is_owned = false;
51739         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
51740         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51741         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51742         CVec_u8Z_free(ret_var);
51743         return ret_arr;
51744 }
51745
51746 int64_t  CS_LDK_UpdateFailMalformedHTLC_read(int8_tArray ser) {
51747         LDKu8slice ser_ref;
51748         ser_ref.datalen = ser->arr_len;
51749         ser_ref.data = ser->elems;
51750         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
51751         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
51752         FREE(ser);
51753         return tag_ptr(ret_conv, true);
51754 }
51755
51756 int8_tArray  CS_LDK_UpdateFee_write(int64_t obj) {
51757         LDKUpdateFee obj_conv;
51758         obj_conv.inner = untag_ptr(obj);
51759         obj_conv.is_owned = ptr_is_owned(obj);
51760         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51761         obj_conv.is_owned = false;
51762         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
51763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51765         CVec_u8Z_free(ret_var);
51766         return ret_arr;
51767 }
51768
51769 int64_t  CS_LDK_UpdateFee_read(int8_tArray ser) {
51770         LDKu8slice ser_ref;
51771         ser_ref.datalen = ser->arr_len;
51772         ser_ref.data = ser->elems;
51773         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
51774         *ret_conv = UpdateFee_read(ser_ref);
51775         FREE(ser);
51776         return tag_ptr(ret_conv, true);
51777 }
51778
51779 int8_tArray  CS_LDK_UpdateFulfillHTLC_write(int64_t obj) {
51780         LDKUpdateFulfillHTLC obj_conv;
51781         obj_conv.inner = untag_ptr(obj);
51782         obj_conv.is_owned = ptr_is_owned(obj);
51783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51784         obj_conv.is_owned = false;
51785         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
51786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51788         CVec_u8Z_free(ret_var);
51789         return ret_arr;
51790 }
51791
51792 int64_t  CS_LDK_UpdateFulfillHTLC_read(int8_tArray ser) {
51793         LDKu8slice ser_ref;
51794         ser_ref.datalen = ser->arr_len;
51795         ser_ref.data = ser->elems;
51796         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
51797         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
51798         FREE(ser);
51799         return tag_ptr(ret_conv, true);
51800 }
51801
51802 int8_tArray  CS_LDK_OnionPacket_write(int64_t obj) {
51803         LDKOnionPacket obj_conv;
51804         obj_conv.inner = untag_ptr(obj);
51805         obj_conv.is_owned = ptr_is_owned(obj);
51806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51807         obj_conv.is_owned = false;
51808         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
51809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51811         CVec_u8Z_free(ret_var);
51812         return ret_arr;
51813 }
51814
51815 int64_t  CS_LDK_OnionPacket_read(int8_tArray ser) {
51816         LDKu8slice ser_ref;
51817         ser_ref.datalen = ser->arr_len;
51818         ser_ref.data = ser->elems;
51819         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
51820         *ret_conv = OnionPacket_read(ser_ref);
51821         FREE(ser);
51822         return tag_ptr(ret_conv, true);
51823 }
51824
51825 int8_tArray  CS_LDK_UpdateAddHTLC_write(int64_t obj) {
51826         LDKUpdateAddHTLC obj_conv;
51827         obj_conv.inner = untag_ptr(obj);
51828         obj_conv.is_owned = ptr_is_owned(obj);
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51830         obj_conv.is_owned = false;
51831         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
51832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51834         CVec_u8Z_free(ret_var);
51835         return ret_arr;
51836 }
51837
51838 int64_t  CS_LDK_UpdateAddHTLC_read(int8_tArray ser) {
51839         LDKu8slice ser_ref;
51840         ser_ref.datalen = ser->arr_len;
51841         ser_ref.data = ser->elems;
51842         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
51843         *ret_conv = UpdateAddHTLC_read(ser_ref);
51844         FREE(ser);
51845         return tag_ptr(ret_conv, true);
51846 }
51847
51848 int64_t  CS_LDK_OnionMessage_read(int8_tArray ser) {
51849         LDKu8slice ser_ref;
51850         ser_ref.datalen = ser->arr_len;
51851         ser_ref.data = ser->elems;
51852         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
51853         *ret_conv = OnionMessage_read(ser_ref);
51854         FREE(ser);
51855         return tag_ptr(ret_conv, true);
51856 }
51857
51858 int8_tArray  CS_LDK_OnionMessage_write(int64_t obj) {
51859         LDKOnionMessage obj_conv;
51860         obj_conv.inner = untag_ptr(obj);
51861         obj_conv.is_owned = ptr_is_owned(obj);
51862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51863         obj_conv.is_owned = false;
51864         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
51865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51867         CVec_u8Z_free(ret_var);
51868         return ret_arr;
51869 }
51870
51871 int8_tArray  CS_LDK_FinalOnionHopData_write(int64_t obj) {
51872         LDKFinalOnionHopData obj_conv;
51873         obj_conv.inner = untag_ptr(obj);
51874         obj_conv.is_owned = ptr_is_owned(obj);
51875         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51876         obj_conv.is_owned = false;
51877         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
51878         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51879         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51880         CVec_u8Z_free(ret_var);
51881         return ret_arr;
51882 }
51883
51884 int64_t  CS_LDK_FinalOnionHopData_read(int8_tArray ser) {
51885         LDKu8slice ser_ref;
51886         ser_ref.datalen = ser->arr_len;
51887         ser_ref.data = ser->elems;
51888         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
51889         *ret_conv = FinalOnionHopData_read(ser_ref);
51890         FREE(ser);
51891         return tag_ptr(ret_conv, true);
51892 }
51893
51894 int8_tArray  CS_LDK_Ping_write(int64_t obj) {
51895         LDKPing obj_conv;
51896         obj_conv.inner = untag_ptr(obj);
51897         obj_conv.is_owned = ptr_is_owned(obj);
51898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51899         obj_conv.is_owned = false;
51900         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
51901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51903         CVec_u8Z_free(ret_var);
51904         return ret_arr;
51905 }
51906
51907 int64_t  CS_LDK_Ping_read(int8_tArray ser) {
51908         LDKu8slice ser_ref;
51909         ser_ref.datalen = ser->arr_len;
51910         ser_ref.data = ser->elems;
51911         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
51912         *ret_conv = Ping_read(ser_ref);
51913         FREE(ser);
51914         return tag_ptr(ret_conv, true);
51915 }
51916
51917 int8_tArray  CS_LDK_Pong_write(int64_t obj) {
51918         LDKPong obj_conv;
51919         obj_conv.inner = untag_ptr(obj);
51920         obj_conv.is_owned = ptr_is_owned(obj);
51921         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51922         obj_conv.is_owned = false;
51923         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
51924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51926         CVec_u8Z_free(ret_var);
51927         return ret_arr;
51928 }
51929
51930 int64_t  CS_LDK_Pong_read(int8_tArray ser) {
51931         LDKu8slice ser_ref;
51932         ser_ref.datalen = ser->arr_len;
51933         ser_ref.data = ser->elems;
51934         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
51935         *ret_conv = Pong_read(ser_ref);
51936         FREE(ser);
51937         return tag_ptr(ret_conv, true);
51938 }
51939
51940 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_write(int64_t obj) {
51941         LDKUnsignedChannelAnnouncement obj_conv;
51942         obj_conv.inner = untag_ptr(obj);
51943         obj_conv.is_owned = ptr_is_owned(obj);
51944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51945         obj_conv.is_owned = false;
51946         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
51947         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51948         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51949         CVec_u8Z_free(ret_var);
51950         return ret_arr;
51951 }
51952
51953 int64_t  CS_LDK_UnsignedChannelAnnouncement_read(int8_tArray ser) {
51954         LDKu8slice ser_ref;
51955         ser_ref.datalen = ser->arr_len;
51956         ser_ref.data = ser->elems;
51957         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
51958         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
51959         FREE(ser);
51960         return tag_ptr(ret_conv, true);
51961 }
51962
51963 int8_tArray  CS_LDK_ChannelAnnouncement_write(int64_t obj) {
51964         LDKChannelAnnouncement obj_conv;
51965         obj_conv.inner = untag_ptr(obj);
51966         obj_conv.is_owned = ptr_is_owned(obj);
51967         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51968         obj_conv.is_owned = false;
51969         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
51970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51972         CVec_u8Z_free(ret_var);
51973         return ret_arr;
51974 }
51975
51976 int64_t  CS_LDK_ChannelAnnouncement_read(int8_tArray ser) {
51977         LDKu8slice ser_ref;
51978         ser_ref.datalen = ser->arr_len;
51979         ser_ref.data = ser->elems;
51980         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
51981         *ret_conv = ChannelAnnouncement_read(ser_ref);
51982         FREE(ser);
51983         return tag_ptr(ret_conv, true);
51984 }
51985
51986 int8_tArray  CS_LDK_UnsignedChannelUpdate_write(int64_t obj) {
51987         LDKUnsignedChannelUpdate obj_conv;
51988         obj_conv.inner = untag_ptr(obj);
51989         obj_conv.is_owned = ptr_is_owned(obj);
51990         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51991         obj_conv.is_owned = false;
51992         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
51993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51995         CVec_u8Z_free(ret_var);
51996         return ret_arr;
51997 }
51998
51999 int64_t  CS_LDK_UnsignedChannelUpdate_read(int8_tArray ser) {
52000         LDKu8slice ser_ref;
52001         ser_ref.datalen = ser->arr_len;
52002         ser_ref.data = ser->elems;
52003         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
52004         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
52005         FREE(ser);
52006         return tag_ptr(ret_conv, true);
52007 }
52008
52009 int8_tArray  CS_LDK_ChannelUpdate_write(int64_t obj) {
52010         LDKChannelUpdate obj_conv;
52011         obj_conv.inner = untag_ptr(obj);
52012         obj_conv.is_owned = ptr_is_owned(obj);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52014         obj_conv.is_owned = false;
52015         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
52016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52018         CVec_u8Z_free(ret_var);
52019         return ret_arr;
52020 }
52021
52022 int64_t  CS_LDK_ChannelUpdate_read(int8_tArray ser) {
52023         LDKu8slice ser_ref;
52024         ser_ref.datalen = ser->arr_len;
52025         ser_ref.data = ser->elems;
52026         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
52027         *ret_conv = ChannelUpdate_read(ser_ref);
52028         FREE(ser);
52029         return tag_ptr(ret_conv, true);
52030 }
52031
52032 int8_tArray  CS_LDK_ErrorMessage_write(int64_t obj) {
52033         LDKErrorMessage obj_conv;
52034         obj_conv.inner = untag_ptr(obj);
52035         obj_conv.is_owned = ptr_is_owned(obj);
52036         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52037         obj_conv.is_owned = false;
52038         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
52039         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52040         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52041         CVec_u8Z_free(ret_var);
52042         return ret_arr;
52043 }
52044
52045 int64_t  CS_LDK_ErrorMessage_read(int8_tArray ser) {
52046         LDKu8slice ser_ref;
52047         ser_ref.datalen = ser->arr_len;
52048         ser_ref.data = ser->elems;
52049         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
52050         *ret_conv = ErrorMessage_read(ser_ref);
52051         FREE(ser);
52052         return tag_ptr(ret_conv, true);
52053 }
52054
52055 int8_tArray  CS_LDK_WarningMessage_write(int64_t obj) {
52056         LDKWarningMessage obj_conv;
52057         obj_conv.inner = untag_ptr(obj);
52058         obj_conv.is_owned = ptr_is_owned(obj);
52059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52060         obj_conv.is_owned = false;
52061         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
52062         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52063         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52064         CVec_u8Z_free(ret_var);
52065         return ret_arr;
52066 }
52067
52068 int64_t  CS_LDK_WarningMessage_read(int8_tArray ser) {
52069         LDKu8slice ser_ref;
52070         ser_ref.datalen = ser->arr_len;
52071         ser_ref.data = ser->elems;
52072         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
52073         *ret_conv = WarningMessage_read(ser_ref);
52074         FREE(ser);
52075         return tag_ptr(ret_conv, true);
52076 }
52077
52078 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_write(int64_t obj) {
52079         LDKUnsignedNodeAnnouncement obj_conv;
52080         obj_conv.inner = untag_ptr(obj);
52081         obj_conv.is_owned = ptr_is_owned(obj);
52082         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52083         obj_conv.is_owned = false;
52084         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
52085         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52086         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52087         CVec_u8Z_free(ret_var);
52088         return ret_arr;
52089 }
52090
52091 int64_t  CS_LDK_UnsignedNodeAnnouncement_read(int8_tArray ser) {
52092         LDKu8slice ser_ref;
52093         ser_ref.datalen = ser->arr_len;
52094         ser_ref.data = ser->elems;
52095         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
52096         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
52097         FREE(ser);
52098         return tag_ptr(ret_conv, true);
52099 }
52100
52101 int8_tArray  CS_LDK_NodeAnnouncement_write(int64_t obj) {
52102         LDKNodeAnnouncement obj_conv;
52103         obj_conv.inner = untag_ptr(obj);
52104         obj_conv.is_owned = ptr_is_owned(obj);
52105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52106         obj_conv.is_owned = false;
52107         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
52108         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52109         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52110         CVec_u8Z_free(ret_var);
52111         return ret_arr;
52112 }
52113
52114 int64_t  CS_LDK_NodeAnnouncement_read(int8_tArray ser) {
52115         LDKu8slice ser_ref;
52116         ser_ref.datalen = ser->arr_len;
52117         ser_ref.data = ser->elems;
52118         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
52119         *ret_conv = NodeAnnouncement_read(ser_ref);
52120         FREE(ser);
52121         return tag_ptr(ret_conv, true);
52122 }
52123
52124 int64_t  CS_LDK_QueryShortChannelIds_read(int8_tArray ser) {
52125         LDKu8slice ser_ref;
52126         ser_ref.datalen = ser->arr_len;
52127         ser_ref.data = ser->elems;
52128         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
52129         *ret_conv = QueryShortChannelIds_read(ser_ref);
52130         FREE(ser);
52131         return tag_ptr(ret_conv, true);
52132 }
52133
52134 int8_tArray  CS_LDK_QueryShortChannelIds_write(int64_t obj) {
52135         LDKQueryShortChannelIds obj_conv;
52136         obj_conv.inner = untag_ptr(obj);
52137         obj_conv.is_owned = ptr_is_owned(obj);
52138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52139         obj_conv.is_owned = false;
52140         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
52141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52143         CVec_u8Z_free(ret_var);
52144         return ret_arr;
52145 }
52146
52147 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_write(int64_t obj) {
52148         LDKReplyShortChannelIdsEnd obj_conv;
52149         obj_conv.inner = untag_ptr(obj);
52150         obj_conv.is_owned = ptr_is_owned(obj);
52151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52152         obj_conv.is_owned = false;
52153         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
52154         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52155         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52156         CVec_u8Z_free(ret_var);
52157         return ret_arr;
52158 }
52159
52160 int64_t  CS_LDK_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
52161         LDKu8slice ser_ref;
52162         ser_ref.datalen = ser->arr_len;
52163         ser_ref.data = ser->elems;
52164         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
52165         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
52166         FREE(ser);
52167         return tag_ptr(ret_conv, true);
52168 }
52169
52170 int32_t  CS_LDK_QueryChannelRange_end_blocknum(int64_t this_arg) {
52171         LDKQueryChannelRange this_arg_conv;
52172         this_arg_conv.inner = untag_ptr(this_arg);
52173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52175         this_arg_conv.is_owned = false;
52176         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
52177         return ret_conv;
52178 }
52179
52180 int8_tArray  CS_LDK_QueryChannelRange_write(int64_t obj) {
52181         LDKQueryChannelRange obj_conv;
52182         obj_conv.inner = untag_ptr(obj);
52183         obj_conv.is_owned = ptr_is_owned(obj);
52184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52185         obj_conv.is_owned = false;
52186         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
52187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52189         CVec_u8Z_free(ret_var);
52190         return ret_arr;
52191 }
52192
52193 int64_t  CS_LDK_QueryChannelRange_read(int8_tArray ser) {
52194         LDKu8slice ser_ref;
52195         ser_ref.datalen = ser->arr_len;
52196         ser_ref.data = ser->elems;
52197         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
52198         *ret_conv = QueryChannelRange_read(ser_ref);
52199         FREE(ser);
52200         return tag_ptr(ret_conv, true);
52201 }
52202
52203 int64_t  CS_LDK_ReplyChannelRange_read(int8_tArray ser) {
52204         LDKu8slice ser_ref;
52205         ser_ref.datalen = ser->arr_len;
52206         ser_ref.data = ser->elems;
52207         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
52208         *ret_conv = ReplyChannelRange_read(ser_ref);
52209         FREE(ser);
52210         return tag_ptr(ret_conv, true);
52211 }
52212
52213 int8_tArray  CS_LDK_ReplyChannelRange_write(int64_t obj) {
52214         LDKReplyChannelRange obj_conv;
52215         obj_conv.inner = untag_ptr(obj);
52216         obj_conv.is_owned = ptr_is_owned(obj);
52217         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52218         obj_conv.is_owned = false;
52219         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
52220         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52221         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52222         CVec_u8Z_free(ret_var);
52223         return ret_arr;
52224 }
52225
52226 int8_tArray  CS_LDK_GossipTimestampFilter_write(int64_t obj) {
52227         LDKGossipTimestampFilter obj_conv;
52228         obj_conv.inner = untag_ptr(obj);
52229         obj_conv.is_owned = ptr_is_owned(obj);
52230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52231         obj_conv.is_owned = false;
52232         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
52233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52235         CVec_u8Z_free(ret_var);
52236         return ret_arr;
52237 }
52238
52239 int64_t  CS_LDK_GossipTimestampFilter_read(int8_tArray ser) {
52240         LDKu8slice ser_ref;
52241         ser_ref.datalen = ser->arr_len;
52242         ser_ref.data = ser->elems;
52243         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
52244         *ret_conv = GossipTimestampFilter_read(ser_ref);
52245         FREE(ser);
52246         return tag_ptr(ret_conv, true);
52247 }
52248
52249 void  CS_LDK_CustomMessageHandler_free(int64_t this_ptr) {
52250         if (!ptr_is_owned(this_ptr)) return;
52251         void* this_ptr_ptr = untag_ptr(this_ptr);
52252         CHECK_ACCESS(this_ptr_ptr);
52253         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
52254         FREE(untag_ptr(this_ptr));
52255         CustomMessageHandler_free(this_ptr_conv);
52256 }
52257
52258 void  CS_LDK_IgnoringMessageHandler_free(int64_t this_obj) {
52259         LDKIgnoringMessageHandler this_obj_conv;
52260         this_obj_conv.inner = untag_ptr(this_obj);
52261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52263         IgnoringMessageHandler_free(this_obj_conv);
52264 }
52265
52266 int64_t  CS_LDK_IgnoringMessageHandler_new() {
52267         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
52268         int64_t ret_ref = 0;
52269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52271         return ret_ref;
52272 }
52273
52274 int64_t  CS_LDK_IgnoringMessageHandler_as_EventsProvider(int64_t this_arg) {
52275         LDKIgnoringMessageHandler this_arg_conv;
52276         this_arg_conv.inner = untag_ptr(this_arg);
52277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52279         this_arg_conv.is_owned = false;
52280         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
52281         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
52282         return tag_ptr(ret_ret, true);
52283 }
52284
52285 int64_t  CS_LDK_IgnoringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
52286         LDKIgnoringMessageHandler this_arg_conv;
52287         this_arg_conv.inner = untag_ptr(this_arg);
52288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52290         this_arg_conv.is_owned = false;
52291         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52292         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52293         return tag_ptr(ret_ret, true);
52294 }
52295
52296 int64_t  CS_LDK_IgnoringMessageHandler_as_RoutingMessageHandler(int64_t this_arg) {
52297         LDKIgnoringMessageHandler this_arg_conv;
52298         this_arg_conv.inner = untag_ptr(this_arg);
52299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52301         this_arg_conv.is_owned = false;
52302         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52303         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
52304         return tag_ptr(ret_ret, true);
52305 }
52306
52307 int64_t  CS_LDK_IgnoringMessageHandler_as_OnionMessageHandler(int64_t this_arg) {
52308         LDKIgnoringMessageHandler this_arg_conv;
52309         this_arg_conv.inner = untag_ptr(this_arg);
52310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52312         this_arg_conv.is_owned = false;
52313         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
52314         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
52315         return tag_ptr(ret_ret, true);
52316 }
52317
52318 int64_t  CS_LDK_IgnoringMessageHandler_as_OffersMessageHandler(int64_t this_arg) {
52319         LDKIgnoringMessageHandler this_arg_conv;
52320         this_arg_conv.inner = untag_ptr(this_arg);
52321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52323         this_arg_conv.is_owned = false;
52324         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
52325         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
52326         return tag_ptr(ret_ret, true);
52327 }
52328
52329 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomOnionMessageHandler(int64_t this_arg) {
52330         LDKIgnoringMessageHandler this_arg_conv;
52331         this_arg_conv.inner = untag_ptr(this_arg);
52332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52334         this_arg_conv.is_owned = false;
52335         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
52336         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
52337         return tag_ptr(ret_ret, true);
52338 }
52339
52340 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageReader(int64_t this_arg) {
52341         LDKIgnoringMessageHandler this_arg_conv;
52342         this_arg_conv.inner = untag_ptr(this_arg);
52343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52345         this_arg_conv.is_owned = false;
52346         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
52347         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
52348         return tag_ptr(ret_ret, true);
52349 }
52350
52351 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageHandler(int64_t this_arg) {
52352         LDKIgnoringMessageHandler this_arg_conv;
52353         this_arg_conv.inner = untag_ptr(this_arg);
52354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52356         this_arg_conv.is_owned = false;
52357         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
52358         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
52359         return tag_ptr(ret_ret, true);
52360 }
52361
52362 void  CS_LDK_ErroringMessageHandler_free(int64_t this_obj) {
52363         LDKErroringMessageHandler this_obj_conv;
52364         this_obj_conv.inner = untag_ptr(this_obj);
52365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52367         ErroringMessageHandler_free(this_obj_conv);
52368 }
52369
52370 int64_t  CS_LDK_ErroringMessageHandler_new() {
52371         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
52372         int64_t ret_ref = 0;
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52375         return ret_ref;
52376 }
52377
52378 int64_t  CS_LDK_ErroringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
52379         LDKErroringMessageHandler this_arg_conv;
52380         this_arg_conv.inner = untag_ptr(this_arg);
52381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52383         this_arg_conv.is_owned = false;
52384         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52385         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
52386         return tag_ptr(ret_ret, true);
52387 }
52388
52389 int64_t  CS_LDK_ErroringMessageHandler_as_ChannelMessageHandler(int64_t this_arg) {
52390         LDKErroringMessageHandler this_arg_conv;
52391         this_arg_conv.inner = untag_ptr(this_arg);
52392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52394         this_arg_conv.is_owned = false;
52395         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
52396         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
52397         return tag_ptr(ret_ret, true);
52398 }
52399
52400 void  CS_LDK_MessageHandler_free(int64_t this_obj) {
52401         LDKMessageHandler this_obj_conv;
52402         this_obj_conv.inner = untag_ptr(this_obj);
52403         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52405         MessageHandler_free(this_obj_conv);
52406 }
52407
52408 int64_t  CS_LDK_MessageHandler_get_chan_handler(int64_t this_ptr) {
52409         LDKMessageHandler this_ptr_conv;
52410         this_ptr_conv.inner = untag_ptr(this_ptr);
52411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52413         this_ptr_conv.is_owned = false;
52414         // WARNING: This object doesn't live past this scope, needs clone!
52415         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
52416         return ret_ret;
52417 }
52418
52419 void  CS_LDK_MessageHandler_set_chan_handler(int64_t this_ptr, int64_t val) {
52420         LDKMessageHandler this_ptr_conv;
52421         this_ptr_conv.inner = untag_ptr(this_ptr);
52422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52424         this_ptr_conv.is_owned = false;
52425         void* val_ptr = untag_ptr(val);
52426         CHECK_ACCESS(val_ptr);
52427         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
52428         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
52429                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52430                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
52431         }
52432         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
52433 }
52434
52435 int64_t  CS_LDK_MessageHandler_get_route_handler(int64_t this_ptr) {
52436         LDKMessageHandler this_ptr_conv;
52437         this_ptr_conv.inner = untag_ptr(this_ptr);
52438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52440         this_ptr_conv.is_owned = false;
52441         // WARNING: This object doesn't live past this scope, needs clone!
52442         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
52443         return ret_ret;
52444 }
52445
52446 void  CS_LDK_MessageHandler_set_route_handler(int64_t this_ptr, int64_t val) {
52447         LDKMessageHandler this_ptr_conv;
52448         this_ptr_conv.inner = untag_ptr(this_ptr);
52449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52451         this_ptr_conv.is_owned = false;
52452         void* val_ptr = untag_ptr(val);
52453         CHECK_ACCESS(val_ptr);
52454         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
52455         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52456                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52457                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
52458         }
52459         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
52460 }
52461
52462 int64_t  CS_LDK_MessageHandler_get_onion_message_handler(int64_t this_ptr) {
52463         LDKMessageHandler this_ptr_conv;
52464         this_ptr_conv.inner = untag_ptr(this_ptr);
52465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52467         this_ptr_conv.is_owned = false;
52468         // WARNING: This object doesn't live past this scope, needs clone!
52469         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
52470         return ret_ret;
52471 }
52472
52473 void  CS_LDK_MessageHandler_set_onion_message_handler(int64_t this_ptr, int64_t val) {
52474         LDKMessageHandler this_ptr_conv;
52475         this_ptr_conv.inner = untag_ptr(this_ptr);
52476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52478         this_ptr_conv.is_owned = false;
52479         void* val_ptr = untag_ptr(val);
52480         CHECK_ACCESS(val_ptr);
52481         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
52482         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
52483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52484                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
52485         }
52486         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
52487 }
52488
52489 int64_t  CS_LDK_MessageHandler_get_custom_message_handler(int64_t this_ptr) {
52490         LDKMessageHandler this_ptr_conv;
52491         this_ptr_conv.inner = untag_ptr(this_ptr);
52492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52494         this_ptr_conv.is_owned = false;
52495         // WARNING: This object doesn't live past this scope, needs clone!
52496         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
52497         return ret_ret;
52498 }
52499
52500 void  CS_LDK_MessageHandler_set_custom_message_handler(int64_t this_ptr, int64_t val) {
52501         LDKMessageHandler this_ptr_conv;
52502         this_ptr_conv.inner = untag_ptr(this_ptr);
52503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52505         this_ptr_conv.is_owned = false;
52506         void* val_ptr = untag_ptr(val);
52507         CHECK_ACCESS(val_ptr);
52508         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
52509         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
52510                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52511                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
52512         }
52513         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
52514 }
52515
52516 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) {
52517         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
52518         CHECK_ACCESS(chan_handler_arg_ptr);
52519         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
52520         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
52521                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52522                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
52523         }
52524         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
52525         CHECK_ACCESS(route_handler_arg_ptr);
52526         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
52527         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
52528                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52529                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
52530         }
52531         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
52532         CHECK_ACCESS(onion_message_handler_arg_ptr);
52533         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
52534         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
52535                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52536                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
52537         }
52538         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
52539         CHECK_ACCESS(custom_message_handler_arg_ptr);
52540         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
52541         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
52542                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52543                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
52544         }
52545         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
52546         int64_t ret_ref = 0;
52547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52549         return ret_ref;
52550 }
52551
52552 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
52553         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52554         *ret_ret = SocketDescriptor_clone(arg);
52555         return tag_ptr(ret_ret, true);
52556 }
52557 int64_t  CS_LDK_SocketDescriptor_clone_ptr(int64_t arg) {
52558         void* arg_ptr = untag_ptr(arg);
52559         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
52560         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
52561         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
52562         return ret_conv;
52563 }
52564
52565 int64_t  CS_LDK_SocketDescriptor_clone(int64_t orig) {
52566         void* orig_ptr = untag_ptr(orig);
52567         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
52568         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
52569         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
52570         *ret_ret = SocketDescriptor_clone(orig_conv);
52571         return tag_ptr(ret_ret, true);
52572 }
52573
52574 void  CS_LDK_SocketDescriptor_free(int64_t this_ptr) {
52575         if (!ptr_is_owned(this_ptr)) return;
52576         void* this_ptr_ptr = untag_ptr(this_ptr);
52577         CHECK_ACCESS(this_ptr_ptr);
52578         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
52579         FREE(untag_ptr(this_ptr));
52580         SocketDescriptor_free(this_ptr_conv);
52581 }
52582
52583 void  CS_LDK_PeerHandleError_free(int64_t this_obj) {
52584         LDKPeerHandleError this_obj_conv;
52585         this_obj_conv.inner = untag_ptr(this_obj);
52586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52588         PeerHandleError_free(this_obj_conv);
52589 }
52590
52591 int64_t  CS_LDK_PeerHandleError_new() {
52592         LDKPeerHandleError ret_var = PeerHandleError_new();
52593         int64_t ret_ref = 0;
52594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52596         return ret_ref;
52597 }
52598
52599 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
52600         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
52601         int64_t ret_ref = 0;
52602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52604         return ret_ref;
52605 }
52606 int64_t  CS_LDK_PeerHandleError_clone_ptr(int64_t arg) {
52607         LDKPeerHandleError arg_conv;
52608         arg_conv.inner = untag_ptr(arg);
52609         arg_conv.is_owned = ptr_is_owned(arg);
52610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52611         arg_conv.is_owned = false;
52612         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
52613         return ret_conv;
52614 }
52615
52616 int64_t  CS_LDK_PeerHandleError_clone(int64_t orig) {
52617         LDKPeerHandleError orig_conv;
52618         orig_conv.inner = untag_ptr(orig);
52619         orig_conv.is_owned = ptr_is_owned(orig);
52620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52621         orig_conv.is_owned = false;
52622         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
52623         int64_t ret_ref = 0;
52624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52626         return ret_ref;
52627 }
52628
52629 void  CS_LDK_PeerManager_free(int64_t this_obj) {
52630         LDKPeerManager this_obj_conv;
52631         this_obj_conv.inner = untag_ptr(this_obj);
52632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52634         PeerManager_free(this_obj_conv);
52635 }
52636
52637 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) {
52638         LDKMessageHandler message_handler_conv;
52639         message_handler_conv.inner = untag_ptr(message_handler);
52640         message_handler_conv.is_owned = ptr_is_owned(message_handler);
52641         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
52642         // WARNING: we need a move here but no clone is available for LDKMessageHandler
52643         
52644         uint8_t ephemeral_random_data_arr[32];
52645         CHECK(ephemeral_random_data->arr_len == 32);
52646         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
52647         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
52648         void* logger_ptr = untag_ptr(logger);
52649         CHECK_ACCESS(logger_ptr);
52650         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52651         if (logger_conv.free == LDKLogger_JCalls_free) {
52652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52653                 LDKLogger_JCalls_cloned(&logger_conv);
52654         }
52655         void* node_signer_ptr = untag_ptr(node_signer);
52656         CHECK_ACCESS(node_signer_ptr);
52657         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
52658         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
52659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52660                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
52661         }
52662         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
52663         int64_t ret_ref = 0;
52664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52666         return ret_ref;
52667 }
52668
52669 int64_tArray  CS_LDK_PeerManager_get_peer_node_ids(int64_t this_arg) {
52670         LDKPeerManager this_arg_conv;
52671         this_arg_conv.inner = untag_ptr(this_arg);
52672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52674         this_arg_conv.is_owned = false;
52675         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
52676         int64_tArray ret_arr = NULL;
52677         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
52678         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
52679         for (size_t r = 0; r < ret_var.datalen; r++) {
52680                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
52681                 *ret_conv_43_conv = ret_var.data[r];
52682                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
52683         }
52684         
52685         FREE(ret_var.data);
52686         return ret_arr;
52687 }
52688
52689 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) {
52690         LDKPeerManager this_arg_conv;
52691         this_arg_conv.inner = untag_ptr(this_arg);
52692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52694         this_arg_conv.is_owned = false;
52695         LDKPublicKey their_node_id_ref;
52696         CHECK(their_node_id->arr_len == 33);
52697         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
52698         void* descriptor_ptr = untag_ptr(descriptor);
52699         CHECK_ACCESS(descriptor_ptr);
52700         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52701         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52702                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52703                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52704         }
52705         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52706         CHECK_ACCESS(remote_network_address_ptr);
52707         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52708         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
52709         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
52710         return tag_ptr(ret_conv, true);
52711 }
52712
52713 int64_t  CS_LDK_PeerManager_new_inbound_connection(int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
52714         LDKPeerManager this_arg_conv;
52715         this_arg_conv.inner = untag_ptr(this_arg);
52716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52718         this_arg_conv.is_owned = false;
52719         void* descriptor_ptr = untag_ptr(descriptor);
52720         CHECK_ACCESS(descriptor_ptr);
52721         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
52722         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
52723                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52724                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
52725         }
52726         void* remote_network_address_ptr = untag_ptr(remote_network_address);
52727         CHECK_ACCESS(remote_network_address_ptr);
52728         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
52729         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52730         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
52731         return tag_ptr(ret_conv, true);
52732 }
52733
52734 int64_t  CS_LDK_PeerManager_write_buffer_space_avail(int64_t this_arg, int64_t descriptor) {
52735         LDKPeerManager this_arg_conv;
52736         this_arg_conv.inner = untag_ptr(this_arg);
52737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52739         this_arg_conv.is_owned = false;
52740         void* descriptor_ptr = untag_ptr(descriptor);
52741         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52742         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52743         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
52744         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
52745         return tag_ptr(ret_conv, true);
52746 }
52747
52748 int64_t  CS_LDK_PeerManager_read_event(int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
52749         LDKPeerManager this_arg_conv;
52750         this_arg_conv.inner = untag_ptr(this_arg);
52751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52753         this_arg_conv.is_owned = false;
52754         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
52755         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
52756         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
52757         LDKu8slice data_ref;
52758         data_ref.datalen = data->arr_len;
52759         data_ref.data = data->elems;
52760         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
52761         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
52762         FREE(data);
52763         return tag_ptr(ret_conv, true);
52764 }
52765
52766 void  CS_LDK_PeerManager_process_events(int64_t this_arg) {
52767         LDKPeerManager this_arg_conv;
52768         this_arg_conv.inner = untag_ptr(this_arg);
52769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52771         this_arg_conv.is_owned = false;
52772         PeerManager_process_events(&this_arg_conv);
52773 }
52774
52775 void  CS_LDK_PeerManager_socket_disconnected(int64_t this_arg, int64_t descriptor) {
52776         LDKPeerManager this_arg_conv;
52777         this_arg_conv.inner = untag_ptr(this_arg);
52778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52780         this_arg_conv.is_owned = false;
52781         void* descriptor_ptr = untag_ptr(descriptor);
52782         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
52783         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
52784         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
52785 }
52786
52787 void  CS_LDK_PeerManager_disconnect_by_node_id(int64_t this_arg, int8_tArray node_id) {
52788         LDKPeerManager this_arg_conv;
52789         this_arg_conv.inner = untag_ptr(this_arg);
52790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52792         this_arg_conv.is_owned = false;
52793         LDKPublicKey node_id_ref;
52794         CHECK(node_id->arr_len == 33);
52795         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
52796         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
52797 }
52798
52799 void  CS_LDK_PeerManager_disconnect_all_peers(int64_t this_arg) {
52800         LDKPeerManager this_arg_conv;
52801         this_arg_conv.inner = untag_ptr(this_arg);
52802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52804         this_arg_conv.is_owned = false;
52805         PeerManager_disconnect_all_peers(&this_arg_conv);
52806 }
52807
52808 void  CS_LDK_PeerManager_timer_tick_occurred(int64_t this_arg) {
52809         LDKPeerManager this_arg_conv;
52810         this_arg_conv.inner = untag_ptr(this_arg);
52811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52813         this_arg_conv.is_owned = false;
52814         PeerManager_timer_tick_occurred(&this_arg_conv);
52815 }
52816
52817 void  CS_LDK_PeerManager_broadcast_node_announcement(int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
52818         LDKPeerManager this_arg_conv;
52819         this_arg_conv.inner = untag_ptr(this_arg);
52820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52822         this_arg_conv.is_owned = false;
52823         LDKThreeBytes rgb_ref;
52824         CHECK(rgb->arr_len == 3);
52825         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
52826         LDKThirtyTwoBytes alias_ref;
52827         CHECK(alias->arr_len == 32);
52828         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
52829         LDKCVec_SocketAddressZ addresses_constr;
52830         addresses_constr.datalen = addresses->arr_len;
52831         if (addresses_constr.datalen > 0)
52832                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
52833         else
52834                 addresses_constr.data = NULL;
52835         int64_t* addresses_vals = addresses->elems;
52836         for (size_t p = 0; p < addresses_constr.datalen; p++) {
52837                 int64_t addresses_conv_15 = addresses_vals[p];
52838                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
52839                 CHECK_ACCESS(addresses_conv_15_ptr);
52840                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
52841                 addresses_constr.data[p] = addresses_conv_15_conv;
52842         }
52843         FREE(addresses);
52844         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
52845 }
52846
52847 int64_t  CS_LDK_htlc_success_tx_weight(int64_t channel_type_features) {
52848         LDKChannelTypeFeatures channel_type_features_conv;
52849         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52850         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52851         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52852         channel_type_features_conv.is_owned = false;
52853         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
52854         return ret_conv;
52855 }
52856
52857 int64_t  CS_LDK_htlc_timeout_tx_weight(int64_t channel_type_features) {
52858         LDKChannelTypeFeatures channel_type_features_conv;
52859         channel_type_features_conv.inner = untag_ptr(channel_type_features);
52860         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
52861         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
52862         channel_type_features_conv.is_owned = false;
52863         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
52864         return ret_conv;
52865 }
52866
52867 int32_t  CS_LDK_HTLCClaim_clone(int64_t orig) {
52868         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
52869         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_clone(orig_conv));
52870         return ret_conv;
52871 }
52872
52873 int32_t  CS_LDK_HTLCClaim_offered_timeout() {
52874         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_timeout());
52875         return ret_conv;
52876 }
52877
52878 int32_t  CS_LDK_HTLCClaim_offered_preimage() {
52879         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_preimage());
52880         return ret_conv;
52881 }
52882
52883 int32_t  CS_LDK_HTLCClaim_accepted_timeout() {
52884         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_timeout());
52885         return ret_conv;
52886 }
52887
52888 int32_t  CS_LDK_HTLCClaim_accepted_preimage() {
52889         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_preimage());
52890         return ret_conv;
52891 }
52892
52893 int32_t  CS_LDK_HTLCClaim_revocation() {
52894         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_revocation());
52895         return ret_conv;
52896 }
52897
52898 jboolean  CS_LDK_HTLCClaim_eq(int64_t a, int64_t b) {
52899         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
52900         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
52901         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
52902         return ret_conv;
52903 }
52904
52905 int64_t  CS_LDK_HTLCClaim_from_witness(int8_tArray witness) {
52906         LDKWitness witness_ref;
52907         witness_ref.datalen = witness->arr_len;
52908         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
52909         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
52910         witness_ref.data_is_owned = true;
52911         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
52912         *ret_copy = HTLCClaim_from_witness(witness_ref);
52913         int64_t ret_ref = tag_ptr(ret_copy, true);
52914         return ret_ref;
52915 }
52916
52917 int8_tArray  CS_LDK_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
52918         uint8_t commitment_seed_arr[32];
52919         CHECK(commitment_seed->arr_len == 32);
52920         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
52921         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
52922         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52923         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
52924         return ret_arr;
52925 }
52926
52927 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) {
52928         LDKCVec_u8Z to_holder_script_ref;
52929         to_holder_script_ref.datalen = to_holder_script->arr_len;
52930         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
52931         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
52932         LDKCVec_u8Z to_counterparty_script_ref;
52933         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
52934         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
52935         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
52936         LDKOutPoint funding_outpoint_conv;
52937         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
52938         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
52939         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
52940         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
52941         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);
52942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52944         Transaction_free(ret_var);
52945         return ret_arr;
52946 }
52947
52948 void  CS_LDK_CounterpartyCommitmentSecrets_free(int64_t this_obj) {
52949         LDKCounterpartyCommitmentSecrets this_obj_conv;
52950         this_obj_conv.inner = untag_ptr(this_obj);
52951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52953         CounterpartyCommitmentSecrets_free(this_obj_conv);
52954 }
52955
52956 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
52957         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
52958         int64_t ret_ref = 0;
52959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52961         return ret_ref;
52962 }
52963 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone_ptr(int64_t arg) {
52964         LDKCounterpartyCommitmentSecrets arg_conv;
52965         arg_conv.inner = untag_ptr(arg);
52966         arg_conv.is_owned = ptr_is_owned(arg);
52967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52968         arg_conv.is_owned = false;
52969         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
52970         return ret_conv;
52971 }
52972
52973 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone(int64_t orig) {
52974         LDKCounterpartyCommitmentSecrets orig_conv;
52975         orig_conv.inner = untag_ptr(orig);
52976         orig_conv.is_owned = ptr_is_owned(orig);
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52978         orig_conv.is_owned = false;
52979         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
52980         int64_t ret_ref = 0;
52981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52983         return ret_ref;
52984 }
52985
52986 int64_t  CS_LDK_CounterpartyCommitmentSecrets_new() {
52987         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
52988         int64_t ret_ref = 0;
52989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52991         return ret_ref;
52992 }
52993
52994 int64_t  CS_LDK_CounterpartyCommitmentSecrets_get_min_seen_secret(int64_t this_arg) {
52995         LDKCounterpartyCommitmentSecrets this_arg_conv;
52996         this_arg_conv.inner = untag_ptr(this_arg);
52997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52999         this_arg_conv.is_owned = false;
53000         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
53001         return ret_conv;
53002 }
53003
53004 int64_t  CS_LDK_CounterpartyCommitmentSecrets_provide_secret(int64_t this_arg, int64_t idx, int8_tArray secret) {
53005         LDKCounterpartyCommitmentSecrets this_arg_conv;
53006         this_arg_conv.inner = untag_ptr(this_arg);
53007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53009         this_arg_conv.is_owned = false;
53010         LDKThirtyTwoBytes secret_ref;
53011         CHECK(secret->arr_len == 32);
53012         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
53013         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53014         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
53015         return tag_ptr(ret_conv, true);
53016 }
53017
53018 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_get_secret(int64_t this_arg, int64_t idx) {
53019         LDKCounterpartyCommitmentSecrets this_arg_conv;
53020         this_arg_conv.inner = untag_ptr(this_arg);
53021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53023         this_arg_conv.is_owned = false;
53024         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53025         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
53026         return ret_arr;
53027 }
53028
53029 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_write(int64_t obj) {
53030         LDKCounterpartyCommitmentSecrets obj_conv;
53031         obj_conv.inner = untag_ptr(obj);
53032         obj_conv.is_owned = ptr_is_owned(obj);
53033         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53034         obj_conv.is_owned = false;
53035         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
53036         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53037         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53038         CVec_u8Z_free(ret_var);
53039         return ret_arr;
53040 }
53041
53042 int64_t  CS_LDK_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
53043         LDKu8slice ser_ref;
53044         ser_ref.datalen = ser->arr_len;
53045         ser_ref.data = ser->elems;
53046         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
53047         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
53048         FREE(ser);
53049         return tag_ptr(ret_conv, true);
53050 }
53051
53052 int8_tArray  CS_LDK_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
53053         LDKPublicKey per_commitment_point_ref;
53054         CHECK(per_commitment_point->arr_len == 33);
53055         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53056         uint8_t base_secret_arr[32];
53057         CHECK(base_secret->arr_len == 32);
53058         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
53059         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
53060         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53061         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
53062         return ret_arr;
53063 }
53064
53065 int8_tArray  CS_LDK_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
53066         uint8_t per_commitment_secret_arr[32];
53067         CHECK(per_commitment_secret->arr_len == 32);
53068         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
53069         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
53070         uint8_t countersignatory_revocation_base_secret_arr[32];
53071         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
53072         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
53073         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
53074         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53075         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
53076         return ret_arr;
53077 }
53078
53079 void  CS_LDK_TxCreationKeys_free(int64_t this_obj) {
53080         LDKTxCreationKeys this_obj_conv;
53081         this_obj_conv.inner = untag_ptr(this_obj);
53082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53084         TxCreationKeys_free(this_obj_conv);
53085 }
53086
53087 int8_tArray  CS_LDK_TxCreationKeys_get_per_commitment_point(int64_t this_ptr) {
53088         LDKTxCreationKeys this_ptr_conv;
53089         this_ptr_conv.inner = untag_ptr(this_ptr);
53090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53092         this_ptr_conv.is_owned = false;
53093         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53094         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
53095         return ret_arr;
53096 }
53097
53098 void  CS_LDK_TxCreationKeys_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
53099         LDKTxCreationKeys this_ptr_conv;
53100         this_ptr_conv.inner = untag_ptr(this_ptr);
53101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53103         this_ptr_conv.is_owned = false;
53104         LDKPublicKey val_ref;
53105         CHECK(val->arr_len == 33);
53106         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53107         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
53108 }
53109
53110 int64_t  CS_LDK_TxCreationKeys_get_revocation_key(int64_t this_ptr) {
53111         LDKTxCreationKeys this_ptr_conv;
53112         this_ptr_conv.inner = untag_ptr(this_ptr);
53113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53115         this_ptr_conv.is_owned = false;
53116         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
53117         int64_t ret_ref = 0;
53118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53120         return ret_ref;
53121 }
53122
53123 void  CS_LDK_TxCreationKeys_set_revocation_key(int64_t this_ptr, int64_t val) {
53124         LDKTxCreationKeys this_ptr_conv;
53125         this_ptr_conv.inner = untag_ptr(this_ptr);
53126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53128         this_ptr_conv.is_owned = false;
53129         LDKRevocationKey val_conv;
53130         val_conv.inner = untag_ptr(val);
53131         val_conv.is_owned = ptr_is_owned(val);
53132         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53133         val_conv = RevocationKey_clone(&val_conv);
53134         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
53135 }
53136
53137 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_htlc_key(int64_t this_ptr) {
53138         LDKTxCreationKeys this_ptr_conv;
53139         this_ptr_conv.inner = untag_ptr(this_ptr);
53140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53142         this_ptr_conv.is_owned = false;
53143         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
53144         int64_t ret_ref = 0;
53145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53147         return ret_ref;
53148 }
53149
53150 void  CS_LDK_TxCreationKeys_set_broadcaster_htlc_key(int64_t this_ptr, int64_t val) {
53151         LDKTxCreationKeys this_ptr_conv;
53152         this_ptr_conv.inner = untag_ptr(this_ptr);
53153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53155         this_ptr_conv.is_owned = false;
53156         LDKHtlcKey val_conv;
53157         val_conv.inner = untag_ptr(val);
53158         val_conv.is_owned = ptr_is_owned(val);
53159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53160         val_conv = HtlcKey_clone(&val_conv);
53161         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
53162 }
53163
53164 int64_t  CS_LDK_TxCreationKeys_get_countersignatory_htlc_key(int64_t this_ptr) {
53165         LDKTxCreationKeys this_ptr_conv;
53166         this_ptr_conv.inner = untag_ptr(this_ptr);
53167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53169         this_ptr_conv.is_owned = false;
53170         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
53171         int64_t ret_ref = 0;
53172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53174         return ret_ref;
53175 }
53176
53177 void  CS_LDK_TxCreationKeys_set_countersignatory_htlc_key(int64_t this_ptr, int64_t val) {
53178         LDKTxCreationKeys 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         LDKHtlcKey val_conv;
53184         val_conv.inner = untag_ptr(val);
53185         val_conv.is_owned = ptr_is_owned(val);
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53187         val_conv = HtlcKey_clone(&val_conv);
53188         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
53189 }
53190
53191 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_delayed_payment_key(int64_t this_ptr) {
53192         LDKTxCreationKeys this_ptr_conv;
53193         this_ptr_conv.inner = untag_ptr(this_ptr);
53194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53196         this_ptr_conv.is_owned = false;
53197         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
53198         int64_t ret_ref = 0;
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53201         return ret_ref;
53202 }
53203
53204 void  CS_LDK_TxCreationKeys_set_broadcaster_delayed_payment_key(int64_t this_ptr, int64_t val) {
53205         LDKTxCreationKeys this_ptr_conv;
53206         this_ptr_conv.inner = untag_ptr(this_ptr);
53207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53209         this_ptr_conv.is_owned = false;
53210         LDKDelayedPaymentKey val_conv;
53211         val_conv.inner = untag_ptr(val);
53212         val_conv.is_owned = ptr_is_owned(val);
53213         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53214         val_conv = DelayedPaymentKey_clone(&val_conv);
53215         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
53216 }
53217
53218 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) {
53219         LDKPublicKey per_commitment_point_arg_ref;
53220         CHECK(per_commitment_point_arg->arr_len == 33);
53221         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
53222         LDKRevocationKey revocation_key_arg_conv;
53223         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
53224         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
53225         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
53226         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
53227         LDKHtlcKey broadcaster_htlc_key_arg_conv;
53228         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
53229         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
53230         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
53231         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
53232         LDKHtlcKey countersignatory_htlc_key_arg_conv;
53233         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
53234         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
53235         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
53236         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
53237         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
53238         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
53239         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
53240         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
53241         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
53242         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);
53243         int64_t ret_ref = 0;
53244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53246         return ret_ref;
53247 }
53248
53249 jboolean  CS_LDK_TxCreationKeys_eq(int64_t a, int64_t b) {
53250         LDKTxCreationKeys a_conv;
53251         a_conv.inner = untag_ptr(a);
53252         a_conv.is_owned = ptr_is_owned(a);
53253         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53254         a_conv.is_owned = false;
53255         LDKTxCreationKeys b_conv;
53256         b_conv.inner = untag_ptr(b);
53257         b_conv.is_owned = ptr_is_owned(b);
53258         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53259         b_conv.is_owned = false;
53260         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
53261         return ret_conv;
53262 }
53263
53264 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
53265         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
53266         int64_t ret_ref = 0;
53267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53269         return ret_ref;
53270 }
53271 int64_t  CS_LDK_TxCreationKeys_clone_ptr(int64_t arg) {
53272         LDKTxCreationKeys arg_conv;
53273         arg_conv.inner = untag_ptr(arg);
53274         arg_conv.is_owned = ptr_is_owned(arg);
53275         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53276         arg_conv.is_owned = false;
53277         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
53278         return ret_conv;
53279 }
53280
53281 int64_t  CS_LDK_TxCreationKeys_clone(int64_t orig) {
53282         LDKTxCreationKeys orig_conv;
53283         orig_conv.inner = untag_ptr(orig);
53284         orig_conv.is_owned = ptr_is_owned(orig);
53285         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53286         orig_conv.is_owned = false;
53287         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
53288         int64_t ret_ref = 0;
53289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53291         return ret_ref;
53292 }
53293
53294 int8_tArray  CS_LDK_TxCreationKeys_write(int64_t obj) {
53295         LDKTxCreationKeys obj_conv;
53296         obj_conv.inner = untag_ptr(obj);
53297         obj_conv.is_owned = ptr_is_owned(obj);
53298         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53299         obj_conv.is_owned = false;
53300         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
53301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53303         CVec_u8Z_free(ret_var);
53304         return ret_arr;
53305 }
53306
53307 int64_t  CS_LDK_TxCreationKeys_read(int8_tArray ser) {
53308         LDKu8slice ser_ref;
53309         ser_ref.datalen = ser->arr_len;
53310         ser_ref.data = ser->elems;
53311         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
53312         *ret_conv = TxCreationKeys_read(ser_ref);
53313         FREE(ser);
53314         return tag_ptr(ret_conv, true);
53315 }
53316
53317 void  CS_LDK_ChannelPublicKeys_free(int64_t this_obj) {
53318         LDKChannelPublicKeys this_obj_conv;
53319         this_obj_conv.inner = untag_ptr(this_obj);
53320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53322         ChannelPublicKeys_free(this_obj_conv);
53323 }
53324
53325 int8_tArray  CS_LDK_ChannelPublicKeys_get_funding_pubkey(int64_t this_ptr) {
53326         LDKChannelPublicKeys 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53332         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
53333         return ret_arr;
53334 }
53335
53336 void  CS_LDK_ChannelPublicKeys_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
53337         LDKChannelPublicKeys this_ptr_conv;
53338         this_ptr_conv.inner = untag_ptr(this_ptr);
53339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53341         this_ptr_conv.is_owned = false;
53342         LDKPublicKey val_ref;
53343         CHECK(val->arr_len == 33);
53344         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53345         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
53346 }
53347
53348 int64_t  CS_LDK_ChannelPublicKeys_get_revocation_basepoint(int64_t this_ptr) {
53349         LDKChannelPublicKeys this_ptr_conv;
53350         this_ptr_conv.inner = untag_ptr(this_ptr);
53351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53353         this_ptr_conv.is_owned = false;
53354         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
53355         int64_t ret_ref = 0;
53356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53358         return ret_ref;
53359 }
53360
53361 void  CS_LDK_ChannelPublicKeys_set_revocation_basepoint(int64_t this_ptr, int64_t val) {
53362         LDKChannelPublicKeys this_ptr_conv;
53363         this_ptr_conv.inner = untag_ptr(this_ptr);
53364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53366         this_ptr_conv.is_owned = false;
53367         LDKRevocationBasepoint val_conv;
53368         val_conv.inner = untag_ptr(val);
53369         val_conv.is_owned = ptr_is_owned(val);
53370         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53371         val_conv = RevocationBasepoint_clone(&val_conv);
53372         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
53373 }
53374
53375 int8_tArray  CS_LDK_ChannelPublicKeys_get_payment_point(int64_t this_ptr) {
53376         LDKChannelPublicKeys this_ptr_conv;
53377         this_ptr_conv.inner = untag_ptr(this_ptr);
53378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53380         this_ptr_conv.is_owned = false;
53381         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
53382         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
53383         return ret_arr;
53384 }
53385
53386 void  CS_LDK_ChannelPublicKeys_set_payment_point(int64_t this_ptr, int8_tArray val) {
53387         LDKChannelPublicKeys this_ptr_conv;
53388         this_ptr_conv.inner = untag_ptr(this_ptr);
53389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53391         this_ptr_conv.is_owned = false;
53392         LDKPublicKey val_ref;
53393         CHECK(val->arr_len == 33);
53394         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
53395         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
53396 }
53397
53398 int64_t  CS_LDK_ChannelPublicKeys_get_delayed_payment_basepoint(int64_t this_ptr) {
53399         LDKChannelPublicKeys this_ptr_conv;
53400         this_ptr_conv.inner = untag_ptr(this_ptr);
53401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53403         this_ptr_conv.is_owned = false;
53404         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
53405         int64_t ret_ref = 0;
53406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53408         return ret_ref;
53409 }
53410
53411 void  CS_LDK_ChannelPublicKeys_set_delayed_payment_basepoint(int64_t this_ptr, int64_t val) {
53412         LDKChannelPublicKeys this_ptr_conv;
53413         this_ptr_conv.inner = untag_ptr(this_ptr);
53414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53416         this_ptr_conv.is_owned = false;
53417         LDKDelayedPaymentBasepoint val_conv;
53418         val_conv.inner = untag_ptr(val);
53419         val_conv.is_owned = ptr_is_owned(val);
53420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53421         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
53422         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
53423 }
53424
53425 int64_t  CS_LDK_ChannelPublicKeys_get_htlc_basepoint(int64_t this_ptr) {
53426         LDKChannelPublicKeys this_ptr_conv;
53427         this_ptr_conv.inner = untag_ptr(this_ptr);
53428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53430         this_ptr_conv.is_owned = false;
53431         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
53432         int64_t ret_ref = 0;
53433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53435         return ret_ref;
53436 }
53437
53438 void  CS_LDK_ChannelPublicKeys_set_htlc_basepoint(int64_t this_ptr, int64_t val) {
53439         LDKChannelPublicKeys this_ptr_conv;
53440         this_ptr_conv.inner = untag_ptr(this_ptr);
53441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53443         this_ptr_conv.is_owned = false;
53444         LDKHtlcBasepoint val_conv;
53445         val_conv.inner = untag_ptr(val);
53446         val_conv.is_owned = ptr_is_owned(val);
53447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53448         val_conv = HtlcBasepoint_clone(&val_conv);
53449         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
53450 }
53451
53452 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) {
53453         LDKPublicKey funding_pubkey_arg_ref;
53454         CHECK(funding_pubkey_arg->arr_len == 33);
53455         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
53456         LDKRevocationBasepoint revocation_basepoint_arg_conv;
53457         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
53458         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
53460         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
53461         LDKPublicKey payment_point_arg_ref;
53462         CHECK(payment_point_arg->arr_len == 33);
53463         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
53464         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
53465         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
53466         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
53467         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
53468         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
53469         LDKHtlcBasepoint htlc_basepoint_arg_conv;
53470         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
53471         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
53472         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
53473         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
53474         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);
53475         int64_t ret_ref = 0;
53476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53478         return ret_ref;
53479 }
53480
53481 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
53482         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
53483         int64_t ret_ref = 0;
53484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53486         return ret_ref;
53487 }
53488 int64_t  CS_LDK_ChannelPublicKeys_clone_ptr(int64_t arg) {
53489         LDKChannelPublicKeys arg_conv;
53490         arg_conv.inner = untag_ptr(arg);
53491         arg_conv.is_owned = ptr_is_owned(arg);
53492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53493         arg_conv.is_owned = false;
53494         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
53495         return ret_conv;
53496 }
53497
53498 int64_t  CS_LDK_ChannelPublicKeys_clone(int64_t orig) {
53499         LDKChannelPublicKeys orig_conv;
53500         orig_conv.inner = untag_ptr(orig);
53501         orig_conv.is_owned = ptr_is_owned(orig);
53502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53503         orig_conv.is_owned = false;
53504         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
53505         int64_t ret_ref = 0;
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53508         return ret_ref;
53509 }
53510
53511 int64_t  CS_LDK_ChannelPublicKeys_hash(int64_t o) {
53512         LDKChannelPublicKeys o_conv;
53513         o_conv.inner = untag_ptr(o);
53514         o_conv.is_owned = ptr_is_owned(o);
53515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53516         o_conv.is_owned = false;
53517         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
53518         return ret_conv;
53519 }
53520
53521 jboolean  CS_LDK_ChannelPublicKeys_eq(int64_t a, int64_t b) {
53522         LDKChannelPublicKeys a_conv;
53523         a_conv.inner = untag_ptr(a);
53524         a_conv.is_owned = ptr_is_owned(a);
53525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53526         a_conv.is_owned = false;
53527         LDKChannelPublicKeys b_conv;
53528         b_conv.inner = untag_ptr(b);
53529         b_conv.is_owned = ptr_is_owned(b);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53531         b_conv.is_owned = false;
53532         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
53533         return ret_conv;
53534 }
53535
53536 int8_tArray  CS_LDK_ChannelPublicKeys_write(int64_t obj) {
53537         LDKChannelPublicKeys obj_conv;
53538         obj_conv.inner = untag_ptr(obj);
53539         obj_conv.is_owned = ptr_is_owned(obj);
53540         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53541         obj_conv.is_owned = false;
53542         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
53543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53545         CVec_u8Z_free(ret_var);
53546         return ret_arr;
53547 }
53548
53549 int64_t  CS_LDK_ChannelPublicKeys_read(int8_tArray ser) {
53550         LDKu8slice ser_ref;
53551         ser_ref.datalen = ser->arr_len;
53552         ser_ref.data = ser->elems;
53553         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
53554         *ret_conv = ChannelPublicKeys_read(ser_ref);
53555         FREE(ser);
53556         return tag_ptr(ret_conv, true);
53557 }
53558
53559 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) {
53560         LDKPublicKey per_commitment_point_ref;
53561         CHECK(per_commitment_point->arr_len == 33);
53562         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53563         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
53564         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
53565         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
53566         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
53567         broadcaster_delayed_payment_base_conv.is_owned = false;
53568         LDKHtlcBasepoint broadcaster_htlc_base_conv;
53569         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
53570         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
53571         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
53572         broadcaster_htlc_base_conv.is_owned = false;
53573         LDKRevocationBasepoint countersignatory_revocation_base_conv;
53574         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
53575         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
53576         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
53577         countersignatory_revocation_base_conv.is_owned = false;
53578         LDKHtlcBasepoint countersignatory_htlc_base_conv;
53579         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
53580         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
53581         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
53582         countersignatory_htlc_base_conv.is_owned = false;
53583         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);
53584         int64_t ret_ref = 0;
53585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53587         return ret_ref;
53588 }
53589
53590 int64_t  CS_LDK_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
53591         LDKPublicKey per_commitment_point_ref;
53592         CHECK(per_commitment_point->arr_len == 33);
53593         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
53594         LDKChannelPublicKeys broadcaster_keys_conv;
53595         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
53596         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
53597         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
53598         broadcaster_keys_conv.is_owned = false;
53599         LDKChannelPublicKeys countersignatory_keys_conv;
53600         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
53601         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
53602         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
53603         countersignatory_keys_conv.is_owned = false;
53604         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
53605         int64_t ret_ref = 0;
53606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53608         return ret_ref;
53609 }
53610
53611 int8_tArray  CS_LDK_get_revokeable_redeemscript(int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
53612         LDKRevocationKey revocation_key_conv;
53613         revocation_key_conv.inner = untag_ptr(revocation_key);
53614         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53615         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53616         revocation_key_conv.is_owned = false;
53617         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53618         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53619         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53620         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53621         broadcaster_delayed_payment_key_conv.is_owned = false;
53622         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
53623         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53624         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53625         CVec_u8Z_free(ret_var);
53626         return ret_arr;
53627 }
53628
53629 int8_tArray  CS_LDK_get_counterparty_payment_script(int64_t channel_type_features, int8_tArray payment_key) {
53630         LDKChannelTypeFeatures channel_type_features_conv;
53631         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53632         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53633         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53634         channel_type_features_conv.is_owned = false;
53635         LDKPublicKey payment_key_ref;
53636         CHECK(payment_key->arr_len == 33);
53637         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
53638         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
53639         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53640         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53641         CVec_u8Z_free(ret_var);
53642         return ret_arr;
53643 }
53644
53645 void  CS_LDK_HTLCOutputInCommitment_free(int64_t this_obj) {
53646         LDKHTLCOutputInCommitment this_obj_conv;
53647         this_obj_conv.inner = untag_ptr(this_obj);
53648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53650         HTLCOutputInCommitment_free(this_obj_conv);
53651 }
53652
53653 jboolean  CS_LDK_HTLCOutputInCommitment_get_offered(int64_t this_ptr) {
53654         LDKHTLCOutputInCommitment this_ptr_conv;
53655         this_ptr_conv.inner = untag_ptr(this_ptr);
53656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53658         this_ptr_conv.is_owned = false;
53659         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
53660         return ret_conv;
53661 }
53662
53663 void  CS_LDK_HTLCOutputInCommitment_set_offered(int64_t this_ptr, jboolean val) {
53664         LDKHTLCOutputInCommitment this_ptr_conv;
53665         this_ptr_conv.inner = untag_ptr(this_ptr);
53666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53668         this_ptr_conv.is_owned = false;
53669         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
53670 }
53671
53672 int64_t  CS_LDK_HTLCOutputInCommitment_get_amount_msat(int64_t this_ptr) {
53673         LDKHTLCOutputInCommitment this_ptr_conv;
53674         this_ptr_conv.inner = untag_ptr(this_ptr);
53675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53677         this_ptr_conv.is_owned = false;
53678         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
53679         return ret_conv;
53680 }
53681
53682 void  CS_LDK_HTLCOutputInCommitment_set_amount_msat(int64_t this_ptr, int64_t val) {
53683         LDKHTLCOutputInCommitment this_ptr_conv;
53684         this_ptr_conv.inner = untag_ptr(this_ptr);
53685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53687         this_ptr_conv.is_owned = false;
53688         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
53689 }
53690
53691 int32_t  CS_LDK_HTLCOutputInCommitment_get_cltv_expiry(int64_t this_ptr) {
53692         LDKHTLCOutputInCommitment this_ptr_conv;
53693         this_ptr_conv.inner = untag_ptr(this_ptr);
53694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53696         this_ptr_conv.is_owned = false;
53697         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
53698         return ret_conv;
53699 }
53700
53701 void  CS_LDK_HTLCOutputInCommitment_set_cltv_expiry(int64_t this_ptr, int32_t val) {
53702         LDKHTLCOutputInCommitment this_ptr_conv;
53703         this_ptr_conv.inner = untag_ptr(this_ptr);
53704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53706         this_ptr_conv.is_owned = false;
53707         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
53708 }
53709
53710 int8_tArray  CS_LDK_HTLCOutputInCommitment_get_payment_hash(int64_t this_ptr) {
53711         LDKHTLCOutputInCommitment this_ptr_conv;
53712         this_ptr_conv.inner = untag_ptr(this_ptr);
53713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53715         this_ptr_conv.is_owned = false;
53716         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53717         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
53718         return ret_arr;
53719 }
53720
53721 void  CS_LDK_HTLCOutputInCommitment_set_payment_hash(int64_t this_ptr, int8_tArray val) {
53722         LDKHTLCOutputInCommitment this_ptr_conv;
53723         this_ptr_conv.inner = untag_ptr(this_ptr);
53724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53726         this_ptr_conv.is_owned = false;
53727         LDKThirtyTwoBytes val_ref;
53728         CHECK(val->arr_len == 32);
53729         memcpy(val_ref.data, val->elems, 32); FREE(val);
53730         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
53731 }
53732
53733 int64_t  CS_LDK_HTLCOutputInCommitment_get_transaction_output_index(int64_t this_ptr) {
53734         LDKHTLCOutputInCommitment this_ptr_conv;
53735         this_ptr_conv.inner = untag_ptr(this_ptr);
53736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53738         this_ptr_conv.is_owned = false;
53739         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53740         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
53741         int64_t ret_ref = tag_ptr(ret_copy, true);
53742         return ret_ref;
53743 }
53744
53745 void  CS_LDK_HTLCOutputInCommitment_set_transaction_output_index(int64_t this_ptr, int64_t val) {
53746         LDKHTLCOutputInCommitment this_ptr_conv;
53747         this_ptr_conv.inner = untag_ptr(this_ptr);
53748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53750         this_ptr_conv.is_owned = false;
53751         void* val_ptr = untag_ptr(val);
53752         CHECK_ACCESS(val_ptr);
53753         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
53754         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
53755         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
53756 }
53757
53758 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) {
53759         LDKThirtyTwoBytes payment_hash_arg_ref;
53760         CHECK(payment_hash_arg->arr_len == 32);
53761         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
53762         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
53763         CHECK_ACCESS(transaction_output_index_arg_ptr);
53764         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
53765         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
53766         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
53767         int64_t ret_ref = 0;
53768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53770         return ret_ref;
53771 }
53772
53773 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
53774         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
53775         int64_t ret_ref = 0;
53776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53778         return ret_ref;
53779 }
53780 int64_t  CS_LDK_HTLCOutputInCommitment_clone_ptr(int64_t arg) {
53781         LDKHTLCOutputInCommitment arg_conv;
53782         arg_conv.inner = untag_ptr(arg);
53783         arg_conv.is_owned = ptr_is_owned(arg);
53784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53785         arg_conv.is_owned = false;
53786         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
53787         return ret_conv;
53788 }
53789
53790 int64_t  CS_LDK_HTLCOutputInCommitment_clone(int64_t orig) {
53791         LDKHTLCOutputInCommitment orig_conv;
53792         orig_conv.inner = untag_ptr(orig);
53793         orig_conv.is_owned = ptr_is_owned(orig);
53794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53795         orig_conv.is_owned = false;
53796         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
53797         int64_t ret_ref = 0;
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53800         return ret_ref;
53801 }
53802
53803 jboolean  CS_LDK_HTLCOutputInCommitment_eq(int64_t a, int64_t b) {
53804         LDKHTLCOutputInCommitment a_conv;
53805         a_conv.inner = untag_ptr(a);
53806         a_conv.is_owned = ptr_is_owned(a);
53807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53808         a_conv.is_owned = false;
53809         LDKHTLCOutputInCommitment b_conv;
53810         b_conv.inner = untag_ptr(b);
53811         b_conv.is_owned = ptr_is_owned(b);
53812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53813         b_conv.is_owned = false;
53814         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
53815         return ret_conv;
53816 }
53817
53818 int8_tArray  CS_LDK_HTLCOutputInCommitment_write(int64_t obj) {
53819         LDKHTLCOutputInCommitment obj_conv;
53820         obj_conv.inner = untag_ptr(obj);
53821         obj_conv.is_owned = ptr_is_owned(obj);
53822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53823         obj_conv.is_owned = false;
53824         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
53825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53827         CVec_u8Z_free(ret_var);
53828         return ret_arr;
53829 }
53830
53831 int64_t  CS_LDK_HTLCOutputInCommitment_read(int8_tArray ser) {
53832         LDKu8slice ser_ref;
53833         ser_ref.datalen = ser->arr_len;
53834         ser_ref.data = ser->elems;
53835         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
53836         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
53837         FREE(ser);
53838         return tag_ptr(ret_conv, true);
53839 }
53840
53841 int8_tArray  CS_LDK_get_htlc_redeemscript(int64_t htlc, int64_t channel_type_features, int64_t keys) {
53842         LDKHTLCOutputInCommitment htlc_conv;
53843         htlc_conv.inner = untag_ptr(htlc);
53844         htlc_conv.is_owned = ptr_is_owned(htlc);
53845         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53846         htlc_conv.is_owned = false;
53847         LDKChannelTypeFeatures channel_type_features_conv;
53848         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53849         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53850         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53851         channel_type_features_conv.is_owned = false;
53852         LDKTxCreationKeys keys_conv;
53853         keys_conv.inner = untag_ptr(keys);
53854         keys_conv.is_owned = ptr_is_owned(keys);
53855         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
53856         keys_conv.is_owned = false;
53857         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
53858         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53859         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53860         CVec_u8Z_free(ret_var);
53861         return ret_arr;
53862 }
53863
53864 int8_tArray  CS_LDK_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
53865         LDKPublicKey broadcaster_ref;
53866         CHECK(broadcaster->arr_len == 33);
53867         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
53868         LDKPublicKey countersignatory_ref;
53869         CHECK(countersignatory->arr_len == 33);
53870         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
53871         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
53872         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53873         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53874         CVec_u8Z_free(ret_var);
53875         return ret_arr;
53876 }
53877
53878 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) {
53879         uint8_t commitment_txid_arr[32];
53880         CHECK(commitment_txid->arr_len == 32);
53881         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
53882         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
53883         LDKHTLCOutputInCommitment htlc_conv;
53884         htlc_conv.inner = untag_ptr(htlc);
53885         htlc_conv.is_owned = ptr_is_owned(htlc);
53886         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
53887         htlc_conv.is_owned = false;
53888         LDKChannelTypeFeatures channel_type_features_conv;
53889         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53890         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53891         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53892         channel_type_features_conv.is_owned = false;
53893         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
53894         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
53895         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
53896         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
53897         broadcaster_delayed_payment_key_conv.is_owned = false;
53898         LDKRevocationKey revocation_key_conv;
53899         revocation_key_conv.inner = untag_ptr(revocation_key);
53900         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
53901         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
53902         revocation_key_conv.is_owned = false;
53903         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);
53904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53906         Transaction_free(ret_var);
53907         return ret_arr;
53908 }
53909
53910 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) {
53911         LDKECDSASignature local_sig_ref;
53912         CHECK(local_sig->arr_len == 64);
53913         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
53914         LDKECDSASignature remote_sig_ref;
53915         CHECK(remote_sig->arr_len == 64);
53916         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
53917         void* preimage_ptr = untag_ptr(preimage);
53918         CHECK_ACCESS(preimage_ptr);
53919         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
53920         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
53921         LDKu8slice redeem_script_ref;
53922         redeem_script_ref.datalen = redeem_script->arr_len;
53923         redeem_script_ref.data = redeem_script->elems;
53924         LDKChannelTypeFeatures channel_type_features_conv;
53925         channel_type_features_conv.inner = untag_ptr(channel_type_features);
53926         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
53927         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
53928         channel_type_features_conv.is_owned = false;
53929         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
53930         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53931         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53932         Witness_free(ret_var);
53933         FREE(redeem_script);
53934         return ret_arr;
53935 }
53936
53937 int8_tArray  CS_LDK_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
53938         LDKPublicKey payment_point_ref;
53939         CHECK(payment_point->arr_len == 33);
53940         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
53941         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
53942         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53943         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53944         CVec_u8Z_free(ret_var);
53945         return ret_arr;
53946 }
53947
53948 int8_tArray  CS_LDK_get_anchor_redeemscript(int8_tArray funding_pubkey) {
53949         LDKPublicKey funding_pubkey_ref;
53950         CHECK(funding_pubkey->arr_len == 33);
53951         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
53952         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
53953         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53954         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53955         CVec_u8Z_free(ret_var);
53956         return ret_arr;
53957 }
53958
53959 int8_tArray  CS_LDK_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
53960         LDKPublicKey funding_key_ref;
53961         CHECK(funding_key->arr_len == 33);
53962         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
53963         LDKECDSASignature funding_sig_ref;
53964         CHECK(funding_sig->arr_len == 64);
53965         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
53966         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
53967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53969         Witness_free(ret_var);
53970         return ret_arr;
53971 }
53972
53973 void  CS_LDK_ChannelTransactionParameters_free(int64_t this_obj) {
53974         LDKChannelTransactionParameters this_obj_conv;
53975         this_obj_conv.inner = untag_ptr(this_obj);
53976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53978         ChannelTransactionParameters_free(this_obj_conv);
53979 }
53980
53981 int64_t  CS_LDK_ChannelTransactionParameters_get_holder_pubkeys(int64_t this_ptr) {
53982         LDKChannelTransactionParameters this_ptr_conv;
53983         this_ptr_conv.inner = untag_ptr(this_ptr);
53984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53986         this_ptr_conv.is_owned = false;
53987         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
53988         int64_t ret_ref = 0;
53989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53991         return ret_ref;
53992 }
53993
53994 void  CS_LDK_ChannelTransactionParameters_set_holder_pubkeys(int64_t this_ptr, int64_t val) {
53995         LDKChannelTransactionParameters this_ptr_conv;
53996         this_ptr_conv.inner = untag_ptr(this_ptr);
53997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53999         this_ptr_conv.is_owned = false;
54000         LDKChannelPublicKeys val_conv;
54001         val_conv.inner = untag_ptr(val);
54002         val_conv.is_owned = ptr_is_owned(val);
54003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54004         val_conv = ChannelPublicKeys_clone(&val_conv);
54005         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
54006 }
54007
54008 int16_t  CS_LDK_ChannelTransactionParameters_get_holder_selected_contest_delay(int64_t this_ptr) {
54009         LDKChannelTransactionParameters this_ptr_conv;
54010         this_ptr_conv.inner = untag_ptr(this_ptr);
54011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54013         this_ptr_conv.is_owned = false;
54014         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
54015         return ret_conv;
54016 }
54017
54018 void  CS_LDK_ChannelTransactionParameters_set_holder_selected_contest_delay(int64_t this_ptr, int16_t val) {
54019         LDKChannelTransactionParameters this_ptr_conv;
54020         this_ptr_conv.inner = untag_ptr(this_ptr);
54021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54023         this_ptr_conv.is_owned = false;
54024         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
54025 }
54026
54027 jboolean  CS_LDK_ChannelTransactionParameters_get_is_outbound_from_holder(int64_t this_ptr) {
54028         LDKChannelTransactionParameters this_ptr_conv;
54029         this_ptr_conv.inner = untag_ptr(this_ptr);
54030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54032         this_ptr_conv.is_owned = false;
54033         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
54034         return ret_conv;
54035 }
54036
54037 void  CS_LDK_ChannelTransactionParameters_set_is_outbound_from_holder(int64_t this_ptr, jboolean val) {
54038         LDKChannelTransactionParameters this_ptr_conv;
54039         this_ptr_conv.inner = untag_ptr(this_ptr);
54040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54042         this_ptr_conv.is_owned = false;
54043         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
54044 }
54045
54046 int64_t  CS_LDK_ChannelTransactionParameters_get_counterparty_parameters(int64_t this_ptr) {
54047         LDKChannelTransactionParameters this_ptr_conv;
54048         this_ptr_conv.inner = untag_ptr(this_ptr);
54049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54051         this_ptr_conv.is_owned = false;
54052         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
54053         int64_t ret_ref = 0;
54054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54056         return ret_ref;
54057 }
54058
54059 void  CS_LDK_ChannelTransactionParameters_set_counterparty_parameters(int64_t this_ptr, int64_t val) {
54060         LDKChannelTransactionParameters this_ptr_conv;
54061         this_ptr_conv.inner = untag_ptr(this_ptr);
54062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54064         this_ptr_conv.is_owned = false;
54065         LDKCounterpartyChannelTransactionParameters val_conv;
54066         val_conv.inner = untag_ptr(val);
54067         val_conv.is_owned = ptr_is_owned(val);
54068         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54069         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
54070         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
54071 }
54072
54073 int64_t  CS_LDK_ChannelTransactionParameters_get_funding_outpoint(int64_t this_ptr) {
54074         LDKChannelTransactionParameters this_ptr_conv;
54075         this_ptr_conv.inner = untag_ptr(this_ptr);
54076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54078         this_ptr_conv.is_owned = false;
54079         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
54080         int64_t ret_ref = 0;
54081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54083         return ret_ref;
54084 }
54085
54086 void  CS_LDK_ChannelTransactionParameters_set_funding_outpoint(int64_t this_ptr, int64_t val) {
54087         LDKChannelTransactionParameters this_ptr_conv;
54088         this_ptr_conv.inner = untag_ptr(this_ptr);
54089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54091         this_ptr_conv.is_owned = false;
54092         LDKOutPoint val_conv;
54093         val_conv.inner = untag_ptr(val);
54094         val_conv.is_owned = ptr_is_owned(val);
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54096         val_conv = OutPoint_clone(&val_conv);
54097         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
54098 }
54099
54100 int64_t  CS_LDK_ChannelTransactionParameters_get_channel_type_features(int64_t this_ptr) {
54101         LDKChannelTransactionParameters this_ptr_conv;
54102         this_ptr_conv.inner = untag_ptr(this_ptr);
54103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54105         this_ptr_conv.is_owned = false;
54106         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
54107         int64_t ret_ref = 0;
54108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54110         return ret_ref;
54111 }
54112
54113 void  CS_LDK_ChannelTransactionParameters_set_channel_type_features(int64_t this_ptr, int64_t val) {
54114         LDKChannelTransactionParameters this_ptr_conv;
54115         this_ptr_conv.inner = untag_ptr(this_ptr);
54116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54118         this_ptr_conv.is_owned = false;
54119         LDKChannelTypeFeatures val_conv;
54120         val_conv.inner = untag_ptr(val);
54121         val_conv.is_owned = ptr_is_owned(val);
54122         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54123         val_conv = ChannelTypeFeatures_clone(&val_conv);
54124         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
54125 }
54126
54127 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) {
54128         LDKChannelPublicKeys holder_pubkeys_arg_conv;
54129         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
54130         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
54131         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
54132         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
54133         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
54134         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
54135         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
54136         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
54137         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
54138         LDKOutPoint funding_outpoint_arg_conv;
54139         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
54140         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
54141         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
54142         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
54143         LDKChannelTypeFeatures channel_type_features_arg_conv;
54144         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
54145         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
54146         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
54147         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
54148         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);
54149         int64_t ret_ref = 0;
54150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54152         return ret_ref;
54153 }
54154
54155 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
54156         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
54157         int64_t ret_ref = 0;
54158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54160         return ret_ref;
54161 }
54162 int64_t  CS_LDK_ChannelTransactionParameters_clone_ptr(int64_t arg) {
54163         LDKChannelTransactionParameters arg_conv;
54164         arg_conv.inner = untag_ptr(arg);
54165         arg_conv.is_owned = ptr_is_owned(arg);
54166         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54167         arg_conv.is_owned = false;
54168         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
54169         return ret_conv;
54170 }
54171
54172 int64_t  CS_LDK_ChannelTransactionParameters_clone(int64_t orig) {
54173         LDKChannelTransactionParameters orig_conv;
54174         orig_conv.inner = untag_ptr(orig);
54175         orig_conv.is_owned = ptr_is_owned(orig);
54176         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54177         orig_conv.is_owned = false;
54178         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
54179         int64_t ret_ref = 0;
54180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54182         return ret_ref;
54183 }
54184
54185 int64_t  CS_LDK_ChannelTransactionParameters_hash(int64_t o) {
54186         LDKChannelTransactionParameters o_conv;
54187         o_conv.inner = untag_ptr(o);
54188         o_conv.is_owned = ptr_is_owned(o);
54189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54190         o_conv.is_owned = false;
54191         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
54192         return ret_conv;
54193 }
54194
54195 jboolean  CS_LDK_ChannelTransactionParameters_eq(int64_t a, int64_t b) {
54196         LDKChannelTransactionParameters a_conv;
54197         a_conv.inner = untag_ptr(a);
54198         a_conv.is_owned = ptr_is_owned(a);
54199         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54200         a_conv.is_owned = false;
54201         LDKChannelTransactionParameters b_conv;
54202         b_conv.inner = untag_ptr(b);
54203         b_conv.is_owned = ptr_is_owned(b);
54204         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54205         b_conv.is_owned = false;
54206         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
54207         return ret_conv;
54208 }
54209
54210 void  CS_LDK_CounterpartyChannelTransactionParameters_free(int64_t this_obj) {
54211         LDKCounterpartyChannelTransactionParameters this_obj_conv;
54212         this_obj_conv.inner = untag_ptr(this_obj);
54213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54215         CounterpartyChannelTransactionParameters_free(this_obj_conv);
54216 }
54217
54218 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_get_pubkeys(int64_t this_ptr) {
54219         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54220         this_ptr_conv.inner = untag_ptr(this_ptr);
54221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54223         this_ptr_conv.is_owned = false;
54224         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
54225         int64_t ret_ref = 0;
54226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54228         return ret_ref;
54229 }
54230
54231 void  CS_LDK_CounterpartyChannelTransactionParameters_set_pubkeys(int64_t this_ptr, int64_t val) {
54232         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54233         this_ptr_conv.inner = untag_ptr(this_ptr);
54234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54236         this_ptr_conv.is_owned = false;
54237         LDKChannelPublicKeys val_conv;
54238         val_conv.inner = untag_ptr(val);
54239         val_conv.is_owned = ptr_is_owned(val);
54240         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54241         val_conv = ChannelPublicKeys_clone(&val_conv);
54242         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
54243 }
54244
54245 int16_t  CS_LDK_CounterpartyChannelTransactionParameters_get_selected_contest_delay(int64_t this_ptr) {
54246         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54247         this_ptr_conv.inner = untag_ptr(this_ptr);
54248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54250         this_ptr_conv.is_owned = false;
54251         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
54252         return ret_conv;
54253 }
54254
54255 void  CS_LDK_CounterpartyChannelTransactionParameters_set_selected_contest_delay(int64_t this_ptr, int16_t val) {
54256         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
54257         this_ptr_conv.inner = untag_ptr(this_ptr);
54258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54260         this_ptr_conv.is_owned = false;
54261         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
54262 }
54263
54264 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_new(int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
54265         LDKChannelPublicKeys pubkeys_arg_conv;
54266         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
54267         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
54268         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
54269         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
54270         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
54271         int64_t ret_ref = 0;
54272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54274         return ret_ref;
54275 }
54276
54277 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
54278         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
54279         int64_t ret_ref = 0;
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54282         return ret_ref;
54283 }
54284 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone_ptr(int64_t arg) {
54285         LDKCounterpartyChannelTransactionParameters arg_conv;
54286         arg_conv.inner = untag_ptr(arg);
54287         arg_conv.is_owned = ptr_is_owned(arg);
54288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54289         arg_conv.is_owned = false;
54290         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
54291         return ret_conv;
54292 }
54293
54294 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone(int64_t orig) {
54295         LDKCounterpartyChannelTransactionParameters orig_conv;
54296         orig_conv.inner = untag_ptr(orig);
54297         orig_conv.is_owned = ptr_is_owned(orig);
54298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54299         orig_conv.is_owned = false;
54300         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
54301         int64_t ret_ref = 0;
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54304         return ret_ref;
54305 }
54306
54307 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_hash(int64_t o) {
54308         LDKCounterpartyChannelTransactionParameters o_conv;
54309         o_conv.inner = untag_ptr(o);
54310         o_conv.is_owned = ptr_is_owned(o);
54311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54312         o_conv.is_owned = false;
54313         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
54314         return ret_conv;
54315 }
54316
54317 jboolean  CS_LDK_CounterpartyChannelTransactionParameters_eq(int64_t a, int64_t b) {
54318         LDKCounterpartyChannelTransactionParameters a_conv;
54319         a_conv.inner = untag_ptr(a);
54320         a_conv.is_owned = ptr_is_owned(a);
54321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54322         a_conv.is_owned = false;
54323         LDKCounterpartyChannelTransactionParameters b_conv;
54324         b_conv.inner = untag_ptr(b);
54325         b_conv.is_owned = ptr_is_owned(b);
54326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54327         b_conv.is_owned = false;
54328         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
54329         return ret_conv;
54330 }
54331
54332 jboolean  CS_LDK_ChannelTransactionParameters_is_populated(int64_t this_arg) {
54333         LDKChannelTransactionParameters this_arg_conv;
54334         this_arg_conv.inner = untag_ptr(this_arg);
54335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54337         this_arg_conv.is_owned = false;
54338         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
54339         return ret_conv;
54340 }
54341
54342 int64_t  CS_LDK_ChannelTransactionParameters_as_holder_broadcastable(int64_t this_arg) {
54343         LDKChannelTransactionParameters this_arg_conv;
54344         this_arg_conv.inner = untag_ptr(this_arg);
54345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54347         this_arg_conv.is_owned = false;
54348         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
54349         int64_t ret_ref = 0;
54350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54352         return ret_ref;
54353 }
54354
54355 int64_t  CS_LDK_ChannelTransactionParameters_as_counterparty_broadcastable(int64_t this_arg) {
54356         LDKChannelTransactionParameters this_arg_conv;
54357         this_arg_conv.inner = untag_ptr(this_arg);
54358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54360         this_arg_conv.is_owned = false;
54361         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
54362         int64_t ret_ref = 0;
54363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54365         return ret_ref;
54366 }
54367
54368 int8_tArray  CS_LDK_CounterpartyChannelTransactionParameters_write(int64_t obj) {
54369         LDKCounterpartyChannelTransactionParameters obj_conv;
54370         obj_conv.inner = untag_ptr(obj);
54371         obj_conv.is_owned = ptr_is_owned(obj);
54372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54373         obj_conv.is_owned = false;
54374         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
54375         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54376         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54377         CVec_u8Z_free(ret_var);
54378         return ret_arr;
54379 }
54380
54381 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
54382         LDKu8slice ser_ref;
54383         ser_ref.datalen = ser->arr_len;
54384         ser_ref.data = ser->elems;
54385         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
54386         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
54387         FREE(ser);
54388         return tag_ptr(ret_conv, true);
54389 }
54390
54391 int8_tArray  CS_LDK_ChannelTransactionParameters_write(int64_t obj) {
54392         LDKChannelTransactionParameters obj_conv;
54393         obj_conv.inner = untag_ptr(obj);
54394         obj_conv.is_owned = ptr_is_owned(obj);
54395         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54396         obj_conv.is_owned = false;
54397         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
54398         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54399         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54400         CVec_u8Z_free(ret_var);
54401         return ret_arr;
54402 }
54403
54404 int64_t  CS_LDK_ChannelTransactionParameters_read(int8_tArray ser) {
54405         LDKu8slice ser_ref;
54406         ser_ref.datalen = ser->arr_len;
54407         ser_ref.data = ser->elems;
54408         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
54409         *ret_conv = ChannelTransactionParameters_read(ser_ref);
54410         FREE(ser);
54411         return tag_ptr(ret_conv, true);
54412 }
54413
54414 void  CS_LDK_DirectedChannelTransactionParameters_free(int64_t this_obj) {
54415         LDKDirectedChannelTransactionParameters this_obj_conv;
54416         this_obj_conv.inner = untag_ptr(this_obj);
54417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54419         DirectedChannelTransactionParameters_free(this_obj_conv);
54420 }
54421
54422 int64_t  CS_LDK_DirectedChannelTransactionParameters_broadcaster_pubkeys(int64_t this_arg) {
54423         LDKDirectedChannelTransactionParameters this_arg_conv;
54424         this_arg_conv.inner = untag_ptr(this_arg);
54425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54427         this_arg_conv.is_owned = false;
54428         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
54429         int64_t ret_ref = 0;
54430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54432         return ret_ref;
54433 }
54434
54435 int64_t  CS_LDK_DirectedChannelTransactionParameters_countersignatory_pubkeys(int64_t this_arg) {
54436         LDKDirectedChannelTransactionParameters this_arg_conv;
54437         this_arg_conv.inner = untag_ptr(this_arg);
54438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54440         this_arg_conv.is_owned = false;
54441         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
54442         int64_t ret_ref = 0;
54443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54445         return ret_ref;
54446 }
54447
54448 int16_t  CS_LDK_DirectedChannelTransactionParameters_contest_delay(int64_t this_arg) {
54449         LDKDirectedChannelTransactionParameters this_arg_conv;
54450         this_arg_conv.inner = untag_ptr(this_arg);
54451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54453         this_arg_conv.is_owned = false;
54454         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
54455         return ret_conv;
54456 }
54457
54458 jboolean  CS_LDK_DirectedChannelTransactionParameters_is_outbound(int64_t this_arg) {
54459         LDKDirectedChannelTransactionParameters this_arg_conv;
54460         this_arg_conv.inner = untag_ptr(this_arg);
54461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54463         this_arg_conv.is_owned = false;
54464         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
54465         return ret_conv;
54466 }
54467
54468 int64_t  CS_LDK_DirectedChannelTransactionParameters_funding_outpoint(int64_t this_arg) {
54469         LDKDirectedChannelTransactionParameters this_arg_conv;
54470         this_arg_conv.inner = untag_ptr(this_arg);
54471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54473         this_arg_conv.is_owned = false;
54474         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
54475         int64_t ret_ref = 0;
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54478         return ret_ref;
54479 }
54480
54481 int64_t  CS_LDK_DirectedChannelTransactionParameters_channel_type_features(int64_t this_arg) {
54482         LDKDirectedChannelTransactionParameters this_arg_conv;
54483         this_arg_conv.inner = untag_ptr(this_arg);
54484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54486         this_arg_conv.is_owned = false;
54487         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
54488         int64_t ret_ref = 0;
54489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54491         return ret_ref;
54492 }
54493
54494 void  CS_LDK_HolderCommitmentTransaction_free(int64_t this_obj) {
54495         LDKHolderCommitmentTransaction this_obj_conv;
54496         this_obj_conv.inner = untag_ptr(this_obj);
54497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54499         HolderCommitmentTransaction_free(this_obj_conv);
54500 }
54501
54502 int8_tArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_sig(int64_t this_ptr) {
54503         LDKHolderCommitmentTransaction this_ptr_conv;
54504         this_ptr_conv.inner = untag_ptr(this_ptr);
54505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54507         this_ptr_conv.is_owned = false;
54508         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54509         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
54510         return ret_arr;
54511 }
54512
54513 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
54514         LDKHolderCommitmentTransaction this_ptr_conv;
54515         this_ptr_conv.inner = untag_ptr(this_ptr);
54516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54518         this_ptr_conv.is_owned = false;
54519         LDKECDSASignature val_ref;
54520         CHECK(val->arr_len == 64);
54521         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54522         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
54523 }
54524
54525 ptrArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_htlc_sigs(int64_t this_ptr) {
54526         LDKHolderCommitmentTransaction this_ptr_conv;
54527         this_ptr_conv.inner = untag_ptr(this_ptr);
54528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54530         this_ptr_conv.is_owned = false;
54531         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
54532         ptrArray ret_arr = NULL;
54533         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
54534         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
54535         for (size_t i = 0; i < ret_var.datalen; i++) {
54536                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
54537                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
54538                 ret_arr_ptr[i] = ret_conv_8_arr;
54539         }
54540         
54541         FREE(ret_var.data);
54542         return ret_arr;
54543 }
54544
54545 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_htlc_sigs(int64_t this_ptr, ptrArray val) {
54546         LDKHolderCommitmentTransaction this_ptr_conv;
54547         this_ptr_conv.inner = untag_ptr(this_ptr);
54548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54550         this_ptr_conv.is_owned = false;
54551         LDKCVec_ECDSASignatureZ val_constr;
54552         val_constr.datalen = val->arr_len;
54553         if (val_constr.datalen > 0)
54554                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54555         else
54556                 val_constr.data = NULL;
54557         int8_tArray* val_vals = (void*) val->elems;
54558         for (size_t i = 0; i < val_constr.datalen; i++) {
54559                 int8_tArray val_conv_8 = val_vals[i];
54560                 LDKECDSASignature val_conv_8_ref;
54561                 CHECK(val_conv_8->arr_len == 64);
54562                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
54563                 val_constr.data[i] = val_conv_8_ref;
54564         }
54565         FREE(val);
54566         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
54567 }
54568
54569 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
54570         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
54571         int64_t ret_ref = 0;
54572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54574         return ret_ref;
54575 }
54576 int64_t  CS_LDK_HolderCommitmentTransaction_clone_ptr(int64_t arg) {
54577         LDKHolderCommitmentTransaction arg_conv;
54578         arg_conv.inner = untag_ptr(arg);
54579         arg_conv.is_owned = ptr_is_owned(arg);
54580         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54581         arg_conv.is_owned = false;
54582         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
54583         return ret_conv;
54584 }
54585
54586 int64_t  CS_LDK_HolderCommitmentTransaction_clone(int64_t orig) {
54587         LDKHolderCommitmentTransaction orig_conv;
54588         orig_conv.inner = untag_ptr(orig);
54589         orig_conv.is_owned = ptr_is_owned(orig);
54590         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54591         orig_conv.is_owned = false;
54592         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
54593         int64_t ret_ref = 0;
54594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54596         return ret_ref;
54597 }
54598
54599 int8_tArray  CS_LDK_HolderCommitmentTransaction_write(int64_t obj) {
54600         LDKHolderCommitmentTransaction obj_conv;
54601         obj_conv.inner = untag_ptr(obj);
54602         obj_conv.is_owned = ptr_is_owned(obj);
54603         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54604         obj_conv.is_owned = false;
54605         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
54606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54608         CVec_u8Z_free(ret_var);
54609         return ret_arr;
54610 }
54611
54612 int64_t  CS_LDK_HolderCommitmentTransaction_read(int8_tArray ser) {
54613         LDKu8slice ser_ref;
54614         ser_ref.datalen = ser->arr_len;
54615         ser_ref.data = ser->elems;
54616         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
54617         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
54618         FREE(ser);
54619         return tag_ptr(ret_conv, true);
54620 }
54621
54622 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) {
54623         LDKCommitmentTransaction commitment_tx_conv;
54624         commitment_tx_conv.inner = untag_ptr(commitment_tx);
54625         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
54626         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
54627         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
54628         LDKECDSASignature counterparty_sig_ref;
54629         CHECK(counterparty_sig->arr_len == 64);
54630         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
54631         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
54632         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
54633         if (counterparty_htlc_sigs_constr.datalen > 0)
54634                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
54635         else
54636                 counterparty_htlc_sigs_constr.data = NULL;
54637         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
54638         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
54639                 int8_tArray counterparty_htlc_sigs_conv_8 = counterparty_htlc_sigs_vals[i];
54640                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
54641                 CHECK(counterparty_htlc_sigs_conv_8->arr_len == 64);
54642                 memcpy(counterparty_htlc_sigs_conv_8_ref.compact_form, counterparty_htlc_sigs_conv_8->elems, 64); FREE(counterparty_htlc_sigs_conv_8);
54643                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
54644         }
54645         FREE(counterparty_htlc_sigs);
54646         LDKPublicKey holder_funding_key_ref;
54647         CHECK(holder_funding_key->arr_len == 33);
54648         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
54649         LDKPublicKey counterparty_funding_key_ref;
54650         CHECK(counterparty_funding_key->arr_len == 33);
54651         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
54652         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
54653         int64_t ret_ref = 0;
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54656         return ret_ref;
54657 }
54658
54659 void  CS_LDK_BuiltCommitmentTransaction_free(int64_t this_obj) {
54660         LDKBuiltCommitmentTransaction this_obj_conv;
54661         this_obj_conv.inner = untag_ptr(this_obj);
54662         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54664         BuiltCommitmentTransaction_free(this_obj_conv);
54665 }
54666
54667 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_transaction(int64_t this_ptr) {
54668         LDKBuiltCommitmentTransaction this_ptr_conv;
54669         this_ptr_conv.inner = untag_ptr(this_ptr);
54670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54672         this_ptr_conv.is_owned = false;
54673         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
54674         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54675         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54676         Transaction_free(ret_var);
54677         return ret_arr;
54678 }
54679
54680 void  CS_LDK_BuiltCommitmentTransaction_set_transaction(int64_t this_ptr, int8_tArray val) {
54681         LDKBuiltCommitmentTransaction this_ptr_conv;
54682         this_ptr_conv.inner = untag_ptr(this_ptr);
54683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54685         this_ptr_conv.is_owned = false;
54686         LDKTransaction val_ref;
54687         val_ref.datalen = val->arr_len;
54688         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
54689         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54690         val_ref.data_is_owned = true;
54691         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
54692 }
54693
54694 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_txid(int64_t this_ptr) {
54695         LDKBuiltCommitmentTransaction this_ptr_conv;
54696         this_ptr_conv.inner = untag_ptr(this_ptr);
54697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54699         this_ptr_conv.is_owned = false;
54700         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54701         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
54702         return ret_arr;
54703 }
54704
54705 void  CS_LDK_BuiltCommitmentTransaction_set_txid(int64_t this_ptr, int8_tArray val) {
54706         LDKBuiltCommitmentTransaction this_ptr_conv;
54707         this_ptr_conv.inner = untag_ptr(this_ptr);
54708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54710         this_ptr_conv.is_owned = false;
54711         LDKThirtyTwoBytes val_ref;
54712         CHECK(val->arr_len == 32);
54713         memcpy(val_ref.data, val->elems, 32); FREE(val);
54714         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
54715 }
54716
54717 int64_t  CS_LDK_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
54718         LDKTransaction transaction_arg_ref;
54719         transaction_arg_ref.datalen = transaction_arg->arr_len;
54720         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
54721         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
54722         transaction_arg_ref.data_is_owned = true;
54723         LDKThirtyTwoBytes txid_arg_ref;
54724         CHECK(txid_arg->arr_len == 32);
54725         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
54726         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
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 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
54734         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
54735         int64_t ret_ref = 0;
54736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54738         return ret_ref;
54739 }
54740 int64_t  CS_LDK_BuiltCommitmentTransaction_clone_ptr(int64_t arg) {
54741         LDKBuiltCommitmentTransaction arg_conv;
54742         arg_conv.inner = untag_ptr(arg);
54743         arg_conv.is_owned = ptr_is_owned(arg);
54744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54745         arg_conv.is_owned = false;
54746         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
54747         return ret_conv;
54748 }
54749
54750 int64_t  CS_LDK_BuiltCommitmentTransaction_clone(int64_t orig) {
54751         LDKBuiltCommitmentTransaction orig_conv;
54752         orig_conv.inner = untag_ptr(orig);
54753         orig_conv.is_owned = ptr_is_owned(orig);
54754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54755         orig_conv.is_owned = false;
54756         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
54757         int64_t ret_ref = 0;
54758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54760         return ret_ref;
54761 }
54762
54763 int8_tArray  CS_LDK_BuiltCommitmentTransaction_write(int64_t obj) {
54764         LDKBuiltCommitmentTransaction obj_conv;
54765         obj_conv.inner = untag_ptr(obj);
54766         obj_conv.is_owned = ptr_is_owned(obj);
54767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54768         obj_conv.is_owned = false;
54769         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
54770         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54771         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54772         CVec_u8Z_free(ret_var);
54773         return ret_arr;
54774 }
54775
54776 int64_t  CS_LDK_BuiltCommitmentTransaction_read(int8_tArray ser) {
54777         LDKu8slice ser_ref;
54778         ser_ref.datalen = ser->arr_len;
54779         ser_ref.data = ser->elems;
54780         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
54781         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
54782         FREE(ser);
54783         return tag_ptr(ret_conv, true);
54784 }
54785
54786 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
54787         LDKBuiltCommitmentTransaction this_arg_conv;
54788         this_arg_conv.inner = untag_ptr(this_arg);
54789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54791         this_arg_conv.is_owned = false;
54792         LDKu8slice funding_redeemscript_ref;
54793         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54794         funding_redeemscript_ref.data = funding_redeemscript->elems;
54795         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54796         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
54797         FREE(funding_redeemscript);
54798         return ret_arr;
54799 }
54800
54801 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) {
54802         LDKBuiltCommitmentTransaction this_arg_conv;
54803         this_arg_conv.inner = untag_ptr(this_arg);
54804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54806         this_arg_conv.is_owned = false;
54807         uint8_t funding_key_arr[32];
54808         CHECK(funding_key->arr_len == 32);
54809         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54810         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54811         LDKu8slice funding_redeemscript_ref;
54812         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54813         funding_redeemscript_ref.data = funding_redeemscript->elems;
54814         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54815         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
54816         FREE(funding_redeemscript);
54817         return ret_arr;
54818 }
54819
54820 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) {
54821         LDKBuiltCommitmentTransaction this_arg_conv;
54822         this_arg_conv.inner = untag_ptr(this_arg);
54823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54825         this_arg_conv.is_owned = false;
54826         uint8_t funding_key_arr[32];
54827         CHECK(funding_key->arr_len == 32);
54828         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
54829         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
54830         LDKu8slice funding_redeemscript_ref;
54831         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
54832         funding_redeemscript_ref.data = funding_redeemscript->elems;
54833         void* entropy_source_ptr = untag_ptr(entropy_source);
54834         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
54835         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
54836         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54837         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);
54838         FREE(funding_redeemscript);
54839         return ret_arr;
54840 }
54841
54842 void  CS_LDK_ClosingTransaction_free(int64_t this_obj) {
54843         LDKClosingTransaction this_obj_conv;
54844         this_obj_conv.inner = untag_ptr(this_obj);
54845         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54847         ClosingTransaction_free(this_obj_conv);
54848 }
54849
54850 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
54851         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
54852         int64_t ret_ref = 0;
54853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54855         return ret_ref;
54856 }
54857 int64_t  CS_LDK_ClosingTransaction_clone_ptr(int64_t arg) {
54858         LDKClosingTransaction arg_conv;
54859         arg_conv.inner = untag_ptr(arg);
54860         arg_conv.is_owned = ptr_is_owned(arg);
54861         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54862         arg_conv.is_owned = false;
54863         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
54864         return ret_conv;
54865 }
54866
54867 int64_t  CS_LDK_ClosingTransaction_clone(int64_t orig) {
54868         LDKClosingTransaction orig_conv;
54869         orig_conv.inner = untag_ptr(orig);
54870         orig_conv.is_owned = ptr_is_owned(orig);
54871         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54872         orig_conv.is_owned = false;
54873         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
54874         int64_t ret_ref = 0;
54875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54877         return ret_ref;
54878 }
54879
54880 int64_t  CS_LDK_ClosingTransaction_hash(int64_t o) {
54881         LDKClosingTransaction o_conv;
54882         o_conv.inner = untag_ptr(o);
54883         o_conv.is_owned = ptr_is_owned(o);
54884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54885         o_conv.is_owned = false;
54886         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
54887         return ret_conv;
54888 }
54889
54890 jboolean  CS_LDK_ClosingTransaction_eq(int64_t a, int64_t b) {
54891         LDKClosingTransaction a_conv;
54892         a_conv.inner = untag_ptr(a);
54893         a_conv.is_owned = ptr_is_owned(a);
54894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54895         a_conv.is_owned = false;
54896         LDKClosingTransaction b_conv;
54897         b_conv.inner = untag_ptr(b);
54898         b_conv.is_owned = ptr_is_owned(b);
54899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54900         b_conv.is_owned = false;
54901         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
54902         return ret_conv;
54903 }
54904
54905 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) {
54906         LDKCVec_u8Z to_holder_script_ref;
54907         to_holder_script_ref.datalen = to_holder_script->arr_len;
54908         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
54909         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
54910         LDKCVec_u8Z to_counterparty_script_ref;
54911         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
54912         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
54913         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
54914         LDKOutPoint funding_outpoint_conv;
54915         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54916         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54917         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54918         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54919         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
54920         int64_t ret_ref = 0;
54921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54923         return ret_ref;
54924 }
54925
54926 int64_t  CS_LDK_ClosingTransaction_trust(int64_t this_arg) {
54927         LDKClosingTransaction this_arg_conv;
54928         this_arg_conv.inner = untag_ptr(this_arg);
54929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54931         this_arg_conv.is_owned = false;
54932         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
54933         int64_t ret_ref = 0;
54934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54936         return ret_ref;
54937 }
54938
54939 int64_t  CS_LDK_ClosingTransaction_verify(int64_t this_arg, int64_t funding_outpoint) {
54940         LDKClosingTransaction this_arg_conv;
54941         this_arg_conv.inner = untag_ptr(this_arg);
54942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54944         this_arg_conv.is_owned = false;
54945         LDKOutPoint funding_outpoint_conv;
54946         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
54947         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
54948         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
54949         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
54950         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
54951         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
54952         return tag_ptr(ret_conv, true);
54953 }
54954
54955 int64_t  CS_LDK_ClosingTransaction_to_holder_value_sat(int64_t this_arg) {
54956         LDKClosingTransaction this_arg_conv;
54957         this_arg_conv.inner = untag_ptr(this_arg);
54958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54960         this_arg_conv.is_owned = false;
54961         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
54962         return ret_conv;
54963 }
54964
54965 int64_t  CS_LDK_ClosingTransaction_to_counterparty_value_sat(int64_t this_arg) {
54966         LDKClosingTransaction this_arg_conv;
54967         this_arg_conv.inner = untag_ptr(this_arg);
54968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54970         this_arg_conv.is_owned = false;
54971         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
54972         return ret_conv;
54973 }
54974
54975 int8_tArray  CS_LDK_ClosingTransaction_to_holder_script(int64_t this_arg) {
54976         LDKClosingTransaction this_arg_conv;
54977         this_arg_conv.inner = untag_ptr(this_arg);
54978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54980         this_arg_conv.is_owned = false;
54981         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
54982         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54983         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54984         return ret_arr;
54985 }
54986
54987 int8_tArray  CS_LDK_ClosingTransaction_to_counterparty_script(int64_t this_arg) {
54988         LDKClosingTransaction this_arg_conv;
54989         this_arg_conv.inner = untag_ptr(this_arg);
54990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54992         this_arg_conv.is_owned = false;
54993         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
54994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54996         return ret_arr;
54997 }
54998
54999 void  CS_LDK_TrustedClosingTransaction_free(int64_t this_obj) {
55000         LDKTrustedClosingTransaction this_obj_conv;
55001         this_obj_conv.inner = untag_ptr(this_obj);
55002         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55004         TrustedClosingTransaction_free(this_obj_conv);
55005 }
55006
55007 int8_tArray  CS_LDK_TrustedClosingTransaction_built_transaction(int64_t this_arg) {
55008         LDKTrustedClosingTransaction this_arg_conv;
55009         this_arg_conv.inner = untag_ptr(this_arg);
55010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55012         this_arg_conv.is_owned = false;
55013         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
55014         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55015         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55016         Transaction_free(ret_var);
55017         return ret_arr;
55018 }
55019
55020 int8_tArray  CS_LDK_TrustedClosingTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
55021         LDKTrustedClosingTransaction this_arg_conv;
55022         this_arg_conv.inner = untag_ptr(this_arg);
55023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55025         this_arg_conv.is_owned = false;
55026         LDKu8slice funding_redeemscript_ref;
55027         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
55028         funding_redeemscript_ref.data = funding_redeemscript->elems;
55029         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55030         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
55031         FREE(funding_redeemscript);
55032         return ret_arr;
55033 }
55034
55035 int8_tArray  CS_LDK_TrustedClosingTransaction_sign(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
55036         LDKTrustedClosingTransaction this_arg_conv;
55037         this_arg_conv.inner = untag_ptr(this_arg);
55038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55040         this_arg_conv.is_owned = false;
55041         uint8_t funding_key_arr[32];
55042         CHECK(funding_key->arr_len == 32);
55043         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
55044         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
55045         LDKu8slice funding_redeemscript_ref;
55046         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
55047         funding_redeemscript_ref.data = funding_redeemscript->elems;
55048         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
55049         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
55050         FREE(funding_redeemscript);
55051         return ret_arr;
55052 }
55053
55054 void  CS_LDK_CommitmentTransaction_free(int64_t this_obj) {
55055         LDKCommitmentTransaction this_obj_conv;
55056         this_obj_conv.inner = untag_ptr(this_obj);
55057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55059         CommitmentTransaction_free(this_obj_conv);
55060 }
55061
55062 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
55063         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
55064         int64_t ret_ref = 0;
55065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55067         return ret_ref;
55068 }
55069 int64_t  CS_LDK_CommitmentTransaction_clone_ptr(int64_t arg) {
55070         LDKCommitmentTransaction arg_conv;
55071         arg_conv.inner = untag_ptr(arg);
55072         arg_conv.is_owned = ptr_is_owned(arg);
55073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55074         arg_conv.is_owned = false;
55075         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
55076         return ret_conv;
55077 }
55078
55079 int64_t  CS_LDK_CommitmentTransaction_clone(int64_t orig) {
55080         LDKCommitmentTransaction orig_conv;
55081         orig_conv.inner = untag_ptr(orig);
55082         orig_conv.is_owned = ptr_is_owned(orig);
55083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55084         orig_conv.is_owned = false;
55085         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
55086         int64_t ret_ref = 0;
55087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55089         return ret_ref;
55090 }
55091
55092 int8_tArray  CS_LDK_CommitmentTransaction_write(int64_t obj) {
55093         LDKCommitmentTransaction obj_conv;
55094         obj_conv.inner = untag_ptr(obj);
55095         obj_conv.is_owned = ptr_is_owned(obj);
55096         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55097         obj_conv.is_owned = false;
55098         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
55099         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55100         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55101         CVec_u8Z_free(ret_var);
55102         return ret_arr;
55103 }
55104
55105 int64_t  CS_LDK_CommitmentTransaction_read(int8_tArray ser) {
55106         LDKu8slice ser_ref;
55107         ser_ref.datalen = ser->arr_len;
55108         ser_ref.data = ser->elems;
55109         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
55110         *ret_conv = CommitmentTransaction_read(ser_ref);
55111         FREE(ser);
55112         return tag_ptr(ret_conv, true);
55113 }
55114
55115 int64_t  CS_LDK_CommitmentTransaction_commitment_number(int64_t this_arg) {
55116         LDKCommitmentTransaction this_arg_conv;
55117         this_arg_conv.inner = untag_ptr(this_arg);
55118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55120         this_arg_conv.is_owned = false;
55121         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
55122         return ret_conv;
55123 }
55124
55125 int8_tArray  CS_LDK_CommitmentTransaction_per_commitment_point(int64_t this_arg) {
55126         LDKCommitmentTransaction this_arg_conv;
55127         this_arg_conv.inner = untag_ptr(this_arg);
55128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55130         this_arg_conv.is_owned = false;
55131         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55132         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
55133         return ret_arr;
55134 }
55135
55136 int64_t  CS_LDK_CommitmentTransaction_to_broadcaster_value_sat(int64_t this_arg) {
55137         LDKCommitmentTransaction this_arg_conv;
55138         this_arg_conv.inner = untag_ptr(this_arg);
55139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55141         this_arg_conv.is_owned = false;
55142         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
55143         return ret_conv;
55144 }
55145
55146 int64_t  CS_LDK_CommitmentTransaction_to_countersignatory_value_sat(int64_t this_arg) {
55147         LDKCommitmentTransaction this_arg_conv;
55148         this_arg_conv.inner = untag_ptr(this_arg);
55149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55151         this_arg_conv.is_owned = false;
55152         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
55153         return ret_conv;
55154 }
55155
55156 int32_t  CS_LDK_CommitmentTransaction_feerate_per_kw(int64_t this_arg) {
55157         LDKCommitmentTransaction this_arg_conv;
55158         this_arg_conv.inner = untag_ptr(this_arg);
55159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55161         this_arg_conv.is_owned = false;
55162         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
55163         return ret_conv;
55164 }
55165
55166 int64_t  CS_LDK_CommitmentTransaction_trust(int64_t this_arg) {
55167         LDKCommitmentTransaction this_arg_conv;
55168         this_arg_conv.inner = untag_ptr(this_arg);
55169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55171         this_arg_conv.is_owned = false;
55172         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
55173         int64_t ret_ref = 0;
55174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55176         return ret_ref;
55177 }
55178
55179 int64_t  CS_LDK_CommitmentTransaction_verify(int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
55180         LDKCommitmentTransaction this_arg_conv;
55181         this_arg_conv.inner = untag_ptr(this_arg);
55182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55184         this_arg_conv.is_owned = false;
55185         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55186         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55187         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55188         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55189         channel_parameters_conv.is_owned = false;
55190         LDKChannelPublicKeys broadcaster_keys_conv;
55191         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
55192         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
55193         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
55194         broadcaster_keys_conv.is_owned = false;
55195         LDKChannelPublicKeys countersignatory_keys_conv;
55196         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
55197         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
55198         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
55199         countersignatory_keys_conv.is_owned = false;
55200         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
55201         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
55202         return tag_ptr(ret_conv, true);
55203 }
55204
55205 void  CS_LDK_TrustedCommitmentTransaction_free(int64_t this_obj) {
55206         LDKTrustedCommitmentTransaction this_obj_conv;
55207         this_obj_conv.inner = untag_ptr(this_obj);
55208         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55210         TrustedCommitmentTransaction_free(this_obj_conv);
55211 }
55212
55213 int8_tArray  CS_LDK_TrustedCommitmentTransaction_txid(int64_t this_arg) {
55214         LDKTrustedCommitmentTransaction this_arg_conv;
55215         this_arg_conv.inner = untag_ptr(this_arg);
55216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55218         this_arg_conv.is_owned = false;
55219         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55220         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
55221         return ret_arr;
55222 }
55223
55224 int64_t  CS_LDK_TrustedCommitmentTransaction_built_transaction(int64_t this_arg) {
55225         LDKTrustedCommitmentTransaction this_arg_conv;
55226         this_arg_conv.inner = untag_ptr(this_arg);
55227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55229         this_arg_conv.is_owned = false;
55230         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
55231         int64_t ret_ref = 0;
55232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55234         return ret_ref;
55235 }
55236
55237 int64_t  CS_LDK_TrustedCommitmentTransaction_keys(int64_t this_arg) {
55238         LDKTrustedCommitmentTransaction this_arg_conv;
55239         this_arg_conv.inner = untag_ptr(this_arg);
55240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55242         this_arg_conv.is_owned = false;
55243         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
55244         int64_t ret_ref = 0;
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55247         return ret_ref;
55248 }
55249
55250 int64_t  CS_LDK_TrustedCommitmentTransaction_channel_type_features(int64_t this_arg) {
55251         LDKTrustedCommitmentTransaction this_arg_conv;
55252         this_arg_conv.inner = untag_ptr(this_arg);
55253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55255         this_arg_conv.is_owned = false;
55256         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
55257         int64_t ret_ref = 0;
55258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55260         return ret_ref;
55261 }
55262
55263 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) {
55264         LDKTrustedCommitmentTransaction this_arg_conv;
55265         this_arg_conv.inner = untag_ptr(this_arg);
55266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55268         this_arg_conv.is_owned = false;
55269         uint8_t htlc_base_key_arr[32];
55270         CHECK(htlc_base_key->arr_len == 32);
55271         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
55272         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
55273         LDKDirectedChannelTransactionParameters channel_parameters_conv;
55274         channel_parameters_conv.inner = untag_ptr(channel_parameters);
55275         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
55276         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
55277         channel_parameters_conv.is_owned = false;
55278         void* entropy_source_ptr = untag_ptr(entropy_source);
55279         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
55280         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
55281         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
55282         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
55283         return tag_ptr(ret_conv, true);
55284 }
55285
55286 int64_t  CS_LDK_TrustedCommitmentTransaction_revokeable_output_index(int64_t this_arg) {
55287         LDKTrustedCommitmentTransaction this_arg_conv;
55288         this_arg_conv.inner = untag_ptr(this_arg);
55289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55291         this_arg_conv.is_owned = false;
55292         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
55293         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
55294         int64_t ret_ref = tag_ptr(ret_copy, true);
55295         return ret_ref;
55296 }
55297
55298 int64_t  CS_LDK_TrustedCommitmentTransaction_build_to_local_justice_tx(int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
55299         LDKTrustedCommitmentTransaction this_arg_conv;
55300         this_arg_conv.inner = untag_ptr(this_arg);
55301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55303         this_arg_conv.is_owned = false;
55304         LDKCVec_u8Z destination_script_ref;
55305         destination_script_ref.datalen = destination_script->arr_len;
55306         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
55307         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
55308         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
55309         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
55310         return tag_ptr(ret_conv, true);
55311 }
55312
55313 int64_t  CS_LDK_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
55314         LDKPublicKey broadcaster_payment_basepoint_ref;
55315         CHECK(broadcaster_payment_basepoint->arr_len == 33);
55316         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
55317         LDKPublicKey countersignatory_payment_basepoint_ref;
55318         CHECK(countersignatory_payment_basepoint->arr_len == 33);
55319         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
55320         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
55321         return ret_conv;
55322 }
55323
55324 jboolean  CS_LDK_InitFeatures_eq(int64_t a, int64_t b) {
55325         LDKInitFeatures a_conv;
55326         a_conv.inner = untag_ptr(a);
55327         a_conv.is_owned = ptr_is_owned(a);
55328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55329         a_conv.is_owned = false;
55330         LDKInitFeatures b_conv;
55331         b_conv.inner = untag_ptr(b);
55332         b_conv.is_owned = ptr_is_owned(b);
55333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55334         b_conv.is_owned = false;
55335         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
55336         return ret_conv;
55337 }
55338
55339 jboolean  CS_LDK_NodeFeatures_eq(int64_t a, int64_t b) {
55340         LDKNodeFeatures a_conv;
55341         a_conv.inner = untag_ptr(a);
55342         a_conv.is_owned = ptr_is_owned(a);
55343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55344         a_conv.is_owned = false;
55345         LDKNodeFeatures b_conv;
55346         b_conv.inner = untag_ptr(b);
55347         b_conv.is_owned = ptr_is_owned(b);
55348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55349         b_conv.is_owned = false;
55350         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
55351         return ret_conv;
55352 }
55353
55354 jboolean  CS_LDK_ChannelFeatures_eq(int64_t a, int64_t b) {
55355         LDKChannelFeatures a_conv;
55356         a_conv.inner = untag_ptr(a);
55357         a_conv.is_owned = ptr_is_owned(a);
55358         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55359         a_conv.is_owned = false;
55360         LDKChannelFeatures b_conv;
55361         b_conv.inner = untag_ptr(b);
55362         b_conv.is_owned = ptr_is_owned(b);
55363         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55364         b_conv.is_owned = false;
55365         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
55366         return ret_conv;
55367 }
55368
55369 jboolean  CS_LDK_Bolt11InvoiceFeatures_eq(int64_t a, int64_t b) {
55370         LDKBolt11InvoiceFeatures a_conv;
55371         a_conv.inner = untag_ptr(a);
55372         a_conv.is_owned = ptr_is_owned(a);
55373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55374         a_conv.is_owned = false;
55375         LDKBolt11InvoiceFeatures b_conv;
55376         b_conv.inner = untag_ptr(b);
55377         b_conv.is_owned = ptr_is_owned(b);
55378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55379         b_conv.is_owned = false;
55380         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
55381         return ret_conv;
55382 }
55383
55384 jboolean  CS_LDK_OfferFeatures_eq(int64_t a, int64_t b) {
55385         LDKOfferFeatures a_conv;
55386         a_conv.inner = untag_ptr(a);
55387         a_conv.is_owned = ptr_is_owned(a);
55388         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55389         a_conv.is_owned = false;
55390         LDKOfferFeatures b_conv;
55391         b_conv.inner = untag_ptr(b);
55392         b_conv.is_owned = ptr_is_owned(b);
55393         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55394         b_conv.is_owned = false;
55395         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
55396         return ret_conv;
55397 }
55398
55399 jboolean  CS_LDK_InvoiceRequestFeatures_eq(int64_t a, int64_t b) {
55400         LDKInvoiceRequestFeatures a_conv;
55401         a_conv.inner = untag_ptr(a);
55402         a_conv.is_owned = ptr_is_owned(a);
55403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55404         a_conv.is_owned = false;
55405         LDKInvoiceRequestFeatures b_conv;
55406         b_conv.inner = untag_ptr(b);
55407         b_conv.is_owned = ptr_is_owned(b);
55408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55409         b_conv.is_owned = false;
55410         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
55411         return ret_conv;
55412 }
55413
55414 jboolean  CS_LDK_Bolt12InvoiceFeatures_eq(int64_t a, int64_t b) {
55415         LDKBolt12InvoiceFeatures a_conv;
55416         a_conv.inner = untag_ptr(a);
55417         a_conv.is_owned = ptr_is_owned(a);
55418         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55419         a_conv.is_owned = false;
55420         LDKBolt12InvoiceFeatures b_conv;
55421         b_conv.inner = untag_ptr(b);
55422         b_conv.is_owned = ptr_is_owned(b);
55423         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55424         b_conv.is_owned = false;
55425         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
55426         return ret_conv;
55427 }
55428
55429 jboolean  CS_LDK_BlindedHopFeatures_eq(int64_t a, int64_t b) {
55430         LDKBlindedHopFeatures a_conv;
55431         a_conv.inner = untag_ptr(a);
55432         a_conv.is_owned = ptr_is_owned(a);
55433         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55434         a_conv.is_owned = false;
55435         LDKBlindedHopFeatures b_conv;
55436         b_conv.inner = untag_ptr(b);
55437         b_conv.is_owned = ptr_is_owned(b);
55438         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55439         b_conv.is_owned = false;
55440         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
55441         return ret_conv;
55442 }
55443
55444 jboolean  CS_LDK_ChannelTypeFeatures_eq(int64_t a, int64_t b) {
55445         LDKChannelTypeFeatures a_conv;
55446         a_conv.inner = untag_ptr(a);
55447         a_conv.is_owned = ptr_is_owned(a);
55448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55449         a_conv.is_owned = false;
55450         LDKChannelTypeFeatures b_conv;
55451         b_conv.inner = untag_ptr(b);
55452         b_conv.is_owned = ptr_is_owned(b);
55453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55454         b_conv.is_owned = false;
55455         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
55456         return ret_conv;
55457 }
55458
55459 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
55460         LDKInitFeatures ret_var = InitFeatures_clone(arg);
55461         int64_t ret_ref = 0;
55462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55464         return ret_ref;
55465 }
55466 int64_t  CS_LDK_InitFeatures_clone_ptr(int64_t arg) {
55467         LDKInitFeatures arg_conv;
55468         arg_conv.inner = untag_ptr(arg);
55469         arg_conv.is_owned = ptr_is_owned(arg);
55470         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55471         arg_conv.is_owned = false;
55472         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
55473         return ret_conv;
55474 }
55475
55476 int64_t  CS_LDK_InitFeatures_clone(int64_t orig) {
55477         LDKInitFeatures orig_conv;
55478         orig_conv.inner = untag_ptr(orig);
55479         orig_conv.is_owned = ptr_is_owned(orig);
55480         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55481         orig_conv.is_owned = false;
55482         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
55483         int64_t ret_ref = 0;
55484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55486         return ret_ref;
55487 }
55488
55489 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
55490         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
55491         int64_t ret_ref = 0;
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55494         return ret_ref;
55495 }
55496 int64_t  CS_LDK_NodeFeatures_clone_ptr(int64_t arg) {
55497         LDKNodeFeatures arg_conv;
55498         arg_conv.inner = untag_ptr(arg);
55499         arg_conv.is_owned = ptr_is_owned(arg);
55500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55501         arg_conv.is_owned = false;
55502         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
55503         return ret_conv;
55504 }
55505
55506 int64_t  CS_LDK_NodeFeatures_clone(int64_t orig) {
55507         LDKNodeFeatures orig_conv;
55508         orig_conv.inner = untag_ptr(orig);
55509         orig_conv.is_owned = ptr_is_owned(orig);
55510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55511         orig_conv.is_owned = false;
55512         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
55513         int64_t ret_ref = 0;
55514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55516         return ret_ref;
55517 }
55518
55519 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
55520         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
55521         int64_t ret_ref = 0;
55522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55524         return ret_ref;
55525 }
55526 int64_t  CS_LDK_ChannelFeatures_clone_ptr(int64_t arg) {
55527         LDKChannelFeatures arg_conv;
55528         arg_conv.inner = untag_ptr(arg);
55529         arg_conv.is_owned = ptr_is_owned(arg);
55530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55531         arg_conv.is_owned = false;
55532         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
55533         return ret_conv;
55534 }
55535
55536 int64_t  CS_LDK_ChannelFeatures_clone(int64_t orig) {
55537         LDKChannelFeatures orig_conv;
55538         orig_conv.inner = untag_ptr(orig);
55539         orig_conv.is_owned = ptr_is_owned(orig);
55540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55541         orig_conv.is_owned = false;
55542         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
55543         int64_t ret_ref = 0;
55544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55546         return ret_ref;
55547 }
55548
55549 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
55550         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
55551         int64_t ret_ref = 0;
55552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55554         return ret_ref;
55555 }
55556 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone_ptr(int64_t arg) {
55557         LDKBolt11InvoiceFeatures arg_conv;
55558         arg_conv.inner = untag_ptr(arg);
55559         arg_conv.is_owned = ptr_is_owned(arg);
55560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55561         arg_conv.is_owned = false;
55562         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
55563         return ret_conv;
55564 }
55565
55566 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone(int64_t orig) {
55567         LDKBolt11InvoiceFeatures orig_conv;
55568         orig_conv.inner = untag_ptr(orig);
55569         orig_conv.is_owned = ptr_is_owned(orig);
55570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55571         orig_conv.is_owned = false;
55572         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
55573         int64_t ret_ref = 0;
55574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55576         return ret_ref;
55577 }
55578
55579 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
55580         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
55581         int64_t ret_ref = 0;
55582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55584         return ret_ref;
55585 }
55586 int64_t  CS_LDK_OfferFeatures_clone_ptr(int64_t arg) {
55587         LDKOfferFeatures arg_conv;
55588         arg_conv.inner = untag_ptr(arg);
55589         arg_conv.is_owned = ptr_is_owned(arg);
55590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55591         arg_conv.is_owned = false;
55592         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
55593         return ret_conv;
55594 }
55595
55596 int64_t  CS_LDK_OfferFeatures_clone(int64_t orig) {
55597         LDKOfferFeatures orig_conv;
55598         orig_conv.inner = untag_ptr(orig);
55599         orig_conv.is_owned = ptr_is_owned(orig);
55600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55601         orig_conv.is_owned = false;
55602         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
55603         int64_t ret_ref = 0;
55604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55606         return ret_ref;
55607 }
55608
55609 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
55610         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
55611         int64_t ret_ref = 0;
55612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55614         return ret_ref;
55615 }
55616 int64_t  CS_LDK_InvoiceRequestFeatures_clone_ptr(int64_t arg) {
55617         LDKInvoiceRequestFeatures arg_conv;
55618         arg_conv.inner = untag_ptr(arg);
55619         arg_conv.is_owned = ptr_is_owned(arg);
55620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55621         arg_conv.is_owned = false;
55622         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
55623         return ret_conv;
55624 }
55625
55626 int64_t  CS_LDK_InvoiceRequestFeatures_clone(int64_t orig) {
55627         LDKInvoiceRequestFeatures orig_conv;
55628         orig_conv.inner = untag_ptr(orig);
55629         orig_conv.is_owned = ptr_is_owned(orig);
55630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55631         orig_conv.is_owned = false;
55632         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
55633         int64_t ret_ref = 0;
55634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55636         return ret_ref;
55637 }
55638
55639 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
55640         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
55641         int64_t ret_ref = 0;
55642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55644         return ret_ref;
55645 }
55646 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone_ptr(int64_t arg) {
55647         LDKBolt12InvoiceFeatures arg_conv;
55648         arg_conv.inner = untag_ptr(arg);
55649         arg_conv.is_owned = ptr_is_owned(arg);
55650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55651         arg_conv.is_owned = false;
55652         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
55653         return ret_conv;
55654 }
55655
55656 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone(int64_t orig) {
55657         LDKBolt12InvoiceFeatures orig_conv;
55658         orig_conv.inner = untag_ptr(orig);
55659         orig_conv.is_owned = ptr_is_owned(orig);
55660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55661         orig_conv.is_owned = false;
55662         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
55663         int64_t ret_ref = 0;
55664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55666         return ret_ref;
55667 }
55668
55669 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
55670         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
55671         int64_t ret_ref = 0;
55672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55674         return ret_ref;
55675 }
55676 int64_t  CS_LDK_BlindedHopFeatures_clone_ptr(int64_t arg) {
55677         LDKBlindedHopFeatures arg_conv;
55678         arg_conv.inner = untag_ptr(arg);
55679         arg_conv.is_owned = ptr_is_owned(arg);
55680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55681         arg_conv.is_owned = false;
55682         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
55683         return ret_conv;
55684 }
55685
55686 int64_t  CS_LDK_BlindedHopFeatures_clone(int64_t orig) {
55687         LDKBlindedHopFeatures orig_conv;
55688         orig_conv.inner = untag_ptr(orig);
55689         orig_conv.is_owned = ptr_is_owned(orig);
55690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55691         orig_conv.is_owned = false;
55692         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
55693         int64_t ret_ref = 0;
55694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55696         return ret_ref;
55697 }
55698
55699 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
55700         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
55701         int64_t ret_ref = 0;
55702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55704         return ret_ref;
55705 }
55706 int64_t  CS_LDK_ChannelTypeFeatures_clone_ptr(int64_t arg) {
55707         LDKChannelTypeFeatures arg_conv;
55708         arg_conv.inner = untag_ptr(arg);
55709         arg_conv.is_owned = ptr_is_owned(arg);
55710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55711         arg_conv.is_owned = false;
55712         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
55713         return ret_conv;
55714 }
55715
55716 int64_t  CS_LDK_ChannelTypeFeatures_clone(int64_t orig) {
55717         LDKChannelTypeFeatures orig_conv;
55718         orig_conv.inner = untag_ptr(orig);
55719         orig_conv.is_owned = ptr_is_owned(orig);
55720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55721         orig_conv.is_owned = false;
55722         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
55723         int64_t ret_ref = 0;
55724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55726         return ret_ref;
55727 }
55728
55729 int64_t  CS_LDK_InitFeatures_hash(int64_t o) {
55730         LDKInitFeatures o_conv;
55731         o_conv.inner = untag_ptr(o);
55732         o_conv.is_owned = ptr_is_owned(o);
55733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55734         o_conv.is_owned = false;
55735         int64_t ret_conv = InitFeatures_hash(&o_conv);
55736         return ret_conv;
55737 }
55738
55739 int64_t  CS_LDK_NodeFeatures_hash(int64_t o) {
55740         LDKNodeFeatures o_conv;
55741         o_conv.inner = untag_ptr(o);
55742         o_conv.is_owned = ptr_is_owned(o);
55743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55744         o_conv.is_owned = false;
55745         int64_t ret_conv = NodeFeatures_hash(&o_conv);
55746         return ret_conv;
55747 }
55748
55749 int64_t  CS_LDK_ChannelFeatures_hash(int64_t o) {
55750         LDKChannelFeatures o_conv;
55751         o_conv.inner = untag_ptr(o);
55752         o_conv.is_owned = ptr_is_owned(o);
55753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55754         o_conv.is_owned = false;
55755         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
55756         return ret_conv;
55757 }
55758
55759 int64_t  CS_LDK_Bolt11InvoiceFeatures_hash(int64_t o) {
55760         LDKBolt11InvoiceFeatures o_conv;
55761         o_conv.inner = untag_ptr(o);
55762         o_conv.is_owned = ptr_is_owned(o);
55763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55764         o_conv.is_owned = false;
55765         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
55766         return ret_conv;
55767 }
55768
55769 int64_t  CS_LDK_OfferFeatures_hash(int64_t o) {
55770         LDKOfferFeatures o_conv;
55771         o_conv.inner = untag_ptr(o);
55772         o_conv.is_owned = ptr_is_owned(o);
55773         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55774         o_conv.is_owned = false;
55775         int64_t ret_conv = OfferFeatures_hash(&o_conv);
55776         return ret_conv;
55777 }
55778
55779 int64_t  CS_LDK_InvoiceRequestFeatures_hash(int64_t o) {
55780         LDKInvoiceRequestFeatures o_conv;
55781         o_conv.inner = untag_ptr(o);
55782         o_conv.is_owned = ptr_is_owned(o);
55783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55784         o_conv.is_owned = false;
55785         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
55786         return ret_conv;
55787 }
55788
55789 int64_t  CS_LDK_Bolt12InvoiceFeatures_hash(int64_t o) {
55790         LDKBolt12InvoiceFeatures o_conv;
55791         o_conv.inner = untag_ptr(o);
55792         o_conv.is_owned = ptr_is_owned(o);
55793         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55794         o_conv.is_owned = false;
55795         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
55796         return ret_conv;
55797 }
55798
55799 int64_t  CS_LDK_BlindedHopFeatures_hash(int64_t o) {
55800         LDKBlindedHopFeatures o_conv;
55801         o_conv.inner = untag_ptr(o);
55802         o_conv.is_owned = ptr_is_owned(o);
55803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55804         o_conv.is_owned = false;
55805         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
55806         return ret_conv;
55807 }
55808
55809 int64_t  CS_LDK_ChannelTypeFeatures_hash(int64_t o) {
55810         LDKChannelTypeFeatures o_conv;
55811         o_conv.inner = untag_ptr(o);
55812         o_conv.is_owned = ptr_is_owned(o);
55813         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55814         o_conv.is_owned = false;
55815         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
55816         return ret_conv;
55817 }
55818
55819 void  CS_LDK_InitFeatures_free(int64_t this_obj) {
55820         LDKInitFeatures this_obj_conv;
55821         this_obj_conv.inner = untag_ptr(this_obj);
55822         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55824         InitFeatures_free(this_obj_conv);
55825 }
55826
55827 void  CS_LDK_NodeFeatures_free(int64_t this_obj) {
55828         LDKNodeFeatures this_obj_conv;
55829         this_obj_conv.inner = untag_ptr(this_obj);
55830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55832         NodeFeatures_free(this_obj_conv);
55833 }
55834
55835 void  CS_LDK_ChannelFeatures_free(int64_t this_obj) {
55836         LDKChannelFeatures this_obj_conv;
55837         this_obj_conv.inner = untag_ptr(this_obj);
55838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55840         ChannelFeatures_free(this_obj_conv);
55841 }
55842
55843 void  CS_LDK_Bolt11InvoiceFeatures_free(int64_t this_obj) {
55844         LDKBolt11InvoiceFeatures this_obj_conv;
55845         this_obj_conv.inner = untag_ptr(this_obj);
55846         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55848         Bolt11InvoiceFeatures_free(this_obj_conv);
55849 }
55850
55851 void  CS_LDK_OfferFeatures_free(int64_t this_obj) {
55852         LDKOfferFeatures this_obj_conv;
55853         this_obj_conv.inner = untag_ptr(this_obj);
55854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55856         OfferFeatures_free(this_obj_conv);
55857 }
55858
55859 void  CS_LDK_InvoiceRequestFeatures_free(int64_t this_obj) {
55860         LDKInvoiceRequestFeatures this_obj_conv;
55861         this_obj_conv.inner = untag_ptr(this_obj);
55862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55864         InvoiceRequestFeatures_free(this_obj_conv);
55865 }
55866
55867 void  CS_LDK_Bolt12InvoiceFeatures_free(int64_t this_obj) {
55868         LDKBolt12InvoiceFeatures this_obj_conv;
55869         this_obj_conv.inner = untag_ptr(this_obj);
55870         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55872         Bolt12InvoiceFeatures_free(this_obj_conv);
55873 }
55874
55875 void  CS_LDK_BlindedHopFeatures_free(int64_t this_obj) {
55876         LDKBlindedHopFeatures this_obj_conv;
55877         this_obj_conv.inner = untag_ptr(this_obj);
55878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55880         BlindedHopFeatures_free(this_obj_conv);
55881 }
55882
55883 void  CS_LDK_ChannelTypeFeatures_free(int64_t this_obj) {
55884         LDKChannelTypeFeatures this_obj_conv;
55885         this_obj_conv.inner = untag_ptr(this_obj);
55886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55888         ChannelTypeFeatures_free(this_obj_conv);
55889 }
55890
55891 int64_t  CS_LDK_InitFeatures_empty() {
55892         LDKInitFeatures ret_var = InitFeatures_empty();
55893         int64_t ret_ref = 0;
55894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55896         return ret_ref;
55897 }
55898
55899 jboolean  CS_LDK_InitFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
55900         LDKInitFeatures this_arg_conv;
55901         this_arg_conv.inner = untag_ptr(this_arg);
55902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55904         this_arg_conv.is_owned = false;
55905         LDKInitFeatures other_conv;
55906         other_conv.inner = untag_ptr(other);
55907         other_conv.is_owned = ptr_is_owned(other);
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55909         other_conv.is_owned = false;
55910         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55911         return ret_conv;
55912 }
55913
55914 jboolean  CS_LDK_InitFeatures_requires_unknown_bits(int64_t this_arg) {
55915         LDKInitFeatures this_arg_conv;
55916         this_arg_conv.inner = untag_ptr(this_arg);
55917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55919         this_arg_conv.is_owned = false;
55920         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
55921         return ret_conv;
55922 }
55923
55924 int64_t  CS_LDK_InitFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
55925         LDKInitFeatures this_arg_conv;
55926         this_arg_conv.inner = untag_ptr(this_arg);
55927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55929         this_arg_conv.is_owned = false;
55930         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55931         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
55932         return tag_ptr(ret_conv, true);
55933 }
55934
55935 int64_t  CS_LDK_InitFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
55936         LDKInitFeatures this_arg_conv;
55937         this_arg_conv.inner = untag_ptr(this_arg);
55938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55940         this_arg_conv.is_owned = false;
55941         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55942         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
55943         return tag_ptr(ret_conv, true);
55944 }
55945
55946 int64_t  CS_LDK_InitFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
55947         LDKInitFeatures this_arg_conv;
55948         this_arg_conv.inner = untag_ptr(this_arg);
55949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55951         this_arg_conv.is_owned = false;
55952         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55953         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
55954         return tag_ptr(ret_conv, true);
55955 }
55956
55957 int64_t  CS_LDK_InitFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
55958         LDKInitFeatures this_arg_conv;
55959         this_arg_conv.inner = untag_ptr(this_arg);
55960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55962         this_arg_conv.is_owned = false;
55963         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
55964         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
55965         return tag_ptr(ret_conv, true);
55966 }
55967
55968 int64_t  CS_LDK_NodeFeatures_empty() {
55969         LDKNodeFeatures ret_var = NodeFeatures_empty();
55970         int64_t ret_ref = 0;
55971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55973         return ret_ref;
55974 }
55975
55976 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
55977         LDKNodeFeatures this_arg_conv;
55978         this_arg_conv.inner = untag_ptr(this_arg);
55979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55981         this_arg_conv.is_owned = false;
55982         LDKNodeFeatures other_conv;
55983         other_conv.inner = untag_ptr(other);
55984         other_conv.is_owned = ptr_is_owned(other);
55985         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
55986         other_conv.is_owned = false;
55987         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
55988         return ret_conv;
55989 }
55990
55991 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits(int64_t this_arg) {
55992         LDKNodeFeatures this_arg_conv;
55993         this_arg_conv.inner = untag_ptr(this_arg);
55994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55996         this_arg_conv.is_owned = false;
55997         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
55998         return ret_conv;
55999 }
56000
56001 int64_t  CS_LDK_NodeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56002         LDKNodeFeatures this_arg_conv;
56003         this_arg_conv.inner = untag_ptr(this_arg);
56004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56006         this_arg_conv.is_owned = false;
56007         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56008         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56009         return tag_ptr(ret_conv, true);
56010 }
56011
56012 int64_t  CS_LDK_NodeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56013         LDKNodeFeatures this_arg_conv;
56014         this_arg_conv.inner = untag_ptr(this_arg);
56015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56017         this_arg_conv.is_owned = false;
56018         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56019         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56020         return tag_ptr(ret_conv, true);
56021 }
56022
56023 int64_t  CS_LDK_NodeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56024         LDKNodeFeatures this_arg_conv;
56025         this_arg_conv.inner = untag_ptr(this_arg);
56026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56028         this_arg_conv.is_owned = false;
56029         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56030         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56031         return tag_ptr(ret_conv, true);
56032 }
56033
56034 int64_t  CS_LDK_NodeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56035         LDKNodeFeatures this_arg_conv;
56036         this_arg_conv.inner = untag_ptr(this_arg);
56037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56039         this_arg_conv.is_owned = false;
56040         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56041         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56042         return tag_ptr(ret_conv, true);
56043 }
56044
56045 int64_t  CS_LDK_ChannelFeatures_empty() {
56046         LDKChannelFeatures ret_var = ChannelFeatures_empty();
56047         int64_t ret_ref = 0;
56048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56050         return ret_ref;
56051 }
56052
56053 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56054         LDKChannelFeatures this_arg_conv;
56055         this_arg_conv.inner = untag_ptr(this_arg);
56056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56058         this_arg_conv.is_owned = false;
56059         LDKChannelFeatures other_conv;
56060         other_conv.inner = untag_ptr(other);
56061         other_conv.is_owned = ptr_is_owned(other);
56062         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56063         other_conv.is_owned = false;
56064         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56065         return ret_conv;
56066 }
56067
56068 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits(int64_t this_arg) {
56069         LDKChannelFeatures this_arg_conv;
56070         this_arg_conv.inner = untag_ptr(this_arg);
56071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56073         this_arg_conv.is_owned = false;
56074         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
56075         return ret_conv;
56076 }
56077
56078 int64_t  CS_LDK_ChannelFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56079         LDKChannelFeatures this_arg_conv;
56080         this_arg_conv.inner = untag_ptr(this_arg);
56081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56083         this_arg_conv.is_owned = false;
56084         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56085         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
56086         return tag_ptr(ret_conv, true);
56087 }
56088
56089 int64_t  CS_LDK_ChannelFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56090         LDKChannelFeatures this_arg_conv;
56091         this_arg_conv.inner = untag_ptr(this_arg);
56092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56094         this_arg_conv.is_owned = false;
56095         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56096         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56097         return tag_ptr(ret_conv, true);
56098 }
56099
56100 int64_t  CS_LDK_ChannelFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56101         LDKChannelFeatures this_arg_conv;
56102         this_arg_conv.inner = untag_ptr(this_arg);
56103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56105         this_arg_conv.is_owned = false;
56106         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56107         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
56108         return tag_ptr(ret_conv, true);
56109 }
56110
56111 int64_t  CS_LDK_ChannelFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56112         LDKChannelFeatures this_arg_conv;
56113         this_arg_conv.inner = untag_ptr(this_arg);
56114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56116         this_arg_conv.is_owned = false;
56117         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56118         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56119         return tag_ptr(ret_conv, true);
56120 }
56121
56122 int64_t  CS_LDK_Bolt11InvoiceFeatures_empty() {
56123         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
56124         int64_t ret_ref = 0;
56125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56127         return ret_ref;
56128 }
56129
56130 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56131         LDKBolt11InvoiceFeatures this_arg_conv;
56132         this_arg_conv.inner = untag_ptr(this_arg);
56133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56135         this_arg_conv.is_owned = false;
56136         LDKBolt11InvoiceFeatures other_conv;
56137         other_conv.inner = untag_ptr(other);
56138         other_conv.is_owned = ptr_is_owned(other);
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56140         other_conv.is_owned = false;
56141         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56142         return ret_conv;
56143 }
56144
56145 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
56146         LDKBolt11InvoiceFeatures this_arg_conv;
56147         this_arg_conv.inner = untag_ptr(this_arg);
56148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56150         this_arg_conv.is_owned = false;
56151         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56152         return ret_conv;
56153 }
56154
56155 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56156         LDKBolt11InvoiceFeatures this_arg_conv;
56157         this_arg_conv.inner = untag_ptr(this_arg);
56158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56160         this_arg_conv.is_owned = false;
56161         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56162         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56163         return tag_ptr(ret_conv, true);
56164 }
56165
56166 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56167         LDKBolt11InvoiceFeatures this_arg_conv;
56168         this_arg_conv.inner = untag_ptr(this_arg);
56169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56171         this_arg_conv.is_owned = false;
56172         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56173         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56174         return tag_ptr(ret_conv, true);
56175 }
56176
56177 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56178         LDKBolt11InvoiceFeatures this_arg_conv;
56179         this_arg_conv.inner = untag_ptr(this_arg);
56180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56182         this_arg_conv.is_owned = false;
56183         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56184         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56185         return tag_ptr(ret_conv, true);
56186 }
56187
56188 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56189         LDKBolt11InvoiceFeatures this_arg_conv;
56190         this_arg_conv.inner = untag_ptr(this_arg);
56191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56193         this_arg_conv.is_owned = false;
56194         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56195         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56196         return tag_ptr(ret_conv, true);
56197 }
56198
56199 int64_t  CS_LDK_OfferFeatures_empty() {
56200         LDKOfferFeatures ret_var = OfferFeatures_empty();
56201         int64_t ret_ref = 0;
56202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56204         return ret_ref;
56205 }
56206
56207 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56208         LDKOfferFeatures this_arg_conv;
56209         this_arg_conv.inner = untag_ptr(this_arg);
56210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56212         this_arg_conv.is_owned = false;
56213         LDKOfferFeatures other_conv;
56214         other_conv.inner = untag_ptr(other);
56215         other_conv.is_owned = ptr_is_owned(other);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56217         other_conv.is_owned = false;
56218         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56219         return ret_conv;
56220 }
56221
56222 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits(int64_t this_arg) {
56223         LDKOfferFeatures this_arg_conv;
56224         this_arg_conv.inner = untag_ptr(this_arg);
56225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56227         this_arg_conv.is_owned = false;
56228         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
56229         return ret_conv;
56230 }
56231
56232 int64_t  CS_LDK_OfferFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56233         LDKOfferFeatures this_arg_conv;
56234         this_arg_conv.inner = untag_ptr(this_arg);
56235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56237         this_arg_conv.is_owned = false;
56238         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56239         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
56240         return tag_ptr(ret_conv, true);
56241 }
56242
56243 int64_t  CS_LDK_OfferFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56244         LDKOfferFeatures this_arg_conv;
56245         this_arg_conv.inner = untag_ptr(this_arg);
56246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56248         this_arg_conv.is_owned = false;
56249         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56250         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56251         return tag_ptr(ret_conv, true);
56252 }
56253
56254 int64_t  CS_LDK_OfferFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56255         LDKOfferFeatures this_arg_conv;
56256         this_arg_conv.inner = untag_ptr(this_arg);
56257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56259         this_arg_conv.is_owned = false;
56260         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56261         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
56262         return tag_ptr(ret_conv, true);
56263 }
56264
56265 int64_t  CS_LDK_OfferFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56266         LDKOfferFeatures this_arg_conv;
56267         this_arg_conv.inner = untag_ptr(this_arg);
56268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56270         this_arg_conv.is_owned = false;
56271         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56272         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56273         return tag_ptr(ret_conv, true);
56274 }
56275
56276 int64_t  CS_LDK_InvoiceRequestFeatures_empty() {
56277         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
56278         int64_t ret_ref = 0;
56279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56281         return ret_ref;
56282 }
56283
56284 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56285         LDKInvoiceRequestFeatures this_arg_conv;
56286         this_arg_conv.inner = untag_ptr(this_arg);
56287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56289         this_arg_conv.is_owned = false;
56290         LDKInvoiceRequestFeatures other_conv;
56291         other_conv.inner = untag_ptr(other);
56292         other_conv.is_owned = ptr_is_owned(other);
56293         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56294         other_conv.is_owned = false;
56295         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56296         return ret_conv;
56297 }
56298
56299 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits(int64_t this_arg) {
56300         LDKInvoiceRequestFeatures 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         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
56306         return ret_conv;
56307 }
56308
56309 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56310         LDKInvoiceRequestFeatures this_arg_conv;
56311         this_arg_conv.inner = untag_ptr(this_arg);
56312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56314         this_arg_conv.is_owned = false;
56315         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56316         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
56317         return tag_ptr(ret_conv, true);
56318 }
56319
56320 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56321         LDKInvoiceRequestFeatures this_arg_conv;
56322         this_arg_conv.inner = untag_ptr(this_arg);
56323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56325         this_arg_conv.is_owned = false;
56326         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56327         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56328         return tag_ptr(ret_conv, true);
56329 }
56330
56331 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56332         LDKInvoiceRequestFeatures this_arg_conv;
56333         this_arg_conv.inner = untag_ptr(this_arg);
56334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56336         this_arg_conv.is_owned = false;
56337         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56338         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
56339         return tag_ptr(ret_conv, true);
56340 }
56341
56342 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56343         LDKInvoiceRequestFeatures this_arg_conv;
56344         this_arg_conv.inner = untag_ptr(this_arg);
56345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56347         this_arg_conv.is_owned = false;
56348         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56349         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56350         return tag_ptr(ret_conv, true);
56351 }
56352
56353 int64_t  CS_LDK_Bolt12InvoiceFeatures_empty() {
56354         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
56355         int64_t ret_ref = 0;
56356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56358         return ret_ref;
56359 }
56360
56361 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56362         LDKBolt12InvoiceFeatures this_arg_conv;
56363         this_arg_conv.inner = untag_ptr(this_arg);
56364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56366         this_arg_conv.is_owned = false;
56367         LDKBolt12InvoiceFeatures other_conv;
56368         other_conv.inner = untag_ptr(other);
56369         other_conv.is_owned = ptr_is_owned(other);
56370         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56371         other_conv.is_owned = false;
56372         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56373         return ret_conv;
56374 }
56375
56376 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
56377         LDKBolt12InvoiceFeatures this_arg_conv;
56378         this_arg_conv.inner = untag_ptr(this_arg);
56379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56381         this_arg_conv.is_owned = false;
56382         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
56383         return ret_conv;
56384 }
56385
56386 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56387         LDKBolt12InvoiceFeatures this_arg_conv;
56388         this_arg_conv.inner = untag_ptr(this_arg);
56389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56391         this_arg_conv.is_owned = false;
56392         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56393         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
56394         return tag_ptr(ret_conv, true);
56395 }
56396
56397 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56398         LDKBolt12InvoiceFeatures this_arg_conv;
56399         this_arg_conv.inner = untag_ptr(this_arg);
56400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56402         this_arg_conv.is_owned = false;
56403         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56404         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56405         return tag_ptr(ret_conv, true);
56406 }
56407
56408 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56409         LDKBolt12InvoiceFeatures this_arg_conv;
56410         this_arg_conv.inner = untag_ptr(this_arg);
56411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56413         this_arg_conv.is_owned = false;
56414         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56415         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
56416         return tag_ptr(ret_conv, true);
56417 }
56418
56419 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56420         LDKBolt12InvoiceFeatures this_arg_conv;
56421         this_arg_conv.inner = untag_ptr(this_arg);
56422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56424         this_arg_conv.is_owned = false;
56425         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56426         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56427         return tag_ptr(ret_conv, true);
56428 }
56429
56430 int64_t  CS_LDK_BlindedHopFeatures_empty() {
56431         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
56432         int64_t ret_ref = 0;
56433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56435         return ret_ref;
56436 }
56437
56438 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56439         LDKBlindedHopFeatures this_arg_conv;
56440         this_arg_conv.inner = untag_ptr(this_arg);
56441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56443         this_arg_conv.is_owned = false;
56444         LDKBlindedHopFeatures other_conv;
56445         other_conv.inner = untag_ptr(other);
56446         other_conv.is_owned = ptr_is_owned(other);
56447         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56448         other_conv.is_owned = false;
56449         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56450         return ret_conv;
56451 }
56452
56453 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits(int64_t this_arg) {
56454         LDKBlindedHopFeatures this_arg_conv;
56455         this_arg_conv.inner = untag_ptr(this_arg);
56456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56458         this_arg_conv.is_owned = false;
56459         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
56460         return ret_conv;
56461 }
56462
56463 int64_t  CS_LDK_BlindedHopFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56464         LDKBlindedHopFeatures this_arg_conv;
56465         this_arg_conv.inner = untag_ptr(this_arg);
56466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56468         this_arg_conv.is_owned = false;
56469         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56470         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
56471         return tag_ptr(ret_conv, true);
56472 }
56473
56474 int64_t  CS_LDK_BlindedHopFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56475         LDKBlindedHopFeatures this_arg_conv;
56476         this_arg_conv.inner = untag_ptr(this_arg);
56477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56479         this_arg_conv.is_owned = false;
56480         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56481         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56482         return tag_ptr(ret_conv, true);
56483 }
56484
56485 int64_t  CS_LDK_BlindedHopFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56486         LDKBlindedHopFeatures this_arg_conv;
56487         this_arg_conv.inner = untag_ptr(this_arg);
56488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56490         this_arg_conv.is_owned = false;
56491         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56492         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
56493         return tag_ptr(ret_conv, true);
56494 }
56495
56496 int64_t  CS_LDK_BlindedHopFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56497         LDKBlindedHopFeatures this_arg_conv;
56498         this_arg_conv.inner = untag_ptr(this_arg);
56499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56501         this_arg_conv.is_owned = false;
56502         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56503         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56504         return tag_ptr(ret_conv, true);
56505 }
56506
56507 int64_t  CS_LDK_ChannelTypeFeatures_empty() {
56508         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
56509         int64_t ret_ref = 0;
56510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56512         return ret_ref;
56513 }
56514
56515 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
56516         LDKChannelTypeFeatures this_arg_conv;
56517         this_arg_conv.inner = untag_ptr(this_arg);
56518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56520         this_arg_conv.is_owned = false;
56521         LDKChannelTypeFeatures other_conv;
56522         other_conv.inner = untag_ptr(other);
56523         other_conv.is_owned = ptr_is_owned(other);
56524         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
56525         other_conv.is_owned = false;
56526         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
56527         return ret_conv;
56528 }
56529
56530 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits(int64_t this_arg) {
56531         LDKChannelTypeFeatures this_arg_conv;
56532         this_arg_conv.inner = untag_ptr(this_arg);
56533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56535         this_arg_conv.is_owned = false;
56536         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
56537         return ret_conv;
56538 }
56539
56540 int64_t  CS_LDK_ChannelTypeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
56541         LDKChannelTypeFeatures this_arg_conv;
56542         this_arg_conv.inner = untag_ptr(this_arg);
56543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56545         this_arg_conv.is_owned = false;
56546         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56547         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
56548         return tag_ptr(ret_conv, true);
56549 }
56550
56551 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
56552         LDKChannelTypeFeatures this_arg_conv;
56553         this_arg_conv.inner = untag_ptr(this_arg);
56554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56556         this_arg_conv.is_owned = false;
56557         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56558         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
56559         return tag_ptr(ret_conv, true);
56560 }
56561
56562 int64_t  CS_LDK_ChannelTypeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
56563         LDKChannelTypeFeatures this_arg_conv;
56564         this_arg_conv.inner = untag_ptr(this_arg);
56565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56567         this_arg_conv.is_owned = false;
56568         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56569         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
56570         return tag_ptr(ret_conv, true);
56571 }
56572
56573 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
56574         LDKChannelTypeFeatures this_arg_conv;
56575         this_arg_conv.inner = untag_ptr(this_arg);
56576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56578         this_arg_conv.is_owned = false;
56579         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
56580         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
56581         return tag_ptr(ret_conv, true);
56582 }
56583
56584 int8_tArray  CS_LDK_InitFeatures_write(int64_t obj) {
56585         LDKInitFeatures obj_conv;
56586         obj_conv.inner = untag_ptr(obj);
56587         obj_conv.is_owned = ptr_is_owned(obj);
56588         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56589         obj_conv.is_owned = false;
56590         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
56591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56593         CVec_u8Z_free(ret_var);
56594         return ret_arr;
56595 }
56596
56597 int64_t  CS_LDK_InitFeatures_read(int8_tArray ser) {
56598         LDKu8slice ser_ref;
56599         ser_ref.datalen = ser->arr_len;
56600         ser_ref.data = ser->elems;
56601         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
56602         *ret_conv = InitFeatures_read(ser_ref);
56603         FREE(ser);
56604         return tag_ptr(ret_conv, true);
56605 }
56606
56607 int8_tArray  CS_LDK_ChannelFeatures_write(int64_t obj) {
56608         LDKChannelFeatures obj_conv;
56609         obj_conv.inner = untag_ptr(obj);
56610         obj_conv.is_owned = ptr_is_owned(obj);
56611         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56612         obj_conv.is_owned = false;
56613         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
56614         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56615         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56616         CVec_u8Z_free(ret_var);
56617         return ret_arr;
56618 }
56619
56620 int64_t  CS_LDK_ChannelFeatures_read(int8_tArray ser) {
56621         LDKu8slice ser_ref;
56622         ser_ref.datalen = ser->arr_len;
56623         ser_ref.data = ser->elems;
56624         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
56625         *ret_conv = ChannelFeatures_read(ser_ref);
56626         FREE(ser);
56627         return tag_ptr(ret_conv, true);
56628 }
56629
56630 int8_tArray  CS_LDK_NodeFeatures_write(int64_t obj) {
56631         LDKNodeFeatures obj_conv;
56632         obj_conv.inner = untag_ptr(obj);
56633         obj_conv.is_owned = ptr_is_owned(obj);
56634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56635         obj_conv.is_owned = false;
56636         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
56637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56639         CVec_u8Z_free(ret_var);
56640         return ret_arr;
56641 }
56642
56643 int64_t  CS_LDK_NodeFeatures_read(int8_tArray ser) {
56644         LDKu8slice ser_ref;
56645         ser_ref.datalen = ser->arr_len;
56646         ser_ref.data = ser->elems;
56647         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
56648         *ret_conv = NodeFeatures_read(ser_ref);
56649         FREE(ser);
56650         return tag_ptr(ret_conv, true);
56651 }
56652
56653 int8_tArray  CS_LDK_Bolt11InvoiceFeatures_write(int64_t obj) {
56654         LDKBolt11InvoiceFeatures obj_conv;
56655         obj_conv.inner = untag_ptr(obj);
56656         obj_conv.is_owned = ptr_is_owned(obj);
56657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56658         obj_conv.is_owned = false;
56659         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
56660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56662         CVec_u8Z_free(ret_var);
56663         return ret_arr;
56664 }
56665
56666 int64_t  CS_LDK_Bolt11InvoiceFeatures_read(int8_tArray ser) {
56667         LDKu8slice ser_ref;
56668         ser_ref.datalen = ser->arr_len;
56669         ser_ref.data = ser->elems;
56670         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
56671         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
56672         FREE(ser);
56673         return tag_ptr(ret_conv, true);
56674 }
56675
56676 int8_tArray  CS_LDK_Bolt12InvoiceFeatures_write(int64_t obj) {
56677         LDKBolt12InvoiceFeatures obj_conv;
56678         obj_conv.inner = untag_ptr(obj);
56679         obj_conv.is_owned = ptr_is_owned(obj);
56680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56681         obj_conv.is_owned = false;
56682         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
56683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56685         CVec_u8Z_free(ret_var);
56686         return ret_arr;
56687 }
56688
56689 int64_t  CS_LDK_Bolt12InvoiceFeatures_read(int8_tArray ser) {
56690         LDKu8slice ser_ref;
56691         ser_ref.datalen = ser->arr_len;
56692         ser_ref.data = ser->elems;
56693         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
56694         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
56695         FREE(ser);
56696         return tag_ptr(ret_conv, true);
56697 }
56698
56699 int8_tArray  CS_LDK_BlindedHopFeatures_write(int64_t obj) {
56700         LDKBlindedHopFeatures obj_conv;
56701         obj_conv.inner = untag_ptr(obj);
56702         obj_conv.is_owned = ptr_is_owned(obj);
56703         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56704         obj_conv.is_owned = false;
56705         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
56706         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56707         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56708         CVec_u8Z_free(ret_var);
56709         return ret_arr;
56710 }
56711
56712 int64_t  CS_LDK_BlindedHopFeatures_read(int8_tArray ser) {
56713         LDKu8slice ser_ref;
56714         ser_ref.datalen = ser->arr_len;
56715         ser_ref.data = ser->elems;
56716         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
56717         *ret_conv = BlindedHopFeatures_read(ser_ref);
56718         FREE(ser);
56719         return tag_ptr(ret_conv, true);
56720 }
56721
56722 int8_tArray  CS_LDK_ChannelTypeFeatures_write(int64_t obj) {
56723         LDKChannelTypeFeatures obj_conv;
56724         obj_conv.inner = untag_ptr(obj);
56725         obj_conv.is_owned = ptr_is_owned(obj);
56726         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56727         obj_conv.is_owned = false;
56728         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
56729         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56730         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56731         CVec_u8Z_free(ret_var);
56732         return ret_arr;
56733 }
56734
56735 int64_t  CS_LDK_ChannelTypeFeatures_read(int8_tArray ser) {
56736         LDKu8slice ser_ref;
56737         ser_ref.datalen = ser->arr_len;
56738         ser_ref.data = ser->elems;
56739         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
56740         *ret_conv = ChannelTypeFeatures_read(ser_ref);
56741         FREE(ser);
56742         return tag_ptr(ret_conv, true);
56743 }
56744
56745 void  CS_LDK_InitFeatures_set_data_loss_protect_optional(int64_t this_arg) {
56746         LDKInitFeatures this_arg_conv;
56747         this_arg_conv.inner = untag_ptr(this_arg);
56748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56750         this_arg_conv.is_owned = false;
56751         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
56752 }
56753
56754 void  CS_LDK_InitFeatures_set_data_loss_protect_required(int64_t this_arg) {
56755         LDKInitFeatures this_arg_conv;
56756         this_arg_conv.inner = untag_ptr(this_arg);
56757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56759         this_arg_conv.is_owned = false;
56760         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
56761 }
56762
56763 jboolean  CS_LDK_InitFeatures_supports_data_loss_protect(int64_t this_arg) {
56764         LDKInitFeatures this_arg_conv;
56765         this_arg_conv.inner = untag_ptr(this_arg);
56766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56768         this_arg_conv.is_owned = false;
56769         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
56770         return ret_conv;
56771 }
56772
56773 void  CS_LDK_NodeFeatures_set_data_loss_protect_optional(int64_t this_arg) {
56774         LDKNodeFeatures this_arg_conv;
56775         this_arg_conv.inner = untag_ptr(this_arg);
56776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56778         this_arg_conv.is_owned = false;
56779         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
56780 }
56781
56782 void  CS_LDK_NodeFeatures_set_data_loss_protect_required(int64_t this_arg) {
56783         LDKNodeFeatures this_arg_conv;
56784         this_arg_conv.inner = untag_ptr(this_arg);
56785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56787         this_arg_conv.is_owned = false;
56788         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
56789 }
56790
56791 jboolean  CS_LDK_NodeFeatures_supports_data_loss_protect(int64_t this_arg) {
56792         LDKNodeFeatures this_arg_conv;
56793         this_arg_conv.inner = untag_ptr(this_arg);
56794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56796         this_arg_conv.is_owned = false;
56797         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
56798         return ret_conv;
56799 }
56800
56801 jboolean  CS_LDK_InitFeatures_requires_data_loss_protect(int64_t this_arg) {
56802         LDKInitFeatures this_arg_conv;
56803         this_arg_conv.inner = untag_ptr(this_arg);
56804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56806         this_arg_conv.is_owned = false;
56807         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
56808         return ret_conv;
56809 }
56810
56811 jboolean  CS_LDK_NodeFeatures_requires_data_loss_protect(int64_t this_arg) {
56812         LDKNodeFeatures this_arg_conv;
56813         this_arg_conv.inner = untag_ptr(this_arg);
56814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56816         this_arg_conv.is_owned = false;
56817         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
56818         return ret_conv;
56819 }
56820
56821 void  CS_LDK_InitFeatures_set_initial_routing_sync_optional(int64_t this_arg) {
56822         LDKInitFeatures this_arg_conv;
56823         this_arg_conv.inner = untag_ptr(this_arg);
56824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56826         this_arg_conv.is_owned = false;
56827         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
56828 }
56829
56830 void  CS_LDK_InitFeatures_set_initial_routing_sync_required(int64_t this_arg) {
56831         LDKInitFeatures this_arg_conv;
56832         this_arg_conv.inner = untag_ptr(this_arg);
56833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56835         this_arg_conv.is_owned = false;
56836         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
56837 }
56838
56839 jboolean  CS_LDK_InitFeatures_initial_routing_sync(int64_t this_arg) {
56840         LDKInitFeatures this_arg_conv;
56841         this_arg_conv.inner = untag_ptr(this_arg);
56842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56844         this_arg_conv.is_owned = false;
56845         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
56846         return ret_conv;
56847 }
56848
56849 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
56850         LDKInitFeatures this_arg_conv;
56851         this_arg_conv.inner = untag_ptr(this_arg);
56852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56854         this_arg_conv.is_owned = false;
56855         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56856 }
56857
56858 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
56859         LDKInitFeatures this_arg_conv;
56860         this_arg_conv.inner = untag_ptr(this_arg);
56861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56863         this_arg_conv.is_owned = false;
56864         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56865 }
56866
56867 jboolean  CS_LDK_InitFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
56868         LDKInitFeatures this_arg_conv;
56869         this_arg_conv.inner = untag_ptr(this_arg);
56870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56872         this_arg_conv.is_owned = false;
56873         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56874         return ret_conv;
56875 }
56876
56877 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
56878         LDKNodeFeatures this_arg_conv;
56879         this_arg_conv.inner = untag_ptr(this_arg);
56880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56882         this_arg_conv.is_owned = false;
56883         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
56884 }
56885
56886 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
56887         LDKNodeFeatures this_arg_conv;
56888         this_arg_conv.inner = untag_ptr(this_arg);
56889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56891         this_arg_conv.is_owned = false;
56892         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
56893 }
56894
56895 jboolean  CS_LDK_NodeFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
56896         LDKNodeFeatures this_arg_conv;
56897         this_arg_conv.inner = untag_ptr(this_arg);
56898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56900         this_arg_conv.is_owned = false;
56901         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
56902         return ret_conv;
56903 }
56904
56905 jboolean  CS_LDK_InitFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
56906         LDKInitFeatures this_arg_conv;
56907         this_arg_conv.inner = untag_ptr(this_arg);
56908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56910         this_arg_conv.is_owned = false;
56911         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56912         return ret_conv;
56913 }
56914
56915 jboolean  CS_LDK_NodeFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
56916         LDKNodeFeatures this_arg_conv;
56917         this_arg_conv.inner = untag_ptr(this_arg);
56918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56920         this_arg_conv.is_owned = false;
56921         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
56922         return ret_conv;
56923 }
56924
56925 void  CS_LDK_InitFeatures_set_gossip_queries_optional(int64_t this_arg) {
56926         LDKInitFeatures this_arg_conv;
56927         this_arg_conv.inner = untag_ptr(this_arg);
56928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56930         this_arg_conv.is_owned = false;
56931         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
56932 }
56933
56934 void  CS_LDK_InitFeatures_set_gossip_queries_required(int64_t this_arg) {
56935         LDKInitFeatures this_arg_conv;
56936         this_arg_conv.inner = untag_ptr(this_arg);
56937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56939         this_arg_conv.is_owned = false;
56940         InitFeatures_set_gossip_queries_required(&this_arg_conv);
56941 }
56942
56943 jboolean  CS_LDK_InitFeatures_supports_gossip_queries(int64_t this_arg) {
56944         LDKInitFeatures this_arg_conv;
56945         this_arg_conv.inner = untag_ptr(this_arg);
56946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56948         this_arg_conv.is_owned = false;
56949         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
56950         return ret_conv;
56951 }
56952
56953 void  CS_LDK_NodeFeatures_set_gossip_queries_optional(int64_t this_arg) {
56954         LDKNodeFeatures this_arg_conv;
56955         this_arg_conv.inner = untag_ptr(this_arg);
56956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56958         this_arg_conv.is_owned = false;
56959         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
56960 }
56961
56962 void  CS_LDK_NodeFeatures_set_gossip_queries_required(int64_t this_arg) {
56963         LDKNodeFeatures this_arg_conv;
56964         this_arg_conv.inner = untag_ptr(this_arg);
56965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56967         this_arg_conv.is_owned = false;
56968         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
56969 }
56970
56971 jboolean  CS_LDK_NodeFeatures_supports_gossip_queries(int64_t this_arg) {
56972         LDKNodeFeatures this_arg_conv;
56973         this_arg_conv.inner = untag_ptr(this_arg);
56974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56976         this_arg_conv.is_owned = false;
56977         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
56978         return ret_conv;
56979 }
56980
56981 jboolean  CS_LDK_InitFeatures_requires_gossip_queries(int64_t this_arg) {
56982         LDKInitFeatures this_arg_conv;
56983         this_arg_conv.inner = untag_ptr(this_arg);
56984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56986         this_arg_conv.is_owned = false;
56987         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
56988         return ret_conv;
56989 }
56990
56991 jboolean  CS_LDK_NodeFeatures_requires_gossip_queries(int64_t this_arg) {
56992         LDKNodeFeatures this_arg_conv;
56993         this_arg_conv.inner = untag_ptr(this_arg);
56994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56996         this_arg_conv.is_owned = false;
56997         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
56998         return ret_conv;
56999 }
57000
57001 void  CS_LDK_InitFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57002         LDKInitFeatures this_arg_conv;
57003         this_arg_conv.inner = untag_ptr(this_arg);
57004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57006         this_arg_conv.is_owned = false;
57007         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
57008 }
57009
57010 void  CS_LDK_InitFeatures_set_variable_length_onion_required(int64_t this_arg) {
57011         LDKInitFeatures this_arg_conv;
57012         this_arg_conv.inner = untag_ptr(this_arg);
57013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57015         this_arg_conv.is_owned = false;
57016         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
57017 }
57018
57019 jboolean  CS_LDK_InitFeatures_supports_variable_length_onion(int64_t this_arg) {
57020         LDKInitFeatures this_arg_conv;
57021         this_arg_conv.inner = untag_ptr(this_arg);
57022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57024         this_arg_conv.is_owned = false;
57025         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
57026         return ret_conv;
57027 }
57028
57029 void  CS_LDK_NodeFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57030         LDKNodeFeatures this_arg_conv;
57031         this_arg_conv.inner = untag_ptr(this_arg);
57032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57034         this_arg_conv.is_owned = false;
57035         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
57036 }
57037
57038 void  CS_LDK_NodeFeatures_set_variable_length_onion_required(int64_t this_arg) {
57039         LDKNodeFeatures this_arg_conv;
57040         this_arg_conv.inner = untag_ptr(this_arg);
57041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57043         this_arg_conv.is_owned = false;
57044         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
57045 }
57046
57047 jboolean  CS_LDK_NodeFeatures_supports_variable_length_onion(int64_t this_arg) {
57048         LDKNodeFeatures this_arg_conv;
57049         this_arg_conv.inner = untag_ptr(this_arg);
57050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57052         this_arg_conv.is_owned = false;
57053         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
57054         return ret_conv;
57055 }
57056
57057 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_optional(int64_t this_arg) {
57058         LDKBolt11InvoiceFeatures this_arg_conv;
57059         this_arg_conv.inner = untag_ptr(this_arg);
57060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57062         this_arg_conv.is_owned = false;
57063         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
57064 }
57065
57066 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_required(int64_t this_arg) {
57067         LDKBolt11InvoiceFeatures this_arg_conv;
57068         this_arg_conv.inner = untag_ptr(this_arg);
57069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57071         this_arg_conv.is_owned = false;
57072         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
57073 }
57074
57075 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_variable_length_onion(int64_t this_arg) {
57076         LDKBolt11InvoiceFeatures this_arg_conv;
57077         this_arg_conv.inner = untag_ptr(this_arg);
57078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57080         this_arg_conv.is_owned = false;
57081         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
57082         return ret_conv;
57083 }
57084
57085 jboolean  CS_LDK_InitFeatures_requires_variable_length_onion(int64_t this_arg) {
57086         LDKInitFeatures this_arg_conv;
57087         this_arg_conv.inner = untag_ptr(this_arg);
57088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57090         this_arg_conv.is_owned = false;
57091         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
57092         return ret_conv;
57093 }
57094
57095 jboolean  CS_LDK_NodeFeatures_requires_variable_length_onion(int64_t this_arg) {
57096         LDKNodeFeatures this_arg_conv;
57097         this_arg_conv.inner = untag_ptr(this_arg);
57098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57100         this_arg_conv.is_owned = false;
57101         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
57102         return ret_conv;
57103 }
57104
57105 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_variable_length_onion(int64_t this_arg) {
57106         LDKBolt11InvoiceFeatures this_arg_conv;
57107         this_arg_conv.inner = untag_ptr(this_arg);
57108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57110         this_arg_conv.is_owned = false;
57111         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
57112         return ret_conv;
57113 }
57114
57115 void  CS_LDK_InitFeatures_set_static_remote_key_optional(int64_t this_arg) {
57116         LDKInitFeatures this_arg_conv;
57117         this_arg_conv.inner = untag_ptr(this_arg);
57118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57120         this_arg_conv.is_owned = false;
57121         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
57122 }
57123
57124 void  CS_LDK_InitFeatures_set_static_remote_key_required(int64_t this_arg) {
57125         LDKInitFeatures this_arg_conv;
57126         this_arg_conv.inner = untag_ptr(this_arg);
57127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57129         this_arg_conv.is_owned = false;
57130         InitFeatures_set_static_remote_key_required(&this_arg_conv);
57131 }
57132
57133 jboolean  CS_LDK_InitFeatures_supports_static_remote_key(int64_t this_arg) {
57134         LDKInitFeatures this_arg_conv;
57135         this_arg_conv.inner = untag_ptr(this_arg);
57136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57138         this_arg_conv.is_owned = false;
57139         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
57140         return ret_conv;
57141 }
57142
57143 void  CS_LDK_NodeFeatures_set_static_remote_key_optional(int64_t this_arg) {
57144         LDKNodeFeatures this_arg_conv;
57145         this_arg_conv.inner = untag_ptr(this_arg);
57146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57148         this_arg_conv.is_owned = false;
57149         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
57150 }
57151
57152 void  CS_LDK_NodeFeatures_set_static_remote_key_required(int64_t this_arg) {
57153         LDKNodeFeatures this_arg_conv;
57154         this_arg_conv.inner = untag_ptr(this_arg);
57155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57157         this_arg_conv.is_owned = false;
57158         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
57159 }
57160
57161 jboolean  CS_LDK_NodeFeatures_supports_static_remote_key(int64_t this_arg) {
57162         LDKNodeFeatures this_arg_conv;
57163         this_arg_conv.inner = untag_ptr(this_arg);
57164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57166         this_arg_conv.is_owned = false;
57167         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
57168         return ret_conv;
57169 }
57170
57171 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_optional(int64_t this_arg) {
57172         LDKChannelTypeFeatures this_arg_conv;
57173         this_arg_conv.inner = untag_ptr(this_arg);
57174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57176         this_arg_conv.is_owned = false;
57177         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
57178 }
57179
57180 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_required(int64_t this_arg) {
57181         LDKChannelTypeFeatures this_arg_conv;
57182         this_arg_conv.inner = untag_ptr(this_arg);
57183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57185         this_arg_conv.is_owned = false;
57186         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
57187 }
57188
57189 jboolean  CS_LDK_ChannelTypeFeatures_supports_static_remote_key(int64_t this_arg) {
57190         LDKChannelTypeFeatures this_arg_conv;
57191         this_arg_conv.inner = untag_ptr(this_arg);
57192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57194         this_arg_conv.is_owned = false;
57195         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
57196         return ret_conv;
57197 }
57198
57199 jboolean  CS_LDK_InitFeatures_requires_static_remote_key(int64_t this_arg) {
57200         LDKInitFeatures this_arg_conv;
57201         this_arg_conv.inner = untag_ptr(this_arg);
57202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57204         this_arg_conv.is_owned = false;
57205         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
57206         return ret_conv;
57207 }
57208
57209 jboolean  CS_LDK_NodeFeatures_requires_static_remote_key(int64_t this_arg) {
57210         LDKNodeFeatures this_arg_conv;
57211         this_arg_conv.inner = untag_ptr(this_arg);
57212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57214         this_arg_conv.is_owned = false;
57215         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
57216         return ret_conv;
57217 }
57218
57219 jboolean  CS_LDK_ChannelTypeFeatures_requires_static_remote_key(int64_t this_arg) {
57220         LDKChannelTypeFeatures this_arg_conv;
57221         this_arg_conv.inner = untag_ptr(this_arg);
57222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57224         this_arg_conv.is_owned = false;
57225         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
57226         return ret_conv;
57227 }
57228
57229 void  CS_LDK_InitFeatures_set_payment_secret_optional(int64_t this_arg) {
57230         LDKInitFeatures this_arg_conv;
57231         this_arg_conv.inner = untag_ptr(this_arg);
57232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57234         this_arg_conv.is_owned = false;
57235         InitFeatures_set_payment_secret_optional(&this_arg_conv);
57236 }
57237
57238 void  CS_LDK_InitFeatures_set_payment_secret_required(int64_t this_arg) {
57239         LDKInitFeatures this_arg_conv;
57240         this_arg_conv.inner = untag_ptr(this_arg);
57241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57243         this_arg_conv.is_owned = false;
57244         InitFeatures_set_payment_secret_required(&this_arg_conv);
57245 }
57246
57247 jboolean  CS_LDK_InitFeatures_supports_payment_secret(int64_t this_arg) {
57248         LDKInitFeatures this_arg_conv;
57249         this_arg_conv.inner = untag_ptr(this_arg);
57250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57252         this_arg_conv.is_owned = false;
57253         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
57254         return ret_conv;
57255 }
57256
57257 void  CS_LDK_NodeFeatures_set_payment_secret_optional(int64_t this_arg) {
57258         LDKNodeFeatures this_arg_conv;
57259         this_arg_conv.inner = untag_ptr(this_arg);
57260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57262         this_arg_conv.is_owned = false;
57263         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
57264 }
57265
57266 void  CS_LDK_NodeFeatures_set_payment_secret_required(int64_t this_arg) {
57267         LDKNodeFeatures this_arg_conv;
57268         this_arg_conv.inner = untag_ptr(this_arg);
57269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57271         this_arg_conv.is_owned = false;
57272         NodeFeatures_set_payment_secret_required(&this_arg_conv);
57273 }
57274
57275 jboolean  CS_LDK_NodeFeatures_supports_payment_secret(int64_t this_arg) {
57276         LDKNodeFeatures this_arg_conv;
57277         this_arg_conv.inner = untag_ptr(this_arg);
57278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57280         this_arg_conv.is_owned = false;
57281         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
57282         return ret_conv;
57283 }
57284
57285 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_optional(int64_t this_arg) {
57286         LDKBolt11InvoiceFeatures this_arg_conv;
57287         this_arg_conv.inner = untag_ptr(this_arg);
57288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57290         this_arg_conv.is_owned = false;
57291         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
57292 }
57293
57294 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_required(int64_t this_arg) {
57295         LDKBolt11InvoiceFeatures this_arg_conv;
57296         this_arg_conv.inner = untag_ptr(this_arg);
57297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57299         this_arg_conv.is_owned = false;
57300         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
57301 }
57302
57303 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_secret(int64_t this_arg) {
57304         LDKBolt11InvoiceFeatures this_arg_conv;
57305         this_arg_conv.inner = untag_ptr(this_arg);
57306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57308         this_arg_conv.is_owned = false;
57309         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
57310         return ret_conv;
57311 }
57312
57313 jboolean  CS_LDK_InitFeatures_requires_payment_secret(int64_t this_arg) {
57314         LDKInitFeatures this_arg_conv;
57315         this_arg_conv.inner = untag_ptr(this_arg);
57316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57318         this_arg_conv.is_owned = false;
57319         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
57320         return ret_conv;
57321 }
57322
57323 jboolean  CS_LDK_NodeFeatures_requires_payment_secret(int64_t this_arg) {
57324         LDKNodeFeatures this_arg_conv;
57325         this_arg_conv.inner = untag_ptr(this_arg);
57326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57328         this_arg_conv.is_owned = false;
57329         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
57330         return ret_conv;
57331 }
57332
57333 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_secret(int64_t this_arg) {
57334         LDKBolt11InvoiceFeatures this_arg_conv;
57335         this_arg_conv.inner = untag_ptr(this_arg);
57336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57338         this_arg_conv.is_owned = false;
57339         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
57340         return ret_conv;
57341 }
57342
57343 void  CS_LDK_InitFeatures_set_basic_mpp_optional(int64_t this_arg) {
57344         LDKInitFeatures this_arg_conv;
57345         this_arg_conv.inner = untag_ptr(this_arg);
57346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57348         this_arg_conv.is_owned = false;
57349         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
57350 }
57351
57352 void  CS_LDK_InitFeatures_set_basic_mpp_required(int64_t this_arg) {
57353         LDKInitFeatures this_arg_conv;
57354         this_arg_conv.inner = untag_ptr(this_arg);
57355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57357         this_arg_conv.is_owned = false;
57358         InitFeatures_set_basic_mpp_required(&this_arg_conv);
57359 }
57360
57361 jboolean  CS_LDK_InitFeatures_supports_basic_mpp(int64_t this_arg) {
57362         LDKInitFeatures this_arg_conv;
57363         this_arg_conv.inner = untag_ptr(this_arg);
57364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57366         this_arg_conv.is_owned = false;
57367         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
57368         return ret_conv;
57369 }
57370
57371 void  CS_LDK_NodeFeatures_set_basic_mpp_optional(int64_t this_arg) {
57372         LDKNodeFeatures this_arg_conv;
57373         this_arg_conv.inner = untag_ptr(this_arg);
57374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57376         this_arg_conv.is_owned = false;
57377         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
57378 }
57379
57380 void  CS_LDK_NodeFeatures_set_basic_mpp_required(int64_t this_arg) {
57381         LDKNodeFeatures this_arg_conv;
57382         this_arg_conv.inner = untag_ptr(this_arg);
57383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57385         this_arg_conv.is_owned = false;
57386         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
57387 }
57388
57389 jboolean  CS_LDK_NodeFeatures_supports_basic_mpp(int64_t this_arg) {
57390         LDKNodeFeatures this_arg_conv;
57391         this_arg_conv.inner = untag_ptr(this_arg);
57392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57394         this_arg_conv.is_owned = false;
57395         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
57396         return ret_conv;
57397 }
57398
57399 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
57400         LDKBolt11InvoiceFeatures this_arg_conv;
57401         this_arg_conv.inner = untag_ptr(this_arg);
57402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57404         this_arg_conv.is_owned = false;
57405         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57406 }
57407
57408 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
57409         LDKBolt11InvoiceFeatures this_arg_conv;
57410         this_arg_conv.inner = untag_ptr(this_arg);
57411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57413         this_arg_conv.is_owned = false;
57414         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57415 }
57416
57417 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
57418         LDKBolt11InvoiceFeatures this_arg_conv;
57419         this_arg_conv.inner = untag_ptr(this_arg);
57420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57422         this_arg_conv.is_owned = false;
57423         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57424         return ret_conv;
57425 }
57426
57427 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
57428         LDKBolt12InvoiceFeatures this_arg_conv;
57429         this_arg_conv.inner = untag_ptr(this_arg);
57430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57432         this_arg_conv.is_owned = false;
57433         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
57434 }
57435
57436 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
57437         LDKBolt12InvoiceFeatures this_arg_conv;
57438         this_arg_conv.inner = untag_ptr(this_arg);
57439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57441         this_arg_conv.is_owned = false;
57442         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
57443 }
57444
57445 jboolean  CS_LDK_Bolt12InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
57446         LDKBolt12InvoiceFeatures this_arg_conv;
57447         this_arg_conv.inner = untag_ptr(this_arg);
57448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57450         this_arg_conv.is_owned = false;
57451         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
57452         return ret_conv;
57453 }
57454
57455 jboolean  CS_LDK_InitFeatures_requires_basic_mpp(int64_t this_arg) {
57456         LDKInitFeatures this_arg_conv;
57457         this_arg_conv.inner = untag_ptr(this_arg);
57458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57460         this_arg_conv.is_owned = false;
57461         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
57462         return ret_conv;
57463 }
57464
57465 jboolean  CS_LDK_NodeFeatures_requires_basic_mpp(int64_t this_arg) {
57466         LDKNodeFeatures this_arg_conv;
57467         this_arg_conv.inner = untag_ptr(this_arg);
57468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57470         this_arg_conv.is_owned = false;
57471         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
57472         return ret_conv;
57473 }
57474
57475 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
57476         LDKBolt11InvoiceFeatures this_arg_conv;
57477         this_arg_conv.inner = untag_ptr(this_arg);
57478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57480         this_arg_conv.is_owned = false;
57481         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57482         return ret_conv;
57483 }
57484
57485 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
57486         LDKBolt12InvoiceFeatures this_arg_conv;
57487         this_arg_conv.inner = untag_ptr(this_arg);
57488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57490         this_arg_conv.is_owned = false;
57491         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
57492         return ret_conv;
57493 }
57494
57495 void  CS_LDK_InitFeatures_set_wumbo_optional(int64_t this_arg) {
57496         LDKInitFeatures this_arg_conv;
57497         this_arg_conv.inner = untag_ptr(this_arg);
57498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57500         this_arg_conv.is_owned = false;
57501         InitFeatures_set_wumbo_optional(&this_arg_conv);
57502 }
57503
57504 void  CS_LDK_InitFeatures_set_wumbo_required(int64_t this_arg) {
57505         LDKInitFeatures this_arg_conv;
57506         this_arg_conv.inner = untag_ptr(this_arg);
57507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57509         this_arg_conv.is_owned = false;
57510         InitFeatures_set_wumbo_required(&this_arg_conv);
57511 }
57512
57513 jboolean  CS_LDK_InitFeatures_supports_wumbo(int64_t this_arg) {
57514         LDKInitFeatures this_arg_conv;
57515         this_arg_conv.inner = untag_ptr(this_arg);
57516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57518         this_arg_conv.is_owned = false;
57519         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
57520         return ret_conv;
57521 }
57522
57523 void  CS_LDK_NodeFeatures_set_wumbo_optional(int64_t this_arg) {
57524         LDKNodeFeatures this_arg_conv;
57525         this_arg_conv.inner = untag_ptr(this_arg);
57526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57528         this_arg_conv.is_owned = false;
57529         NodeFeatures_set_wumbo_optional(&this_arg_conv);
57530 }
57531
57532 void  CS_LDK_NodeFeatures_set_wumbo_required(int64_t this_arg) {
57533         LDKNodeFeatures this_arg_conv;
57534         this_arg_conv.inner = untag_ptr(this_arg);
57535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57537         this_arg_conv.is_owned = false;
57538         NodeFeatures_set_wumbo_required(&this_arg_conv);
57539 }
57540
57541 jboolean  CS_LDK_NodeFeatures_supports_wumbo(int64_t this_arg) {
57542         LDKNodeFeatures this_arg_conv;
57543         this_arg_conv.inner = untag_ptr(this_arg);
57544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57546         this_arg_conv.is_owned = false;
57547         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
57548         return ret_conv;
57549 }
57550
57551 jboolean  CS_LDK_InitFeatures_requires_wumbo(int64_t this_arg) {
57552         LDKInitFeatures this_arg_conv;
57553         this_arg_conv.inner = untag_ptr(this_arg);
57554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57556         this_arg_conv.is_owned = false;
57557         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
57558         return ret_conv;
57559 }
57560
57561 jboolean  CS_LDK_NodeFeatures_requires_wumbo(int64_t this_arg) {
57562         LDKNodeFeatures this_arg_conv;
57563         this_arg_conv.inner = untag_ptr(this_arg);
57564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57566         this_arg_conv.is_owned = false;
57567         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
57568         return ret_conv;
57569 }
57570
57571 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57572         LDKInitFeatures this_arg_conv;
57573         this_arg_conv.inner = untag_ptr(this_arg);
57574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57576         this_arg_conv.is_owned = false;
57577         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57578 }
57579
57580 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57581         LDKInitFeatures this_arg_conv;
57582         this_arg_conv.inner = untag_ptr(this_arg);
57583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57585         this_arg_conv.is_owned = false;
57586         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57587 }
57588
57589 jboolean  CS_LDK_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57590         LDKInitFeatures this_arg_conv;
57591         this_arg_conv.inner = untag_ptr(this_arg);
57592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57594         this_arg_conv.is_owned = false;
57595         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57596         return ret_conv;
57597 }
57598
57599 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57600         LDKNodeFeatures this_arg_conv;
57601         this_arg_conv.inner = untag_ptr(this_arg);
57602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57604         this_arg_conv.is_owned = false;
57605         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57606 }
57607
57608 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57609         LDKNodeFeatures this_arg_conv;
57610         this_arg_conv.inner = untag_ptr(this_arg);
57611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57613         this_arg_conv.is_owned = false;
57614         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57615 }
57616
57617 jboolean  CS_LDK_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57618         LDKNodeFeatures this_arg_conv;
57619         this_arg_conv.inner = untag_ptr(this_arg);
57620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57622         this_arg_conv.is_owned = false;
57623         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57624         return ret_conv;
57625 }
57626
57627 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
57628         LDKChannelTypeFeatures this_arg_conv;
57629         this_arg_conv.inner = untag_ptr(this_arg);
57630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57632         this_arg_conv.is_owned = false;
57633         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
57634 }
57635
57636 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
57637         LDKChannelTypeFeatures this_arg_conv;
57638         this_arg_conv.inner = untag_ptr(this_arg);
57639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57641         this_arg_conv.is_owned = false;
57642         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
57643 }
57644
57645 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57646         LDKChannelTypeFeatures this_arg_conv;
57647         this_arg_conv.inner = untag_ptr(this_arg);
57648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57650         this_arg_conv.is_owned = false;
57651         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57652         return ret_conv;
57653 }
57654
57655 jboolean  CS_LDK_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57656         LDKInitFeatures this_arg_conv;
57657         this_arg_conv.inner = untag_ptr(this_arg);
57658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57660         this_arg_conv.is_owned = false;
57661         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57662         return ret_conv;
57663 }
57664
57665 jboolean  CS_LDK_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57666         LDKNodeFeatures this_arg_conv;
57667         this_arg_conv.inner = untag_ptr(this_arg);
57668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57670         this_arg_conv.is_owned = false;
57671         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57672         return ret_conv;
57673 }
57674
57675 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
57676         LDKChannelTypeFeatures this_arg_conv;
57677         this_arg_conv.inner = untag_ptr(this_arg);
57678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57680         this_arg_conv.is_owned = false;
57681         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
57682         return ret_conv;
57683 }
57684
57685 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57686         LDKInitFeatures this_arg_conv;
57687         this_arg_conv.inner = untag_ptr(this_arg);
57688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57690         this_arg_conv.is_owned = false;
57691         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57692 }
57693
57694 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57695         LDKInitFeatures this_arg_conv;
57696         this_arg_conv.inner = untag_ptr(this_arg);
57697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57699         this_arg_conv.is_owned = false;
57700         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57701 }
57702
57703 jboolean  CS_LDK_InitFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57704         LDKInitFeatures this_arg_conv;
57705         this_arg_conv.inner = untag_ptr(this_arg);
57706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57708         this_arg_conv.is_owned = false;
57709         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57710         return ret_conv;
57711 }
57712
57713 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57714         LDKNodeFeatures this_arg_conv;
57715         this_arg_conv.inner = untag_ptr(this_arg);
57716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57718         this_arg_conv.is_owned = false;
57719         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57720 }
57721
57722 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57723         LDKNodeFeatures this_arg_conv;
57724         this_arg_conv.inner = untag_ptr(this_arg);
57725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57727         this_arg_conv.is_owned = false;
57728         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57729 }
57730
57731 jboolean  CS_LDK_NodeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57732         LDKNodeFeatures this_arg_conv;
57733         this_arg_conv.inner = untag_ptr(this_arg);
57734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57736         this_arg_conv.is_owned = false;
57737         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57738         return ret_conv;
57739 }
57740
57741 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
57742         LDKChannelTypeFeatures this_arg_conv;
57743         this_arg_conv.inner = untag_ptr(this_arg);
57744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57746         this_arg_conv.is_owned = false;
57747         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
57748 }
57749
57750 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
57751         LDKChannelTypeFeatures this_arg_conv;
57752         this_arg_conv.inner = untag_ptr(this_arg);
57753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57755         this_arg_conv.is_owned = false;
57756         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
57757 }
57758
57759 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57760         LDKChannelTypeFeatures this_arg_conv;
57761         this_arg_conv.inner = untag_ptr(this_arg);
57762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57764         this_arg_conv.is_owned = false;
57765         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
57766         return ret_conv;
57767 }
57768
57769 jboolean  CS_LDK_InitFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57770         LDKInitFeatures this_arg_conv;
57771         this_arg_conv.inner = untag_ptr(this_arg);
57772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57774         this_arg_conv.is_owned = false;
57775         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57776         return ret_conv;
57777 }
57778
57779 jboolean  CS_LDK_NodeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57780         LDKNodeFeatures this_arg_conv;
57781         this_arg_conv.inner = untag_ptr(this_arg);
57782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57784         this_arg_conv.is_owned = false;
57785         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57786         return ret_conv;
57787 }
57788
57789 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
57790         LDKChannelTypeFeatures this_arg_conv;
57791         this_arg_conv.inner = untag_ptr(this_arg);
57792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57794         this_arg_conv.is_owned = false;
57795         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
57796         return ret_conv;
57797 }
57798
57799 void  CS_LDK_InitFeatures_set_route_blinding_optional(int64_t this_arg) {
57800         LDKInitFeatures this_arg_conv;
57801         this_arg_conv.inner = untag_ptr(this_arg);
57802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57804         this_arg_conv.is_owned = false;
57805         InitFeatures_set_route_blinding_optional(&this_arg_conv);
57806 }
57807
57808 void  CS_LDK_InitFeatures_set_route_blinding_required(int64_t this_arg) {
57809         LDKInitFeatures this_arg_conv;
57810         this_arg_conv.inner = untag_ptr(this_arg);
57811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57813         this_arg_conv.is_owned = false;
57814         InitFeatures_set_route_blinding_required(&this_arg_conv);
57815 }
57816
57817 jboolean  CS_LDK_InitFeatures_supports_route_blinding(int64_t this_arg) {
57818         LDKInitFeatures this_arg_conv;
57819         this_arg_conv.inner = untag_ptr(this_arg);
57820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57822         this_arg_conv.is_owned = false;
57823         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
57824         return ret_conv;
57825 }
57826
57827 void  CS_LDK_NodeFeatures_set_route_blinding_optional(int64_t this_arg) {
57828         LDKNodeFeatures this_arg_conv;
57829         this_arg_conv.inner = untag_ptr(this_arg);
57830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57832         this_arg_conv.is_owned = false;
57833         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
57834 }
57835
57836 void  CS_LDK_NodeFeatures_set_route_blinding_required(int64_t this_arg) {
57837         LDKNodeFeatures this_arg_conv;
57838         this_arg_conv.inner = untag_ptr(this_arg);
57839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57841         this_arg_conv.is_owned = false;
57842         NodeFeatures_set_route_blinding_required(&this_arg_conv);
57843 }
57844
57845 jboolean  CS_LDK_NodeFeatures_supports_route_blinding(int64_t this_arg) {
57846         LDKNodeFeatures this_arg_conv;
57847         this_arg_conv.inner = untag_ptr(this_arg);
57848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57850         this_arg_conv.is_owned = false;
57851         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
57852         return ret_conv;
57853 }
57854
57855 jboolean  CS_LDK_InitFeatures_requires_route_blinding(int64_t this_arg) {
57856         LDKInitFeatures this_arg_conv;
57857         this_arg_conv.inner = untag_ptr(this_arg);
57858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57860         this_arg_conv.is_owned = false;
57861         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
57862         return ret_conv;
57863 }
57864
57865 jboolean  CS_LDK_NodeFeatures_requires_route_blinding(int64_t this_arg) {
57866         LDKNodeFeatures this_arg_conv;
57867         this_arg_conv.inner = untag_ptr(this_arg);
57868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57870         this_arg_conv.is_owned = false;
57871         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
57872         return ret_conv;
57873 }
57874
57875 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
57876         LDKInitFeatures this_arg_conv;
57877         this_arg_conv.inner = untag_ptr(this_arg);
57878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57880         this_arg_conv.is_owned = false;
57881         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57882 }
57883
57884 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
57885         LDKInitFeatures this_arg_conv;
57886         this_arg_conv.inner = untag_ptr(this_arg);
57887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57889         this_arg_conv.is_owned = false;
57890         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57891 }
57892
57893 jboolean  CS_LDK_InitFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
57894         LDKInitFeatures this_arg_conv;
57895         this_arg_conv.inner = untag_ptr(this_arg);
57896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57898         this_arg_conv.is_owned = false;
57899         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57900         return ret_conv;
57901 }
57902
57903 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
57904         LDKNodeFeatures this_arg_conv;
57905         this_arg_conv.inner = untag_ptr(this_arg);
57906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57908         this_arg_conv.is_owned = false;
57909         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
57910 }
57911
57912 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
57913         LDKNodeFeatures this_arg_conv;
57914         this_arg_conv.inner = untag_ptr(this_arg);
57915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57917         this_arg_conv.is_owned = false;
57918         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
57919 }
57920
57921 jboolean  CS_LDK_NodeFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
57922         LDKNodeFeatures this_arg_conv;
57923         this_arg_conv.inner = untag_ptr(this_arg);
57924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57926         this_arg_conv.is_owned = false;
57927         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
57928         return ret_conv;
57929 }
57930
57931 jboolean  CS_LDK_InitFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
57932         LDKInitFeatures this_arg_conv;
57933         this_arg_conv.inner = untag_ptr(this_arg);
57934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57936         this_arg_conv.is_owned = false;
57937         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57938         return ret_conv;
57939 }
57940
57941 jboolean  CS_LDK_NodeFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
57942         LDKNodeFeatures this_arg_conv;
57943         this_arg_conv.inner = untag_ptr(this_arg);
57944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57946         this_arg_conv.is_owned = false;
57947         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
57948         return ret_conv;
57949 }
57950
57951 void  CS_LDK_InitFeatures_set_taproot_optional(int64_t this_arg) {
57952         LDKInitFeatures this_arg_conv;
57953         this_arg_conv.inner = untag_ptr(this_arg);
57954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57956         this_arg_conv.is_owned = false;
57957         InitFeatures_set_taproot_optional(&this_arg_conv);
57958 }
57959
57960 void  CS_LDK_InitFeatures_set_taproot_required(int64_t this_arg) {
57961         LDKInitFeatures this_arg_conv;
57962         this_arg_conv.inner = untag_ptr(this_arg);
57963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57965         this_arg_conv.is_owned = false;
57966         InitFeatures_set_taproot_required(&this_arg_conv);
57967 }
57968
57969 jboolean  CS_LDK_InitFeatures_supports_taproot(int64_t this_arg) {
57970         LDKInitFeatures this_arg_conv;
57971         this_arg_conv.inner = untag_ptr(this_arg);
57972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57974         this_arg_conv.is_owned = false;
57975         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
57976         return ret_conv;
57977 }
57978
57979 void  CS_LDK_NodeFeatures_set_taproot_optional(int64_t this_arg) {
57980         LDKNodeFeatures this_arg_conv;
57981         this_arg_conv.inner = untag_ptr(this_arg);
57982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57984         this_arg_conv.is_owned = false;
57985         NodeFeatures_set_taproot_optional(&this_arg_conv);
57986 }
57987
57988 void  CS_LDK_NodeFeatures_set_taproot_required(int64_t this_arg) {
57989         LDKNodeFeatures this_arg_conv;
57990         this_arg_conv.inner = untag_ptr(this_arg);
57991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57993         this_arg_conv.is_owned = false;
57994         NodeFeatures_set_taproot_required(&this_arg_conv);
57995 }
57996
57997 jboolean  CS_LDK_NodeFeatures_supports_taproot(int64_t this_arg) {
57998         LDKNodeFeatures this_arg_conv;
57999         this_arg_conv.inner = untag_ptr(this_arg);
58000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58002         this_arg_conv.is_owned = false;
58003         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
58004         return ret_conv;
58005 }
58006
58007 void  CS_LDK_ChannelTypeFeatures_set_taproot_optional(int64_t this_arg) {
58008         LDKChannelTypeFeatures this_arg_conv;
58009         this_arg_conv.inner = untag_ptr(this_arg);
58010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58012         this_arg_conv.is_owned = false;
58013         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
58014 }
58015
58016 void  CS_LDK_ChannelTypeFeatures_set_taproot_required(int64_t this_arg) {
58017         LDKChannelTypeFeatures this_arg_conv;
58018         this_arg_conv.inner = untag_ptr(this_arg);
58019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58021         this_arg_conv.is_owned = false;
58022         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
58023 }
58024
58025 jboolean  CS_LDK_ChannelTypeFeatures_supports_taproot(int64_t this_arg) {
58026         LDKChannelTypeFeatures this_arg_conv;
58027         this_arg_conv.inner = untag_ptr(this_arg);
58028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58030         this_arg_conv.is_owned = false;
58031         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
58032         return ret_conv;
58033 }
58034
58035 jboolean  CS_LDK_InitFeatures_requires_taproot(int64_t this_arg) {
58036         LDKInitFeatures this_arg_conv;
58037         this_arg_conv.inner = untag_ptr(this_arg);
58038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58040         this_arg_conv.is_owned = false;
58041         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
58042         return ret_conv;
58043 }
58044
58045 jboolean  CS_LDK_NodeFeatures_requires_taproot(int64_t this_arg) {
58046         LDKNodeFeatures this_arg_conv;
58047         this_arg_conv.inner = untag_ptr(this_arg);
58048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58050         this_arg_conv.is_owned = false;
58051         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
58052         return ret_conv;
58053 }
58054
58055 jboolean  CS_LDK_ChannelTypeFeatures_requires_taproot(int64_t this_arg) {
58056         LDKChannelTypeFeatures this_arg_conv;
58057         this_arg_conv.inner = untag_ptr(this_arg);
58058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58060         this_arg_conv.is_owned = false;
58061         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
58062         return ret_conv;
58063 }
58064
58065 void  CS_LDK_InitFeatures_set_onion_messages_optional(int64_t this_arg) {
58066         LDKInitFeatures this_arg_conv;
58067         this_arg_conv.inner = untag_ptr(this_arg);
58068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58070         this_arg_conv.is_owned = false;
58071         InitFeatures_set_onion_messages_optional(&this_arg_conv);
58072 }
58073
58074 void  CS_LDK_InitFeatures_set_onion_messages_required(int64_t this_arg) {
58075         LDKInitFeatures this_arg_conv;
58076         this_arg_conv.inner = untag_ptr(this_arg);
58077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58079         this_arg_conv.is_owned = false;
58080         InitFeatures_set_onion_messages_required(&this_arg_conv);
58081 }
58082
58083 jboolean  CS_LDK_InitFeatures_supports_onion_messages(int64_t this_arg) {
58084         LDKInitFeatures this_arg_conv;
58085         this_arg_conv.inner = untag_ptr(this_arg);
58086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58088         this_arg_conv.is_owned = false;
58089         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
58090         return ret_conv;
58091 }
58092
58093 void  CS_LDK_NodeFeatures_set_onion_messages_optional(int64_t this_arg) {
58094         LDKNodeFeatures this_arg_conv;
58095         this_arg_conv.inner = untag_ptr(this_arg);
58096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58098         this_arg_conv.is_owned = false;
58099         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
58100 }
58101
58102 void  CS_LDK_NodeFeatures_set_onion_messages_required(int64_t this_arg) {
58103         LDKNodeFeatures this_arg_conv;
58104         this_arg_conv.inner = untag_ptr(this_arg);
58105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58107         this_arg_conv.is_owned = false;
58108         NodeFeatures_set_onion_messages_required(&this_arg_conv);
58109 }
58110
58111 jboolean  CS_LDK_NodeFeatures_supports_onion_messages(int64_t this_arg) {
58112         LDKNodeFeatures this_arg_conv;
58113         this_arg_conv.inner = untag_ptr(this_arg);
58114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58116         this_arg_conv.is_owned = false;
58117         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
58118         return ret_conv;
58119 }
58120
58121 jboolean  CS_LDK_InitFeatures_requires_onion_messages(int64_t this_arg) {
58122         LDKInitFeatures this_arg_conv;
58123         this_arg_conv.inner = untag_ptr(this_arg);
58124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58126         this_arg_conv.is_owned = false;
58127         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
58128         return ret_conv;
58129 }
58130
58131 jboolean  CS_LDK_NodeFeatures_requires_onion_messages(int64_t this_arg) {
58132         LDKNodeFeatures this_arg_conv;
58133         this_arg_conv.inner = untag_ptr(this_arg);
58134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58136         this_arg_conv.is_owned = false;
58137         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
58138         return ret_conv;
58139 }
58140
58141 void  CS_LDK_InitFeatures_set_channel_type_optional(int64_t this_arg) {
58142         LDKInitFeatures this_arg_conv;
58143         this_arg_conv.inner = untag_ptr(this_arg);
58144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58146         this_arg_conv.is_owned = false;
58147         InitFeatures_set_channel_type_optional(&this_arg_conv);
58148 }
58149
58150 void  CS_LDK_InitFeatures_set_channel_type_required(int64_t this_arg) {
58151         LDKInitFeatures this_arg_conv;
58152         this_arg_conv.inner = untag_ptr(this_arg);
58153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58155         this_arg_conv.is_owned = false;
58156         InitFeatures_set_channel_type_required(&this_arg_conv);
58157 }
58158
58159 jboolean  CS_LDK_InitFeatures_supports_channel_type(int64_t this_arg) {
58160         LDKInitFeatures this_arg_conv;
58161         this_arg_conv.inner = untag_ptr(this_arg);
58162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58164         this_arg_conv.is_owned = false;
58165         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
58166         return ret_conv;
58167 }
58168
58169 void  CS_LDK_NodeFeatures_set_channel_type_optional(int64_t this_arg) {
58170         LDKNodeFeatures this_arg_conv;
58171         this_arg_conv.inner = untag_ptr(this_arg);
58172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58174         this_arg_conv.is_owned = false;
58175         NodeFeatures_set_channel_type_optional(&this_arg_conv);
58176 }
58177
58178 void  CS_LDK_NodeFeatures_set_channel_type_required(int64_t this_arg) {
58179         LDKNodeFeatures this_arg_conv;
58180         this_arg_conv.inner = untag_ptr(this_arg);
58181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58183         this_arg_conv.is_owned = false;
58184         NodeFeatures_set_channel_type_required(&this_arg_conv);
58185 }
58186
58187 jboolean  CS_LDK_NodeFeatures_supports_channel_type(int64_t this_arg) {
58188         LDKNodeFeatures this_arg_conv;
58189         this_arg_conv.inner = untag_ptr(this_arg);
58190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58192         this_arg_conv.is_owned = false;
58193         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
58194         return ret_conv;
58195 }
58196
58197 jboolean  CS_LDK_InitFeatures_requires_channel_type(int64_t this_arg) {
58198         LDKInitFeatures this_arg_conv;
58199         this_arg_conv.inner = untag_ptr(this_arg);
58200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58202         this_arg_conv.is_owned = false;
58203         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
58204         return ret_conv;
58205 }
58206
58207 jboolean  CS_LDK_NodeFeatures_requires_channel_type(int64_t this_arg) {
58208         LDKNodeFeatures this_arg_conv;
58209         this_arg_conv.inner = untag_ptr(this_arg);
58210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58212         this_arg_conv.is_owned = false;
58213         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
58214         return ret_conv;
58215 }
58216
58217 void  CS_LDK_InitFeatures_set_scid_privacy_optional(int64_t this_arg) {
58218         LDKInitFeatures this_arg_conv;
58219         this_arg_conv.inner = untag_ptr(this_arg);
58220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58222         this_arg_conv.is_owned = false;
58223         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
58224 }
58225
58226 void  CS_LDK_InitFeatures_set_scid_privacy_required(int64_t this_arg) {
58227         LDKInitFeatures this_arg_conv;
58228         this_arg_conv.inner = untag_ptr(this_arg);
58229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58231         this_arg_conv.is_owned = false;
58232         InitFeatures_set_scid_privacy_required(&this_arg_conv);
58233 }
58234
58235 jboolean  CS_LDK_InitFeatures_supports_scid_privacy(int64_t this_arg) {
58236         LDKInitFeatures this_arg_conv;
58237         this_arg_conv.inner = untag_ptr(this_arg);
58238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58240         this_arg_conv.is_owned = false;
58241         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
58242         return ret_conv;
58243 }
58244
58245 void  CS_LDK_NodeFeatures_set_scid_privacy_optional(int64_t this_arg) {
58246         LDKNodeFeatures this_arg_conv;
58247         this_arg_conv.inner = untag_ptr(this_arg);
58248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58250         this_arg_conv.is_owned = false;
58251         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
58252 }
58253
58254 void  CS_LDK_NodeFeatures_set_scid_privacy_required(int64_t this_arg) {
58255         LDKNodeFeatures this_arg_conv;
58256         this_arg_conv.inner = untag_ptr(this_arg);
58257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58259         this_arg_conv.is_owned = false;
58260         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
58261 }
58262
58263 jboolean  CS_LDK_NodeFeatures_supports_scid_privacy(int64_t this_arg) {
58264         LDKNodeFeatures this_arg_conv;
58265         this_arg_conv.inner = untag_ptr(this_arg);
58266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58268         this_arg_conv.is_owned = false;
58269         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
58270         return ret_conv;
58271 }
58272
58273 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_optional(int64_t this_arg) {
58274         LDKChannelTypeFeatures this_arg_conv;
58275         this_arg_conv.inner = untag_ptr(this_arg);
58276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58278         this_arg_conv.is_owned = false;
58279         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
58280 }
58281
58282 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_required(int64_t this_arg) {
58283         LDKChannelTypeFeatures this_arg_conv;
58284         this_arg_conv.inner = untag_ptr(this_arg);
58285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58287         this_arg_conv.is_owned = false;
58288         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
58289 }
58290
58291 jboolean  CS_LDK_ChannelTypeFeatures_supports_scid_privacy(int64_t this_arg) {
58292         LDKChannelTypeFeatures this_arg_conv;
58293         this_arg_conv.inner = untag_ptr(this_arg);
58294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58296         this_arg_conv.is_owned = false;
58297         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
58298         return ret_conv;
58299 }
58300
58301 jboolean  CS_LDK_InitFeatures_requires_scid_privacy(int64_t this_arg) {
58302         LDKInitFeatures this_arg_conv;
58303         this_arg_conv.inner = untag_ptr(this_arg);
58304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58306         this_arg_conv.is_owned = false;
58307         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
58308         return ret_conv;
58309 }
58310
58311 jboolean  CS_LDK_NodeFeatures_requires_scid_privacy(int64_t this_arg) {
58312         LDKNodeFeatures this_arg_conv;
58313         this_arg_conv.inner = untag_ptr(this_arg);
58314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58316         this_arg_conv.is_owned = false;
58317         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
58318         return ret_conv;
58319 }
58320
58321 jboolean  CS_LDK_ChannelTypeFeatures_requires_scid_privacy(int64_t this_arg) {
58322         LDKChannelTypeFeatures this_arg_conv;
58323         this_arg_conv.inner = untag_ptr(this_arg);
58324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58326         this_arg_conv.is_owned = false;
58327         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
58328         return ret_conv;
58329 }
58330
58331 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_optional(int64_t this_arg) {
58332         LDKBolt11InvoiceFeatures this_arg_conv;
58333         this_arg_conv.inner = untag_ptr(this_arg);
58334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58336         this_arg_conv.is_owned = false;
58337         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
58338 }
58339
58340 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_required(int64_t this_arg) {
58341         LDKBolt11InvoiceFeatures this_arg_conv;
58342         this_arg_conv.inner = untag_ptr(this_arg);
58343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58345         this_arg_conv.is_owned = false;
58346         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
58347 }
58348
58349 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_metadata(int64_t this_arg) {
58350         LDKBolt11InvoiceFeatures this_arg_conv;
58351         this_arg_conv.inner = untag_ptr(this_arg);
58352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58354         this_arg_conv.is_owned = false;
58355         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
58356         return ret_conv;
58357 }
58358
58359 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_metadata(int64_t this_arg) {
58360         LDKBolt11InvoiceFeatures this_arg_conv;
58361         this_arg_conv.inner = untag_ptr(this_arg);
58362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58364         this_arg_conv.is_owned = false;
58365         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
58366         return ret_conv;
58367 }
58368
58369 void  CS_LDK_InitFeatures_set_zero_conf_optional(int64_t this_arg) {
58370         LDKInitFeatures this_arg_conv;
58371         this_arg_conv.inner = untag_ptr(this_arg);
58372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58374         this_arg_conv.is_owned = false;
58375         InitFeatures_set_zero_conf_optional(&this_arg_conv);
58376 }
58377
58378 void  CS_LDK_InitFeatures_set_zero_conf_required(int64_t this_arg) {
58379         LDKInitFeatures this_arg_conv;
58380         this_arg_conv.inner = untag_ptr(this_arg);
58381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58383         this_arg_conv.is_owned = false;
58384         InitFeatures_set_zero_conf_required(&this_arg_conv);
58385 }
58386
58387 jboolean  CS_LDK_InitFeatures_supports_zero_conf(int64_t this_arg) {
58388         LDKInitFeatures this_arg_conv;
58389         this_arg_conv.inner = untag_ptr(this_arg);
58390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58392         this_arg_conv.is_owned = false;
58393         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
58394         return ret_conv;
58395 }
58396
58397 void  CS_LDK_NodeFeatures_set_zero_conf_optional(int64_t this_arg) {
58398         LDKNodeFeatures this_arg_conv;
58399         this_arg_conv.inner = untag_ptr(this_arg);
58400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58402         this_arg_conv.is_owned = false;
58403         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
58404 }
58405
58406 void  CS_LDK_NodeFeatures_set_zero_conf_required(int64_t this_arg) {
58407         LDKNodeFeatures this_arg_conv;
58408         this_arg_conv.inner = untag_ptr(this_arg);
58409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58411         this_arg_conv.is_owned = false;
58412         NodeFeatures_set_zero_conf_required(&this_arg_conv);
58413 }
58414
58415 jboolean  CS_LDK_NodeFeatures_supports_zero_conf(int64_t this_arg) {
58416         LDKNodeFeatures this_arg_conv;
58417         this_arg_conv.inner = untag_ptr(this_arg);
58418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58420         this_arg_conv.is_owned = false;
58421         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
58422         return ret_conv;
58423 }
58424
58425 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_optional(int64_t this_arg) {
58426         LDKChannelTypeFeatures this_arg_conv;
58427         this_arg_conv.inner = untag_ptr(this_arg);
58428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58430         this_arg_conv.is_owned = false;
58431         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
58432 }
58433
58434 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_required(int64_t this_arg) {
58435         LDKChannelTypeFeatures this_arg_conv;
58436         this_arg_conv.inner = untag_ptr(this_arg);
58437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58439         this_arg_conv.is_owned = false;
58440         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
58441 }
58442
58443 jboolean  CS_LDK_ChannelTypeFeatures_supports_zero_conf(int64_t this_arg) {
58444         LDKChannelTypeFeatures this_arg_conv;
58445         this_arg_conv.inner = untag_ptr(this_arg);
58446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58448         this_arg_conv.is_owned = false;
58449         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
58450         return ret_conv;
58451 }
58452
58453 jboolean  CS_LDK_InitFeatures_requires_zero_conf(int64_t this_arg) {
58454         LDKInitFeatures this_arg_conv;
58455         this_arg_conv.inner = untag_ptr(this_arg);
58456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58458         this_arg_conv.is_owned = false;
58459         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
58460         return ret_conv;
58461 }
58462
58463 jboolean  CS_LDK_NodeFeatures_requires_zero_conf(int64_t this_arg) {
58464         LDKNodeFeatures this_arg_conv;
58465         this_arg_conv.inner = untag_ptr(this_arg);
58466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58468         this_arg_conv.is_owned = false;
58469         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
58470         return ret_conv;
58471 }
58472
58473 jboolean  CS_LDK_ChannelTypeFeatures_requires_zero_conf(int64_t this_arg) {
58474         LDKChannelTypeFeatures this_arg_conv;
58475         this_arg_conv.inner = untag_ptr(this_arg);
58476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58478         this_arg_conv.is_owned = false;
58479         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
58480         return ret_conv;
58481 }
58482
58483 void  CS_LDK_NodeFeatures_set_keysend_optional(int64_t this_arg) {
58484         LDKNodeFeatures this_arg_conv;
58485         this_arg_conv.inner = untag_ptr(this_arg);
58486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58488         this_arg_conv.is_owned = false;
58489         NodeFeatures_set_keysend_optional(&this_arg_conv);
58490 }
58491
58492 void  CS_LDK_NodeFeatures_set_keysend_required(int64_t this_arg) {
58493         LDKNodeFeatures this_arg_conv;
58494         this_arg_conv.inner = untag_ptr(this_arg);
58495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58497         this_arg_conv.is_owned = false;
58498         NodeFeatures_set_keysend_required(&this_arg_conv);
58499 }
58500
58501 jboolean  CS_LDK_NodeFeatures_supports_keysend(int64_t this_arg) {
58502         LDKNodeFeatures this_arg_conv;
58503         this_arg_conv.inner = untag_ptr(this_arg);
58504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58506         this_arg_conv.is_owned = false;
58507         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
58508         return ret_conv;
58509 }
58510
58511 jboolean  CS_LDK_NodeFeatures_requires_keysend(int64_t this_arg) {
58512         LDKNodeFeatures this_arg_conv;
58513         this_arg_conv.inner = untag_ptr(this_arg);
58514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58516         this_arg_conv.is_owned = false;
58517         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
58518         return ret_conv;
58519 }
58520
58521 void  CS_LDK_ShutdownScript_free(int64_t this_obj) {
58522         LDKShutdownScript this_obj_conv;
58523         this_obj_conv.inner = untag_ptr(this_obj);
58524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58526         ShutdownScript_free(this_obj_conv);
58527 }
58528
58529 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
58530         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
58531         int64_t ret_ref = 0;
58532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58534         return ret_ref;
58535 }
58536 int64_t  CS_LDK_ShutdownScript_clone_ptr(int64_t arg) {
58537         LDKShutdownScript arg_conv;
58538         arg_conv.inner = untag_ptr(arg);
58539         arg_conv.is_owned = ptr_is_owned(arg);
58540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58541         arg_conv.is_owned = false;
58542         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
58543         return ret_conv;
58544 }
58545
58546 int64_t  CS_LDK_ShutdownScript_clone(int64_t orig) {
58547         LDKShutdownScript orig_conv;
58548         orig_conv.inner = untag_ptr(orig);
58549         orig_conv.is_owned = ptr_is_owned(orig);
58550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58551         orig_conv.is_owned = false;
58552         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
58553         int64_t ret_ref = 0;
58554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58556         return ret_ref;
58557 }
58558
58559 jboolean  CS_LDK_ShutdownScript_eq(int64_t a, int64_t b) {
58560         LDKShutdownScript a_conv;
58561         a_conv.inner = untag_ptr(a);
58562         a_conv.is_owned = ptr_is_owned(a);
58563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58564         a_conv.is_owned = false;
58565         LDKShutdownScript b_conv;
58566         b_conv.inner = untag_ptr(b);
58567         b_conv.is_owned = ptr_is_owned(b);
58568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58569         b_conv.is_owned = false;
58570         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
58571         return ret_conv;
58572 }
58573
58574 void  CS_LDK_InvalidShutdownScript_free(int64_t this_obj) {
58575         LDKInvalidShutdownScript this_obj_conv;
58576         this_obj_conv.inner = untag_ptr(this_obj);
58577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58579         InvalidShutdownScript_free(this_obj_conv);
58580 }
58581
58582 int8_tArray  CS_LDK_InvalidShutdownScript_get_script(int64_t this_ptr) {
58583         LDKInvalidShutdownScript this_ptr_conv;
58584         this_ptr_conv.inner = untag_ptr(this_ptr);
58585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58587         this_ptr_conv.is_owned = false;
58588         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
58589         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58590         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58591         CVec_u8Z_free(ret_var);
58592         return ret_arr;
58593 }
58594
58595 void  CS_LDK_InvalidShutdownScript_set_script(int64_t this_ptr, int8_tArray val) {
58596         LDKInvalidShutdownScript this_ptr_conv;
58597         this_ptr_conv.inner = untag_ptr(this_ptr);
58598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58600         this_ptr_conv.is_owned = false;
58601         LDKCVec_u8Z val_ref;
58602         val_ref.datalen = val->arr_len;
58603         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58604         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
58605         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
58606 }
58607
58608 int64_t  CS_LDK_InvalidShutdownScript_new(int8_tArray script_arg) {
58609         LDKCVec_u8Z script_arg_ref;
58610         script_arg_ref.datalen = script_arg->arr_len;
58611         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58612         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
58613         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
58614         int64_t ret_ref = 0;
58615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58617         return ret_ref;
58618 }
58619
58620 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
58621         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
58622         int64_t ret_ref = 0;
58623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58625         return ret_ref;
58626 }
58627 int64_t  CS_LDK_InvalidShutdownScript_clone_ptr(int64_t arg) {
58628         LDKInvalidShutdownScript arg_conv;
58629         arg_conv.inner = untag_ptr(arg);
58630         arg_conv.is_owned = ptr_is_owned(arg);
58631         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58632         arg_conv.is_owned = false;
58633         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
58634         return ret_conv;
58635 }
58636
58637 int64_t  CS_LDK_InvalidShutdownScript_clone(int64_t orig) {
58638         LDKInvalidShutdownScript orig_conv;
58639         orig_conv.inner = untag_ptr(orig);
58640         orig_conv.is_owned = ptr_is_owned(orig);
58641         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58642         orig_conv.is_owned = false;
58643         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
58644         int64_t ret_ref = 0;
58645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58647         return ret_ref;
58648 }
58649
58650 int8_tArray  CS_LDK_ShutdownScript_write(int64_t obj) {
58651         LDKShutdownScript obj_conv;
58652         obj_conv.inner = untag_ptr(obj);
58653         obj_conv.is_owned = ptr_is_owned(obj);
58654         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58655         obj_conv.is_owned = false;
58656         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
58657         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58658         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58659         CVec_u8Z_free(ret_var);
58660         return ret_arr;
58661 }
58662
58663 int64_t  CS_LDK_ShutdownScript_read(int8_tArray ser) {
58664         LDKu8slice ser_ref;
58665         ser_ref.datalen = ser->arr_len;
58666         ser_ref.data = ser->elems;
58667         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
58668         *ret_conv = ShutdownScript_read(ser_ref);
58669         FREE(ser);
58670         return tag_ptr(ret_conv, true);
58671 }
58672
58673 int64_t  CS_LDK_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
58674         uint8_t pubkey_hash_arr[20];
58675         CHECK(pubkey_hash->arr_len == 20);
58676         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
58677         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
58678         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
58679         int64_t ret_ref = 0;
58680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58682         return ret_ref;
58683 }
58684
58685 int64_t  CS_LDK_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
58686         uint8_t script_hash_arr[32];
58687         CHECK(script_hash->arr_len == 32);
58688         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
58689         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
58690         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
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
58697 int64_t  CS_LDK_ShutdownScript_new_witness_program(int64_t witness_program) {
58698         void* witness_program_ptr = untag_ptr(witness_program);
58699         CHECK_ACCESS(witness_program_ptr);
58700         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
58701         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
58702         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
58703         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
58704         return tag_ptr(ret_conv, true);
58705 }
58706
58707 int8_tArray  CS_LDK_ShutdownScript_into_inner(int64_t this_arg) {
58708         LDKShutdownScript this_arg_conv;
58709         this_arg_conv.inner = untag_ptr(this_arg);
58710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58712         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
58713         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
58714         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58715         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58716         CVec_u8Z_free(ret_var);
58717         return ret_arr;
58718 }
58719
58720 int8_tArray  CS_LDK_ShutdownScript_as_legacy_pubkey(int64_t this_arg) {
58721         LDKShutdownScript this_arg_conv;
58722         this_arg_conv.inner = untag_ptr(this_arg);
58723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58725         this_arg_conv.is_owned = false;
58726         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58727         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
58728         return ret_arr;
58729 }
58730
58731 jboolean  CS_LDK_ShutdownScript_is_compatible(int64_t this_arg, int64_t features) {
58732         LDKShutdownScript this_arg_conv;
58733         this_arg_conv.inner = untag_ptr(this_arg);
58734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58736         this_arg_conv.is_owned = false;
58737         LDKInitFeatures features_conv;
58738         features_conv.inner = untag_ptr(features);
58739         features_conv.is_owned = ptr_is_owned(features);
58740         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58741         features_conv.is_owned = false;
58742         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
58743         return ret_conv;
58744 }
58745
58746 void  CS_LDK_Retry_free(int64_t this_ptr) {
58747         if (!ptr_is_owned(this_ptr)) return;
58748         void* this_ptr_ptr = untag_ptr(this_ptr);
58749         CHECK_ACCESS(this_ptr_ptr);
58750         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
58751         FREE(untag_ptr(this_ptr));
58752         Retry_free(this_ptr_conv);
58753 }
58754
58755 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
58756         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58757         *ret_copy = Retry_clone(arg);
58758         int64_t ret_ref = tag_ptr(ret_copy, true);
58759         return ret_ref;
58760 }
58761 int64_t  CS_LDK_Retry_clone_ptr(int64_t arg) {
58762         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
58763         int64_t ret_conv = Retry_clone_ptr(arg_conv);
58764         return ret_conv;
58765 }
58766
58767 int64_t  CS_LDK_Retry_clone(int64_t orig) {
58768         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
58769         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58770         *ret_copy = Retry_clone(orig_conv);
58771         int64_t ret_ref = tag_ptr(ret_copy, true);
58772         return ret_ref;
58773 }
58774
58775 int64_t  CS_LDK_Retry_attempts(int32_t a) {
58776         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58777         *ret_copy = Retry_attempts(a);
58778         int64_t ret_ref = tag_ptr(ret_copy, true);
58779         return ret_ref;
58780 }
58781
58782 int64_t  CS_LDK_Retry_timeout(int64_t a) {
58783         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
58784         *ret_copy = Retry_timeout(a);
58785         int64_t ret_ref = tag_ptr(ret_copy, true);
58786         return ret_ref;
58787 }
58788
58789 jboolean  CS_LDK_Retry_eq(int64_t a, int64_t b) {
58790         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
58791         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
58792         jboolean ret_conv = Retry_eq(a_conv, b_conv);
58793         return ret_conv;
58794 }
58795
58796 int64_t  CS_LDK_Retry_hash(int64_t o) {
58797         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
58798         int64_t ret_conv = Retry_hash(o_conv);
58799         return ret_conv;
58800 }
58801
58802 int8_tArray  CS_LDK_Retry_write(int64_t obj) {
58803         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
58804         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
58805         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58806         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58807         CVec_u8Z_free(ret_var);
58808         return ret_arr;
58809 }
58810
58811 int64_t  CS_LDK_Retry_read(int8_tArray ser) {
58812         LDKu8slice ser_ref;
58813         ser_ref.datalen = ser->arr_len;
58814         ser_ref.data = ser->elems;
58815         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
58816         *ret_conv = Retry_read(ser_ref);
58817         FREE(ser);
58818         return tag_ptr(ret_conv, true);
58819 }
58820
58821 int32_t  CS_LDK_RetryableSendFailure_clone(int64_t orig) {
58822         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
58823         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_clone(orig_conv));
58824         return ret_conv;
58825 }
58826
58827 int32_t  CS_LDK_RetryableSendFailure_payment_expired() {
58828         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_payment_expired());
58829         return ret_conv;
58830 }
58831
58832 int32_t  CS_LDK_RetryableSendFailure_route_not_found() {
58833         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_route_not_found());
58834         return ret_conv;
58835 }
58836
58837 int32_t  CS_LDK_RetryableSendFailure_duplicate_payment() {
58838         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_duplicate_payment());
58839         return ret_conv;
58840 }
58841
58842 jboolean  CS_LDK_RetryableSendFailure_eq(int64_t a, int64_t b) {
58843         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
58844         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
58845         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
58846         return ret_conv;
58847 }
58848
58849 void  CS_LDK_PaymentSendFailure_free(int64_t this_ptr) {
58850         if (!ptr_is_owned(this_ptr)) return;
58851         void* this_ptr_ptr = untag_ptr(this_ptr);
58852         CHECK_ACCESS(this_ptr_ptr);
58853         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
58854         FREE(untag_ptr(this_ptr));
58855         PaymentSendFailure_free(this_ptr_conv);
58856 }
58857
58858 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
58859         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58860         *ret_copy = PaymentSendFailure_clone(arg);
58861         int64_t ret_ref = tag_ptr(ret_copy, true);
58862         return ret_ref;
58863 }
58864 int64_t  CS_LDK_PaymentSendFailure_clone_ptr(int64_t arg) {
58865         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
58866         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
58867         return ret_conv;
58868 }
58869
58870 int64_t  CS_LDK_PaymentSendFailure_clone(int64_t orig) {
58871         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
58872         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58873         *ret_copy = PaymentSendFailure_clone(orig_conv);
58874         int64_t ret_ref = tag_ptr(ret_copy, true);
58875         return ret_ref;
58876 }
58877
58878 int64_t  CS_LDK_PaymentSendFailure_parameter_error(int64_t a) {
58879         void* a_ptr = untag_ptr(a);
58880         CHECK_ACCESS(a_ptr);
58881         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
58882         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
58883         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58884         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
58885         int64_t ret_ref = tag_ptr(ret_copy, true);
58886         return ret_ref;
58887 }
58888
58889 int64_t  CS_LDK_PaymentSendFailure_path_parameter_error(int64_tArray a) {
58890         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
58891         a_constr.datalen = a->arr_len;
58892         if (a_constr.datalen > 0)
58893                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58894         else
58895                 a_constr.data = NULL;
58896         int64_t* a_vals = a->elems;
58897         for (size_t w = 0; w < a_constr.datalen; w++) {
58898                 int64_t a_conv_22 = a_vals[w];
58899                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
58900                 CHECK_ACCESS(a_conv_22_ptr);
58901                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
58902                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
58903                 a_constr.data[w] = a_conv_22_conv;
58904         }
58905         FREE(a);
58906         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58907         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
58908         int64_t ret_ref = tag_ptr(ret_copy, true);
58909         return ret_ref;
58910 }
58911
58912 int64_t  CS_LDK_PaymentSendFailure_all_failed_resend_safe(int64_tArray a) {
58913         LDKCVec_APIErrorZ a_constr;
58914         a_constr.datalen = a->arr_len;
58915         if (a_constr.datalen > 0)
58916                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
58917         else
58918                 a_constr.data = NULL;
58919         int64_t* a_vals = a->elems;
58920         for (size_t k = 0; k < a_constr.datalen; k++) {
58921                 int64_t a_conv_10 = a_vals[k];
58922                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
58923                 CHECK_ACCESS(a_conv_10_ptr);
58924                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
58925                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
58926                 a_constr.data[k] = a_conv_10_conv;
58927         }
58928         FREE(a);
58929         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58930         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
58931         int64_t ret_ref = tag_ptr(ret_copy, true);
58932         return ret_ref;
58933 }
58934
58935 int64_t  CS_LDK_PaymentSendFailure_duplicate_payment() {
58936         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58937         *ret_copy = PaymentSendFailure_duplicate_payment();
58938         int64_t ret_ref = tag_ptr(ret_copy, true);
58939         return ret_ref;
58940 }
58941
58942 int64_t  CS_LDK_PaymentSendFailure_partial_failure(int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
58943         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
58944         results_constr.datalen = results->arr_len;
58945         if (results_constr.datalen > 0)
58946                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
58947         else
58948                 results_constr.data = NULL;
58949         int64_t* results_vals = results->elems;
58950         for (size_t w = 0; w < results_constr.datalen; w++) {
58951                 int64_t results_conv_22 = results_vals[w];
58952                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
58953                 CHECK_ACCESS(results_conv_22_ptr);
58954                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
58955                 results_constr.data[w] = results_conv_22_conv;
58956         }
58957         FREE(results);
58958         LDKRouteParameters failed_paths_retry_conv;
58959         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
58960         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
58961         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
58962         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
58963         LDKThirtyTwoBytes payment_id_ref;
58964         CHECK(payment_id->arr_len == 32);
58965         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
58966         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
58967         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
58968         int64_t ret_ref = tag_ptr(ret_copy, true);
58969         return ret_ref;
58970 }
58971
58972 jboolean  CS_LDK_PaymentSendFailure_eq(int64_t a, int64_t b) {
58973         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
58974         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
58975         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
58976         return ret_conv;
58977 }
58978
58979 void  CS_LDK_ProbeSendFailure_free(int64_t this_ptr) {
58980         if (!ptr_is_owned(this_ptr)) return;
58981         void* this_ptr_ptr = untag_ptr(this_ptr);
58982         CHECK_ACCESS(this_ptr_ptr);
58983         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
58984         FREE(untag_ptr(this_ptr));
58985         ProbeSendFailure_free(this_ptr_conv);
58986 }
58987
58988 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
58989         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
58990         *ret_copy = ProbeSendFailure_clone(arg);
58991         int64_t ret_ref = tag_ptr(ret_copy, true);
58992         return ret_ref;
58993 }
58994 int64_t  CS_LDK_ProbeSendFailure_clone_ptr(int64_t arg) {
58995         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
58996         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
58997         return ret_conv;
58998 }
58999
59000 int64_t  CS_LDK_ProbeSendFailure_clone(int64_t orig) {
59001         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
59002         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59003         *ret_copy = ProbeSendFailure_clone(orig_conv);
59004         int64_t ret_ref = tag_ptr(ret_copy, true);
59005         return ret_ref;
59006 }
59007
59008 int64_t  CS_LDK_ProbeSendFailure_route_not_found() {
59009         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59010         *ret_copy = ProbeSendFailure_route_not_found();
59011         int64_t ret_ref = tag_ptr(ret_copy, true);
59012         return ret_ref;
59013 }
59014
59015 int64_t  CS_LDK_ProbeSendFailure_sending_failed(int64_t a) {
59016         void* a_ptr = untag_ptr(a);
59017         CHECK_ACCESS(a_ptr);
59018         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
59019         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
59020         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
59021         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
59022         int64_t ret_ref = tag_ptr(ret_copy, true);
59023         return ret_ref;
59024 }
59025
59026 jboolean  CS_LDK_ProbeSendFailure_eq(int64_t a, int64_t b) {
59027         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
59028         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
59029         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
59030         return ret_conv;
59031 }
59032
59033 void  CS_LDK_RecipientOnionFields_free(int64_t this_obj) {
59034         LDKRecipientOnionFields this_obj_conv;
59035         this_obj_conv.inner = untag_ptr(this_obj);
59036         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59038         RecipientOnionFields_free(this_obj_conv);
59039 }
59040
59041 int64_t  CS_LDK_RecipientOnionFields_get_payment_secret(int64_t this_ptr) {
59042         LDKRecipientOnionFields this_ptr_conv;
59043         this_ptr_conv.inner = untag_ptr(this_ptr);
59044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59046         this_ptr_conv.is_owned = false;
59047         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
59048         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
59049         int64_t ret_ref = tag_ptr(ret_copy, true);
59050         return ret_ref;
59051 }
59052
59053 void  CS_LDK_RecipientOnionFields_set_payment_secret(int64_t this_ptr, int64_t val) {
59054         LDKRecipientOnionFields this_ptr_conv;
59055         this_ptr_conv.inner = untag_ptr(this_ptr);
59056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59058         this_ptr_conv.is_owned = false;
59059         void* val_ptr = untag_ptr(val);
59060         CHECK_ACCESS(val_ptr);
59061         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
59062         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
59063         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
59064 }
59065
59066 int64_t  CS_LDK_RecipientOnionFields_get_payment_metadata(int64_t this_ptr) {
59067         LDKRecipientOnionFields this_ptr_conv;
59068         this_ptr_conv.inner = untag_ptr(this_ptr);
59069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59071         this_ptr_conv.is_owned = false;
59072         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59073         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
59074         int64_t ret_ref = tag_ptr(ret_copy, true);
59075         return ret_ref;
59076 }
59077
59078 void  CS_LDK_RecipientOnionFields_set_payment_metadata(int64_t this_ptr, int64_t val) {
59079         LDKRecipientOnionFields this_ptr_conv;
59080         this_ptr_conv.inner = untag_ptr(this_ptr);
59081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59083         this_ptr_conv.is_owned = false;
59084         void* val_ptr = untag_ptr(val);
59085         CHECK_ACCESS(val_ptr);
59086         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
59087         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
59088         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
59089 }
59090
59091 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
59092         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
59093         int64_t ret_ref = 0;
59094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59096         return ret_ref;
59097 }
59098 int64_t  CS_LDK_RecipientOnionFields_clone_ptr(int64_t arg) {
59099         LDKRecipientOnionFields arg_conv;
59100         arg_conv.inner = untag_ptr(arg);
59101         arg_conv.is_owned = ptr_is_owned(arg);
59102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59103         arg_conv.is_owned = false;
59104         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
59105         return ret_conv;
59106 }
59107
59108 int64_t  CS_LDK_RecipientOnionFields_clone(int64_t orig) {
59109         LDKRecipientOnionFields orig_conv;
59110         orig_conv.inner = untag_ptr(orig);
59111         orig_conv.is_owned = ptr_is_owned(orig);
59112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59113         orig_conv.is_owned = false;
59114         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
59115         int64_t ret_ref = 0;
59116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59118         return ret_ref;
59119 }
59120
59121 jboolean  CS_LDK_RecipientOnionFields_eq(int64_t a, int64_t b) {
59122         LDKRecipientOnionFields a_conv;
59123         a_conv.inner = untag_ptr(a);
59124         a_conv.is_owned = ptr_is_owned(a);
59125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59126         a_conv.is_owned = false;
59127         LDKRecipientOnionFields b_conv;
59128         b_conv.inner = untag_ptr(b);
59129         b_conv.is_owned = ptr_is_owned(b);
59130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59131         b_conv.is_owned = false;
59132         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
59133         return ret_conv;
59134 }
59135
59136 int8_tArray  CS_LDK_RecipientOnionFields_write(int64_t obj) {
59137         LDKRecipientOnionFields obj_conv;
59138         obj_conv.inner = untag_ptr(obj);
59139         obj_conv.is_owned = ptr_is_owned(obj);
59140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59141         obj_conv.is_owned = false;
59142         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
59143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59145         CVec_u8Z_free(ret_var);
59146         return ret_arr;
59147 }
59148
59149 int64_t  CS_LDK_RecipientOnionFields_read(int8_tArray ser) {
59150         LDKu8slice ser_ref;
59151         ser_ref.datalen = ser->arr_len;
59152         ser_ref.data = ser->elems;
59153         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
59154         *ret_conv = RecipientOnionFields_read(ser_ref);
59155         FREE(ser);
59156         return tag_ptr(ret_conv, true);
59157 }
59158
59159 int64_t  CS_LDK_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
59160         LDKThirtyTwoBytes payment_secret_ref;
59161         CHECK(payment_secret->arr_len == 32);
59162         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
59163         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
59164         int64_t ret_ref = 0;
59165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59167         return ret_ref;
59168 }
59169
59170 int64_t  CS_LDK_RecipientOnionFields_spontaneous_empty() {
59171         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
59172         int64_t ret_ref = 0;
59173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59175         return ret_ref;
59176 }
59177
59178 int64_t  CS_LDK_RecipientOnionFields_with_custom_tlvs(int64_t this_arg, int64_tArray custom_tlvs) {
59179         LDKRecipientOnionFields this_arg_conv;
59180         this_arg_conv.inner = untag_ptr(this_arg);
59181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59183         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
59184         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
59185         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
59186         if (custom_tlvs_constr.datalen > 0)
59187                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
59188         else
59189                 custom_tlvs_constr.data = NULL;
59190         int64_t* custom_tlvs_vals = custom_tlvs->elems;
59191         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
59192                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
59193                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
59194                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
59195                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
59196                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
59197                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
59198         }
59199         FREE(custom_tlvs);
59200         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
59201         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
59202         return tag_ptr(ret_conv, true);
59203 }
59204
59205 int64_tArray  CS_LDK_RecipientOnionFields_custom_tlvs(int64_t this_arg) {
59206         LDKRecipientOnionFields this_arg_conv;
59207         this_arg_conv.inner = untag_ptr(this_arg);
59208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59210         this_arg_conv.is_owned = false;
59211         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
59212         int64_tArray ret_arr = NULL;
59213         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59214         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59215         for (size_t x = 0; x < ret_var.datalen; x++) {
59216                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
59217                 *ret_conv_23_conv = ret_var.data[x];
59218                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
59219         }
59220         
59221         FREE(ret_var.data);
59222         return ret_arr;
59223 }
59224
59225 void  CS_LDK_CustomMessageReader_free(int64_t this_ptr) {
59226         if (!ptr_is_owned(this_ptr)) return;
59227         void* this_ptr_ptr = untag_ptr(this_ptr);
59228         CHECK_ACCESS(this_ptr_ptr);
59229         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
59230         FREE(untag_ptr(this_ptr));
59231         CustomMessageReader_free(this_ptr_conv);
59232 }
59233
59234 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
59235         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
59236         *ret_ret = Type_clone(arg);
59237         return tag_ptr(ret_ret, true);
59238 }
59239 int64_t  CS_LDK_Type_clone_ptr(int64_t arg) {
59240         void* arg_ptr = untag_ptr(arg);
59241         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
59242         LDKType* arg_conv = (LDKType*)arg_ptr;
59243         int64_t ret_conv = Type_clone_ptr(arg_conv);
59244         return ret_conv;
59245 }
59246
59247 int64_t  CS_LDK_Type_clone(int64_t orig) {
59248         void* orig_ptr = untag_ptr(orig);
59249         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
59250         LDKType* orig_conv = (LDKType*)orig_ptr;
59251         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
59252         *ret_ret = Type_clone(orig_conv);
59253         return tag_ptr(ret_ret, true);
59254 }
59255
59256 void  CS_LDK_Type_free(int64_t this_ptr) {
59257         if (!ptr_is_owned(this_ptr)) return;
59258         void* this_ptr_ptr = untag_ptr(this_ptr);
59259         CHECK_ACCESS(this_ptr_ptr);
59260         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
59261         FREE(untag_ptr(this_ptr));
59262         Type_free(this_ptr_conv);
59263 }
59264
59265 void  CS_LDK_Offer_free(int64_t this_obj) {
59266         LDKOffer this_obj_conv;
59267         this_obj_conv.inner = untag_ptr(this_obj);
59268         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59270         Offer_free(this_obj_conv);
59271 }
59272
59273 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
59274         LDKOffer ret_var = Offer_clone(arg);
59275         int64_t ret_ref = 0;
59276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59278         return ret_ref;
59279 }
59280 int64_t  CS_LDK_Offer_clone_ptr(int64_t arg) {
59281         LDKOffer arg_conv;
59282         arg_conv.inner = untag_ptr(arg);
59283         arg_conv.is_owned = ptr_is_owned(arg);
59284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59285         arg_conv.is_owned = false;
59286         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
59287         return ret_conv;
59288 }
59289
59290 int64_t  CS_LDK_Offer_clone(int64_t orig) {
59291         LDKOffer orig_conv;
59292         orig_conv.inner = untag_ptr(orig);
59293         orig_conv.is_owned = ptr_is_owned(orig);
59294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59295         orig_conv.is_owned = false;
59296         LDKOffer ret_var = Offer_clone(&orig_conv);
59297         int64_t ret_ref = 0;
59298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59300         return ret_ref;
59301 }
59302
59303 ptrArray  CS_LDK_Offer_chains(int64_t this_arg) {
59304         LDKOffer this_arg_conv;
59305         this_arg_conv.inner = untag_ptr(this_arg);
59306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59308         this_arg_conv.is_owned = false;
59309         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
59310         ptrArray ret_arr = NULL;
59311         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
59312         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
59313         for (size_t i = 0; i < ret_var.datalen; i++) {
59314                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
59315                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
59316                 ret_arr_ptr[i] = ret_conv_8_arr;
59317         }
59318         
59319         FREE(ret_var.data);
59320         return ret_arr;
59321 }
59322
59323 int64_t  CS_LDK_Offer_metadata(int64_t this_arg) {
59324         LDKOffer this_arg_conv;
59325         this_arg_conv.inner = untag_ptr(this_arg);
59326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59328         this_arg_conv.is_owned = false;
59329         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59330         *ret_copy = Offer_metadata(&this_arg_conv);
59331         int64_t ret_ref = tag_ptr(ret_copy, true);
59332         return ret_ref;
59333 }
59334
59335 int64_t  CS_LDK_Offer_amount(int64_t this_arg) {
59336         LDKOffer this_arg_conv;
59337         this_arg_conv.inner = untag_ptr(this_arg);
59338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59340         this_arg_conv.is_owned = false;
59341         LDKAmount ret_var = Offer_amount(&this_arg_conv);
59342         int64_t ret_ref = 0;
59343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59345         return ret_ref;
59346 }
59347
59348 int64_t  CS_LDK_Offer_description(int64_t this_arg) {
59349         LDKOffer this_arg_conv;
59350         this_arg_conv.inner = untag_ptr(this_arg);
59351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59353         this_arg_conv.is_owned = false;
59354         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
59355         int64_t ret_ref = 0;
59356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59358         return ret_ref;
59359 }
59360
59361 int64_t  CS_LDK_Offer_offer_features(int64_t this_arg) {
59362         LDKOffer this_arg_conv;
59363         this_arg_conv.inner = untag_ptr(this_arg);
59364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59366         this_arg_conv.is_owned = false;
59367         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
59368         int64_t ret_ref = 0;
59369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59371         return ret_ref;
59372 }
59373
59374 int64_t  CS_LDK_Offer_absolute_expiry(int64_t this_arg) {
59375         LDKOffer this_arg_conv;
59376         this_arg_conv.inner = untag_ptr(this_arg);
59377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59379         this_arg_conv.is_owned = false;
59380         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59381         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
59382         int64_t ret_ref = tag_ptr(ret_copy, true);
59383         return ret_ref;
59384 }
59385
59386 int64_t  CS_LDK_Offer_issuer(int64_t this_arg) {
59387         LDKOffer this_arg_conv;
59388         this_arg_conv.inner = untag_ptr(this_arg);
59389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59391         this_arg_conv.is_owned = false;
59392         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
59393         int64_t ret_ref = 0;
59394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59396         return ret_ref;
59397 }
59398
59399 int64_tArray  CS_LDK_Offer_paths(int64_t this_arg) {
59400         LDKOffer this_arg_conv;
59401         this_arg_conv.inner = untag_ptr(this_arg);
59402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59404         this_arg_conv.is_owned = false;
59405         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
59406         int64_tArray ret_arr = NULL;
59407         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59408         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59409         for (size_t n = 0; n < ret_var.datalen; n++) {
59410                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59411                 int64_t ret_conv_13_ref = 0;
59412                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59413                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59414                 ret_arr_ptr[n] = ret_conv_13_ref;
59415         }
59416         
59417         FREE(ret_var.data);
59418         return ret_arr;
59419 }
59420
59421 int64_t  CS_LDK_Offer_supported_quantity(int64_t this_arg) {
59422         LDKOffer this_arg_conv;
59423         this_arg_conv.inner = untag_ptr(this_arg);
59424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59426         this_arg_conv.is_owned = false;
59427         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
59428         int64_t ret_ref = 0;
59429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59431         return ret_ref;
59432 }
59433
59434 int8_tArray  CS_LDK_Offer_signing_pubkey(int64_t this_arg) {
59435         LDKOffer this_arg_conv;
59436         this_arg_conv.inner = untag_ptr(this_arg);
59437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59439         this_arg_conv.is_owned = false;
59440         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59441         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
59442         return ret_arr;
59443 }
59444
59445 jboolean  CS_LDK_Offer_supports_chain(int64_t this_arg, int8_tArray chain) {
59446         LDKOffer this_arg_conv;
59447         this_arg_conv.inner = untag_ptr(this_arg);
59448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59450         this_arg_conv.is_owned = false;
59451         LDKThirtyTwoBytes chain_ref;
59452         CHECK(chain->arr_len == 32);
59453         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
59454         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
59455         return ret_conv;
59456 }
59457
59458 jboolean  CS_LDK_Offer_is_expired(int64_t this_arg) {
59459         LDKOffer this_arg_conv;
59460         this_arg_conv.inner = untag_ptr(this_arg);
59461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59463         this_arg_conv.is_owned = false;
59464         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
59465         return ret_conv;
59466 }
59467
59468 jboolean  CS_LDK_Offer_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
59469         LDKOffer this_arg_conv;
59470         this_arg_conv.inner = untag_ptr(this_arg);
59471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59473         this_arg_conv.is_owned = false;
59474         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
59475         return ret_conv;
59476 }
59477
59478 jboolean  CS_LDK_Offer_is_valid_quantity(int64_t this_arg, int64_t quantity) {
59479         LDKOffer this_arg_conv;
59480         this_arg_conv.inner = untag_ptr(this_arg);
59481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59483         this_arg_conv.is_owned = false;
59484         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
59485         return ret_conv;
59486 }
59487
59488 jboolean  CS_LDK_Offer_expects_quantity(int64_t this_arg) {
59489         LDKOffer this_arg_conv;
59490         this_arg_conv.inner = untag_ptr(this_arg);
59491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59493         this_arg_conv.is_owned = false;
59494         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
59495         return ret_conv;
59496 }
59497
59498 int8_tArray  CS_LDK_Offer_write(int64_t obj) {
59499         LDKOffer obj_conv;
59500         obj_conv.inner = untag_ptr(obj);
59501         obj_conv.is_owned = ptr_is_owned(obj);
59502         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59503         obj_conv.is_owned = false;
59504         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
59505         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59506         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59507         CVec_u8Z_free(ret_var);
59508         return ret_arr;
59509 }
59510
59511 void  CS_LDK_Amount_free(int64_t this_obj) {
59512         LDKAmount this_obj_conv;
59513         this_obj_conv.inner = untag_ptr(this_obj);
59514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59516         Amount_free(this_obj_conv);
59517 }
59518
59519 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
59520         LDKAmount ret_var = Amount_clone(arg);
59521         int64_t ret_ref = 0;
59522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59524         return ret_ref;
59525 }
59526 int64_t  CS_LDK_Amount_clone_ptr(int64_t arg) {
59527         LDKAmount arg_conv;
59528         arg_conv.inner = untag_ptr(arg);
59529         arg_conv.is_owned = ptr_is_owned(arg);
59530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59531         arg_conv.is_owned = false;
59532         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
59533         return ret_conv;
59534 }
59535
59536 int64_t  CS_LDK_Amount_clone(int64_t orig) {
59537         LDKAmount orig_conv;
59538         orig_conv.inner = untag_ptr(orig);
59539         orig_conv.is_owned = ptr_is_owned(orig);
59540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59541         orig_conv.is_owned = false;
59542         LDKAmount ret_var = Amount_clone(&orig_conv);
59543         int64_t ret_ref = 0;
59544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59546         return ret_ref;
59547 }
59548
59549 void  CS_LDK_Quantity_free(int64_t this_obj) {
59550         LDKQuantity this_obj_conv;
59551         this_obj_conv.inner = untag_ptr(this_obj);
59552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59554         Quantity_free(this_obj_conv);
59555 }
59556
59557 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
59558         LDKQuantity ret_var = Quantity_clone(arg);
59559         int64_t ret_ref = 0;
59560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59562         return ret_ref;
59563 }
59564 int64_t  CS_LDK_Quantity_clone_ptr(int64_t arg) {
59565         LDKQuantity arg_conv;
59566         arg_conv.inner = untag_ptr(arg);
59567         arg_conv.is_owned = ptr_is_owned(arg);
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59569         arg_conv.is_owned = false;
59570         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
59571         return ret_conv;
59572 }
59573
59574 int64_t  CS_LDK_Quantity_clone(int64_t orig) {
59575         LDKQuantity orig_conv;
59576         orig_conv.inner = untag_ptr(orig);
59577         orig_conv.is_owned = ptr_is_owned(orig);
59578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59579         orig_conv.is_owned = false;
59580         LDKQuantity ret_var = Quantity_clone(&orig_conv);
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
59587 int64_t  CS_LDK_Offer_from_str(jstring s) {
59588         LDKStr s_conv = str_ref_to_owned_c(s);
59589         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
59590         *ret_conv = Offer_from_str(s_conv);
59591         return tag_ptr(ret_conv, true);
59592 }
59593
59594 void  CS_LDK_UnsignedBolt12Invoice_free(int64_t this_obj) {
59595         LDKUnsignedBolt12Invoice this_obj_conv;
59596         this_obj_conv.inner = untag_ptr(this_obj);
59597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59599         UnsignedBolt12Invoice_free(this_obj_conv);
59600 }
59601
59602 int64_t  CS_LDK_UnsignedBolt12Invoice_tagged_hash(int64_t this_arg) {
59603         LDKUnsignedBolt12Invoice this_arg_conv;
59604         this_arg_conv.inner = untag_ptr(this_arg);
59605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59607         this_arg_conv.is_owned = false;
59608         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
59609         int64_t ret_ref = 0;
59610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59612         return ret_ref;
59613 }
59614
59615 void  CS_LDK_Bolt12Invoice_free(int64_t this_obj) {
59616         LDKBolt12Invoice this_obj_conv;
59617         this_obj_conv.inner = untag_ptr(this_obj);
59618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59620         Bolt12Invoice_free(this_obj_conv);
59621 }
59622
59623 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
59624         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
59625         int64_t ret_ref = 0;
59626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59628         return ret_ref;
59629 }
59630 int64_t  CS_LDK_Bolt12Invoice_clone_ptr(int64_t arg) {
59631         LDKBolt12Invoice arg_conv;
59632         arg_conv.inner = untag_ptr(arg);
59633         arg_conv.is_owned = ptr_is_owned(arg);
59634         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59635         arg_conv.is_owned = false;
59636         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
59637         return ret_conv;
59638 }
59639
59640 int64_t  CS_LDK_Bolt12Invoice_clone(int64_t orig) {
59641         LDKBolt12Invoice orig_conv;
59642         orig_conv.inner = untag_ptr(orig);
59643         orig_conv.is_owned = ptr_is_owned(orig);
59644         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59645         orig_conv.is_owned = false;
59646         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
59647         int64_t ret_ref = 0;
59648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59650         return ret_ref;
59651 }
59652
59653 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_chains(int64_t this_arg) {
59654         LDKUnsignedBolt12Invoice this_arg_conv;
59655         this_arg_conv.inner = untag_ptr(this_arg);
59656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59658         this_arg_conv.is_owned = false;
59659         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59660         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
59661         int64_t ret_ref = tag_ptr(ret_copy, true);
59662         return ret_ref;
59663 }
59664
59665 int8_tArray  CS_LDK_UnsignedBolt12Invoice_chain(int64_t this_arg) {
59666         LDKUnsignedBolt12Invoice this_arg_conv;
59667         this_arg_conv.inner = untag_ptr(this_arg);
59668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59670         this_arg_conv.is_owned = false;
59671         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59672         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
59673         return ret_arr;
59674 }
59675
59676 int64_t  CS_LDK_UnsignedBolt12Invoice_metadata(int64_t this_arg) {
59677         LDKUnsignedBolt12Invoice this_arg_conv;
59678         this_arg_conv.inner = untag_ptr(this_arg);
59679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59681         this_arg_conv.is_owned = false;
59682         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59683         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
59684         int64_t ret_ref = tag_ptr(ret_copy, true);
59685         return ret_ref;
59686 }
59687
59688 int64_t  CS_LDK_UnsignedBolt12Invoice_amount(int64_t this_arg) {
59689         LDKUnsignedBolt12Invoice this_arg_conv;
59690         this_arg_conv.inner = untag_ptr(this_arg);
59691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59693         this_arg_conv.is_owned = false;
59694         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
59695         int64_t ret_ref = 0;
59696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59698         return ret_ref;
59699 }
59700
59701 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_features(int64_t this_arg) {
59702         LDKUnsignedBolt12Invoice this_arg_conv;
59703         this_arg_conv.inner = untag_ptr(this_arg);
59704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59706         this_arg_conv.is_owned = false;
59707         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
59708         int64_t ret_ref = 0;
59709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59711         return ret_ref;
59712 }
59713
59714 int64_t  CS_LDK_UnsignedBolt12Invoice_description(int64_t this_arg) {
59715         LDKUnsignedBolt12Invoice this_arg_conv;
59716         this_arg_conv.inner = untag_ptr(this_arg);
59717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59719         this_arg_conv.is_owned = false;
59720         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
59721         int64_t ret_ref = 0;
59722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59724         return ret_ref;
59725 }
59726
59727 int64_t  CS_LDK_UnsignedBolt12Invoice_absolute_expiry(int64_t this_arg) {
59728         LDKUnsignedBolt12Invoice this_arg_conv;
59729         this_arg_conv.inner = untag_ptr(this_arg);
59730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59732         this_arg_conv.is_owned = false;
59733         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59734         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
59735         int64_t ret_ref = tag_ptr(ret_copy, true);
59736         return ret_ref;
59737 }
59738
59739 int64_t  CS_LDK_UnsignedBolt12Invoice_issuer(int64_t this_arg) {
59740         LDKUnsignedBolt12Invoice this_arg_conv;
59741         this_arg_conv.inner = untag_ptr(this_arg);
59742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59744         this_arg_conv.is_owned = false;
59745         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
59746         int64_t ret_ref = 0;
59747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59749         return ret_ref;
59750 }
59751
59752 int64_tArray  CS_LDK_UnsignedBolt12Invoice_message_paths(int64_t this_arg) {
59753         LDKUnsignedBolt12Invoice this_arg_conv;
59754         this_arg_conv.inner = untag_ptr(this_arg);
59755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59757         this_arg_conv.is_owned = false;
59758         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
59759         int64_tArray ret_arr = NULL;
59760         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
59761         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
59762         for (size_t n = 0; n < ret_var.datalen; n++) {
59763                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
59764                 int64_t ret_conv_13_ref = 0;
59765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
59766                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
59767                 ret_arr_ptr[n] = ret_conv_13_ref;
59768         }
59769         
59770         FREE(ret_var.data);
59771         return ret_arr;
59772 }
59773
59774 int64_t  CS_LDK_UnsignedBolt12Invoice_supported_quantity(int64_t this_arg) {
59775         LDKUnsignedBolt12Invoice this_arg_conv;
59776         this_arg_conv.inner = untag_ptr(this_arg);
59777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59779         this_arg_conv.is_owned = false;
59780         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
59781         int64_t ret_ref = 0;
59782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59784         return ret_ref;
59785 }
59786
59787 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_metadata(int64_t this_arg) {
59788         LDKUnsignedBolt12Invoice this_arg_conv;
59789         this_arg_conv.inner = untag_ptr(this_arg);
59790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59792         this_arg_conv.is_owned = false;
59793         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
59794         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59795         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59796         return ret_arr;
59797 }
59798
59799 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_request_features(int64_t this_arg) {
59800         LDKUnsignedBolt12Invoice this_arg_conv;
59801         this_arg_conv.inner = untag_ptr(this_arg);
59802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59804         this_arg_conv.is_owned = false;
59805         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
59806         int64_t ret_ref = 0;
59807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59809         return ret_ref;
59810 }
59811
59812 int64_t  CS_LDK_UnsignedBolt12Invoice_quantity(int64_t this_arg) {
59813         LDKUnsignedBolt12Invoice this_arg_conv;
59814         this_arg_conv.inner = untag_ptr(this_arg);
59815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59817         this_arg_conv.is_owned = false;
59818         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59819         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
59820         int64_t ret_ref = tag_ptr(ret_copy, true);
59821         return ret_ref;
59822 }
59823
59824 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_id(int64_t this_arg) {
59825         LDKUnsignedBolt12Invoice this_arg_conv;
59826         this_arg_conv.inner = untag_ptr(this_arg);
59827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59829         this_arg_conv.is_owned = false;
59830         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59831         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
59832         return ret_arr;
59833 }
59834
59835 int64_t  CS_LDK_UnsignedBolt12Invoice_payer_note(int64_t this_arg) {
59836         LDKUnsignedBolt12Invoice this_arg_conv;
59837         this_arg_conv.inner = untag_ptr(this_arg);
59838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59840         this_arg_conv.is_owned = false;
59841         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
59842         int64_t ret_ref = 0;
59843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59845         return ret_ref;
59846 }
59847
59848 int64_t  CS_LDK_UnsignedBolt12Invoice_created_at(int64_t this_arg) {
59849         LDKUnsignedBolt12Invoice this_arg_conv;
59850         this_arg_conv.inner = untag_ptr(this_arg);
59851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59853         this_arg_conv.is_owned = false;
59854         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
59855         return ret_conv;
59856 }
59857
59858 int64_t  CS_LDK_UnsignedBolt12Invoice_relative_expiry(int64_t this_arg) {
59859         LDKUnsignedBolt12Invoice this_arg_conv;
59860         this_arg_conv.inner = untag_ptr(this_arg);
59861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59863         this_arg_conv.is_owned = false;
59864         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
59865         return ret_conv;
59866 }
59867
59868 jboolean  CS_LDK_UnsignedBolt12Invoice_is_expired(int64_t this_arg) {
59869         LDKUnsignedBolt12Invoice this_arg_conv;
59870         this_arg_conv.inner = untag_ptr(this_arg);
59871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59873         this_arg_conv.is_owned = false;
59874         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
59875         return ret_conv;
59876 }
59877
59878 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payment_hash(int64_t this_arg) {
59879         LDKUnsignedBolt12Invoice this_arg_conv;
59880         this_arg_conv.inner = untag_ptr(this_arg);
59881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59883         this_arg_conv.is_owned = false;
59884         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59885         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
59886         return ret_arr;
59887 }
59888
59889 int64_t  CS_LDK_UnsignedBolt12Invoice_amount_msats(int64_t this_arg) {
59890         LDKUnsignedBolt12Invoice this_arg_conv;
59891         this_arg_conv.inner = untag_ptr(this_arg);
59892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59894         this_arg_conv.is_owned = false;
59895         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
59896         return ret_conv;
59897 }
59898
59899 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_features(int64_t this_arg) {
59900         LDKUnsignedBolt12Invoice this_arg_conv;
59901         this_arg_conv.inner = untag_ptr(this_arg);
59902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59904         this_arg_conv.is_owned = false;
59905         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
59906         int64_t ret_ref = 0;
59907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59909         return ret_ref;
59910 }
59911
59912 int8_tArray  CS_LDK_UnsignedBolt12Invoice_signing_pubkey(int64_t this_arg) {
59913         LDKUnsignedBolt12Invoice this_arg_conv;
59914         this_arg_conv.inner = untag_ptr(this_arg);
59915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59917         this_arg_conv.is_owned = false;
59918         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
59919         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
59920         return ret_arr;
59921 }
59922
59923 int64_t  CS_LDK_Bolt12Invoice_offer_chains(int64_t this_arg) {
59924         LDKBolt12Invoice this_arg_conv;
59925         this_arg_conv.inner = untag_ptr(this_arg);
59926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59928         this_arg_conv.is_owned = false;
59929         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
59930         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
59931         int64_t ret_ref = tag_ptr(ret_copy, true);
59932         return ret_ref;
59933 }
59934
59935 int8_tArray  CS_LDK_Bolt12Invoice_chain(int64_t this_arg) {
59936         LDKBolt12Invoice this_arg_conv;
59937         this_arg_conv.inner = untag_ptr(this_arg);
59938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59940         this_arg_conv.is_owned = false;
59941         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59942         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
59943         return ret_arr;
59944 }
59945
59946 int64_t  CS_LDK_Bolt12Invoice_metadata(int64_t this_arg) {
59947         LDKBolt12Invoice this_arg_conv;
59948         this_arg_conv.inner = untag_ptr(this_arg);
59949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59951         this_arg_conv.is_owned = false;
59952         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
59953         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
59954         int64_t ret_ref = tag_ptr(ret_copy, true);
59955         return ret_ref;
59956 }
59957
59958 int64_t  CS_LDK_Bolt12Invoice_amount(int64_t this_arg) {
59959         LDKBolt12Invoice this_arg_conv;
59960         this_arg_conv.inner = untag_ptr(this_arg);
59961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59963         this_arg_conv.is_owned = false;
59964         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
59965         int64_t ret_ref = 0;
59966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59968         return ret_ref;
59969 }
59970
59971 int64_t  CS_LDK_Bolt12Invoice_offer_features(int64_t this_arg) {
59972         LDKBolt12Invoice this_arg_conv;
59973         this_arg_conv.inner = untag_ptr(this_arg);
59974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59976         this_arg_conv.is_owned = false;
59977         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
59978         int64_t ret_ref = 0;
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59981         return ret_ref;
59982 }
59983
59984 int64_t  CS_LDK_Bolt12Invoice_description(int64_t this_arg) {
59985         LDKBolt12Invoice this_arg_conv;
59986         this_arg_conv.inner = untag_ptr(this_arg);
59987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59989         this_arg_conv.is_owned = false;
59990         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
59991         int64_t ret_ref = 0;
59992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59994         return ret_ref;
59995 }
59996
59997 int64_t  CS_LDK_Bolt12Invoice_absolute_expiry(int64_t this_arg) {
59998         LDKBolt12Invoice this_arg_conv;
59999         this_arg_conv.inner = untag_ptr(this_arg);
60000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60002         this_arg_conv.is_owned = false;
60003         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60004         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
60005         int64_t ret_ref = tag_ptr(ret_copy, true);
60006         return ret_ref;
60007 }
60008
60009 int64_t  CS_LDK_Bolt12Invoice_issuer(int64_t this_arg) {
60010         LDKBolt12Invoice this_arg_conv;
60011         this_arg_conv.inner = untag_ptr(this_arg);
60012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60014         this_arg_conv.is_owned = false;
60015         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
60016         int64_t ret_ref = 0;
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60019         return ret_ref;
60020 }
60021
60022 int64_tArray  CS_LDK_Bolt12Invoice_message_paths(int64_t this_arg) {
60023         LDKBolt12Invoice this_arg_conv;
60024         this_arg_conv.inner = untag_ptr(this_arg);
60025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60027         this_arg_conv.is_owned = false;
60028         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
60029         int64_tArray ret_arr = NULL;
60030         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
60031         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
60032         for (size_t n = 0; n < ret_var.datalen; n++) {
60033                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60034                 int64_t ret_conv_13_ref = 0;
60035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60036                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60037                 ret_arr_ptr[n] = ret_conv_13_ref;
60038         }
60039         
60040         FREE(ret_var.data);
60041         return ret_arr;
60042 }
60043
60044 int64_t  CS_LDK_Bolt12Invoice_supported_quantity(int64_t this_arg) {
60045         LDKBolt12Invoice 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         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
60051         int64_t ret_ref = 0;
60052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60054         return ret_ref;
60055 }
60056
60057 int8_tArray  CS_LDK_Bolt12Invoice_payer_metadata(int64_t this_arg) {
60058         LDKBolt12Invoice this_arg_conv;
60059         this_arg_conv.inner = untag_ptr(this_arg);
60060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60062         this_arg_conv.is_owned = false;
60063         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
60064         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60065         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60066         return ret_arr;
60067 }
60068
60069 int64_t  CS_LDK_Bolt12Invoice_invoice_request_features(int64_t this_arg) {
60070         LDKBolt12Invoice this_arg_conv;
60071         this_arg_conv.inner = untag_ptr(this_arg);
60072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60074         this_arg_conv.is_owned = false;
60075         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
60076         int64_t ret_ref = 0;
60077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60079         return ret_ref;
60080 }
60081
60082 int64_t  CS_LDK_Bolt12Invoice_quantity(int64_t this_arg) {
60083         LDKBolt12Invoice this_arg_conv;
60084         this_arg_conv.inner = untag_ptr(this_arg);
60085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60087         this_arg_conv.is_owned = false;
60088         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60089         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
60090         int64_t ret_ref = tag_ptr(ret_copy, true);
60091         return ret_ref;
60092 }
60093
60094 int8_tArray  CS_LDK_Bolt12Invoice_payer_id(int64_t this_arg) {
60095         LDKBolt12Invoice this_arg_conv;
60096         this_arg_conv.inner = untag_ptr(this_arg);
60097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60099         this_arg_conv.is_owned = false;
60100         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60101         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
60102         return ret_arr;
60103 }
60104
60105 int64_t  CS_LDK_Bolt12Invoice_payer_note(int64_t this_arg) {
60106         LDKBolt12Invoice this_arg_conv;
60107         this_arg_conv.inner = untag_ptr(this_arg);
60108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60110         this_arg_conv.is_owned = false;
60111         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
60112         int64_t ret_ref = 0;
60113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60115         return ret_ref;
60116 }
60117
60118 int64_t  CS_LDK_Bolt12Invoice_created_at(int64_t this_arg) {
60119         LDKBolt12Invoice this_arg_conv;
60120         this_arg_conv.inner = untag_ptr(this_arg);
60121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60123         this_arg_conv.is_owned = false;
60124         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
60125         return ret_conv;
60126 }
60127
60128 int64_t  CS_LDK_Bolt12Invoice_relative_expiry(int64_t this_arg) {
60129         LDKBolt12Invoice this_arg_conv;
60130         this_arg_conv.inner = untag_ptr(this_arg);
60131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60133         this_arg_conv.is_owned = false;
60134         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
60135         return ret_conv;
60136 }
60137
60138 jboolean  CS_LDK_Bolt12Invoice_is_expired(int64_t this_arg) {
60139         LDKBolt12Invoice this_arg_conv;
60140         this_arg_conv.inner = untag_ptr(this_arg);
60141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60143         this_arg_conv.is_owned = false;
60144         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
60145         return ret_conv;
60146 }
60147
60148 int8_tArray  CS_LDK_Bolt12Invoice_payment_hash(int64_t this_arg) {
60149         LDKBolt12Invoice this_arg_conv;
60150         this_arg_conv.inner = untag_ptr(this_arg);
60151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60153         this_arg_conv.is_owned = false;
60154         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60155         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
60156         return ret_arr;
60157 }
60158
60159 int64_t  CS_LDK_Bolt12Invoice_amount_msats(int64_t this_arg) {
60160         LDKBolt12Invoice this_arg_conv;
60161         this_arg_conv.inner = untag_ptr(this_arg);
60162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60164         this_arg_conv.is_owned = false;
60165         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
60166         return ret_conv;
60167 }
60168
60169 int64_t  CS_LDK_Bolt12Invoice_invoice_features(int64_t this_arg) {
60170         LDKBolt12Invoice this_arg_conv;
60171         this_arg_conv.inner = untag_ptr(this_arg);
60172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60174         this_arg_conv.is_owned = false;
60175         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
60176         int64_t ret_ref = 0;
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60179         return ret_ref;
60180 }
60181
60182 int8_tArray  CS_LDK_Bolt12Invoice_signing_pubkey(int64_t this_arg) {
60183         LDKBolt12Invoice this_arg_conv;
60184         this_arg_conv.inner = untag_ptr(this_arg);
60185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60187         this_arg_conv.is_owned = false;
60188         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60189         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
60190         return ret_arr;
60191 }
60192
60193 int8_tArray  CS_LDK_Bolt12Invoice_signature(int64_t this_arg) {
60194         LDKBolt12Invoice this_arg_conv;
60195         this_arg_conv.inner = untag_ptr(this_arg);
60196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60198         this_arg_conv.is_owned = false;
60199         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60200         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
60201         return ret_arr;
60202 }
60203
60204 int8_tArray  CS_LDK_Bolt12Invoice_signable_hash(int64_t this_arg) {
60205         LDKBolt12Invoice this_arg_conv;
60206         this_arg_conv.inner = untag_ptr(this_arg);
60207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60209         this_arg_conv.is_owned = false;
60210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60211         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
60212         return ret_arr;
60213 }
60214
60215 int64_t  CS_LDK_Bolt12Invoice_verify(int64_t this_arg, int64_t key) {
60216         LDKBolt12Invoice this_arg_conv;
60217         this_arg_conv.inner = untag_ptr(this_arg);
60218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60220         this_arg_conv.is_owned = false;
60221         LDKExpandedKey key_conv;
60222         key_conv.inner = untag_ptr(key);
60223         key_conv.is_owned = ptr_is_owned(key);
60224         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
60225         key_conv.is_owned = false;
60226         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
60227         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
60228         return tag_ptr(ret_conv, true);
60229 }
60230
60231 int8_tArray  CS_LDK_UnsignedBolt12Invoice_write(int64_t obj) {
60232         LDKUnsignedBolt12Invoice obj_conv;
60233         obj_conv.inner = untag_ptr(obj);
60234         obj_conv.is_owned = ptr_is_owned(obj);
60235         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60236         obj_conv.is_owned = false;
60237         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
60238         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60239         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60240         CVec_u8Z_free(ret_var);
60241         return ret_arr;
60242 }
60243
60244 int8_tArray  CS_LDK_Bolt12Invoice_write(int64_t obj) {
60245         LDKBolt12Invoice obj_conv;
60246         obj_conv.inner = untag_ptr(obj);
60247         obj_conv.is_owned = ptr_is_owned(obj);
60248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60249         obj_conv.is_owned = false;
60250         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
60251         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60252         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60253         CVec_u8Z_free(ret_var);
60254         return ret_arr;
60255 }
60256
60257 void  CS_LDK_BlindedPayInfo_free(int64_t this_obj) {
60258         LDKBlindedPayInfo this_obj_conv;
60259         this_obj_conv.inner = untag_ptr(this_obj);
60260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60262         BlindedPayInfo_free(this_obj_conv);
60263 }
60264
60265 int32_t  CS_LDK_BlindedPayInfo_get_fee_base_msat(int64_t this_ptr) {
60266         LDKBlindedPayInfo this_ptr_conv;
60267         this_ptr_conv.inner = untag_ptr(this_ptr);
60268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60270         this_ptr_conv.is_owned = false;
60271         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
60272         return ret_conv;
60273 }
60274
60275 void  CS_LDK_BlindedPayInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
60276         LDKBlindedPayInfo this_ptr_conv;
60277         this_ptr_conv.inner = untag_ptr(this_ptr);
60278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60280         this_ptr_conv.is_owned = false;
60281         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
60282 }
60283
60284 int32_t  CS_LDK_BlindedPayInfo_get_fee_proportional_millionths(int64_t this_ptr) {
60285         LDKBlindedPayInfo this_ptr_conv;
60286         this_ptr_conv.inner = untag_ptr(this_ptr);
60287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60289         this_ptr_conv.is_owned = false;
60290         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
60291         return ret_conv;
60292 }
60293
60294 void  CS_LDK_BlindedPayInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
60295         LDKBlindedPayInfo this_ptr_conv;
60296         this_ptr_conv.inner = untag_ptr(this_ptr);
60297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60299         this_ptr_conv.is_owned = false;
60300         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
60301 }
60302
60303 int16_t  CS_LDK_BlindedPayInfo_get_cltv_expiry_delta(int64_t this_ptr) {
60304         LDKBlindedPayInfo this_ptr_conv;
60305         this_ptr_conv.inner = untag_ptr(this_ptr);
60306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60308         this_ptr_conv.is_owned = false;
60309         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
60310         return ret_conv;
60311 }
60312
60313 void  CS_LDK_BlindedPayInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
60314         LDKBlindedPayInfo this_ptr_conv;
60315         this_ptr_conv.inner = untag_ptr(this_ptr);
60316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60318         this_ptr_conv.is_owned = false;
60319         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
60320 }
60321
60322 int64_t  CS_LDK_BlindedPayInfo_get_htlc_minimum_msat(int64_t this_ptr) {
60323         LDKBlindedPayInfo this_ptr_conv;
60324         this_ptr_conv.inner = untag_ptr(this_ptr);
60325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60327         this_ptr_conv.is_owned = false;
60328         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
60329         return ret_conv;
60330 }
60331
60332 void  CS_LDK_BlindedPayInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
60333         LDKBlindedPayInfo this_ptr_conv;
60334         this_ptr_conv.inner = untag_ptr(this_ptr);
60335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60337         this_ptr_conv.is_owned = false;
60338         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
60339 }
60340
60341 int64_t  CS_LDK_BlindedPayInfo_get_htlc_maximum_msat(int64_t this_ptr) {
60342         LDKBlindedPayInfo this_ptr_conv;
60343         this_ptr_conv.inner = untag_ptr(this_ptr);
60344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60346         this_ptr_conv.is_owned = false;
60347         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
60348         return ret_conv;
60349 }
60350
60351 void  CS_LDK_BlindedPayInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
60352         LDKBlindedPayInfo this_ptr_conv;
60353         this_ptr_conv.inner = untag_ptr(this_ptr);
60354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60356         this_ptr_conv.is_owned = false;
60357         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
60358 }
60359
60360 int64_t  CS_LDK_BlindedPayInfo_get_features(int64_t this_ptr) {
60361         LDKBlindedPayInfo this_ptr_conv;
60362         this_ptr_conv.inner = untag_ptr(this_ptr);
60363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60365         this_ptr_conv.is_owned = false;
60366         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
60367         int64_t ret_ref = 0;
60368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60370         return ret_ref;
60371 }
60372
60373 void  CS_LDK_BlindedPayInfo_set_features(int64_t this_ptr, int64_t val) {
60374         LDKBlindedPayInfo this_ptr_conv;
60375         this_ptr_conv.inner = untag_ptr(this_ptr);
60376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60378         this_ptr_conv.is_owned = false;
60379         LDKBlindedHopFeatures val_conv;
60380         val_conv.inner = untag_ptr(val);
60381         val_conv.is_owned = ptr_is_owned(val);
60382         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60383         val_conv = BlindedHopFeatures_clone(&val_conv);
60384         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
60385 }
60386
60387 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) {
60388         LDKBlindedHopFeatures features_arg_conv;
60389         features_arg_conv.inner = untag_ptr(features_arg);
60390         features_arg_conv.is_owned = ptr_is_owned(features_arg);
60391         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
60392         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
60393         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);
60394         int64_t ret_ref = 0;
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60397         return ret_ref;
60398 }
60399
60400 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
60401         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
60402         int64_t ret_ref = 0;
60403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60405         return ret_ref;
60406 }
60407 int64_t  CS_LDK_BlindedPayInfo_clone_ptr(int64_t arg) {
60408         LDKBlindedPayInfo arg_conv;
60409         arg_conv.inner = untag_ptr(arg);
60410         arg_conv.is_owned = ptr_is_owned(arg);
60411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60412         arg_conv.is_owned = false;
60413         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
60414         return ret_conv;
60415 }
60416
60417 int64_t  CS_LDK_BlindedPayInfo_clone(int64_t orig) {
60418         LDKBlindedPayInfo orig_conv;
60419         orig_conv.inner = untag_ptr(orig);
60420         orig_conv.is_owned = ptr_is_owned(orig);
60421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60422         orig_conv.is_owned = false;
60423         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
60424         int64_t ret_ref = 0;
60425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60427         return ret_ref;
60428 }
60429
60430 int64_t  CS_LDK_BlindedPayInfo_hash(int64_t o) {
60431         LDKBlindedPayInfo o_conv;
60432         o_conv.inner = untag_ptr(o);
60433         o_conv.is_owned = ptr_is_owned(o);
60434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60435         o_conv.is_owned = false;
60436         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
60437         return ret_conv;
60438 }
60439
60440 jboolean  CS_LDK_BlindedPayInfo_eq(int64_t a, int64_t b) {
60441         LDKBlindedPayInfo a_conv;
60442         a_conv.inner = untag_ptr(a);
60443         a_conv.is_owned = ptr_is_owned(a);
60444         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60445         a_conv.is_owned = false;
60446         LDKBlindedPayInfo b_conv;
60447         b_conv.inner = untag_ptr(b);
60448         b_conv.is_owned = ptr_is_owned(b);
60449         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60450         b_conv.is_owned = false;
60451         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
60452         return ret_conv;
60453 }
60454
60455 int8_tArray  CS_LDK_BlindedPayInfo_write(int64_t obj) {
60456         LDKBlindedPayInfo obj_conv;
60457         obj_conv.inner = untag_ptr(obj);
60458         obj_conv.is_owned = ptr_is_owned(obj);
60459         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60460         obj_conv.is_owned = false;
60461         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
60462         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60463         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60464         CVec_u8Z_free(ret_var);
60465         return ret_arr;
60466 }
60467
60468 int64_t  CS_LDK_BlindedPayInfo_read(int8_tArray ser) {
60469         LDKu8slice ser_ref;
60470         ser_ref.datalen = ser->arr_len;
60471         ser_ref.data = ser->elems;
60472         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
60473         *ret_conv = BlindedPayInfo_read(ser_ref);
60474         FREE(ser);
60475         return tag_ptr(ret_conv, true);
60476 }
60477
60478 void  CS_LDK_InvoiceError_free(int64_t this_obj) {
60479         LDKInvoiceError this_obj_conv;
60480         this_obj_conv.inner = untag_ptr(this_obj);
60481         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60483         InvoiceError_free(this_obj_conv);
60484 }
60485
60486 int64_t  CS_LDK_InvoiceError_get_erroneous_field(int64_t this_ptr) {
60487         LDKInvoiceError this_ptr_conv;
60488         this_ptr_conv.inner = untag_ptr(this_ptr);
60489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60491         this_ptr_conv.is_owned = false;
60492         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
60493         int64_t ret_ref = 0;
60494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60496         return ret_ref;
60497 }
60498
60499 void  CS_LDK_InvoiceError_set_erroneous_field(int64_t this_ptr, int64_t val) {
60500         LDKInvoiceError this_ptr_conv;
60501         this_ptr_conv.inner = untag_ptr(this_ptr);
60502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60504         this_ptr_conv.is_owned = false;
60505         LDKErroneousField val_conv;
60506         val_conv.inner = untag_ptr(val);
60507         val_conv.is_owned = ptr_is_owned(val);
60508         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60509         val_conv = ErroneousField_clone(&val_conv);
60510         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
60511 }
60512
60513 int64_t  CS_LDK_InvoiceError_get_message(int64_t this_ptr) {
60514         LDKInvoiceError this_ptr_conv;
60515         this_ptr_conv.inner = untag_ptr(this_ptr);
60516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60518         this_ptr_conv.is_owned = false;
60519         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
60520         int64_t ret_ref = 0;
60521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60523         return ret_ref;
60524 }
60525
60526 void  CS_LDK_InvoiceError_set_message(int64_t this_ptr, int64_t val) {
60527         LDKInvoiceError this_ptr_conv;
60528         this_ptr_conv.inner = untag_ptr(this_ptr);
60529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60531         this_ptr_conv.is_owned = false;
60532         LDKUntrustedString val_conv;
60533         val_conv.inner = untag_ptr(val);
60534         val_conv.is_owned = ptr_is_owned(val);
60535         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60536         val_conv = UntrustedString_clone(&val_conv);
60537         InvoiceError_set_message(&this_ptr_conv, val_conv);
60538 }
60539
60540 int64_t  CS_LDK_InvoiceError_new(int64_t erroneous_field_arg, int64_t message_arg) {
60541         LDKErroneousField erroneous_field_arg_conv;
60542         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
60543         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
60544         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
60545         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
60546         LDKUntrustedString message_arg_conv;
60547         message_arg_conv.inner = untag_ptr(message_arg);
60548         message_arg_conv.is_owned = ptr_is_owned(message_arg);
60549         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
60550         message_arg_conv = UntrustedString_clone(&message_arg_conv);
60551         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
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 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
60559         LDKInvoiceError ret_var = InvoiceError_clone(arg);
60560         int64_t ret_ref = 0;
60561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60563         return ret_ref;
60564 }
60565 int64_t  CS_LDK_InvoiceError_clone_ptr(int64_t arg) {
60566         LDKInvoiceError arg_conv;
60567         arg_conv.inner = untag_ptr(arg);
60568         arg_conv.is_owned = ptr_is_owned(arg);
60569         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60570         arg_conv.is_owned = false;
60571         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
60572         return ret_conv;
60573 }
60574
60575 int64_t  CS_LDK_InvoiceError_clone(int64_t orig) {
60576         LDKInvoiceError orig_conv;
60577         orig_conv.inner = untag_ptr(orig);
60578         orig_conv.is_owned = ptr_is_owned(orig);
60579         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60580         orig_conv.is_owned = false;
60581         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
60582         int64_t ret_ref = 0;
60583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60585         return ret_ref;
60586 }
60587
60588 void  CS_LDK_ErroneousField_free(int64_t this_obj) {
60589         LDKErroneousField this_obj_conv;
60590         this_obj_conv.inner = untag_ptr(this_obj);
60591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60593         ErroneousField_free(this_obj_conv);
60594 }
60595
60596 int64_t  CS_LDK_ErroneousField_get_tlv_fieldnum(int64_t this_ptr) {
60597         LDKErroneousField this_ptr_conv;
60598         this_ptr_conv.inner = untag_ptr(this_ptr);
60599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60601         this_ptr_conv.is_owned = false;
60602         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
60603         return ret_conv;
60604 }
60605
60606 void  CS_LDK_ErroneousField_set_tlv_fieldnum(int64_t this_ptr, int64_t val) {
60607         LDKErroneousField this_ptr_conv;
60608         this_ptr_conv.inner = untag_ptr(this_ptr);
60609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60611         this_ptr_conv.is_owned = false;
60612         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
60613 }
60614
60615 int64_t  CS_LDK_ErroneousField_get_suggested_value(int64_t this_ptr) {
60616         LDKErroneousField this_ptr_conv;
60617         this_ptr_conv.inner = untag_ptr(this_ptr);
60618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60620         this_ptr_conv.is_owned = false;
60621         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60622         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
60623         int64_t ret_ref = tag_ptr(ret_copy, true);
60624         return ret_ref;
60625 }
60626
60627 void  CS_LDK_ErroneousField_set_suggested_value(int64_t this_ptr, int64_t val) {
60628         LDKErroneousField this_ptr_conv;
60629         this_ptr_conv.inner = untag_ptr(this_ptr);
60630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60632         this_ptr_conv.is_owned = false;
60633         void* val_ptr = untag_ptr(val);
60634         CHECK_ACCESS(val_ptr);
60635         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
60636         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
60637         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
60638 }
60639
60640 int64_t  CS_LDK_ErroneousField_new(int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
60641         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
60642         CHECK_ACCESS(suggested_value_arg_ptr);
60643         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
60644         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
60645         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
60646         int64_t ret_ref = 0;
60647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60649         return ret_ref;
60650 }
60651
60652 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
60653         LDKErroneousField ret_var = ErroneousField_clone(arg);
60654         int64_t ret_ref = 0;
60655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60657         return ret_ref;
60658 }
60659 int64_t  CS_LDK_ErroneousField_clone_ptr(int64_t arg) {
60660         LDKErroneousField arg_conv;
60661         arg_conv.inner = untag_ptr(arg);
60662         arg_conv.is_owned = ptr_is_owned(arg);
60663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60664         arg_conv.is_owned = false;
60665         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
60666         return ret_conv;
60667 }
60668
60669 int64_t  CS_LDK_ErroneousField_clone(int64_t orig) {
60670         LDKErroneousField orig_conv;
60671         orig_conv.inner = untag_ptr(orig);
60672         orig_conv.is_owned = ptr_is_owned(orig);
60673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60674         orig_conv.is_owned = false;
60675         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
60676         int64_t ret_ref = 0;
60677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60679         return ret_ref;
60680 }
60681
60682 int64_t  CS_LDK_InvoiceError_from_string(jstring s) {
60683         LDKStr s_conv = str_ref_to_owned_c(s);
60684         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
60685         int64_t ret_ref = 0;
60686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60688         return ret_ref;
60689 }
60690
60691 int8_tArray  CS_LDK_InvoiceError_write(int64_t obj) {
60692         LDKInvoiceError obj_conv;
60693         obj_conv.inner = untag_ptr(obj);
60694         obj_conv.is_owned = ptr_is_owned(obj);
60695         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60696         obj_conv.is_owned = false;
60697         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
60698         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60699         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60700         CVec_u8Z_free(ret_var);
60701         return ret_arr;
60702 }
60703
60704 int64_t  CS_LDK_InvoiceError_read(int8_tArray ser) {
60705         LDKu8slice ser_ref;
60706         ser_ref.datalen = ser->arr_len;
60707         ser_ref.data = ser->elems;
60708         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
60709         *ret_conv = InvoiceError_read(ser_ref);
60710         FREE(ser);
60711         return tag_ptr(ret_conv, true);
60712 }
60713
60714 void  CS_LDK_UnsignedInvoiceRequest_free(int64_t this_obj) {
60715         LDKUnsignedInvoiceRequest this_obj_conv;
60716         this_obj_conv.inner = untag_ptr(this_obj);
60717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60719         UnsignedInvoiceRequest_free(this_obj_conv);
60720 }
60721
60722 int64_t  CS_LDK_UnsignedInvoiceRequest_tagged_hash(int64_t this_arg) {
60723         LDKUnsignedInvoiceRequest this_arg_conv;
60724         this_arg_conv.inner = untag_ptr(this_arg);
60725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60727         this_arg_conv.is_owned = false;
60728         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
60729         int64_t ret_ref = 0;
60730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60732         return ret_ref;
60733 }
60734
60735 void  CS_LDK_InvoiceRequest_free(int64_t this_obj) {
60736         LDKInvoiceRequest this_obj_conv;
60737         this_obj_conv.inner = untag_ptr(this_obj);
60738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60740         InvoiceRequest_free(this_obj_conv);
60741 }
60742
60743 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
60744         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
60745         int64_t ret_ref = 0;
60746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60748         return ret_ref;
60749 }
60750 int64_t  CS_LDK_InvoiceRequest_clone_ptr(int64_t arg) {
60751         LDKInvoiceRequest arg_conv;
60752         arg_conv.inner = untag_ptr(arg);
60753         arg_conv.is_owned = ptr_is_owned(arg);
60754         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60755         arg_conv.is_owned = false;
60756         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
60757         return ret_conv;
60758 }
60759
60760 int64_t  CS_LDK_InvoiceRequest_clone(int64_t orig) {
60761         LDKInvoiceRequest orig_conv;
60762         orig_conv.inner = untag_ptr(orig);
60763         orig_conv.is_owned = ptr_is_owned(orig);
60764         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60765         orig_conv.is_owned = false;
60766         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
60767         int64_t ret_ref = 0;
60768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60770         return ret_ref;
60771 }
60772
60773 void  CS_LDK_VerifiedInvoiceRequest_free(int64_t this_obj) {
60774         LDKVerifiedInvoiceRequest this_obj_conv;
60775         this_obj_conv.inner = untag_ptr(this_obj);
60776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60778         VerifiedInvoiceRequest_free(this_obj_conv);
60779 }
60780
60781 int64_t  CS_LDK_VerifiedInvoiceRequest_get_keys(int64_t this_ptr) {
60782         LDKVerifiedInvoiceRequest this_ptr_conv;
60783         this_ptr_conv.inner = untag_ptr(this_ptr);
60784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60786         this_ptr_conv.is_owned = false;
60787         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
60788         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
60789         int64_t ret_ref = tag_ptr(ret_copy, true);
60790         return ret_ref;
60791 }
60792
60793 void  CS_LDK_VerifiedInvoiceRequest_set_keys(int64_t this_ptr, int64_t val) {
60794         LDKVerifiedInvoiceRequest this_ptr_conv;
60795         this_ptr_conv.inner = untag_ptr(this_ptr);
60796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60798         this_ptr_conv.is_owned = false;
60799         void* val_ptr = untag_ptr(val);
60800         CHECK_ACCESS(val_ptr);
60801         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
60802         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
60803         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
60804 }
60805
60806 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
60807         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
60808         int64_t ret_ref = 0;
60809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60811         return ret_ref;
60812 }
60813 int64_t  CS_LDK_VerifiedInvoiceRequest_clone_ptr(int64_t arg) {
60814         LDKVerifiedInvoiceRequest arg_conv;
60815         arg_conv.inner = untag_ptr(arg);
60816         arg_conv.is_owned = ptr_is_owned(arg);
60817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60818         arg_conv.is_owned = false;
60819         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
60820         return ret_conv;
60821 }
60822
60823 int64_t  CS_LDK_VerifiedInvoiceRequest_clone(int64_t orig) {
60824         LDKVerifiedInvoiceRequest orig_conv;
60825         orig_conv.inner = untag_ptr(orig);
60826         orig_conv.is_owned = ptr_is_owned(orig);
60827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60828         orig_conv.is_owned = false;
60829         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
60830         int64_t ret_ref = 0;
60831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60833         return ret_ref;
60834 }
60835
60836 ptrArray  CS_LDK_UnsignedInvoiceRequest_chains(int64_t this_arg) {
60837         LDKUnsignedInvoiceRequest this_arg_conv;
60838         this_arg_conv.inner = untag_ptr(this_arg);
60839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60841         this_arg_conv.is_owned = false;
60842         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
60843         ptrArray ret_arr = NULL;
60844         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
60845         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
60846         for (size_t i = 0; i < ret_var.datalen; i++) {
60847                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
60848                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
60849                 ret_arr_ptr[i] = ret_conv_8_arr;
60850         }
60851         
60852         FREE(ret_var.data);
60853         return ret_arr;
60854 }
60855
60856 int64_t  CS_LDK_UnsignedInvoiceRequest_metadata(int64_t this_arg) {
60857         LDKUnsignedInvoiceRequest this_arg_conv;
60858         this_arg_conv.inner = untag_ptr(this_arg);
60859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60861         this_arg_conv.is_owned = false;
60862         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
60863         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
60864         int64_t ret_ref = tag_ptr(ret_copy, true);
60865         return ret_ref;
60866 }
60867
60868 int64_t  CS_LDK_UnsignedInvoiceRequest_amount(int64_t this_arg) {
60869         LDKUnsignedInvoiceRequest this_arg_conv;
60870         this_arg_conv.inner = untag_ptr(this_arg);
60871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60873         this_arg_conv.is_owned = false;
60874         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
60875         int64_t ret_ref = 0;
60876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60878         return ret_ref;
60879 }
60880
60881 int64_t  CS_LDK_UnsignedInvoiceRequest_description(int64_t this_arg) {
60882         LDKUnsignedInvoiceRequest this_arg_conv;
60883         this_arg_conv.inner = untag_ptr(this_arg);
60884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60886         this_arg_conv.is_owned = false;
60887         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
60888         int64_t ret_ref = 0;
60889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60891         return ret_ref;
60892 }
60893
60894 int64_t  CS_LDK_UnsignedInvoiceRequest_offer_features(int64_t this_arg) {
60895         LDKUnsignedInvoiceRequest this_arg_conv;
60896         this_arg_conv.inner = untag_ptr(this_arg);
60897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60899         this_arg_conv.is_owned = false;
60900         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
60901         int64_t ret_ref = 0;
60902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60904         return ret_ref;
60905 }
60906
60907 int64_t  CS_LDK_UnsignedInvoiceRequest_absolute_expiry(int64_t this_arg) {
60908         LDKUnsignedInvoiceRequest this_arg_conv;
60909         this_arg_conv.inner = untag_ptr(this_arg);
60910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60912         this_arg_conv.is_owned = false;
60913         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60914         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
60915         int64_t ret_ref = tag_ptr(ret_copy, true);
60916         return ret_ref;
60917 }
60918
60919 int64_t  CS_LDK_UnsignedInvoiceRequest_issuer(int64_t this_arg) {
60920         LDKUnsignedInvoiceRequest this_arg_conv;
60921         this_arg_conv.inner = untag_ptr(this_arg);
60922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60924         this_arg_conv.is_owned = false;
60925         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
60926         int64_t ret_ref = 0;
60927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60929         return ret_ref;
60930 }
60931
60932 int64_tArray  CS_LDK_UnsignedInvoiceRequest_paths(int64_t this_arg) {
60933         LDKUnsignedInvoiceRequest this_arg_conv;
60934         this_arg_conv.inner = untag_ptr(this_arg);
60935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60937         this_arg_conv.is_owned = false;
60938         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
60939         int64_tArray ret_arr = NULL;
60940         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
60941         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
60942         for (size_t n = 0; n < ret_var.datalen; n++) {
60943                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
60944                 int64_t ret_conv_13_ref = 0;
60945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
60946                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
60947                 ret_arr_ptr[n] = ret_conv_13_ref;
60948         }
60949         
60950         FREE(ret_var.data);
60951         return ret_arr;
60952 }
60953
60954 int64_t  CS_LDK_UnsignedInvoiceRequest_supported_quantity(int64_t this_arg) {
60955         LDKUnsignedInvoiceRequest this_arg_conv;
60956         this_arg_conv.inner = untag_ptr(this_arg);
60957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60959         this_arg_conv.is_owned = false;
60960         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
60961         int64_t ret_ref = 0;
60962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60964         return ret_ref;
60965 }
60966
60967 int8_tArray  CS_LDK_UnsignedInvoiceRequest_signing_pubkey(int64_t this_arg) {
60968         LDKUnsignedInvoiceRequest this_arg_conv;
60969         this_arg_conv.inner = untag_ptr(this_arg);
60970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60972         this_arg_conv.is_owned = false;
60973         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60974         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
60975         return ret_arr;
60976 }
60977
60978 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_metadata(int64_t this_arg) {
60979         LDKUnsignedInvoiceRequest 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         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
60985         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60986         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60987         return ret_arr;
60988 }
60989
60990 int8_tArray  CS_LDK_UnsignedInvoiceRequest_chain(int64_t this_arg) {
60991         LDKUnsignedInvoiceRequest this_arg_conv;
60992         this_arg_conv.inner = untag_ptr(this_arg);
60993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60995         this_arg_conv.is_owned = false;
60996         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60997         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
60998         return ret_arr;
60999 }
61000
61001 int64_t  CS_LDK_UnsignedInvoiceRequest_amount_msats(int64_t this_arg) {
61002         LDKUnsignedInvoiceRequest this_arg_conv;
61003         this_arg_conv.inner = untag_ptr(this_arg);
61004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61006         this_arg_conv.is_owned = false;
61007         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61008         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
61009         int64_t ret_ref = tag_ptr(ret_copy, true);
61010         return ret_ref;
61011 }
61012
61013 int64_t  CS_LDK_UnsignedInvoiceRequest_invoice_request_features(int64_t this_arg) {
61014         LDKUnsignedInvoiceRequest this_arg_conv;
61015         this_arg_conv.inner = untag_ptr(this_arg);
61016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61018         this_arg_conv.is_owned = false;
61019         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
61020         int64_t ret_ref = 0;
61021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61023         return ret_ref;
61024 }
61025
61026 int64_t  CS_LDK_UnsignedInvoiceRequest_quantity(int64_t this_arg) {
61027         LDKUnsignedInvoiceRequest this_arg_conv;
61028         this_arg_conv.inner = untag_ptr(this_arg);
61029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61031         this_arg_conv.is_owned = false;
61032         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61033         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
61034         int64_t ret_ref = tag_ptr(ret_copy, true);
61035         return ret_ref;
61036 }
61037
61038 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_id(int64_t this_arg) {
61039         LDKUnsignedInvoiceRequest this_arg_conv;
61040         this_arg_conv.inner = untag_ptr(this_arg);
61041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61043         this_arg_conv.is_owned = false;
61044         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61045         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61046         return ret_arr;
61047 }
61048
61049 int64_t  CS_LDK_UnsignedInvoiceRequest_payer_note(int64_t this_arg) {
61050         LDKUnsignedInvoiceRequest this_arg_conv;
61051         this_arg_conv.inner = untag_ptr(this_arg);
61052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61054         this_arg_conv.is_owned = false;
61055         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
61056         int64_t ret_ref = 0;
61057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61059         return ret_ref;
61060 }
61061
61062 ptrArray  CS_LDK_InvoiceRequest_chains(int64_t this_arg) {
61063         LDKInvoiceRequest this_arg_conv;
61064         this_arg_conv.inner = untag_ptr(this_arg);
61065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61067         this_arg_conv.is_owned = false;
61068         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
61069         ptrArray ret_arr = NULL;
61070         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
61071         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
61072         for (size_t i = 0; i < ret_var.datalen; i++) {
61073                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
61074                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
61075                 ret_arr_ptr[i] = ret_conv_8_arr;
61076         }
61077         
61078         FREE(ret_var.data);
61079         return ret_arr;
61080 }
61081
61082 int64_t  CS_LDK_InvoiceRequest_metadata(int64_t this_arg) {
61083         LDKInvoiceRequest 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61089         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
61090         int64_t ret_ref = tag_ptr(ret_copy, true);
61091         return ret_ref;
61092 }
61093
61094 int64_t  CS_LDK_InvoiceRequest_amount(int64_t this_arg) {
61095         LDKInvoiceRequest this_arg_conv;
61096         this_arg_conv.inner = untag_ptr(this_arg);
61097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61099         this_arg_conv.is_owned = false;
61100         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
61101         int64_t ret_ref = 0;
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61104         return ret_ref;
61105 }
61106
61107 int64_t  CS_LDK_InvoiceRequest_description(int64_t this_arg) {
61108         LDKInvoiceRequest this_arg_conv;
61109         this_arg_conv.inner = untag_ptr(this_arg);
61110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61112         this_arg_conv.is_owned = false;
61113         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
61114         int64_t ret_ref = 0;
61115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61117         return ret_ref;
61118 }
61119
61120 int64_t  CS_LDK_InvoiceRequest_offer_features(int64_t this_arg) {
61121         LDKInvoiceRequest this_arg_conv;
61122         this_arg_conv.inner = untag_ptr(this_arg);
61123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61125         this_arg_conv.is_owned = false;
61126         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
61127         int64_t ret_ref = 0;
61128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61130         return ret_ref;
61131 }
61132
61133 int64_t  CS_LDK_InvoiceRequest_absolute_expiry(int64_t this_arg) {
61134         LDKInvoiceRequest this_arg_conv;
61135         this_arg_conv.inner = untag_ptr(this_arg);
61136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61138         this_arg_conv.is_owned = false;
61139         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61140         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
61141         int64_t ret_ref = tag_ptr(ret_copy, true);
61142         return ret_ref;
61143 }
61144
61145 int64_t  CS_LDK_InvoiceRequest_issuer(int64_t this_arg) {
61146         LDKInvoiceRequest this_arg_conv;
61147         this_arg_conv.inner = untag_ptr(this_arg);
61148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61150         this_arg_conv.is_owned = false;
61151         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
61152         int64_t ret_ref = 0;
61153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61155         return ret_ref;
61156 }
61157
61158 int64_tArray  CS_LDK_InvoiceRequest_paths(int64_t this_arg) {
61159         LDKInvoiceRequest 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         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
61165         int64_tArray ret_arr = NULL;
61166         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61167         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61168         for (size_t n = 0; n < ret_var.datalen; n++) {
61169                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61170                 int64_t ret_conv_13_ref = 0;
61171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61172                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61173                 ret_arr_ptr[n] = ret_conv_13_ref;
61174         }
61175         
61176         FREE(ret_var.data);
61177         return ret_arr;
61178 }
61179
61180 int64_t  CS_LDK_InvoiceRequest_supported_quantity(int64_t this_arg) {
61181         LDKInvoiceRequest this_arg_conv;
61182         this_arg_conv.inner = untag_ptr(this_arg);
61183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61185         this_arg_conv.is_owned = false;
61186         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
61187         int64_t ret_ref = 0;
61188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61190         return ret_ref;
61191 }
61192
61193 int8_tArray  CS_LDK_InvoiceRequest_signing_pubkey(int64_t this_arg) {
61194         LDKInvoiceRequest this_arg_conv;
61195         this_arg_conv.inner = untag_ptr(this_arg);
61196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61198         this_arg_conv.is_owned = false;
61199         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61200         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61201         return ret_arr;
61202 }
61203
61204 int8_tArray  CS_LDK_InvoiceRequest_payer_metadata(int64_t this_arg) {
61205         LDKInvoiceRequest this_arg_conv;
61206         this_arg_conv.inner = untag_ptr(this_arg);
61207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61209         this_arg_conv.is_owned = false;
61210         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
61211         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61212         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61213         return ret_arr;
61214 }
61215
61216 int8_tArray  CS_LDK_InvoiceRequest_chain(int64_t this_arg) {
61217         LDKInvoiceRequest this_arg_conv;
61218         this_arg_conv.inner = untag_ptr(this_arg);
61219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61221         this_arg_conv.is_owned = false;
61222         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61223         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
61224         return ret_arr;
61225 }
61226
61227 int64_t  CS_LDK_InvoiceRequest_amount_msats(int64_t this_arg) {
61228         LDKInvoiceRequest this_arg_conv;
61229         this_arg_conv.inner = untag_ptr(this_arg);
61230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61232         this_arg_conv.is_owned = false;
61233         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61234         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
61235         int64_t ret_ref = tag_ptr(ret_copy, true);
61236         return ret_ref;
61237 }
61238
61239 int64_t  CS_LDK_InvoiceRequest_invoice_request_features(int64_t this_arg) {
61240         LDKInvoiceRequest this_arg_conv;
61241         this_arg_conv.inner = untag_ptr(this_arg);
61242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61244         this_arg_conv.is_owned = false;
61245         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
61246         int64_t ret_ref = 0;
61247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61249         return ret_ref;
61250 }
61251
61252 int64_t  CS_LDK_InvoiceRequest_quantity(int64_t this_arg) {
61253         LDKInvoiceRequest this_arg_conv;
61254         this_arg_conv.inner = untag_ptr(this_arg);
61255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61257         this_arg_conv.is_owned = false;
61258         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61259         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
61260         int64_t ret_ref = tag_ptr(ret_copy, true);
61261         return ret_ref;
61262 }
61263
61264 int8_tArray  CS_LDK_InvoiceRequest_payer_id(int64_t this_arg) {
61265         LDKInvoiceRequest this_arg_conv;
61266         this_arg_conv.inner = untag_ptr(this_arg);
61267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61269         this_arg_conv.is_owned = false;
61270         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61271         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61272         return ret_arr;
61273 }
61274
61275 int64_t  CS_LDK_InvoiceRequest_payer_note(int64_t this_arg) {
61276         LDKInvoiceRequest this_arg_conv;
61277         this_arg_conv.inner = untag_ptr(this_arg);
61278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61280         this_arg_conv.is_owned = false;
61281         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
61282         int64_t ret_ref = 0;
61283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61285         return ret_ref;
61286 }
61287
61288 int8_tArray  CS_LDK_InvoiceRequest_signature(int64_t this_arg) {
61289         LDKInvoiceRequest this_arg_conv;
61290         this_arg_conv.inner = untag_ptr(this_arg);
61291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61293         this_arg_conv.is_owned = false;
61294         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
61295         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
61296         return ret_arr;
61297 }
61298
61299 int64_t  CS_LDK_InvoiceRequest_verify(int64_t this_arg, int64_t key) {
61300         LDKInvoiceRequest this_arg_conv;
61301         this_arg_conv.inner = untag_ptr(this_arg);
61302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61304         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
61305         LDKExpandedKey key_conv;
61306         key_conv.inner = untag_ptr(key);
61307         key_conv.is_owned = ptr_is_owned(key);
61308         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
61309         key_conv.is_owned = false;
61310         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
61311         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
61312         return tag_ptr(ret_conv, true);
61313 }
61314
61315 ptrArray  CS_LDK_VerifiedInvoiceRequest_chains(int64_t this_arg) {
61316         LDKVerifiedInvoiceRequest this_arg_conv;
61317         this_arg_conv.inner = untag_ptr(this_arg);
61318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61320         this_arg_conv.is_owned = false;
61321         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
61322         ptrArray ret_arr = NULL;
61323         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
61324         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
61325         for (size_t i = 0; i < ret_var.datalen; i++) {
61326                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
61327                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
61328                 ret_arr_ptr[i] = ret_conv_8_arr;
61329         }
61330         
61331         FREE(ret_var.data);
61332         return ret_arr;
61333 }
61334
61335 int64_t  CS_LDK_VerifiedInvoiceRequest_metadata(int64_t this_arg) {
61336         LDKVerifiedInvoiceRequest this_arg_conv;
61337         this_arg_conv.inner = untag_ptr(this_arg);
61338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61340         this_arg_conv.is_owned = false;
61341         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
61342         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
61343         int64_t ret_ref = tag_ptr(ret_copy, true);
61344         return ret_ref;
61345 }
61346
61347 int64_t  CS_LDK_VerifiedInvoiceRequest_amount(int64_t this_arg) {
61348         LDKVerifiedInvoiceRequest this_arg_conv;
61349         this_arg_conv.inner = untag_ptr(this_arg);
61350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61352         this_arg_conv.is_owned = false;
61353         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
61354         int64_t ret_ref = 0;
61355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61357         return ret_ref;
61358 }
61359
61360 int64_t  CS_LDK_VerifiedInvoiceRequest_description(int64_t this_arg) {
61361         LDKVerifiedInvoiceRequest this_arg_conv;
61362         this_arg_conv.inner = untag_ptr(this_arg);
61363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61365         this_arg_conv.is_owned = false;
61366         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
61367         int64_t ret_ref = 0;
61368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61370         return ret_ref;
61371 }
61372
61373 int64_t  CS_LDK_VerifiedInvoiceRequest_offer_features(int64_t this_arg) {
61374         LDKVerifiedInvoiceRequest this_arg_conv;
61375         this_arg_conv.inner = untag_ptr(this_arg);
61376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61378         this_arg_conv.is_owned = false;
61379         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
61380         int64_t ret_ref = 0;
61381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61383         return ret_ref;
61384 }
61385
61386 int64_t  CS_LDK_VerifiedInvoiceRequest_absolute_expiry(int64_t this_arg) {
61387         LDKVerifiedInvoiceRequest 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61393         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
61394         int64_t ret_ref = tag_ptr(ret_copy, true);
61395         return ret_ref;
61396 }
61397
61398 int64_t  CS_LDK_VerifiedInvoiceRequest_issuer(int64_t this_arg) {
61399         LDKVerifiedInvoiceRequest this_arg_conv;
61400         this_arg_conv.inner = untag_ptr(this_arg);
61401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61403         this_arg_conv.is_owned = false;
61404         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
61405         int64_t ret_ref = 0;
61406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61408         return ret_ref;
61409 }
61410
61411 int64_tArray  CS_LDK_VerifiedInvoiceRequest_paths(int64_t this_arg) {
61412         LDKVerifiedInvoiceRequest this_arg_conv;
61413         this_arg_conv.inner = untag_ptr(this_arg);
61414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61416         this_arg_conv.is_owned = false;
61417         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
61418         int64_tArray ret_arr = NULL;
61419         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61420         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61421         for (size_t n = 0; n < ret_var.datalen; n++) {
61422                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61423                 int64_t ret_conv_13_ref = 0;
61424                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61425                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61426                 ret_arr_ptr[n] = ret_conv_13_ref;
61427         }
61428         
61429         FREE(ret_var.data);
61430         return ret_arr;
61431 }
61432
61433 int64_t  CS_LDK_VerifiedInvoiceRequest_supported_quantity(int64_t this_arg) {
61434         LDKVerifiedInvoiceRequest 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         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
61440         int64_t ret_ref = 0;
61441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61443         return ret_ref;
61444 }
61445
61446 int8_tArray  CS_LDK_VerifiedInvoiceRequest_signing_pubkey(int64_t this_arg) {
61447         LDKVerifiedInvoiceRequest this_arg_conv;
61448         this_arg_conv.inner = untag_ptr(this_arg);
61449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61451         this_arg_conv.is_owned = false;
61452         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61453         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
61454         return ret_arr;
61455 }
61456
61457 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_metadata(int64_t this_arg) {
61458         LDKVerifiedInvoiceRequest this_arg_conv;
61459         this_arg_conv.inner = untag_ptr(this_arg);
61460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61462         this_arg_conv.is_owned = false;
61463         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
61464         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61465         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61466         return ret_arr;
61467 }
61468
61469 int8_tArray  CS_LDK_VerifiedInvoiceRequest_chain(int64_t this_arg) {
61470         LDKVerifiedInvoiceRequest this_arg_conv;
61471         this_arg_conv.inner = untag_ptr(this_arg);
61472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61474         this_arg_conv.is_owned = false;
61475         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61476         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
61477         return ret_arr;
61478 }
61479
61480 int64_t  CS_LDK_VerifiedInvoiceRequest_amount_msats(int64_t this_arg) {
61481         LDKVerifiedInvoiceRequest this_arg_conv;
61482         this_arg_conv.inner = untag_ptr(this_arg);
61483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61485         this_arg_conv.is_owned = false;
61486         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61487         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
61488         int64_t ret_ref = tag_ptr(ret_copy, true);
61489         return ret_ref;
61490 }
61491
61492 int64_t  CS_LDK_VerifiedInvoiceRequest_invoice_request_features(int64_t this_arg) {
61493         LDKVerifiedInvoiceRequest this_arg_conv;
61494         this_arg_conv.inner = untag_ptr(this_arg);
61495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61497         this_arg_conv.is_owned = false;
61498         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
61499         int64_t ret_ref = 0;
61500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61502         return ret_ref;
61503 }
61504
61505 int64_t  CS_LDK_VerifiedInvoiceRequest_quantity(int64_t this_arg) {
61506         LDKVerifiedInvoiceRequest this_arg_conv;
61507         this_arg_conv.inner = untag_ptr(this_arg);
61508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61510         this_arg_conv.is_owned = false;
61511         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61512         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
61513         int64_t ret_ref = tag_ptr(ret_copy, true);
61514         return ret_ref;
61515 }
61516
61517 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_id(int64_t this_arg) {
61518         LDKVerifiedInvoiceRequest this_arg_conv;
61519         this_arg_conv.inner = untag_ptr(this_arg);
61520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61522         this_arg_conv.is_owned = false;
61523         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
61524         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
61525         return ret_arr;
61526 }
61527
61528 int64_t  CS_LDK_VerifiedInvoiceRequest_payer_note(int64_t this_arg) {
61529         LDKVerifiedInvoiceRequest 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         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
61535         int64_t ret_ref = 0;
61536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61538         return ret_ref;
61539 }
61540
61541 int8_tArray  CS_LDK_UnsignedInvoiceRequest_write(int64_t obj) {
61542         LDKUnsignedInvoiceRequest obj_conv;
61543         obj_conv.inner = untag_ptr(obj);
61544         obj_conv.is_owned = ptr_is_owned(obj);
61545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61546         obj_conv.is_owned = false;
61547         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
61548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61550         CVec_u8Z_free(ret_var);
61551         return ret_arr;
61552 }
61553
61554 int8_tArray  CS_LDK_InvoiceRequest_write(int64_t obj) {
61555         LDKInvoiceRequest obj_conv;
61556         obj_conv.inner = untag_ptr(obj);
61557         obj_conv.is_owned = ptr_is_owned(obj);
61558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61559         obj_conv.is_owned = false;
61560         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
61561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61563         CVec_u8Z_free(ret_var);
61564         return ret_arr;
61565 }
61566
61567 void  CS_LDK_TaggedHash_free(int64_t this_obj) {
61568         LDKTaggedHash this_obj_conv;
61569         this_obj_conv.inner = untag_ptr(this_obj);
61570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61572         TaggedHash_free(this_obj_conv);
61573 }
61574
61575 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
61576         LDKTaggedHash ret_var = TaggedHash_clone(arg);
61577         int64_t ret_ref = 0;
61578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61580         return ret_ref;
61581 }
61582 int64_t  CS_LDK_TaggedHash_clone_ptr(int64_t arg) {
61583         LDKTaggedHash arg_conv;
61584         arg_conv.inner = untag_ptr(arg);
61585         arg_conv.is_owned = ptr_is_owned(arg);
61586         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61587         arg_conv.is_owned = false;
61588         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
61589         return ret_conv;
61590 }
61591
61592 int64_t  CS_LDK_TaggedHash_clone(int64_t orig) {
61593         LDKTaggedHash orig_conv;
61594         orig_conv.inner = untag_ptr(orig);
61595         orig_conv.is_owned = ptr_is_owned(orig);
61596         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61597         orig_conv.is_owned = false;
61598         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
61599         int64_t ret_ref = 0;
61600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61602         return ret_ref;
61603 }
61604
61605 int8_tArray  CS_LDK_TaggedHash_as_digest(int64_t this_arg) {
61606         LDKTaggedHash 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61612         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
61613         return ret_arr;
61614 }
61615
61616 jstring  CS_LDK_TaggedHash_tag(int64_t this_arg) {
61617         LDKTaggedHash this_arg_conv;
61618         this_arg_conv.inner = untag_ptr(this_arg);
61619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61621         this_arg_conv.is_owned = false;
61622         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
61623         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
61624         Str_free(ret_str);
61625         return ret_conv;
61626 }
61627
61628 int8_tArray  CS_LDK_TaggedHash_merkle_root(int64_t this_arg) {
61629         LDKTaggedHash this_arg_conv;
61630         this_arg_conv.inner = untag_ptr(this_arg);
61631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61633         this_arg_conv.is_owned = false;
61634         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61635         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
61636         return ret_arr;
61637 }
61638
61639 void  CS_LDK_Bolt12ParseError_free(int64_t this_obj) {
61640         LDKBolt12ParseError this_obj_conv;
61641         this_obj_conv.inner = untag_ptr(this_obj);
61642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61644         Bolt12ParseError_free(this_obj_conv);
61645 }
61646
61647 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
61648         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
61649         int64_t ret_ref = 0;
61650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61652         return ret_ref;
61653 }
61654 int64_t  CS_LDK_Bolt12ParseError_clone_ptr(int64_t arg) {
61655         LDKBolt12ParseError arg_conv;
61656         arg_conv.inner = untag_ptr(arg);
61657         arg_conv.is_owned = ptr_is_owned(arg);
61658         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61659         arg_conv.is_owned = false;
61660         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
61661         return ret_conv;
61662 }
61663
61664 int64_t  CS_LDK_Bolt12ParseError_clone(int64_t orig) {
61665         LDKBolt12ParseError orig_conv;
61666         orig_conv.inner = untag_ptr(orig);
61667         orig_conv.is_owned = ptr_is_owned(orig);
61668         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61669         orig_conv.is_owned = false;
61670         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
61671         int64_t ret_ref = 0;
61672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61674         return ret_ref;
61675 }
61676
61677 int32_t  CS_LDK_Bolt12SemanticError_clone(int64_t orig) {
61678         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
61679         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_clone(orig_conv));
61680         return ret_conv;
61681 }
61682
61683 int32_t  CS_LDK_Bolt12SemanticError_already_expired() {
61684         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_already_expired());
61685         return ret_conv;
61686 }
61687
61688 int32_t  CS_LDK_Bolt12SemanticError_unsupported_chain() {
61689         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_chain());
61690         return ret_conv;
61691 }
61692
61693 int32_t  CS_LDK_Bolt12SemanticError_unexpected_chain() {
61694         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_chain());
61695         return ret_conv;
61696 }
61697
61698 int32_t  CS_LDK_Bolt12SemanticError_missing_amount() {
61699         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_amount());
61700         return ret_conv;
61701 }
61702
61703 int32_t  CS_LDK_Bolt12SemanticError_invalid_amount() {
61704         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_amount());
61705         return ret_conv;
61706 }
61707
61708 int32_t  CS_LDK_Bolt12SemanticError_insufficient_amount() {
61709         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_insufficient_amount());
61710         return ret_conv;
61711 }
61712
61713 int32_t  CS_LDK_Bolt12SemanticError_unexpected_amount() {
61714         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_amount());
61715         return ret_conv;
61716 }
61717
61718 int32_t  CS_LDK_Bolt12SemanticError_unsupported_currency() {
61719         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_currency());
61720         return ret_conv;
61721 }
61722
61723 int32_t  CS_LDK_Bolt12SemanticError_unknown_required_features() {
61724         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unknown_required_features());
61725         return ret_conv;
61726 }
61727
61728 int32_t  CS_LDK_Bolt12SemanticError_unexpected_features() {
61729         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_features());
61730         return ret_conv;
61731 }
61732
61733 int32_t  CS_LDK_Bolt12SemanticError_missing_description() {
61734         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_description());
61735         return ret_conv;
61736 }
61737
61738 int32_t  CS_LDK_Bolt12SemanticError_missing_signing_pubkey() {
61739         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signing_pubkey());
61740         return ret_conv;
61741 }
61742
61743 int32_t  CS_LDK_Bolt12SemanticError_invalid_signing_pubkey() {
61744         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_signing_pubkey());
61745         return ret_conv;
61746 }
61747
61748 int32_t  CS_LDK_Bolt12SemanticError_unexpected_signing_pubkey() {
61749         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_signing_pubkey());
61750         return ret_conv;
61751 }
61752
61753 int32_t  CS_LDK_Bolt12SemanticError_missing_quantity() {
61754         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_quantity());
61755         return ret_conv;
61756 }
61757
61758 int32_t  CS_LDK_Bolt12SemanticError_invalid_quantity() {
61759         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_quantity());
61760         return ret_conv;
61761 }
61762
61763 int32_t  CS_LDK_Bolt12SemanticError_unexpected_quantity() {
61764         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_quantity());
61765         return ret_conv;
61766 }
61767
61768 int32_t  CS_LDK_Bolt12SemanticError_invalid_metadata() {
61769         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_metadata());
61770         return ret_conv;
61771 }
61772
61773 int32_t  CS_LDK_Bolt12SemanticError_unexpected_metadata() {
61774         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_metadata());
61775         return ret_conv;
61776 }
61777
61778 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_metadata() {
61779         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_metadata());
61780         return ret_conv;
61781 }
61782
61783 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_id() {
61784         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_id());
61785         return ret_conv;
61786 }
61787
61788 int32_t  CS_LDK_Bolt12SemanticError_duplicate_payment_id() {
61789         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_duplicate_payment_id());
61790         return ret_conv;
61791 }
61792
61793 int32_t  CS_LDK_Bolt12SemanticError_missing_paths() {
61794         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_paths());
61795         return ret_conv;
61796 }
61797
61798 int32_t  CS_LDK_Bolt12SemanticError_invalid_pay_info() {
61799         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_pay_info());
61800         return ret_conv;
61801 }
61802
61803 int32_t  CS_LDK_Bolt12SemanticError_missing_creation_time() {
61804         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_creation_time());
61805         return ret_conv;
61806 }
61807
61808 int32_t  CS_LDK_Bolt12SemanticError_missing_payment_hash() {
61809         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payment_hash());
61810         return ret_conv;
61811 }
61812
61813 int32_t  CS_LDK_Bolt12SemanticError_missing_signature() {
61814         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signature());
61815         return ret_conv;
61816 }
61817
61818 void  CS_LDK_Refund_free(int64_t this_obj) {
61819         LDKRefund this_obj_conv;
61820         this_obj_conv.inner = untag_ptr(this_obj);
61821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61823         Refund_free(this_obj_conv);
61824 }
61825
61826 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
61827         LDKRefund ret_var = Refund_clone(arg);
61828         int64_t ret_ref = 0;
61829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61831         return ret_ref;
61832 }
61833 int64_t  CS_LDK_Refund_clone_ptr(int64_t arg) {
61834         LDKRefund arg_conv;
61835         arg_conv.inner = untag_ptr(arg);
61836         arg_conv.is_owned = ptr_is_owned(arg);
61837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61838         arg_conv.is_owned = false;
61839         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
61840         return ret_conv;
61841 }
61842
61843 int64_t  CS_LDK_Refund_clone(int64_t orig) {
61844         LDKRefund orig_conv;
61845         orig_conv.inner = untag_ptr(orig);
61846         orig_conv.is_owned = ptr_is_owned(orig);
61847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61848         orig_conv.is_owned = false;
61849         LDKRefund ret_var = Refund_clone(&orig_conv);
61850         int64_t ret_ref = 0;
61851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61853         return ret_ref;
61854 }
61855
61856 int64_t  CS_LDK_Refund_description(int64_t this_arg) {
61857         LDKRefund this_arg_conv;
61858         this_arg_conv.inner = untag_ptr(this_arg);
61859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61861         this_arg_conv.is_owned = false;
61862         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
61863         int64_t ret_ref = 0;
61864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61866         return ret_ref;
61867 }
61868
61869 int64_t  CS_LDK_Refund_absolute_expiry(int64_t this_arg) {
61870         LDKRefund this_arg_conv;
61871         this_arg_conv.inner = untag_ptr(this_arg);
61872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61874         this_arg_conv.is_owned = false;
61875         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61876         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
61877         int64_t ret_ref = tag_ptr(ret_copy, true);
61878         return ret_ref;
61879 }
61880
61881 jboolean  CS_LDK_Refund_is_expired(int64_t this_arg) {
61882         LDKRefund this_arg_conv;
61883         this_arg_conv.inner = untag_ptr(this_arg);
61884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61886         this_arg_conv.is_owned = false;
61887         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
61888         return ret_conv;
61889 }
61890
61891 jboolean  CS_LDK_Refund_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
61892         LDKRefund this_arg_conv;
61893         this_arg_conv.inner = untag_ptr(this_arg);
61894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61896         this_arg_conv.is_owned = false;
61897         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
61898         return ret_conv;
61899 }
61900
61901 int64_t  CS_LDK_Refund_issuer(int64_t this_arg) {
61902         LDKRefund this_arg_conv;
61903         this_arg_conv.inner = untag_ptr(this_arg);
61904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61906         this_arg_conv.is_owned = false;
61907         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
61908         int64_t ret_ref = 0;
61909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61911         return ret_ref;
61912 }
61913
61914 int64_tArray  CS_LDK_Refund_paths(int64_t this_arg) {
61915         LDKRefund this_arg_conv;
61916         this_arg_conv.inner = untag_ptr(this_arg);
61917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61919         this_arg_conv.is_owned = false;
61920         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
61921         int64_tArray ret_arr = NULL;
61922         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
61923         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
61924         for (size_t n = 0; n < ret_var.datalen; n++) {
61925                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
61926                 int64_t ret_conv_13_ref = 0;
61927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
61928                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
61929                 ret_arr_ptr[n] = ret_conv_13_ref;
61930         }
61931         
61932         FREE(ret_var.data);
61933         return ret_arr;
61934 }
61935
61936 int8_tArray  CS_LDK_Refund_payer_metadata(int64_t this_arg) {
61937         LDKRefund this_arg_conv;
61938         this_arg_conv.inner = untag_ptr(this_arg);
61939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61941         this_arg_conv.is_owned = false;
61942         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
61943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
61944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
61945         return ret_arr;
61946 }
61947
61948 int8_tArray  CS_LDK_Refund_chain(int64_t this_arg) {
61949         LDKRefund this_arg_conv;
61950         this_arg_conv.inner = untag_ptr(this_arg);
61951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61953         this_arg_conv.is_owned = false;
61954         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
61955         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
61956         return ret_arr;
61957 }
61958
61959 int64_t  CS_LDK_Refund_amount_msats(int64_t this_arg) {
61960         LDKRefund this_arg_conv;
61961         this_arg_conv.inner = untag_ptr(this_arg);
61962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61964         this_arg_conv.is_owned = false;
61965         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
61966         return ret_conv;
61967 }
61968
61969 int64_t  CS_LDK_Refund_features(int64_t this_arg) {
61970         LDKRefund this_arg_conv;
61971         this_arg_conv.inner = untag_ptr(this_arg);
61972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61974         this_arg_conv.is_owned = false;
61975         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
61976         int64_t ret_ref = 0;
61977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61979         return ret_ref;
61980 }
61981
61982 int64_t  CS_LDK_Refund_quantity(int64_t this_arg) {
61983         LDKRefund this_arg_conv;
61984         this_arg_conv.inner = untag_ptr(this_arg);
61985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61987         this_arg_conv.is_owned = false;
61988         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61989         *ret_copy = Refund_quantity(&this_arg_conv);
61990         int64_t ret_ref = tag_ptr(ret_copy, true);
61991         return ret_ref;
61992 }
61993
61994 int8_tArray  CS_LDK_Refund_payer_id(int64_t this_arg) {
61995         LDKRefund this_arg_conv;
61996         this_arg_conv.inner = untag_ptr(this_arg);
61997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61999         this_arg_conv.is_owned = false;
62000         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62001         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
62002         return ret_arr;
62003 }
62004
62005 int64_t  CS_LDK_Refund_payer_note(int64_t this_arg) {
62006         LDKRefund this_arg_conv;
62007         this_arg_conv.inner = untag_ptr(this_arg);
62008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62010         this_arg_conv.is_owned = false;
62011         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
62012         int64_t ret_ref = 0;
62013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62015         return ret_ref;
62016 }
62017
62018 int8_tArray  CS_LDK_Refund_write(int64_t obj) {
62019         LDKRefund obj_conv;
62020         obj_conv.inner = untag_ptr(obj);
62021         obj_conv.is_owned = ptr_is_owned(obj);
62022         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62023         obj_conv.is_owned = false;
62024         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
62025         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62026         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62027         CVec_u8Z_free(ret_var);
62028         return ret_arr;
62029 }
62030
62031 int64_t  CS_LDK_Refund_from_str(jstring s) {
62032         LDKStr s_conv = str_ref_to_owned_c(s);
62033         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
62034         *ret_conv = Refund_from_str(s_conv);
62035         return tag_ptr(ret_conv, true);
62036 }
62037
62038 int32_t  CS_LDK_UtxoLookupError_clone(int64_t orig) {
62039         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
62040         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_clone(orig_conv));
62041         return ret_conv;
62042 }
62043
62044 int32_t  CS_LDK_UtxoLookupError_unknown_chain() {
62045         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_chain());
62046         return ret_conv;
62047 }
62048
62049 int32_t  CS_LDK_UtxoLookupError_unknown_tx() {
62050         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_tx());
62051         return ret_conv;
62052 }
62053
62054 void  CS_LDK_UtxoResult_free(int64_t this_ptr) {
62055         if (!ptr_is_owned(this_ptr)) return;
62056         void* this_ptr_ptr = untag_ptr(this_ptr);
62057         CHECK_ACCESS(this_ptr_ptr);
62058         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
62059         FREE(untag_ptr(this_ptr));
62060         UtxoResult_free(this_ptr_conv);
62061 }
62062
62063 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
62064         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62065         *ret_copy = UtxoResult_clone(arg);
62066         int64_t ret_ref = tag_ptr(ret_copy, true);
62067         return ret_ref;
62068 }
62069 int64_t  CS_LDK_UtxoResult_clone_ptr(int64_t arg) {
62070         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
62071         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
62072         return ret_conv;
62073 }
62074
62075 int64_t  CS_LDK_UtxoResult_clone(int64_t orig) {
62076         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
62077         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62078         *ret_copy = UtxoResult_clone(orig_conv);
62079         int64_t ret_ref = tag_ptr(ret_copy, true);
62080         return ret_ref;
62081 }
62082
62083 int64_t  CS_LDK_UtxoResult_sync(int64_t a) {
62084         void* a_ptr = untag_ptr(a);
62085         CHECK_ACCESS(a_ptr);
62086         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
62087         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
62088         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62089         *ret_copy = UtxoResult_sync(a_conv);
62090         int64_t ret_ref = tag_ptr(ret_copy, true);
62091         return ret_ref;
62092 }
62093
62094 int64_t  CS_LDK_UtxoResult_async(int64_t a) {
62095         LDKUtxoFuture a_conv;
62096         a_conv.inner = untag_ptr(a);
62097         a_conv.is_owned = ptr_is_owned(a);
62098         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62099         a_conv = UtxoFuture_clone(&a_conv);
62100         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
62101         *ret_copy = UtxoResult_async(a_conv);
62102         int64_t ret_ref = tag_ptr(ret_copy, true);
62103         return ret_ref;
62104 }
62105
62106 void  CS_LDK_UtxoLookup_free(int64_t this_ptr) {
62107         if (!ptr_is_owned(this_ptr)) return;
62108         void* this_ptr_ptr = untag_ptr(this_ptr);
62109         CHECK_ACCESS(this_ptr_ptr);
62110         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
62111         FREE(untag_ptr(this_ptr));
62112         UtxoLookup_free(this_ptr_conv);
62113 }
62114
62115 void  CS_LDK_UtxoFuture_free(int64_t this_obj) {
62116         LDKUtxoFuture this_obj_conv;
62117         this_obj_conv.inner = untag_ptr(this_obj);
62118         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62120         UtxoFuture_free(this_obj_conv);
62121 }
62122
62123 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
62124         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
62125         int64_t ret_ref = 0;
62126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62128         return ret_ref;
62129 }
62130 int64_t  CS_LDK_UtxoFuture_clone_ptr(int64_t arg) {
62131         LDKUtxoFuture arg_conv;
62132         arg_conv.inner = untag_ptr(arg);
62133         arg_conv.is_owned = ptr_is_owned(arg);
62134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62135         arg_conv.is_owned = false;
62136         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
62137         return ret_conv;
62138 }
62139
62140 int64_t  CS_LDK_UtxoFuture_clone(int64_t orig) {
62141         LDKUtxoFuture orig_conv;
62142         orig_conv.inner = untag_ptr(orig);
62143         orig_conv.is_owned = ptr_is_owned(orig);
62144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62145         orig_conv.is_owned = false;
62146         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
62147         int64_t ret_ref = 0;
62148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62150         return ret_ref;
62151 }
62152
62153 int64_t  CS_LDK_UtxoFuture_new() {
62154         LDKUtxoFuture ret_var = UtxoFuture_new();
62155         int64_t ret_ref = 0;
62156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62158         return ret_ref;
62159 }
62160
62161 void  CS_LDK_UtxoFuture_resolve_without_forwarding(int64_t this_arg, int64_t graph, int64_t result) {
62162         LDKUtxoFuture this_arg_conv;
62163         this_arg_conv.inner = untag_ptr(this_arg);
62164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62166         this_arg_conv.is_owned = false;
62167         LDKNetworkGraph graph_conv;
62168         graph_conv.inner = untag_ptr(graph);
62169         graph_conv.is_owned = ptr_is_owned(graph);
62170         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
62171         graph_conv.is_owned = false;
62172         void* result_ptr = untag_ptr(result);
62173         CHECK_ACCESS(result_ptr);
62174         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
62175         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
62176 }
62177
62178 void  CS_LDK_UtxoFuture_resolve(int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
62179         LDKUtxoFuture this_arg_conv;
62180         this_arg_conv.inner = untag_ptr(this_arg);
62181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62183         this_arg_conv.is_owned = false;
62184         LDKNetworkGraph graph_conv;
62185         graph_conv.inner = untag_ptr(graph);
62186         graph_conv.is_owned = ptr_is_owned(graph);
62187         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
62188         graph_conv.is_owned = false;
62189         LDKP2PGossipSync gossip_conv;
62190         gossip_conv.inner = untag_ptr(gossip);
62191         gossip_conv.is_owned = ptr_is_owned(gossip);
62192         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
62193         gossip_conv.is_owned = false;
62194         void* result_ptr = untag_ptr(result);
62195         CHECK_ACCESS(result_ptr);
62196         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
62197         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
62198 }
62199
62200 void  CS_LDK_NodeId_free(int64_t this_obj) {
62201         LDKNodeId this_obj_conv;
62202         this_obj_conv.inner = untag_ptr(this_obj);
62203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62205         NodeId_free(this_obj_conv);
62206 }
62207
62208 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
62209         LDKNodeId ret_var = NodeId_clone(arg);
62210         int64_t ret_ref = 0;
62211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62213         return ret_ref;
62214 }
62215 int64_t  CS_LDK_NodeId_clone_ptr(int64_t arg) {
62216         LDKNodeId arg_conv;
62217         arg_conv.inner = untag_ptr(arg);
62218         arg_conv.is_owned = ptr_is_owned(arg);
62219         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62220         arg_conv.is_owned = false;
62221         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
62222         return ret_conv;
62223 }
62224
62225 int64_t  CS_LDK_NodeId_clone(int64_t orig) {
62226         LDKNodeId orig_conv;
62227         orig_conv.inner = untag_ptr(orig);
62228         orig_conv.is_owned = ptr_is_owned(orig);
62229         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62230         orig_conv.is_owned = false;
62231         LDKNodeId ret_var = NodeId_clone(&orig_conv);
62232         int64_t ret_ref = 0;
62233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62235         return ret_ref;
62236 }
62237
62238 int64_t  CS_LDK_NodeId_from_pubkey(int8_tArray pubkey) {
62239         LDKPublicKey pubkey_ref;
62240         CHECK(pubkey->arr_len == 33);
62241         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
62242         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
62243         int64_t ret_ref = 0;
62244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62246         return ret_ref;
62247 }
62248
62249 int8_tArray  CS_LDK_NodeId_as_slice(int64_t this_arg) {
62250         LDKNodeId this_arg_conv;
62251         this_arg_conv.inner = untag_ptr(this_arg);
62252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62254         this_arg_conv.is_owned = false;
62255         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
62256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62258         return ret_arr;
62259 }
62260
62261 int8_tArray  CS_LDK_NodeId_as_array(int64_t this_arg) {
62262         LDKNodeId 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62268         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
62269         return ret_arr;
62270 }
62271
62272 int64_t  CS_LDK_NodeId_as_pubkey(int64_t this_arg) {
62273         LDKNodeId this_arg_conv;
62274         this_arg_conv.inner = untag_ptr(this_arg);
62275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62277         this_arg_conv.is_owned = false;
62278         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
62279         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
62280         return tag_ptr(ret_conv, true);
62281 }
62282
62283 int64_t  CS_LDK_NodeId_hash(int64_t o) {
62284         LDKNodeId o_conv;
62285         o_conv.inner = untag_ptr(o);
62286         o_conv.is_owned = ptr_is_owned(o);
62287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62288         o_conv.is_owned = false;
62289         int64_t ret_conv = NodeId_hash(&o_conv);
62290         return ret_conv;
62291 }
62292
62293 int8_tArray  CS_LDK_NodeId_write(int64_t obj) {
62294         LDKNodeId obj_conv;
62295         obj_conv.inner = untag_ptr(obj);
62296         obj_conv.is_owned = ptr_is_owned(obj);
62297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62298         obj_conv.is_owned = false;
62299         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
62300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62302         CVec_u8Z_free(ret_var);
62303         return ret_arr;
62304 }
62305
62306 int64_t  CS_LDK_NodeId_read(int8_tArray ser) {
62307         LDKu8slice ser_ref;
62308         ser_ref.datalen = ser->arr_len;
62309         ser_ref.data = ser->elems;
62310         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
62311         *ret_conv = NodeId_read(ser_ref);
62312         FREE(ser);
62313         return tag_ptr(ret_conv, true);
62314 }
62315
62316 void  CS_LDK_NetworkGraph_free(int64_t this_obj) {
62317         LDKNetworkGraph this_obj_conv;
62318         this_obj_conv.inner = untag_ptr(this_obj);
62319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62321         NetworkGraph_free(this_obj_conv);
62322 }
62323
62324 void  CS_LDK_ReadOnlyNetworkGraph_free(int64_t this_obj) {
62325         LDKReadOnlyNetworkGraph this_obj_conv;
62326         this_obj_conv.inner = untag_ptr(this_obj);
62327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62329         ReadOnlyNetworkGraph_free(this_obj_conv);
62330 }
62331
62332 void  CS_LDK_NetworkUpdate_free(int64_t this_ptr) {
62333         if (!ptr_is_owned(this_ptr)) return;
62334         void* this_ptr_ptr = untag_ptr(this_ptr);
62335         CHECK_ACCESS(this_ptr_ptr);
62336         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
62337         FREE(untag_ptr(this_ptr));
62338         NetworkUpdate_free(this_ptr_conv);
62339 }
62340
62341 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
62342         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62343         *ret_copy = NetworkUpdate_clone(arg);
62344         int64_t ret_ref = tag_ptr(ret_copy, true);
62345         return ret_ref;
62346 }
62347 int64_t  CS_LDK_NetworkUpdate_clone_ptr(int64_t arg) {
62348         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
62349         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
62350         return ret_conv;
62351 }
62352
62353 int64_t  CS_LDK_NetworkUpdate_clone(int64_t orig) {
62354         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
62355         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62356         *ret_copy = NetworkUpdate_clone(orig_conv);
62357         int64_t ret_ref = tag_ptr(ret_copy, true);
62358         return ret_ref;
62359 }
62360
62361 int64_t  CS_LDK_NetworkUpdate_channel_update_message(int64_t msg) {
62362         LDKChannelUpdate msg_conv;
62363         msg_conv.inner = untag_ptr(msg);
62364         msg_conv.is_owned = ptr_is_owned(msg);
62365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62366         msg_conv = ChannelUpdate_clone(&msg_conv);
62367         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62368         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
62369         int64_t ret_ref = tag_ptr(ret_copy, true);
62370         return ret_ref;
62371 }
62372
62373 int64_t  CS_LDK_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
62374         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62375         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
62376         int64_t ret_ref = tag_ptr(ret_copy, true);
62377         return ret_ref;
62378 }
62379
62380 int64_t  CS_LDK_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
62381         LDKPublicKey node_id_ref;
62382         CHECK(node_id->arr_len == 33);
62383         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
62384         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
62385         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
62386         int64_t ret_ref = tag_ptr(ret_copy, true);
62387         return ret_ref;
62388 }
62389
62390 jboolean  CS_LDK_NetworkUpdate_eq(int64_t a, int64_t b) {
62391         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
62392         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
62393         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
62394         return ret_conv;
62395 }
62396
62397 int8_tArray  CS_LDK_NetworkUpdate_write(int64_t obj) {
62398         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
62399         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
62400         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62401         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62402         CVec_u8Z_free(ret_var);
62403         return ret_arr;
62404 }
62405
62406 int64_t  CS_LDK_NetworkUpdate_read(int8_tArray ser) {
62407         LDKu8slice ser_ref;
62408         ser_ref.datalen = ser->arr_len;
62409         ser_ref.data = ser->elems;
62410         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
62411         *ret_conv = NetworkUpdate_read(ser_ref);
62412         FREE(ser);
62413         return tag_ptr(ret_conv, true);
62414 }
62415
62416 void  CS_LDK_P2PGossipSync_free(int64_t this_obj) {
62417         LDKP2PGossipSync this_obj_conv;
62418         this_obj_conv.inner = untag_ptr(this_obj);
62419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62421         P2PGossipSync_free(this_obj_conv);
62422 }
62423
62424 int64_t  CS_LDK_P2PGossipSync_new(int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
62425         LDKNetworkGraph network_graph_conv;
62426         network_graph_conv.inner = untag_ptr(network_graph);
62427         network_graph_conv.is_owned = ptr_is_owned(network_graph);
62428         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
62429         network_graph_conv.is_owned = false;
62430         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62431         CHECK_ACCESS(utxo_lookup_ptr);
62432         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62433         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62434         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62435                 // Manually implement clone for Java trait instances
62436                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62437                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62438                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62439                 }
62440         }
62441         void* logger_ptr = untag_ptr(logger);
62442         CHECK_ACCESS(logger_ptr);
62443         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62444         if (logger_conv.free == LDKLogger_JCalls_free) {
62445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62446                 LDKLogger_JCalls_cloned(&logger_conv);
62447         }
62448         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
62449         int64_t ret_ref = 0;
62450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62452         return ret_ref;
62453 }
62454
62455 void  CS_LDK_P2PGossipSync_add_utxo_lookup(int64_t this_arg, int64_t utxo_lookup) {
62456         LDKP2PGossipSync this_arg_conv;
62457         this_arg_conv.inner = untag_ptr(this_arg);
62458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62460         this_arg_conv.is_owned = false;
62461         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
62462         CHECK_ACCESS(utxo_lookup_ptr);
62463         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
62464         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
62465         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
62466                 // Manually implement clone for Java trait instances
62467                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
62468                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62469                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
62470                 }
62471         }
62472         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
62473 }
62474
62475 void  CS_LDK_NetworkGraph_handle_network_update(int64_t this_arg, int64_t network_update) {
62476         LDKNetworkGraph this_arg_conv;
62477         this_arg_conv.inner = untag_ptr(this_arg);
62478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62480         this_arg_conv.is_owned = false;
62481         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
62482         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
62483 }
62484
62485 int8_tArray  CS_LDK_NetworkGraph_get_chain_hash(int64_t this_arg) {
62486         LDKNetworkGraph this_arg_conv;
62487         this_arg_conv.inner = untag_ptr(this_arg);
62488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62490         this_arg_conv.is_owned = false;
62491         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
62492         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
62493         return ret_arr;
62494 }
62495
62496 int64_t  CS_LDK_verify_node_announcement(int64_t msg) {
62497         LDKNodeAnnouncement msg_conv;
62498         msg_conv.inner = untag_ptr(msg);
62499         msg_conv.is_owned = ptr_is_owned(msg);
62500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62501         msg_conv.is_owned = false;
62502         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62503         *ret_conv = verify_node_announcement(&msg_conv);
62504         return tag_ptr(ret_conv, true);
62505 }
62506
62507 int64_t  CS_LDK_verify_channel_announcement(int64_t msg) {
62508         LDKChannelAnnouncement msg_conv;
62509         msg_conv.inner = untag_ptr(msg);
62510         msg_conv.is_owned = ptr_is_owned(msg);
62511         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
62512         msg_conv.is_owned = false;
62513         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
62514         *ret_conv = verify_channel_announcement(&msg_conv);
62515         return tag_ptr(ret_conv, true);
62516 }
62517
62518 int64_t  CS_LDK_P2PGossipSync_as_RoutingMessageHandler(int64_t this_arg) {
62519         LDKP2PGossipSync this_arg_conv;
62520         this_arg_conv.inner = untag_ptr(this_arg);
62521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62523         this_arg_conv.is_owned = false;
62524         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
62525         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
62526         return tag_ptr(ret_ret, true);
62527 }
62528
62529 int64_t  CS_LDK_P2PGossipSync_as_MessageSendEventsProvider(int64_t this_arg) {
62530         LDKP2PGossipSync this_arg_conv;
62531         this_arg_conv.inner = untag_ptr(this_arg);
62532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62534         this_arg_conv.is_owned = false;
62535         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
62536         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
62537         return tag_ptr(ret_ret, true);
62538 }
62539
62540 void  CS_LDK_ChannelUpdateInfo_free(int64_t this_obj) {
62541         LDKChannelUpdateInfo this_obj_conv;
62542         this_obj_conv.inner = untag_ptr(this_obj);
62543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62545         ChannelUpdateInfo_free(this_obj_conv);
62546 }
62547
62548 int32_t  CS_LDK_ChannelUpdateInfo_get_last_update(int64_t this_ptr) {
62549         LDKChannelUpdateInfo this_ptr_conv;
62550         this_ptr_conv.inner = untag_ptr(this_ptr);
62551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62553         this_ptr_conv.is_owned = false;
62554         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
62555         return ret_conv;
62556 }
62557
62558 void  CS_LDK_ChannelUpdateInfo_set_last_update(int64_t this_ptr, int32_t val) {
62559         LDKChannelUpdateInfo this_ptr_conv;
62560         this_ptr_conv.inner = untag_ptr(this_ptr);
62561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62563         this_ptr_conv.is_owned = false;
62564         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
62565 }
62566
62567 jboolean  CS_LDK_ChannelUpdateInfo_get_enabled(int64_t this_ptr) {
62568         LDKChannelUpdateInfo this_ptr_conv;
62569         this_ptr_conv.inner = untag_ptr(this_ptr);
62570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62572         this_ptr_conv.is_owned = false;
62573         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
62574         return ret_conv;
62575 }
62576
62577 void  CS_LDK_ChannelUpdateInfo_set_enabled(int64_t this_ptr, jboolean val) {
62578         LDKChannelUpdateInfo this_ptr_conv;
62579         this_ptr_conv.inner = untag_ptr(this_ptr);
62580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62582         this_ptr_conv.is_owned = false;
62583         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
62584 }
62585
62586 int16_t  CS_LDK_ChannelUpdateInfo_get_cltv_expiry_delta(int64_t this_ptr) {
62587         LDKChannelUpdateInfo this_ptr_conv;
62588         this_ptr_conv.inner = untag_ptr(this_ptr);
62589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62591         this_ptr_conv.is_owned = false;
62592         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
62593         return ret_conv;
62594 }
62595
62596 void  CS_LDK_ChannelUpdateInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
62597         LDKChannelUpdateInfo this_ptr_conv;
62598         this_ptr_conv.inner = untag_ptr(this_ptr);
62599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62601         this_ptr_conv.is_owned = false;
62602         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
62603 }
62604
62605 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_minimum_msat(int64_t this_ptr) {
62606         LDKChannelUpdateInfo this_ptr_conv;
62607         this_ptr_conv.inner = untag_ptr(this_ptr);
62608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62610         this_ptr_conv.is_owned = false;
62611         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
62612         return ret_conv;
62613 }
62614
62615 void  CS_LDK_ChannelUpdateInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
62616         LDKChannelUpdateInfo this_ptr_conv;
62617         this_ptr_conv.inner = untag_ptr(this_ptr);
62618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62620         this_ptr_conv.is_owned = false;
62621         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
62622 }
62623
62624 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_maximum_msat(int64_t this_ptr) {
62625         LDKChannelUpdateInfo this_ptr_conv;
62626         this_ptr_conv.inner = untag_ptr(this_ptr);
62627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62629         this_ptr_conv.is_owned = false;
62630         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
62631         return ret_conv;
62632 }
62633
62634 void  CS_LDK_ChannelUpdateInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
62635         LDKChannelUpdateInfo this_ptr_conv;
62636         this_ptr_conv.inner = untag_ptr(this_ptr);
62637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62639         this_ptr_conv.is_owned = false;
62640         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
62641 }
62642
62643 int64_t  CS_LDK_ChannelUpdateInfo_get_fees(int64_t this_ptr) {
62644         LDKChannelUpdateInfo this_ptr_conv;
62645         this_ptr_conv.inner = untag_ptr(this_ptr);
62646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62648         this_ptr_conv.is_owned = false;
62649         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
62650         int64_t ret_ref = 0;
62651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62653         return ret_ref;
62654 }
62655
62656 void  CS_LDK_ChannelUpdateInfo_set_fees(int64_t this_ptr, int64_t val) {
62657         LDKChannelUpdateInfo this_ptr_conv;
62658         this_ptr_conv.inner = untag_ptr(this_ptr);
62659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62661         this_ptr_conv.is_owned = false;
62662         LDKRoutingFees val_conv;
62663         val_conv.inner = untag_ptr(val);
62664         val_conv.is_owned = ptr_is_owned(val);
62665         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62666         val_conv = RoutingFees_clone(&val_conv);
62667         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
62668 }
62669
62670 int64_t  CS_LDK_ChannelUpdateInfo_get_last_update_message(int64_t this_ptr) {
62671         LDKChannelUpdateInfo this_ptr_conv;
62672         this_ptr_conv.inner = untag_ptr(this_ptr);
62673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62675         this_ptr_conv.is_owned = false;
62676         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
62677         int64_t ret_ref = 0;
62678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62680         return ret_ref;
62681 }
62682
62683 void  CS_LDK_ChannelUpdateInfo_set_last_update_message(int64_t this_ptr, int64_t val) {
62684         LDKChannelUpdateInfo this_ptr_conv;
62685         this_ptr_conv.inner = untag_ptr(this_ptr);
62686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62688         this_ptr_conv.is_owned = false;
62689         LDKChannelUpdate val_conv;
62690         val_conv.inner = untag_ptr(val);
62691         val_conv.is_owned = ptr_is_owned(val);
62692         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62693         val_conv = ChannelUpdate_clone(&val_conv);
62694         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
62695 }
62696
62697 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) {
62698         LDKRoutingFees fees_arg_conv;
62699         fees_arg_conv.inner = untag_ptr(fees_arg);
62700         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
62701         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
62702         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
62703         LDKChannelUpdate last_update_message_arg_conv;
62704         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
62705         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
62706         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
62707         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
62708         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);
62709         int64_t ret_ref = 0;
62710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62712         return ret_ref;
62713 }
62714
62715 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
62716         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
62717         int64_t ret_ref = 0;
62718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62720         return ret_ref;
62721 }
62722 int64_t  CS_LDK_ChannelUpdateInfo_clone_ptr(int64_t arg) {
62723         LDKChannelUpdateInfo arg_conv;
62724         arg_conv.inner = untag_ptr(arg);
62725         arg_conv.is_owned = ptr_is_owned(arg);
62726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62727         arg_conv.is_owned = false;
62728         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
62729         return ret_conv;
62730 }
62731
62732 int64_t  CS_LDK_ChannelUpdateInfo_clone(int64_t orig) {
62733         LDKChannelUpdateInfo orig_conv;
62734         orig_conv.inner = untag_ptr(orig);
62735         orig_conv.is_owned = ptr_is_owned(orig);
62736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62737         orig_conv.is_owned = false;
62738         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
62739         int64_t ret_ref = 0;
62740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62742         return ret_ref;
62743 }
62744
62745 jboolean  CS_LDK_ChannelUpdateInfo_eq(int64_t a, int64_t b) {
62746         LDKChannelUpdateInfo a_conv;
62747         a_conv.inner = untag_ptr(a);
62748         a_conv.is_owned = ptr_is_owned(a);
62749         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62750         a_conv.is_owned = false;
62751         LDKChannelUpdateInfo b_conv;
62752         b_conv.inner = untag_ptr(b);
62753         b_conv.is_owned = ptr_is_owned(b);
62754         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62755         b_conv.is_owned = false;
62756         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
62757         return ret_conv;
62758 }
62759
62760 int8_tArray  CS_LDK_ChannelUpdateInfo_write(int64_t obj) {
62761         LDKChannelUpdateInfo obj_conv;
62762         obj_conv.inner = untag_ptr(obj);
62763         obj_conv.is_owned = ptr_is_owned(obj);
62764         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62765         obj_conv.is_owned = false;
62766         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
62767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62769         CVec_u8Z_free(ret_var);
62770         return ret_arr;
62771 }
62772
62773 int64_t  CS_LDK_ChannelUpdateInfo_read(int8_tArray ser) {
62774         LDKu8slice ser_ref;
62775         ser_ref.datalen = ser->arr_len;
62776         ser_ref.data = ser->elems;
62777         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
62778         *ret_conv = ChannelUpdateInfo_read(ser_ref);
62779         FREE(ser);
62780         return tag_ptr(ret_conv, true);
62781 }
62782
62783 void  CS_LDK_ChannelInfo_free(int64_t this_obj) {
62784         LDKChannelInfo this_obj_conv;
62785         this_obj_conv.inner = untag_ptr(this_obj);
62786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62788         ChannelInfo_free(this_obj_conv);
62789 }
62790
62791 int64_t  CS_LDK_ChannelInfo_get_features(int64_t this_ptr) {
62792         LDKChannelInfo this_ptr_conv;
62793         this_ptr_conv.inner = untag_ptr(this_ptr);
62794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62796         this_ptr_conv.is_owned = false;
62797         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
62798         int64_t ret_ref = 0;
62799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62801         return ret_ref;
62802 }
62803
62804 void  CS_LDK_ChannelInfo_set_features(int64_t this_ptr, int64_t val) {
62805         LDKChannelInfo this_ptr_conv;
62806         this_ptr_conv.inner = untag_ptr(this_ptr);
62807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62809         this_ptr_conv.is_owned = false;
62810         LDKChannelFeatures val_conv;
62811         val_conv.inner = untag_ptr(val);
62812         val_conv.is_owned = ptr_is_owned(val);
62813         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62814         val_conv = ChannelFeatures_clone(&val_conv);
62815         ChannelInfo_set_features(&this_ptr_conv, val_conv);
62816 }
62817
62818 int64_t  CS_LDK_ChannelInfo_get_node_one(int64_t this_ptr) {
62819         LDKChannelInfo this_ptr_conv;
62820         this_ptr_conv.inner = untag_ptr(this_ptr);
62821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62823         this_ptr_conv.is_owned = false;
62824         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
62825         int64_t ret_ref = 0;
62826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62828         return ret_ref;
62829 }
62830
62831 void  CS_LDK_ChannelInfo_set_node_one(int64_t this_ptr, int64_t val) {
62832         LDKChannelInfo this_ptr_conv;
62833         this_ptr_conv.inner = untag_ptr(this_ptr);
62834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62836         this_ptr_conv.is_owned = false;
62837         LDKNodeId val_conv;
62838         val_conv.inner = untag_ptr(val);
62839         val_conv.is_owned = ptr_is_owned(val);
62840         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62841         val_conv = NodeId_clone(&val_conv);
62842         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
62843 }
62844
62845 int64_t  CS_LDK_ChannelInfo_get_one_to_two(int64_t this_ptr) {
62846         LDKChannelInfo this_ptr_conv;
62847         this_ptr_conv.inner = untag_ptr(this_ptr);
62848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62850         this_ptr_conv.is_owned = false;
62851         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
62852         int64_t ret_ref = 0;
62853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62855         return ret_ref;
62856 }
62857
62858 void  CS_LDK_ChannelInfo_set_one_to_two(int64_t this_ptr, int64_t val) {
62859         LDKChannelInfo this_ptr_conv;
62860         this_ptr_conv.inner = untag_ptr(this_ptr);
62861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62863         this_ptr_conv.is_owned = false;
62864         LDKChannelUpdateInfo val_conv;
62865         val_conv.inner = untag_ptr(val);
62866         val_conv.is_owned = ptr_is_owned(val);
62867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62868         val_conv = ChannelUpdateInfo_clone(&val_conv);
62869         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
62870 }
62871
62872 int64_t  CS_LDK_ChannelInfo_get_node_two(int64_t this_ptr) {
62873         LDKChannelInfo this_ptr_conv;
62874         this_ptr_conv.inner = untag_ptr(this_ptr);
62875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62877         this_ptr_conv.is_owned = false;
62878         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
62879         int64_t ret_ref = 0;
62880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62882         return ret_ref;
62883 }
62884
62885 void  CS_LDK_ChannelInfo_set_node_two(int64_t this_ptr, int64_t val) {
62886         LDKChannelInfo this_ptr_conv;
62887         this_ptr_conv.inner = untag_ptr(this_ptr);
62888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62890         this_ptr_conv.is_owned = false;
62891         LDKNodeId val_conv;
62892         val_conv.inner = untag_ptr(val);
62893         val_conv.is_owned = ptr_is_owned(val);
62894         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62895         val_conv = NodeId_clone(&val_conv);
62896         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
62897 }
62898
62899 int64_t  CS_LDK_ChannelInfo_get_two_to_one(int64_t this_ptr) {
62900         LDKChannelInfo this_ptr_conv;
62901         this_ptr_conv.inner = untag_ptr(this_ptr);
62902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62904         this_ptr_conv.is_owned = false;
62905         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
62906         int64_t ret_ref = 0;
62907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62909         return ret_ref;
62910 }
62911
62912 void  CS_LDK_ChannelInfo_set_two_to_one(int64_t this_ptr, int64_t val) {
62913         LDKChannelInfo this_ptr_conv;
62914         this_ptr_conv.inner = untag_ptr(this_ptr);
62915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62917         this_ptr_conv.is_owned = false;
62918         LDKChannelUpdateInfo val_conv;
62919         val_conv.inner = untag_ptr(val);
62920         val_conv.is_owned = ptr_is_owned(val);
62921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62922         val_conv = ChannelUpdateInfo_clone(&val_conv);
62923         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
62924 }
62925
62926 int64_t  CS_LDK_ChannelInfo_get_capacity_sats(int64_t this_ptr) {
62927         LDKChannelInfo this_ptr_conv;
62928         this_ptr_conv.inner = untag_ptr(this_ptr);
62929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62931         this_ptr_conv.is_owned = false;
62932         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
62933         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
62934         int64_t ret_ref = tag_ptr(ret_copy, true);
62935         return ret_ref;
62936 }
62937
62938 void  CS_LDK_ChannelInfo_set_capacity_sats(int64_t this_ptr, int64_t val) {
62939         LDKChannelInfo this_ptr_conv;
62940         this_ptr_conv.inner = untag_ptr(this_ptr);
62941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62943         this_ptr_conv.is_owned = false;
62944         void* val_ptr = untag_ptr(val);
62945         CHECK_ACCESS(val_ptr);
62946         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
62947         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
62948         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
62949 }
62950
62951 int64_t  CS_LDK_ChannelInfo_get_announcement_message(int64_t this_ptr) {
62952         LDKChannelInfo this_ptr_conv;
62953         this_ptr_conv.inner = untag_ptr(this_ptr);
62954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62956         this_ptr_conv.is_owned = false;
62957         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
62958         int64_t ret_ref = 0;
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62961         return ret_ref;
62962 }
62963
62964 void  CS_LDK_ChannelInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
62965         LDKChannelInfo this_ptr_conv;
62966         this_ptr_conv.inner = untag_ptr(this_ptr);
62967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62969         this_ptr_conv.is_owned = false;
62970         LDKChannelAnnouncement val_conv;
62971         val_conv.inner = untag_ptr(val);
62972         val_conv.is_owned = ptr_is_owned(val);
62973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62974         val_conv = ChannelAnnouncement_clone(&val_conv);
62975         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
62976 }
62977
62978 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
62979         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
62980         int64_t ret_ref = 0;
62981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62983         return ret_ref;
62984 }
62985 int64_t  CS_LDK_ChannelInfo_clone_ptr(int64_t arg) {
62986         LDKChannelInfo arg_conv;
62987         arg_conv.inner = untag_ptr(arg);
62988         arg_conv.is_owned = ptr_is_owned(arg);
62989         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62990         arg_conv.is_owned = false;
62991         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
62992         return ret_conv;
62993 }
62994
62995 int64_t  CS_LDK_ChannelInfo_clone(int64_t orig) {
62996         LDKChannelInfo orig_conv;
62997         orig_conv.inner = untag_ptr(orig);
62998         orig_conv.is_owned = ptr_is_owned(orig);
62999         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63000         orig_conv.is_owned = false;
63001         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
63002         int64_t ret_ref = 0;
63003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63005         return ret_ref;
63006 }
63007
63008 jboolean  CS_LDK_ChannelInfo_eq(int64_t a, int64_t b) {
63009         LDKChannelInfo a_conv;
63010         a_conv.inner = untag_ptr(a);
63011         a_conv.is_owned = ptr_is_owned(a);
63012         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63013         a_conv.is_owned = false;
63014         LDKChannelInfo b_conv;
63015         b_conv.inner = untag_ptr(b);
63016         b_conv.is_owned = ptr_is_owned(b);
63017         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63018         b_conv.is_owned = false;
63019         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
63020         return ret_conv;
63021 }
63022
63023 int64_t  CS_LDK_ChannelInfo_get_directional_info(int64_t this_arg, int8_t channel_flags) {
63024         LDKChannelInfo this_arg_conv;
63025         this_arg_conv.inner = untag_ptr(this_arg);
63026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63028         this_arg_conv.is_owned = false;
63029         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
63030         int64_t ret_ref = 0;
63031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63033         return ret_ref;
63034 }
63035
63036 int8_tArray  CS_LDK_ChannelInfo_write(int64_t obj) {
63037         LDKChannelInfo obj_conv;
63038         obj_conv.inner = untag_ptr(obj);
63039         obj_conv.is_owned = ptr_is_owned(obj);
63040         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63041         obj_conv.is_owned = false;
63042         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
63043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63045         CVec_u8Z_free(ret_var);
63046         return ret_arr;
63047 }
63048
63049 int64_t  CS_LDK_ChannelInfo_read(int8_tArray ser) {
63050         LDKu8slice ser_ref;
63051         ser_ref.datalen = ser->arr_len;
63052         ser_ref.data = ser->elems;
63053         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
63054         *ret_conv = ChannelInfo_read(ser_ref);
63055         FREE(ser);
63056         return tag_ptr(ret_conv, true);
63057 }
63058
63059 void  CS_LDK_DirectedChannelInfo_free(int64_t this_obj) {
63060         LDKDirectedChannelInfo this_obj_conv;
63061         this_obj_conv.inner = untag_ptr(this_obj);
63062         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63064         DirectedChannelInfo_free(this_obj_conv);
63065 }
63066
63067 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
63068         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
63069         int64_t ret_ref = 0;
63070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63072         return ret_ref;
63073 }
63074 int64_t  CS_LDK_DirectedChannelInfo_clone_ptr(int64_t arg) {
63075         LDKDirectedChannelInfo arg_conv;
63076         arg_conv.inner = untag_ptr(arg);
63077         arg_conv.is_owned = ptr_is_owned(arg);
63078         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63079         arg_conv.is_owned = false;
63080         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
63081         return ret_conv;
63082 }
63083
63084 int64_t  CS_LDK_DirectedChannelInfo_clone(int64_t orig) {
63085         LDKDirectedChannelInfo orig_conv;
63086         orig_conv.inner = untag_ptr(orig);
63087         orig_conv.is_owned = ptr_is_owned(orig);
63088         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63089         orig_conv.is_owned = false;
63090         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
63091         int64_t ret_ref = 0;
63092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63094         return ret_ref;
63095 }
63096
63097 int64_t  CS_LDK_DirectedChannelInfo_channel(int64_t this_arg) {
63098         LDKDirectedChannelInfo this_arg_conv;
63099         this_arg_conv.inner = untag_ptr(this_arg);
63100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63102         this_arg_conv.is_owned = false;
63103         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
63104         int64_t ret_ref = 0;
63105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63107         return ret_ref;
63108 }
63109
63110 int64_t  CS_LDK_DirectedChannelInfo_effective_capacity(int64_t this_arg) {
63111         LDKDirectedChannelInfo this_arg_conv;
63112         this_arg_conv.inner = untag_ptr(this_arg);
63113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63115         this_arg_conv.is_owned = false;
63116         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63117         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
63118         int64_t ret_ref = tag_ptr(ret_copy, true);
63119         return ret_ref;
63120 }
63121
63122 void  CS_LDK_EffectiveCapacity_free(int64_t this_ptr) {
63123         if (!ptr_is_owned(this_ptr)) return;
63124         void* this_ptr_ptr = untag_ptr(this_ptr);
63125         CHECK_ACCESS(this_ptr_ptr);
63126         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
63127         FREE(untag_ptr(this_ptr));
63128         EffectiveCapacity_free(this_ptr_conv);
63129 }
63130
63131 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
63132         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63133         *ret_copy = EffectiveCapacity_clone(arg);
63134         int64_t ret_ref = tag_ptr(ret_copy, true);
63135         return ret_ref;
63136 }
63137 int64_t  CS_LDK_EffectiveCapacity_clone_ptr(int64_t arg) {
63138         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
63139         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
63140         return ret_conv;
63141 }
63142
63143 int64_t  CS_LDK_EffectiveCapacity_clone(int64_t orig) {
63144         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
63145         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63146         *ret_copy = EffectiveCapacity_clone(orig_conv);
63147         int64_t ret_ref = tag_ptr(ret_copy, true);
63148         return ret_ref;
63149 }
63150
63151 int64_t  CS_LDK_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
63152         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63153         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
63154         int64_t ret_ref = tag_ptr(ret_copy, true);
63155         return ret_ref;
63156 }
63157
63158 int64_t  CS_LDK_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
63159         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63160         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
63161         int64_t ret_ref = tag_ptr(ret_copy, true);
63162         return ret_ref;
63163 }
63164
63165 int64_t  CS_LDK_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
63166         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63167         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
63168         int64_t ret_ref = tag_ptr(ret_copy, true);
63169         return ret_ref;
63170 }
63171
63172 int64_t  CS_LDK_EffectiveCapacity_infinite() {
63173         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63174         *ret_copy = EffectiveCapacity_infinite();
63175         int64_t ret_ref = tag_ptr(ret_copy, true);
63176         return ret_ref;
63177 }
63178
63179 int64_t  CS_LDK_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
63180         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63181         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
63182         int64_t ret_ref = tag_ptr(ret_copy, true);
63183         return ret_ref;
63184 }
63185
63186 int64_t  CS_LDK_EffectiveCapacity_unknown() {
63187         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
63188         *ret_copy = EffectiveCapacity_unknown();
63189         int64_t ret_ref = tag_ptr(ret_copy, true);
63190         return ret_ref;
63191 }
63192
63193 int64_t  CS_LDK_EffectiveCapacity_as_msat(int64_t this_arg) {
63194         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
63195         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
63196         return ret_conv;
63197 }
63198
63199 void  CS_LDK_RoutingFees_free(int64_t this_obj) {
63200         LDKRoutingFees this_obj_conv;
63201         this_obj_conv.inner = untag_ptr(this_obj);
63202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63204         RoutingFees_free(this_obj_conv);
63205 }
63206
63207 int32_t  CS_LDK_RoutingFees_get_base_msat(int64_t this_ptr) {
63208         LDKRoutingFees this_ptr_conv;
63209         this_ptr_conv.inner = untag_ptr(this_ptr);
63210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63212         this_ptr_conv.is_owned = false;
63213         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
63214         return ret_conv;
63215 }
63216
63217 void  CS_LDK_RoutingFees_set_base_msat(int64_t this_ptr, int32_t val) {
63218         LDKRoutingFees this_ptr_conv;
63219         this_ptr_conv.inner = untag_ptr(this_ptr);
63220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63222         this_ptr_conv.is_owned = false;
63223         RoutingFees_set_base_msat(&this_ptr_conv, val);
63224 }
63225
63226 int32_t  CS_LDK_RoutingFees_get_proportional_millionths(int64_t this_ptr) {
63227         LDKRoutingFees this_ptr_conv;
63228         this_ptr_conv.inner = untag_ptr(this_ptr);
63229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63231         this_ptr_conv.is_owned = false;
63232         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
63233         return ret_conv;
63234 }
63235
63236 void  CS_LDK_RoutingFees_set_proportional_millionths(int64_t this_ptr, int32_t val) {
63237         LDKRoutingFees this_ptr_conv;
63238         this_ptr_conv.inner = untag_ptr(this_ptr);
63239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63241         this_ptr_conv.is_owned = false;
63242         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
63243 }
63244
63245 int64_t  CS_LDK_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
63246         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
63247         int64_t ret_ref = 0;
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63250         return ret_ref;
63251 }
63252
63253 jboolean  CS_LDK_RoutingFees_eq(int64_t a, int64_t b) {
63254         LDKRoutingFees a_conv;
63255         a_conv.inner = untag_ptr(a);
63256         a_conv.is_owned = ptr_is_owned(a);
63257         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63258         a_conv.is_owned = false;
63259         LDKRoutingFees b_conv;
63260         b_conv.inner = untag_ptr(b);
63261         b_conv.is_owned = ptr_is_owned(b);
63262         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63263         b_conv.is_owned = false;
63264         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
63265         return ret_conv;
63266 }
63267
63268 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
63269         LDKRoutingFees ret_var = RoutingFees_clone(arg);
63270         int64_t ret_ref = 0;
63271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63273         return ret_ref;
63274 }
63275 int64_t  CS_LDK_RoutingFees_clone_ptr(int64_t arg) {
63276         LDKRoutingFees arg_conv;
63277         arg_conv.inner = untag_ptr(arg);
63278         arg_conv.is_owned = ptr_is_owned(arg);
63279         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63280         arg_conv.is_owned = false;
63281         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
63282         return ret_conv;
63283 }
63284
63285 int64_t  CS_LDK_RoutingFees_clone(int64_t orig) {
63286         LDKRoutingFees orig_conv;
63287         orig_conv.inner = untag_ptr(orig);
63288         orig_conv.is_owned = ptr_is_owned(orig);
63289         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63290         orig_conv.is_owned = false;
63291         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
63292         int64_t ret_ref = 0;
63293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63295         return ret_ref;
63296 }
63297
63298 int64_t  CS_LDK_RoutingFees_hash(int64_t o) {
63299         LDKRoutingFees o_conv;
63300         o_conv.inner = untag_ptr(o);
63301         o_conv.is_owned = ptr_is_owned(o);
63302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63303         o_conv.is_owned = false;
63304         int64_t ret_conv = RoutingFees_hash(&o_conv);
63305         return ret_conv;
63306 }
63307
63308 int8_tArray  CS_LDK_RoutingFees_write(int64_t obj) {
63309         LDKRoutingFees obj_conv;
63310         obj_conv.inner = untag_ptr(obj);
63311         obj_conv.is_owned = ptr_is_owned(obj);
63312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63313         obj_conv.is_owned = false;
63314         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
63315         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63316         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63317         CVec_u8Z_free(ret_var);
63318         return ret_arr;
63319 }
63320
63321 int64_t  CS_LDK_RoutingFees_read(int8_tArray ser) {
63322         LDKu8slice ser_ref;
63323         ser_ref.datalen = ser->arr_len;
63324         ser_ref.data = ser->elems;
63325         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
63326         *ret_conv = RoutingFees_read(ser_ref);
63327         FREE(ser);
63328         return tag_ptr(ret_conv, true);
63329 }
63330
63331 void  CS_LDK_NodeAnnouncementInfo_free(int64_t this_obj) {
63332         LDKNodeAnnouncementInfo this_obj_conv;
63333         this_obj_conv.inner = untag_ptr(this_obj);
63334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63336         NodeAnnouncementInfo_free(this_obj_conv);
63337 }
63338
63339 int64_t  CS_LDK_NodeAnnouncementInfo_get_features(int64_t this_ptr) {
63340         LDKNodeAnnouncementInfo this_ptr_conv;
63341         this_ptr_conv.inner = untag_ptr(this_ptr);
63342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63344         this_ptr_conv.is_owned = false;
63345         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
63346         int64_t ret_ref = 0;
63347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63349         return ret_ref;
63350 }
63351
63352 void  CS_LDK_NodeAnnouncementInfo_set_features(int64_t this_ptr, int64_t val) {
63353         LDKNodeAnnouncementInfo this_ptr_conv;
63354         this_ptr_conv.inner = untag_ptr(this_ptr);
63355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63357         this_ptr_conv.is_owned = false;
63358         LDKNodeFeatures val_conv;
63359         val_conv.inner = untag_ptr(val);
63360         val_conv.is_owned = ptr_is_owned(val);
63361         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63362         val_conv = NodeFeatures_clone(&val_conv);
63363         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
63364 }
63365
63366 int32_t  CS_LDK_NodeAnnouncementInfo_get_last_update(int64_t this_ptr) {
63367         LDKNodeAnnouncementInfo this_ptr_conv;
63368         this_ptr_conv.inner = untag_ptr(this_ptr);
63369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63371         this_ptr_conv.is_owned = false;
63372         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
63373         return ret_conv;
63374 }
63375
63376 void  CS_LDK_NodeAnnouncementInfo_set_last_update(int64_t this_ptr, int32_t val) {
63377         LDKNodeAnnouncementInfo this_ptr_conv;
63378         this_ptr_conv.inner = untag_ptr(this_ptr);
63379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63381         this_ptr_conv.is_owned = false;
63382         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
63383 }
63384
63385 int8_tArray  CS_LDK_NodeAnnouncementInfo_get_rgb(int64_t this_ptr) {
63386         LDKNodeAnnouncementInfo this_ptr_conv;
63387         this_ptr_conv.inner = untag_ptr(this_ptr);
63388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63390         this_ptr_conv.is_owned = false;
63391         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
63392         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
63393         return ret_arr;
63394 }
63395
63396 void  CS_LDK_NodeAnnouncementInfo_set_rgb(int64_t this_ptr, int8_tArray val) {
63397         LDKNodeAnnouncementInfo this_ptr_conv;
63398         this_ptr_conv.inner = untag_ptr(this_ptr);
63399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63401         this_ptr_conv.is_owned = false;
63402         LDKThreeBytes val_ref;
63403         CHECK(val->arr_len == 3);
63404         memcpy(val_ref.data, val->elems, 3); FREE(val);
63405         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
63406 }
63407
63408 int64_t  CS_LDK_NodeAnnouncementInfo_get_alias(int64_t this_ptr) {
63409         LDKNodeAnnouncementInfo this_ptr_conv;
63410         this_ptr_conv.inner = untag_ptr(this_ptr);
63411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63413         this_ptr_conv.is_owned = false;
63414         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
63415         int64_t ret_ref = 0;
63416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63418         return ret_ref;
63419 }
63420
63421 void  CS_LDK_NodeAnnouncementInfo_set_alias(int64_t this_ptr, int64_t val) {
63422         LDKNodeAnnouncementInfo this_ptr_conv;
63423         this_ptr_conv.inner = untag_ptr(this_ptr);
63424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63426         this_ptr_conv.is_owned = false;
63427         LDKNodeAlias val_conv;
63428         val_conv.inner = untag_ptr(val);
63429         val_conv.is_owned = ptr_is_owned(val);
63430         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63431         val_conv = NodeAlias_clone(&val_conv);
63432         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
63433 }
63434
63435 int64_t  CS_LDK_NodeAnnouncementInfo_get_announcement_message(int64_t this_ptr) {
63436         LDKNodeAnnouncementInfo this_ptr_conv;
63437         this_ptr_conv.inner = untag_ptr(this_ptr);
63438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63440         this_ptr_conv.is_owned = false;
63441         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
63442         int64_t ret_ref = 0;
63443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63445         return ret_ref;
63446 }
63447
63448 void  CS_LDK_NodeAnnouncementInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
63449         LDKNodeAnnouncementInfo this_ptr_conv;
63450         this_ptr_conv.inner = untag_ptr(this_ptr);
63451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63453         this_ptr_conv.is_owned = false;
63454         LDKNodeAnnouncement val_conv;
63455         val_conv.inner = untag_ptr(val);
63456         val_conv.is_owned = ptr_is_owned(val);
63457         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63458         val_conv = NodeAnnouncement_clone(&val_conv);
63459         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
63460 }
63461
63462 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) {
63463         LDKNodeFeatures features_arg_conv;
63464         features_arg_conv.inner = untag_ptr(features_arg);
63465         features_arg_conv.is_owned = ptr_is_owned(features_arg);
63466         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
63467         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
63468         LDKThreeBytes rgb_arg_ref;
63469         CHECK(rgb_arg->arr_len == 3);
63470         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
63471         LDKNodeAlias alias_arg_conv;
63472         alias_arg_conv.inner = untag_ptr(alias_arg);
63473         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
63474         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
63475         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
63476         LDKNodeAnnouncement announcement_message_arg_conv;
63477         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
63478         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
63479         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
63480         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
63481         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
63482         int64_t ret_ref = 0;
63483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63485         return ret_ref;
63486 }
63487
63488 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
63489         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
63490         int64_t ret_ref = 0;
63491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63493         return ret_ref;
63494 }
63495 int64_t  CS_LDK_NodeAnnouncementInfo_clone_ptr(int64_t arg) {
63496         LDKNodeAnnouncementInfo arg_conv;
63497         arg_conv.inner = untag_ptr(arg);
63498         arg_conv.is_owned = ptr_is_owned(arg);
63499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63500         arg_conv.is_owned = false;
63501         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
63502         return ret_conv;
63503 }
63504
63505 int64_t  CS_LDK_NodeAnnouncementInfo_clone(int64_t orig) {
63506         LDKNodeAnnouncementInfo orig_conv;
63507         orig_conv.inner = untag_ptr(orig);
63508         orig_conv.is_owned = ptr_is_owned(orig);
63509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63510         orig_conv.is_owned = false;
63511         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
63512         int64_t ret_ref = 0;
63513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63515         return ret_ref;
63516 }
63517
63518 jboolean  CS_LDK_NodeAnnouncementInfo_eq(int64_t a, int64_t b) {
63519         LDKNodeAnnouncementInfo a_conv;
63520         a_conv.inner = untag_ptr(a);
63521         a_conv.is_owned = ptr_is_owned(a);
63522         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63523         a_conv.is_owned = false;
63524         LDKNodeAnnouncementInfo b_conv;
63525         b_conv.inner = untag_ptr(b);
63526         b_conv.is_owned = ptr_is_owned(b);
63527         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63528         b_conv.is_owned = false;
63529         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
63530         return ret_conv;
63531 }
63532
63533 int64_tArray  CS_LDK_NodeAnnouncementInfo_addresses(int64_t this_arg) {
63534         LDKNodeAnnouncementInfo this_arg_conv;
63535         this_arg_conv.inner = untag_ptr(this_arg);
63536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63538         this_arg_conv.is_owned = false;
63539         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
63540         int64_tArray ret_arr = NULL;
63541         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63542         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63543         for (size_t p = 0; p < ret_var.datalen; p++) {
63544                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
63545                 *ret_conv_15_copy = ret_var.data[p];
63546                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
63547                 ret_arr_ptr[p] = ret_conv_15_ref;
63548         }
63549         
63550         FREE(ret_var.data);
63551         return ret_arr;
63552 }
63553
63554 int8_tArray  CS_LDK_NodeAnnouncementInfo_write(int64_t obj) {
63555         LDKNodeAnnouncementInfo obj_conv;
63556         obj_conv.inner = untag_ptr(obj);
63557         obj_conv.is_owned = ptr_is_owned(obj);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63559         obj_conv.is_owned = false;
63560         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
63561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63563         CVec_u8Z_free(ret_var);
63564         return ret_arr;
63565 }
63566
63567 int64_t  CS_LDK_NodeAnnouncementInfo_read(int8_tArray ser) {
63568         LDKu8slice ser_ref;
63569         ser_ref.datalen = ser->arr_len;
63570         ser_ref.data = ser->elems;
63571         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
63572         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
63573         FREE(ser);
63574         return tag_ptr(ret_conv, true);
63575 }
63576
63577 void  CS_LDK_NodeAlias_free(int64_t this_obj) {
63578         LDKNodeAlias this_obj_conv;
63579         this_obj_conv.inner = untag_ptr(this_obj);
63580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63582         NodeAlias_free(this_obj_conv);
63583 }
63584
63585 int8_tArray  CS_LDK_NodeAlias_get_a(int64_t this_ptr) {
63586         LDKNodeAlias this_ptr_conv;
63587         this_ptr_conv.inner = untag_ptr(this_ptr);
63588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63590         this_ptr_conv.is_owned = false;
63591         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63592         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
63593         return ret_arr;
63594 }
63595
63596 void  CS_LDK_NodeAlias_set_a(int64_t this_ptr, int8_tArray val) {
63597         LDKNodeAlias this_ptr_conv;
63598         this_ptr_conv.inner = untag_ptr(this_ptr);
63599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63601         this_ptr_conv.is_owned = false;
63602         LDKThirtyTwoBytes val_ref;
63603         CHECK(val->arr_len == 32);
63604         memcpy(val_ref.data, val->elems, 32); FREE(val);
63605         NodeAlias_set_a(&this_ptr_conv, val_ref);
63606 }
63607
63608 int64_t  CS_LDK_NodeAlias_new(int8_tArray a_arg) {
63609         LDKThirtyTwoBytes a_arg_ref;
63610         CHECK(a_arg->arr_len == 32);
63611         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
63612         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
63613         int64_t ret_ref = 0;
63614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63616         return ret_ref;
63617 }
63618
63619 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
63620         LDKNodeAlias ret_var = NodeAlias_clone(arg);
63621         int64_t ret_ref = 0;
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63624         return ret_ref;
63625 }
63626 int64_t  CS_LDK_NodeAlias_clone_ptr(int64_t arg) {
63627         LDKNodeAlias arg_conv;
63628         arg_conv.inner = untag_ptr(arg);
63629         arg_conv.is_owned = ptr_is_owned(arg);
63630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63631         arg_conv.is_owned = false;
63632         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
63633         return ret_conv;
63634 }
63635
63636 int64_t  CS_LDK_NodeAlias_clone(int64_t orig) {
63637         LDKNodeAlias orig_conv;
63638         orig_conv.inner = untag_ptr(orig);
63639         orig_conv.is_owned = ptr_is_owned(orig);
63640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63641         orig_conv.is_owned = false;
63642         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
63643         int64_t ret_ref = 0;
63644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63646         return ret_ref;
63647 }
63648
63649 int64_t  CS_LDK_NodeAlias_hash(int64_t o) {
63650         LDKNodeAlias o_conv;
63651         o_conv.inner = untag_ptr(o);
63652         o_conv.is_owned = ptr_is_owned(o);
63653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63654         o_conv.is_owned = false;
63655         int64_t ret_conv = NodeAlias_hash(&o_conv);
63656         return ret_conv;
63657 }
63658
63659 jboolean  CS_LDK_NodeAlias_eq(int64_t a, int64_t b) {
63660         LDKNodeAlias a_conv;
63661         a_conv.inner = untag_ptr(a);
63662         a_conv.is_owned = ptr_is_owned(a);
63663         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63664         a_conv.is_owned = false;
63665         LDKNodeAlias b_conv;
63666         b_conv.inner = untag_ptr(b);
63667         b_conv.is_owned = ptr_is_owned(b);
63668         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63669         b_conv.is_owned = false;
63670         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
63671         return ret_conv;
63672 }
63673
63674 int8_tArray  CS_LDK_NodeAlias_write(int64_t obj) {
63675         LDKNodeAlias obj_conv;
63676         obj_conv.inner = untag_ptr(obj);
63677         obj_conv.is_owned = ptr_is_owned(obj);
63678         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63679         obj_conv.is_owned = false;
63680         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
63681         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63682         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63683         CVec_u8Z_free(ret_var);
63684         return ret_arr;
63685 }
63686
63687 int64_t  CS_LDK_NodeAlias_read(int8_tArray ser) {
63688         LDKu8slice ser_ref;
63689         ser_ref.datalen = ser->arr_len;
63690         ser_ref.data = ser->elems;
63691         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
63692         *ret_conv = NodeAlias_read(ser_ref);
63693         FREE(ser);
63694         return tag_ptr(ret_conv, true);
63695 }
63696
63697 void  CS_LDK_NodeInfo_free(int64_t this_obj) {
63698         LDKNodeInfo this_obj_conv;
63699         this_obj_conv.inner = untag_ptr(this_obj);
63700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63702         NodeInfo_free(this_obj_conv);
63703 }
63704
63705 int64_tArray  CS_LDK_NodeInfo_get_channels(int64_t this_ptr) {
63706         LDKNodeInfo this_ptr_conv;
63707         this_ptr_conv.inner = untag_ptr(this_ptr);
63708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63710         this_ptr_conv.is_owned = false;
63711         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
63712         int64_tArray ret_arr = NULL;
63713         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
63714         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
63715         for (size_t g = 0; g < ret_var.datalen; g++) {
63716                 int64_t ret_conv_6_conv = ret_var.data[g];
63717                 ret_arr_ptr[g] = ret_conv_6_conv;
63718         }
63719         
63720         FREE(ret_var.data);
63721         return ret_arr;
63722 }
63723
63724 void  CS_LDK_NodeInfo_set_channels(int64_t this_ptr, int64_tArray val) {
63725         LDKNodeInfo this_ptr_conv;
63726         this_ptr_conv.inner = untag_ptr(this_ptr);
63727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63729         this_ptr_conv.is_owned = false;
63730         LDKCVec_u64Z val_constr;
63731         val_constr.datalen = val->arr_len;
63732         if (val_constr.datalen > 0)
63733                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63734         else
63735                 val_constr.data = NULL;
63736         int64_t* val_vals = val->elems;
63737         for (size_t g = 0; g < val_constr.datalen; g++) {
63738                 int64_t val_conv_6 = val_vals[g];
63739                 val_constr.data[g] = val_conv_6;
63740         }
63741         FREE(val);
63742         NodeInfo_set_channels(&this_ptr_conv, val_constr);
63743 }
63744
63745 int64_t  CS_LDK_NodeInfo_get_announcement_info(int64_t this_ptr) {
63746         LDKNodeInfo this_ptr_conv;
63747         this_ptr_conv.inner = untag_ptr(this_ptr);
63748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63750         this_ptr_conv.is_owned = false;
63751         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
63752         int64_t ret_ref = 0;
63753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63755         return ret_ref;
63756 }
63757
63758 void  CS_LDK_NodeInfo_set_announcement_info(int64_t this_ptr, int64_t val) {
63759         LDKNodeInfo this_ptr_conv;
63760         this_ptr_conv.inner = untag_ptr(this_ptr);
63761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63763         this_ptr_conv.is_owned = false;
63764         LDKNodeAnnouncementInfo val_conv;
63765         val_conv.inner = untag_ptr(val);
63766         val_conv.is_owned = ptr_is_owned(val);
63767         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63768         val_conv = NodeAnnouncementInfo_clone(&val_conv);
63769         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
63770 }
63771
63772 int64_t  CS_LDK_NodeInfo_new(int64_tArray channels_arg, int64_t announcement_info_arg) {
63773         LDKCVec_u64Z channels_arg_constr;
63774         channels_arg_constr.datalen = channels_arg->arr_len;
63775         if (channels_arg_constr.datalen > 0)
63776                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
63777         else
63778                 channels_arg_constr.data = NULL;
63779         int64_t* channels_arg_vals = channels_arg->elems;
63780         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
63781                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
63782                 channels_arg_constr.data[g] = channels_arg_conv_6;
63783         }
63784         FREE(channels_arg);
63785         LDKNodeAnnouncementInfo announcement_info_arg_conv;
63786         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
63787         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
63788         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
63789         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
63790         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
63791         int64_t ret_ref = 0;
63792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63794         return ret_ref;
63795 }
63796
63797 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
63798         LDKNodeInfo ret_var = NodeInfo_clone(arg);
63799         int64_t ret_ref = 0;
63800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63802         return ret_ref;
63803 }
63804 int64_t  CS_LDK_NodeInfo_clone_ptr(int64_t arg) {
63805         LDKNodeInfo arg_conv;
63806         arg_conv.inner = untag_ptr(arg);
63807         arg_conv.is_owned = ptr_is_owned(arg);
63808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63809         arg_conv.is_owned = false;
63810         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
63811         return ret_conv;
63812 }
63813
63814 int64_t  CS_LDK_NodeInfo_clone(int64_t orig) {
63815         LDKNodeInfo orig_conv;
63816         orig_conv.inner = untag_ptr(orig);
63817         orig_conv.is_owned = ptr_is_owned(orig);
63818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63819         orig_conv.is_owned = false;
63820         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
63821         int64_t ret_ref = 0;
63822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63824         return ret_ref;
63825 }
63826
63827 jboolean  CS_LDK_NodeInfo_eq(int64_t a, int64_t b) {
63828         LDKNodeInfo a_conv;
63829         a_conv.inner = untag_ptr(a);
63830         a_conv.is_owned = ptr_is_owned(a);
63831         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63832         a_conv.is_owned = false;
63833         LDKNodeInfo b_conv;
63834         b_conv.inner = untag_ptr(b);
63835         b_conv.is_owned = ptr_is_owned(b);
63836         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63837         b_conv.is_owned = false;
63838         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
63839         return ret_conv;
63840 }
63841
63842 int8_tArray  CS_LDK_NodeInfo_write(int64_t obj) {
63843         LDKNodeInfo obj_conv;
63844         obj_conv.inner = untag_ptr(obj);
63845         obj_conv.is_owned = ptr_is_owned(obj);
63846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63847         obj_conv.is_owned = false;
63848         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
63849         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63850         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63851         CVec_u8Z_free(ret_var);
63852         return ret_arr;
63853 }
63854
63855 int64_t  CS_LDK_NodeInfo_read(int8_tArray ser) {
63856         LDKu8slice ser_ref;
63857         ser_ref.datalen = ser->arr_len;
63858         ser_ref.data = ser->elems;
63859         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
63860         *ret_conv = NodeInfo_read(ser_ref);
63861         FREE(ser);
63862         return tag_ptr(ret_conv, true);
63863 }
63864
63865 int8_tArray  CS_LDK_NetworkGraph_write(int64_t obj) {
63866         LDKNetworkGraph obj_conv;
63867         obj_conv.inner = untag_ptr(obj);
63868         obj_conv.is_owned = ptr_is_owned(obj);
63869         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63870         obj_conv.is_owned = false;
63871         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
63872         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
63873         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
63874         CVec_u8Z_free(ret_var);
63875         return ret_arr;
63876 }
63877
63878 int64_t  CS_LDK_NetworkGraph_read(int8_tArray ser, int64_t arg) {
63879         LDKu8slice ser_ref;
63880         ser_ref.datalen = ser->arr_len;
63881         ser_ref.data = ser->elems;
63882         void* arg_ptr = untag_ptr(arg);
63883         CHECK_ACCESS(arg_ptr);
63884         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
63885         if (arg_conv.free == LDKLogger_JCalls_free) {
63886                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63887                 LDKLogger_JCalls_cloned(&arg_conv);
63888         }
63889         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
63890         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
63891         FREE(ser);
63892         return tag_ptr(ret_conv, true);
63893 }
63894
63895 int64_t  CS_LDK_NetworkGraph_new(int32_t network, int64_t logger) {
63896         LDKNetwork network_conv = LDKNetwork_from_cs(network);
63897         void* logger_ptr = untag_ptr(logger);
63898         CHECK_ACCESS(logger_ptr);
63899         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63900         if (logger_conv.free == LDKLogger_JCalls_free) {
63901                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63902                 LDKLogger_JCalls_cloned(&logger_conv);
63903         }
63904         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
63905         int64_t ret_ref = 0;
63906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63908         return ret_ref;
63909 }
63910
63911 int64_t  CS_LDK_NetworkGraph_read_only(int64_t this_arg) {
63912         LDKNetworkGraph this_arg_conv;
63913         this_arg_conv.inner = untag_ptr(this_arg);
63914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63916         this_arg_conv.is_owned = false;
63917         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
63918         int64_t ret_ref = 0;
63919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63921         return ret_ref;
63922 }
63923
63924 int64_t  CS_LDK_NetworkGraph_get_last_rapid_gossip_sync_timestamp(int64_t this_arg) {
63925         LDKNetworkGraph this_arg_conv;
63926         this_arg_conv.inner = untag_ptr(this_arg);
63927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63929         this_arg_conv.is_owned = false;
63930         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63931         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
63932         int64_t ret_ref = tag_ptr(ret_copy, true);
63933         return ret_ref;
63934 }
63935
63936 void  CS_LDK_NetworkGraph_set_last_rapid_gossip_sync_timestamp(int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
63937         LDKNetworkGraph this_arg_conv;
63938         this_arg_conv.inner = untag_ptr(this_arg);
63939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63941         this_arg_conv.is_owned = false;
63942         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
63943 }
63944
63945 int64_t  CS_LDK_NetworkGraph_update_node_from_announcement(int64_t this_arg, int64_t msg) {
63946         LDKNetworkGraph this_arg_conv;
63947         this_arg_conv.inner = untag_ptr(this_arg);
63948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63950         this_arg_conv.is_owned = false;
63951         LDKNodeAnnouncement msg_conv;
63952         msg_conv.inner = untag_ptr(msg);
63953         msg_conv.is_owned = ptr_is_owned(msg);
63954         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63955         msg_conv.is_owned = false;
63956         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63957         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
63958         return tag_ptr(ret_conv, true);
63959 }
63960
63961 int64_t  CS_LDK_NetworkGraph_update_node_from_unsigned_announcement(int64_t this_arg, int64_t msg) {
63962         LDKNetworkGraph this_arg_conv;
63963         this_arg_conv.inner = untag_ptr(this_arg);
63964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63966         this_arg_conv.is_owned = false;
63967         LDKUnsignedNodeAnnouncement msg_conv;
63968         msg_conv.inner = untag_ptr(msg);
63969         msg_conv.is_owned = ptr_is_owned(msg);
63970         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63971         msg_conv.is_owned = false;
63972         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
63973         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
63974         return tag_ptr(ret_conv, true);
63975 }
63976
63977 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
63978         LDKNetworkGraph this_arg_conv;
63979         this_arg_conv.inner = untag_ptr(this_arg);
63980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63982         this_arg_conv.is_owned = false;
63983         LDKChannelAnnouncement msg_conv;
63984         msg_conv.inner = untag_ptr(msg);
63985         msg_conv.is_owned = ptr_is_owned(msg);
63986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
63987         msg_conv.is_owned = false;
63988         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
63989         CHECK_ACCESS(utxo_lookup_ptr);
63990         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
63991         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
63992         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
63993                 // Manually implement clone for Java trait instances
63994                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
63995                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63996                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
63997                 }
63998         }
63999         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64000         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
64001         return tag_ptr(ret_conv, true);
64002 }
64003
64004 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement_no_lookup(int64_t this_arg, int64_t msg) {
64005         LDKNetworkGraph this_arg_conv;
64006         this_arg_conv.inner = untag_ptr(this_arg);
64007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64009         this_arg_conv.is_owned = false;
64010         LDKChannelAnnouncement msg_conv;
64011         msg_conv.inner = untag_ptr(msg);
64012         msg_conv.is_owned = ptr_is_owned(msg);
64013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64014         msg_conv.is_owned = false;
64015         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64016         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
64017         return tag_ptr(ret_conv, true);
64018 }
64019
64020 int64_t  CS_LDK_NetworkGraph_update_channel_from_unsigned_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
64021         LDKNetworkGraph this_arg_conv;
64022         this_arg_conv.inner = untag_ptr(this_arg);
64023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64025         this_arg_conv.is_owned = false;
64026         LDKUnsignedChannelAnnouncement msg_conv;
64027         msg_conv.inner = untag_ptr(msg);
64028         msg_conv.is_owned = ptr_is_owned(msg);
64029         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64030         msg_conv.is_owned = false;
64031         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
64032         CHECK_ACCESS(utxo_lookup_ptr);
64033         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
64034         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
64035         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
64036                 // Manually implement clone for Java trait instances
64037                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
64038                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64039                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
64040                 }
64041         }
64042         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64043         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
64044         return tag_ptr(ret_conv, true);
64045 }
64046
64047 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) {
64048         LDKNetworkGraph this_arg_conv;
64049         this_arg_conv.inner = untag_ptr(this_arg);
64050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64052         this_arg_conv.is_owned = false;
64053         LDKChannelFeatures features_conv;
64054         features_conv.inner = untag_ptr(features);
64055         features_conv.is_owned = ptr_is_owned(features);
64056         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64057         features_conv = ChannelFeatures_clone(&features_conv);
64058         LDKPublicKey node_id_1_ref;
64059         CHECK(node_id_1->arr_len == 33);
64060         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
64061         LDKPublicKey node_id_2_ref;
64062         CHECK(node_id_2->arr_len == 33);
64063         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
64064         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64065         *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);
64066         return tag_ptr(ret_conv, true);
64067 }
64068
64069 void  CS_LDK_NetworkGraph_channel_failed_permanent(int64_t this_arg, int64_t short_channel_id) {
64070         LDKNetworkGraph this_arg_conv;
64071         this_arg_conv.inner = untag_ptr(this_arg);
64072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64074         this_arg_conv.is_owned = false;
64075         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
64076 }
64077
64078 void  CS_LDK_NetworkGraph_node_failed_permanent(int64_t this_arg, int8_tArray node_id) {
64079         LDKNetworkGraph this_arg_conv;
64080         this_arg_conv.inner = untag_ptr(this_arg);
64081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64083         this_arg_conv.is_owned = false;
64084         LDKPublicKey node_id_ref;
64085         CHECK(node_id->arr_len == 33);
64086         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
64087         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
64088 }
64089
64090 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking(int64_t this_arg) {
64091         LDKNetworkGraph this_arg_conv;
64092         this_arg_conv.inner = untag_ptr(this_arg);
64093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64095         this_arg_conv.is_owned = false;
64096         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
64097 }
64098
64099 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking_with_time(int64_t this_arg, int64_t current_time_unix) {
64100         LDKNetworkGraph this_arg_conv;
64101         this_arg_conv.inner = untag_ptr(this_arg);
64102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64104         this_arg_conv.is_owned = false;
64105         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
64106 }
64107
64108 int64_t  CS_LDK_NetworkGraph_update_channel(int64_t this_arg, int64_t msg) {
64109         LDKNetworkGraph this_arg_conv;
64110         this_arg_conv.inner = untag_ptr(this_arg);
64111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64113         this_arg_conv.is_owned = false;
64114         LDKChannelUpdate msg_conv;
64115         msg_conv.inner = untag_ptr(msg);
64116         msg_conv.is_owned = ptr_is_owned(msg);
64117         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64118         msg_conv.is_owned = false;
64119         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64120         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
64121         return tag_ptr(ret_conv, true);
64122 }
64123
64124 int64_t  CS_LDK_NetworkGraph_update_channel_unsigned(int64_t this_arg, int64_t msg) {
64125         LDKNetworkGraph this_arg_conv;
64126         this_arg_conv.inner = untag_ptr(this_arg);
64127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64129         this_arg_conv.is_owned = false;
64130         LDKUnsignedChannelUpdate msg_conv;
64131         msg_conv.inner = untag_ptr(msg);
64132         msg_conv.is_owned = ptr_is_owned(msg);
64133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64134         msg_conv.is_owned = false;
64135         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64136         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
64137         return tag_ptr(ret_conv, true);
64138 }
64139
64140 int64_t  CS_LDK_NetworkGraph_verify_channel_update(int64_t this_arg, int64_t msg) {
64141         LDKNetworkGraph this_arg_conv;
64142         this_arg_conv.inner = untag_ptr(this_arg);
64143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64145         this_arg_conv.is_owned = false;
64146         LDKChannelUpdate msg_conv;
64147         msg_conv.inner = untag_ptr(msg);
64148         msg_conv.is_owned = ptr_is_owned(msg);
64149         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
64150         msg_conv.is_owned = false;
64151         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
64152         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
64153         return tag_ptr(ret_conv, true);
64154 }
64155
64156 int64_t  CS_LDK_ReadOnlyNetworkGraph_channel(int64_t this_arg, int64_t short_channel_id) {
64157         LDKReadOnlyNetworkGraph this_arg_conv;
64158         this_arg_conv.inner = untag_ptr(this_arg);
64159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64161         this_arg_conv.is_owned = false;
64162         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
64163         int64_t ret_ref = 0;
64164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64166         return ret_ref;
64167 }
64168
64169 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_channels(int64_t this_arg) {
64170         LDKReadOnlyNetworkGraph this_arg_conv;
64171         this_arg_conv.inner = untag_ptr(this_arg);
64172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64174         this_arg_conv.is_owned = false;
64175         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
64176         int64_tArray ret_arr = NULL;
64177         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64178         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64179         for (size_t g = 0; g < ret_var.datalen; g++) {
64180                 int64_t ret_conv_6_conv = ret_var.data[g];
64181                 ret_arr_ptr[g] = ret_conv_6_conv;
64182         }
64183         
64184         FREE(ret_var.data);
64185         return ret_arr;
64186 }
64187
64188 int64_t  CS_LDK_ReadOnlyNetworkGraph_node(int64_t this_arg, int64_t node_id) {
64189         LDKReadOnlyNetworkGraph this_arg_conv;
64190         this_arg_conv.inner = untag_ptr(this_arg);
64191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64193         this_arg_conv.is_owned = false;
64194         LDKNodeId node_id_conv;
64195         node_id_conv.inner = untag_ptr(node_id);
64196         node_id_conv.is_owned = ptr_is_owned(node_id);
64197         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
64198         node_id_conv.is_owned = false;
64199         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
64200         int64_t ret_ref = 0;
64201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64203         return ret_ref;
64204 }
64205
64206 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_nodes(int64_t this_arg) {
64207         LDKReadOnlyNetworkGraph this_arg_conv;
64208         this_arg_conv.inner = untag_ptr(this_arg);
64209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64211         this_arg_conv.is_owned = false;
64212         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
64213         int64_tArray ret_arr = NULL;
64214         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64215         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64216         for (size_t i = 0; i < ret_var.datalen; i++) {
64217                 LDKNodeId ret_conv_8_var = ret_var.data[i];
64218                 int64_t ret_conv_8_ref = 0;
64219                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
64220                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
64221                 ret_arr_ptr[i] = ret_conv_8_ref;
64222         }
64223         
64224         FREE(ret_var.data);
64225         return ret_arr;
64226 }
64227
64228 int64_t  CS_LDK_ReadOnlyNetworkGraph_get_addresses(int64_t this_arg, int8_tArray pubkey) {
64229         LDKReadOnlyNetworkGraph this_arg_conv;
64230         this_arg_conv.inner = untag_ptr(this_arg);
64231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64233         this_arg_conv.is_owned = false;
64234         LDKPublicKey pubkey_ref;
64235         CHECK(pubkey->arr_len == 33);
64236         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
64237         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
64238         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
64239         int64_t ret_ref = tag_ptr(ret_copy, true);
64240         return ret_ref;
64241 }
64242
64243 void  CS_LDK_DefaultRouter_free(int64_t this_obj) {
64244         LDKDefaultRouter this_obj_conv;
64245         this_obj_conv.inner = untag_ptr(this_obj);
64246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64248         DefaultRouter_free(this_obj_conv);
64249 }
64250
64251 int64_t  CS_LDK_DefaultRouter_new(int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
64252         LDKNetworkGraph network_graph_conv;
64253         network_graph_conv.inner = untag_ptr(network_graph);
64254         network_graph_conv.is_owned = ptr_is_owned(network_graph);
64255         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
64256         network_graph_conv.is_owned = false;
64257         void* logger_ptr = untag_ptr(logger);
64258         CHECK_ACCESS(logger_ptr);
64259         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64260         if (logger_conv.free == LDKLogger_JCalls_free) {
64261                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64262                 LDKLogger_JCalls_cloned(&logger_conv);
64263         }
64264         void* entropy_source_ptr = untag_ptr(entropy_source);
64265         CHECK_ACCESS(entropy_source_ptr);
64266         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64267         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64268                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64269                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64270         }
64271         void* scorer_ptr = untag_ptr(scorer);
64272         CHECK_ACCESS(scorer_ptr);
64273         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
64274         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
64275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64276                 LDKLockableScore_JCalls_cloned(&scorer_conv);
64277         }
64278         LDKProbabilisticScoringFeeParameters score_params_conv;
64279         score_params_conv.inner = untag_ptr(score_params);
64280         score_params_conv.is_owned = ptr_is_owned(score_params);
64281         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
64282         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
64283         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
64284         int64_t ret_ref = 0;
64285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64287         return ret_ref;
64288 }
64289
64290 int64_t  CS_LDK_DefaultRouter_as_Router(int64_t this_arg) {
64291         LDKDefaultRouter this_arg_conv;
64292         this_arg_conv.inner = untag_ptr(this_arg);
64293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64295         this_arg_conv.is_owned = false;
64296         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
64297         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
64298         return tag_ptr(ret_ret, true);
64299 }
64300
64301 int64_t  CS_LDK_DefaultRouter_as_MessageRouter(int64_t this_arg) {
64302         LDKDefaultRouter this_arg_conv;
64303         this_arg_conv.inner = untag_ptr(this_arg);
64304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64306         this_arg_conv.is_owned = false;
64307         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
64308         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
64309         return tag_ptr(ret_ret, true);
64310 }
64311
64312 void  CS_LDK_Router_free(int64_t this_ptr) {
64313         if (!ptr_is_owned(this_ptr)) return;
64314         void* this_ptr_ptr = untag_ptr(this_ptr);
64315         CHECK_ACCESS(this_ptr_ptr);
64316         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
64317         FREE(untag_ptr(this_ptr));
64318         Router_free(this_ptr_conv);
64319 }
64320
64321 void  CS_LDK_ScorerAccountingForInFlightHtlcs_free(int64_t this_obj) {
64322         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
64323         this_obj_conv.inner = untag_ptr(this_obj);
64324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64326         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
64327 }
64328
64329 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_new(int64_t scorer, int64_t inflight_htlcs) {
64330         void* scorer_ptr = untag_ptr(scorer);
64331         CHECK_ACCESS(scorer_ptr);
64332         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
64333         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
64334                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64335                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
64336         }
64337         LDKInFlightHtlcs inflight_htlcs_conv;
64338         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
64339         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
64340         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
64341         inflight_htlcs_conv.is_owned = false;
64342         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
64343         int64_t ret_ref = 0;
64344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64346         return ret_ref;
64347 }
64348
64349 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(int64_t this_arg) {
64350         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
64351         this_arg_conv.inner = untag_ptr(this_arg);
64352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64354         this_arg_conv.is_owned = false;
64355         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
64356         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
64357         return tag_ptr(ret_ret, true);
64358 }
64359
64360 void  CS_LDK_InFlightHtlcs_free(int64_t this_obj) {
64361         LDKInFlightHtlcs this_obj_conv;
64362         this_obj_conv.inner = untag_ptr(this_obj);
64363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64365         InFlightHtlcs_free(this_obj_conv);
64366 }
64367
64368 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
64369         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
64370         int64_t ret_ref = 0;
64371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64373         return ret_ref;
64374 }
64375 int64_t  CS_LDK_InFlightHtlcs_clone_ptr(int64_t arg) {
64376         LDKInFlightHtlcs arg_conv;
64377         arg_conv.inner = untag_ptr(arg);
64378         arg_conv.is_owned = ptr_is_owned(arg);
64379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64380         arg_conv.is_owned = false;
64381         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
64382         return ret_conv;
64383 }
64384
64385 int64_t  CS_LDK_InFlightHtlcs_clone(int64_t orig) {
64386         LDKInFlightHtlcs orig_conv;
64387         orig_conv.inner = untag_ptr(orig);
64388         orig_conv.is_owned = ptr_is_owned(orig);
64389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64390         orig_conv.is_owned = false;
64391         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
64392         int64_t ret_ref = 0;
64393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64395         return ret_ref;
64396 }
64397
64398 int64_t  CS_LDK_InFlightHtlcs_new() {
64399         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
64400         int64_t ret_ref = 0;
64401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64403         return ret_ref;
64404 }
64405
64406 void  CS_LDK_InFlightHtlcs_process_path(int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
64407         LDKInFlightHtlcs this_arg_conv;
64408         this_arg_conv.inner = untag_ptr(this_arg);
64409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64411         this_arg_conv.is_owned = false;
64412         LDKPath path_conv;
64413         path_conv.inner = untag_ptr(path);
64414         path_conv.is_owned = ptr_is_owned(path);
64415         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64416         path_conv.is_owned = false;
64417         LDKPublicKey payer_node_id_ref;
64418         CHECK(payer_node_id->arr_len == 33);
64419         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
64420         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
64421 }
64422
64423 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) {
64424         LDKInFlightHtlcs this_arg_conv;
64425         this_arg_conv.inner = untag_ptr(this_arg);
64426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64428         this_arg_conv.is_owned = false;
64429         LDKNodeId source_conv;
64430         source_conv.inner = untag_ptr(source);
64431         source_conv.is_owned = ptr_is_owned(source);
64432         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
64433         source_conv.is_owned = false;
64434         LDKNodeId target_conv;
64435         target_conv.inner = untag_ptr(target);
64436         target_conv.is_owned = ptr_is_owned(target);
64437         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64438         target_conv.is_owned = false;
64439         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
64440 }
64441
64442 int64_t  CS_LDK_InFlightHtlcs_used_liquidity_msat(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
64443         LDKInFlightHtlcs this_arg_conv;
64444         this_arg_conv.inner = untag_ptr(this_arg);
64445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64447         this_arg_conv.is_owned = false;
64448         LDKNodeId source_conv;
64449         source_conv.inner = untag_ptr(source);
64450         source_conv.is_owned = ptr_is_owned(source);
64451         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
64452         source_conv.is_owned = false;
64453         LDKNodeId target_conv;
64454         target_conv.inner = untag_ptr(target);
64455         target_conv.is_owned = ptr_is_owned(target);
64456         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
64457         target_conv.is_owned = false;
64458         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64459         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
64460         int64_t ret_ref = tag_ptr(ret_copy, true);
64461         return ret_ref;
64462 }
64463
64464 int8_tArray  CS_LDK_InFlightHtlcs_write(int64_t obj) {
64465         LDKInFlightHtlcs obj_conv;
64466         obj_conv.inner = untag_ptr(obj);
64467         obj_conv.is_owned = ptr_is_owned(obj);
64468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64469         obj_conv.is_owned = false;
64470         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
64471         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64472         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64473         CVec_u8Z_free(ret_var);
64474         return ret_arr;
64475 }
64476
64477 int64_t  CS_LDK_InFlightHtlcs_read(int8_tArray ser) {
64478         LDKu8slice ser_ref;
64479         ser_ref.datalen = ser->arr_len;
64480         ser_ref.data = ser->elems;
64481         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
64482         *ret_conv = InFlightHtlcs_read(ser_ref);
64483         FREE(ser);
64484         return tag_ptr(ret_conv, true);
64485 }
64486
64487 void  CS_LDK_RouteHop_free(int64_t this_obj) {
64488         LDKRouteHop this_obj_conv;
64489         this_obj_conv.inner = untag_ptr(this_obj);
64490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64492         RouteHop_free(this_obj_conv);
64493 }
64494
64495 int8_tArray  CS_LDK_RouteHop_get_pubkey(int64_t this_ptr) {
64496         LDKRouteHop this_ptr_conv;
64497         this_ptr_conv.inner = untag_ptr(this_ptr);
64498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64500         this_ptr_conv.is_owned = false;
64501         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64502         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
64503         return ret_arr;
64504 }
64505
64506 void  CS_LDK_RouteHop_set_pubkey(int64_t this_ptr, int8_tArray val) {
64507         LDKRouteHop this_ptr_conv;
64508         this_ptr_conv.inner = untag_ptr(this_ptr);
64509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64511         this_ptr_conv.is_owned = false;
64512         LDKPublicKey val_ref;
64513         CHECK(val->arr_len == 33);
64514         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64515         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
64516 }
64517
64518 int64_t  CS_LDK_RouteHop_get_node_features(int64_t this_ptr) {
64519         LDKRouteHop this_ptr_conv;
64520         this_ptr_conv.inner = untag_ptr(this_ptr);
64521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64523         this_ptr_conv.is_owned = false;
64524         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
64525         int64_t ret_ref = 0;
64526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64528         return ret_ref;
64529 }
64530
64531 void  CS_LDK_RouteHop_set_node_features(int64_t this_ptr, int64_t val) {
64532         LDKRouteHop this_ptr_conv;
64533         this_ptr_conv.inner = untag_ptr(this_ptr);
64534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64536         this_ptr_conv.is_owned = false;
64537         LDKNodeFeatures val_conv;
64538         val_conv.inner = untag_ptr(val);
64539         val_conv.is_owned = ptr_is_owned(val);
64540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64541         val_conv = NodeFeatures_clone(&val_conv);
64542         RouteHop_set_node_features(&this_ptr_conv, val_conv);
64543 }
64544
64545 int64_t  CS_LDK_RouteHop_get_short_channel_id(int64_t this_ptr) {
64546         LDKRouteHop this_ptr_conv;
64547         this_ptr_conv.inner = untag_ptr(this_ptr);
64548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64550         this_ptr_conv.is_owned = false;
64551         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
64552         return ret_conv;
64553 }
64554
64555 void  CS_LDK_RouteHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
64556         LDKRouteHop this_ptr_conv;
64557         this_ptr_conv.inner = untag_ptr(this_ptr);
64558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64560         this_ptr_conv.is_owned = false;
64561         RouteHop_set_short_channel_id(&this_ptr_conv, val);
64562 }
64563
64564 int64_t  CS_LDK_RouteHop_get_channel_features(int64_t this_ptr) {
64565         LDKRouteHop this_ptr_conv;
64566         this_ptr_conv.inner = untag_ptr(this_ptr);
64567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64569         this_ptr_conv.is_owned = false;
64570         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
64571         int64_t ret_ref = 0;
64572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64574         return ret_ref;
64575 }
64576
64577 void  CS_LDK_RouteHop_set_channel_features(int64_t this_ptr, int64_t val) {
64578         LDKRouteHop this_ptr_conv;
64579         this_ptr_conv.inner = untag_ptr(this_ptr);
64580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64582         this_ptr_conv.is_owned = false;
64583         LDKChannelFeatures val_conv;
64584         val_conv.inner = untag_ptr(val);
64585         val_conv.is_owned = ptr_is_owned(val);
64586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
64587         val_conv = ChannelFeatures_clone(&val_conv);
64588         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
64589 }
64590
64591 int64_t  CS_LDK_RouteHop_get_fee_msat(int64_t this_ptr) {
64592         LDKRouteHop this_ptr_conv;
64593         this_ptr_conv.inner = untag_ptr(this_ptr);
64594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64596         this_ptr_conv.is_owned = false;
64597         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
64598         return ret_conv;
64599 }
64600
64601 void  CS_LDK_RouteHop_set_fee_msat(int64_t this_ptr, int64_t val) {
64602         LDKRouteHop this_ptr_conv;
64603         this_ptr_conv.inner = untag_ptr(this_ptr);
64604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64606         this_ptr_conv.is_owned = false;
64607         RouteHop_set_fee_msat(&this_ptr_conv, val);
64608 }
64609
64610 int32_t  CS_LDK_RouteHop_get_cltv_expiry_delta(int64_t this_ptr) {
64611         LDKRouteHop this_ptr_conv;
64612         this_ptr_conv.inner = untag_ptr(this_ptr);
64613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64615         this_ptr_conv.is_owned = false;
64616         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
64617         return ret_conv;
64618 }
64619
64620 void  CS_LDK_RouteHop_set_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
64621         LDKRouteHop this_ptr_conv;
64622         this_ptr_conv.inner = untag_ptr(this_ptr);
64623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64625         this_ptr_conv.is_owned = false;
64626         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
64627 }
64628
64629 jboolean  CS_LDK_RouteHop_get_maybe_announced_channel(int64_t this_ptr) {
64630         LDKRouteHop this_ptr_conv;
64631         this_ptr_conv.inner = untag_ptr(this_ptr);
64632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64634         this_ptr_conv.is_owned = false;
64635         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
64636         return ret_conv;
64637 }
64638
64639 void  CS_LDK_RouteHop_set_maybe_announced_channel(int64_t this_ptr, jboolean val) {
64640         LDKRouteHop this_ptr_conv;
64641         this_ptr_conv.inner = untag_ptr(this_ptr);
64642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64644         this_ptr_conv.is_owned = false;
64645         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
64646 }
64647
64648 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) {
64649         LDKPublicKey pubkey_arg_ref;
64650         CHECK(pubkey_arg->arr_len == 33);
64651         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
64652         LDKNodeFeatures node_features_arg_conv;
64653         node_features_arg_conv.inner = untag_ptr(node_features_arg);
64654         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
64655         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
64656         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
64657         LDKChannelFeatures channel_features_arg_conv;
64658         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
64659         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
64660         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
64661         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
64662         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);
64663         int64_t ret_ref = 0;
64664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64666         return ret_ref;
64667 }
64668
64669 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
64670         LDKRouteHop ret_var = RouteHop_clone(arg);
64671         int64_t ret_ref = 0;
64672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64674         return ret_ref;
64675 }
64676 int64_t  CS_LDK_RouteHop_clone_ptr(int64_t arg) {
64677         LDKRouteHop arg_conv;
64678         arg_conv.inner = untag_ptr(arg);
64679         arg_conv.is_owned = ptr_is_owned(arg);
64680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64681         arg_conv.is_owned = false;
64682         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
64683         return ret_conv;
64684 }
64685
64686 int64_t  CS_LDK_RouteHop_clone(int64_t orig) {
64687         LDKRouteHop orig_conv;
64688         orig_conv.inner = untag_ptr(orig);
64689         orig_conv.is_owned = ptr_is_owned(orig);
64690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64691         orig_conv.is_owned = false;
64692         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
64693         int64_t ret_ref = 0;
64694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64696         return ret_ref;
64697 }
64698
64699 int64_t  CS_LDK_RouteHop_hash(int64_t o) {
64700         LDKRouteHop o_conv;
64701         o_conv.inner = untag_ptr(o);
64702         o_conv.is_owned = ptr_is_owned(o);
64703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64704         o_conv.is_owned = false;
64705         int64_t ret_conv = RouteHop_hash(&o_conv);
64706         return ret_conv;
64707 }
64708
64709 jboolean  CS_LDK_RouteHop_eq(int64_t a, int64_t b) {
64710         LDKRouteHop a_conv;
64711         a_conv.inner = untag_ptr(a);
64712         a_conv.is_owned = ptr_is_owned(a);
64713         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64714         a_conv.is_owned = false;
64715         LDKRouteHop b_conv;
64716         b_conv.inner = untag_ptr(b);
64717         b_conv.is_owned = ptr_is_owned(b);
64718         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64719         b_conv.is_owned = false;
64720         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
64721         return ret_conv;
64722 }
64723
64724 int8_tArray  CS_LDK_RouteHop_write(int64_t obj) {
64725         LDKRouteHop obj_conv;
64726         obj_conv.inner = untag_ptr(obj);
64727         obj_conv.is_owned = ptr_is_owned(obj);
64728         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64729         obj_conv.is_owned = false;
64730         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
64731         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64732         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64733         CVec_u8Z_free(ret_var);
64734         return ret_arr;
64735 }
64736
64737 int64_t  CS_LDK_RouteHop_read(int8_tArray ser) {
64738         LDKu8slice ser_ref;
64739         ser_ref.datalen = ser->arr_len;
64740         ser_ref.data = ser->elems;
64741         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
64742         *ret_conv = RouteHop_read(ser_ref);
64743         FREE(ser);
64744         return tag_ptr(ret_conv, true);
64745 }
64746
64747 void  CS_LDK_BlindedTail_free(int64_t this_obj) {
64748         LDKBlindedTail this_obj_conv;
64749         this_obj_conv.inner = untag_ptr(this_obj);
64750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64752         BlindedTail_free(this_obj_conv);
64753 }
64754
64755 int64_tArray  CS_LDK_BlindedTail_get_hops(int64_t this_ptr) {
64756         LDKBlindedTail this_ptr_conv;
64757         this_ptr_conv.inner = untag_ptr(this_ptr);
64758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64760         this_ptr_conv.is_owned = false;
64761         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
64762         int64_tArray ret_arr = NULL;
64763         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64764         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64765         for (size_t m = 0; m < ret_var.datalen; m++) {
64766                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
64767                 int64_t ret_conv_12_ref = 0;
64768                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
64769                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
64770                 ret_arr_ptr[m] = ret_conv_12_ref;
64771         }
64772         
64773         FREE(ret_var.data);
64774         return ret_arr;
64775 }
64776
64777 void  CS_LDK_BlindedTail_set_hops(int64_t this_ptr, int64_tArray val) {
64778         LDKBlindedTail this_ptr_conv;
64779         this_ptr_conv.inner = untag_ptr(this_ptr);
64780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64782         this_ptr_conv.is_owned = false;
64783         LDKCVec_BlindedHopZ val_constr;
64784         val_constr.datalen = val->arr_len;
64785         if (val_constr.datalen > 0)
64786                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64787         else
64788                 val_constr.data = NULL;
64789         int64_t* val_vals = val->elems;
64790         for (size_t m = 0; m < val_constr.datalen; m++) {
64791                 int64_t val_conv_12 = val_vals[m];
64792                 LDKBlindedHop val_conv_12_conv;
64793                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
64794                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
64795                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
64796                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
64797                 val_constr.data[m] = val_conv_12_conv;
64798         }
64799         FREE(val);
64800         BlindedTail_set_hops(&this_ptr_conv, val_constr);
64801 }
64802
64803 int8_tArray  CS_LDK_BlindedTail_get_blinding_point(int64_t this_ptr) {
64804         LDKBlindedTail this_ptr_conv;
64805         this_ptr_conv.inner = untag_ptr(this_ptr);
64806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64808         this_ptr_conv.is_owned = false;
64809         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64810         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
64811         return ret_arr;
64812 }
64813
64814 void  CS_LDK_BlindedTail_set_blinding_point(int64_t this_ptr, int8_tArray val) {
64815         LDKBlindedTail this_ptr_conv;
64816         this_ptr_conv.inner = untag_ptr(this_ptr);
64817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64819         this_ptr_conv.is_owned = false;
64820         LDKPublicKey val_ref;
64821         CHECK(val->arr_len == 33);
64822         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
64823         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
64824 }
64825
64826 int32_t  CS_LDK_BlindedTail_get_excess_final_cltv_expiry_delta(int64_t this_ptr) {
64827         LDKBlindedTail this_ptr_conv;
64828         this_ptr_conv.inner = untag_ptr(this_ptr);
64829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64831         this_ptr_conv.is_owned = false;
64832         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
64833         return ret_conv;
64834 }
64835
64836 void  CS_LDK_BlindedTail_set_excess_final_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
64837         LDKBlindedTail this_ptr_conv;
64838         this_ptr_conv.inner = untag_ptr(this_ptr);
64839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64841         this_ptr_conv.is_owned = false;
64842         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
64843 }
64844
64845 int64_t  CS_LDK_BlindedTail_get_final_value_msat(int64_t this_ptr) {
64846         LDKBlindedTail this_ptr_conv;
64847         this_ptr_conv.inner = untag_ptr(this_ptr);
64848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64850         this_ptr_conv.is_owned = false;
64851         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
64852         return ret_conv;
64853 }
64854
64855 void  CS_LDK_BlindedTail_set_final_value_msat(int64_t this_ptr, int64_t val) {
64856         LDKBlindedTail this_ptr_conv;
64857         this_ptr_conv.inner = untag_ptr(this_ptr);
64858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64860         this_ptr_conv.is_owned = false;
64861         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
64862 }
64863
64864 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) {
64865         LDKCVec_BlindedHopZ hops_arg_constr;
64866         hops_arg_constr.datalen = hops_arg->arr_len;
64867         if (hops_arg_constr.datalen > 0)
64868                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
64869         else
64870                 hops_arg_constr.data = NULL;
64871         int64_t* hops_arg_vals = hops_arg->elems;
64872         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
64873                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
64874                 LDKBlindedHop hops_arg_conv_12_conv;
64875                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
64876                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
64877                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
64878                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
64879                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
64880         }
64881         FREE(hops_arg);
64882         LDKPublicKey blinding_point_arg_ref;
64883         CHECK(blinding_point_arg->arr_len == 33);
64884         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
64885         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
64886         int64_t ret_ref = 0;
64887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64889         return ret_ref;
64890 }
64891
64892 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
64893         LDKBlindedTail ret_var = BlindedTail_clone(arg);
64894         int64_t ret_ref = 0;
64895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64897         return ret_ref;
64898 }
64899 int64_t  CS_LDK_BlindedTail_clone_ptr(int64_t arg) {
64900         LDKBlindedTail arg_conv;
64901         arg_conv.inner = untag_ptr(arg);
64902         arg_conv.is_owned = ptr_is_owned(arg);
64903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64904         arg_conv.is_owned = false;
64905         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
64906         return ret_conv;
64907 }
64908
64909 int64_t  CS_LDK_BlindedTail_clone(int64_t orig) {
64910         LDKBlindedTail orig_conv;
64911         orig_conv.inner = untag_ptr(orig);
64912         orig_conv.is_owned = ptr_is_owned(orig);
64913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64914         orig_conv.is_owned = false;
64915         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
64916         int64_t ret_ref = 0;
64917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64919         return ret_ref;
64920 }
64921
64922 int64_t  CS_LDK_BlindedTail_hash(int64_t o) {
64923         LDKBlindedTail o_conv;
64924         o_conv.inner = untag_ptr(o);
64925         o_conv.is_owned = ptr_is_owned(o);
64926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64927         o_conv.is_owned = false;
64928         int64_t ret_conv = BlindedTail_hash(&o_conv);
64929         return ret_conv;
64930 }
64931
64932 jboolean  CS_LDK_BlindedTail_eq(int64_t a, int64_t b) {
64933         LDKBlindedTail a_conv;
64934         a_conv.inner = untag_ptr(a);
64935         a_conv.is_owned = ptr_is_owned(a);
64936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64937         a_conv.is_owned = false;
64938         LDKBlindedTail b_conv;
64939         b_conv.inner = untag_ptr(b);
64940         b_conv.is_owned = ptr_is_owned(b);
64941         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64942         b_conv.is_owned = false;
64943         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
64944         return ret_conv;
64945 }
64946
64947 int8_tArray  CS_LDK_BlindedTail_write(int64_t obj) {
64948         LDKBlindedTail obj_conv;
64949         obj_conv.inner = untag_ptr(obj);
64950         obj_conv.is_owned = ptr_is_owned(obj);
64951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64952         obj_conv.is_owned = false;
64953         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
64954         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64955         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64956         CVec_u8Z_free(ret_var);
64957         return ret_arr;
64958 }
64959
64960 int64_t  CS_LDK_BlindedTail_read(int8_tArray ser) {
64961         LDKu8slice ser_ref;
64962         ser_ref.datalen = ser->arr_len;
64963         ser_ref.data = ser->elems;
64964         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
64965         *ret_conv = BlindedTail_read(ser_ref);
64966         FREE(ser);
64967         return tag_ptr(ret_conv, true);
64968 }
64969
64970 void  CS_LDK_Path_free(int64_t this_obj) {
64971         LDKPath this_obj_conv;
64972         this_obj_conv.inner = untag_ptr(this_obj);
64973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64975         Path_free(this_obj_conv);
64976 }
64977
64978 int64_tArray  CS_LDK_Path_get_hops(int64_t this_ptr) {
64979         LDKPath this_ptr_conv;
64980         this_ptr_conv.inner = untag_ptr(this_ptr);
64981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64983         this_ptr_conv.is_owned = false;
64984         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
64985         int64_tArray ret_arr = NULL;
64986         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
64987         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
64988         for (size_t k = 0; k < ret_var.datalen; k++) {
64989                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
64990                 int64_t ret_conv_10_ref = 0;
64991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
64992                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
64993                 ret_arr_ptr[k] = ret_conv_10_ref;
64994         }
64995         
64996         FREE(ret_var.data);
64997         return ret_arr;
64998 }
64999
65000 void  CS_LDK_Path_set_hops(int64_t this_ptr, int64_tArray val) {
65001         LDKPath this_ptr_conv;
65002         this_ptr_conv.inner = untag_ptr(this_ptr);
65003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65005         this_ptr_conv.is_owned = false;
65006         LDKCVec_RouteHopZ val_constr;
65007         val_constr.datalen = val->arr_len;
65008         if (val_constr.datalen > 0)
65009                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
65010         else
65011                 val_constr.data = NULL;
65012         int64_t* val_vals = val->elems;
65013         for (size_t k = 0; k < val_constr.datalen; k++) {
65014                 int64_t val_conv_10 = val_vals[k];
65015                 LDKRouteHop val_conv_10_conv;
65016                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
65017                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
65018                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
65019                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
65020                 val_constr.data[k] = val_conv_10_conv;
65021         }
65022         FREE(val);
65023         Path_set_hops(&this_ptr_conv, val_constr);
65024 }
65025
65026 int64_t  CS_LDK_Path_get_blinded_tail(int64_t this_ptr) {
65027         LDKPath this_ptr_conv;
65028         this_ptr_conv.inner = untag_ptr(this_ptr);
65029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65031         this_ptr_conv.is_owned = false;
65032         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
65033         int64_t ret_ref = 0;
65034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65036         return ret_ref;
65037 }
65038
65039 void  CS_LDK_Path_set_blinded_tail(int64_t this_ptr, int64_t val) {
65040         LDKPath this_ptr_conv;
65041         this_ptr_conv.inner = untag_ptr(this_ptr);
65042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65044         this_ptr_conv.is_owned = false;
65045         LDKBlindedTail val_conv;
65046         val_conv.inner = untag_ptr(val);
65047         val_conv.is_owned = ptr_is_owned(val);
65048         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65049         val_conv = BlindedTail_clone(&val_conv);
65050         Path_set_blinded_tail(&this_ptr_conv, val_conv);
65051 }
65052
65053 int64_t  CS_LDK_Path_new(int64_tArray hops_arg, int64_t blinded_tail_arg) {
65054         LDKCVec_RouteHopZ hops_arg_constr;
65055         hops_arg_constr.datalen = hops_arg->arr_len;
65056         if (hops_arg_constr.datalen > 0)
65057                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
65058         else
65059                 hops_arg_constr.data = NULL;
65060         int64_t* hops_arg_vals = hops_arg->elems;
65061         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
65062                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
65063                 LDKRouteHop hops_arg_conv_10_conv;
65064                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
65065                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
65066                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
65067                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
65068                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
65069         }
65070         FREE(hops_arg);
65071         LDKBlindedTail blinded_tail_arg_conv;
65072         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
65073         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
65074         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
65075         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
65076         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
65077         int64_t ret_ref = 0;
65078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65080         return ret_ref;
65081 }
65082
65083 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
65084         LDKPath ret_var = Path_clone(arg);
65085         int64_t ret_ref = 0;
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65088         return ret_ref;
65089 }
65090 int64_t  CS_LDK_Path_clone_ptr(int64_t arg) {
65091         LDKPath arg_conv;
65092         arg_conv.inner = untag_ptr(arg);
65093         arg_conv.is_owned = ptr_is_owned(arg);
65094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65095         arg_conv.is_owned = false;
65096         int64_t ret_conv = Path_clone_ptr(&arg_conv);
65097         return ret_conv;
65098 }
65099
65100 int64_t  CS_LDK_Path_clone(int64_t orig) {
65101         LDKPath orig_conv;
65102         orig_conv.inner = untag_ptr(orig);
65103         orig_conv.is_owned = ptr_is_owned(orig);
65104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65105         orig_conv.is_owned = false;
65106         LDKPath ret_var = Path_clone(&orig_conv);
65107         int64_t ret_ref = 0;
65108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65110         return ret_ref;
65111 }
65112
65113 int64_t  CS_LDK_Path_hash(int64_t o) {
65114         LDKPath o_conv;
65115         o_conv.inner = untag_ptr(o);
65116         o_conv.is_owned = ptr_is_owned(o);
65117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65118         o_conv.is_owned = false;
65119         int64_t ret_conv = Path_hash(&o_conv);
65120         return ret_conv;
65121 }
65122
65123 jboolean  CS_LDK_Path_eq(int64_t a, int64_t b) {
65124         LDKPath a_conv;
65125         a_conv.inner = untag_ptr(a);
65126         a_conv.is_owned = ptr_is_owned(a);
65127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65128         a_conv.is_owned = false;
65129         LDKPath b_conv;
65130         b_conv.inner = untag_ptr(b);
65131         b_conv.is_owned = ptr_is_owned(b);
65132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65133         b_conv.is_owned = false;
65134         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
65135         return ret_conv;
65136 }
65137
65138 int64_t  CS_LDK_Path_fee_msat(int64_t this_arg) {
65139         LDKPath this_arg_conv;
65140         this_arg_conv.inner = untag_ptr(this_arg);
65141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65143         this_arg_conv.is_owned = false;
65144         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
65145         return ret_conv;
65146 }
65147
65148 int64_t  CS_LDK_Path_final_value_msat(int64_t this_arg) {
65149         LDKPath this_arg_conv;
65150         this_arg_conv.inner = untag_ptr(this_arg);
65151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65153         this_arg_conv.is_owned = false;
65154         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
65155         return ret_conv;
65156 }
65157
65158 int64_t  CS_LDK_Path_final_cltv_expiry_delta(int64_t this_arg) {
65159         LDKPath this_arg_conv;
65160         this_arg_conv.inner = untag_ptr(this_arg);
65161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65163         this_arg_conv.is_owned = false;
65164         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
65165         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
65166         int64_t ret_ref = tag_ptr(ret_copy, true);
65167         return ret_ref;
65168 }
65169
65170 void  CS_LDK_Route_free(int64_t this_obj) {
65171         LDKRoute this_obj_conv;
65172         this_obj_conv.inner = untag_ptr(this_obj);
65173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65175         Route_free(this_obj_conv);
65176 }
65177
65178 int64_tArray  CS_LDK_Route_get_paths(int64_t this_ptr) {
65179         LDKRoute this_ptr_conv;
65180         this_ptr_conv.inner = untag_ptr(this_ptr);
65181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65183         this_ptr_conv.is_owned = false;
65184         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
65185         int64_tArray ret_arr = NULL;
65186         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65187         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65188         for (size_t g = 0; g < ret_var.datalen; g++) {
65189                 LDKPath ret_conv_6_var = ret_var.data[g];
65190                 int64_t ret_conv_6_ref = 0;
65191                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
65192                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
65193                 ret_arr_ptr[g] = ret_conv_6_ref;
65194         }
65195         
65196         FREE(ret_var.data);
65197         return ret_arr;
65198 }
65199
65200 void  CS_LDK_Route_set_paths(int64_t this_ptr, int64_tArray val) {
65201         LDKRoute this_ptr_conv;
65202         this_ptr_conv.inner = untag_ptr(this_ptr);
65203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65205         this_ptr_conv.is_owned = false;
65206         LDKCVec_PathZ val_constr;
65207         val_constr.datalen = val->arr_len;
65208         if (val_constr.datalen > 0)
65209                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
65210         else
65211                 val_constr.data = NULL;
65212         int64_t* val_vals = val->elems;
65213         for (size_t g = 0; g < val_constr.datalen; g++) {
65214                 int64_t val_conv_6 = val_vals[g];
65215                 LDKPath val_conv_6_conv;
65216                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
65217                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
65218                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
65219                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
65220                 val_constr.data[g] = val_conv_6_conv;
65221         }
65222         FREE(val);
65223         Route_set_paths(&this_ptr_conv, val_constr);
65224 }
65225
65226 int64_t  CS_LDK_Route_get_route_params(int64_t this_ptr) {
65227         LDKRoute this_ptr_conv;
65228         this_ptr_conv.inner = untag_ptr(this_ptr);
65229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65231         this_ptr_conv.is_owned = false;
65232         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
65233         int64_t ret_ref = 0;
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65236         return ret_ref;
65237 }
65238
65239 void  CS_LDK_Route_set_route_params(int64_t this_ptr, int64_t val) {
65240         LDKRoute this_ptr_conv;
65241         this_ptr_conv.inner = untag_ptr(this_ptr);
65242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65244         this_ptr_conv.is_owned = false;
65245         LDKRouteParameters val_conv;
65246         val_conv.inner = untag_ptr(val);
65247         val_conv.is_owned = ptr_is_owned(val);
65248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65249         val_conv = RouteParameters_clone(&val_conv);
65250         Route_set_route_params(&this_ptr_conv, val_conv);
65251 }
65252
65253 int64_t  CS_LDK_Route_new(int64_tArray paths_arg, int64_t route_params_arg) {
65254         LDKCVec_PathZ paths_arg_constr;
65255         paths_arg_constr.datalen = paths_arg->arr_len;
65256         if (paths_arg_constr.datalen > 0)
65257                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
65258         else
65259                 paths_arg_constr.data = NULL;
65260         int64_t* paths_arg_vals = paths_arg->elems;
65261         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
65262                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
65263                 LDKPath paths_arg_conv_6_conv;
65264                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
65265                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
65266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
65267                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
65268                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
65269         }
65270         FREE(paths_arg);
65271         LDKRouteParameters route_params_arg_conv;
65272         route_params_arg_conv.inner = untag_ptr(route_params_arg);
65273         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
65275         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
65276         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
65277         int64_t ret_ref = 0;
65278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65280         return ret_ref;
65281 }
65282
65283 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
65284         LDKRoute ret_var = Route_clone(arg);
65285         int64_t ret_ref = 0;
65286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65288         return ret_ref;
65289 }
65290 int64_t  CS_LDK_Route_clone_ptr(int64_t arg) {
65291         LDKRoute arg_conv;
65292         arg_conv.inner = untag_ptr(arg);
65293         arg_conv.is_owned = ptr_is_owned(arg);
65294         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65295         arg_conv.is_owned = false;
65296         int64_t ret_conv = Route_clone_ptr(&arg_conv);
65297         return ret_conv;
65298 }
65299
65300 int64_t  CS_LDK_Route_clone(int64_t orig) {
65301         LDKRoute orig_conv;
65302         orig_conv.inner = untag_ptr(orig);
65303         orig_conv.is_owned = ptr_is_owned(orig);
65304         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65305         orig_conv.is_owned = false;
65306         LDKRoute ret_var = Route_clone(&orig_conv);
65307         int64_t ret_ref = 0;
65308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65310         return ret_ref;
65311 }
65312
65313 int64_t  CS_LDK_Route_hash(int64_t o) {
65314         LDKRoute o_conv;
65315         o_conv.inner = untag_ptr(o);
65316         o_conv.is_owned = ptr_is_owned(o);
65317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65318         o_conv.is_owned = false;
65319         int64_t ret_conv = Route_hash(&o_conv);
65320         return ret_conv;
65321 }
65322
65323 jboolean  CS_LDK_Route_eq(int64_t a, int64_t b) {
65324         LDKRoute a_conv;
65325         a_conv.inner = untag_ptr(a);
65326         a_conv.is_owned = ptr_is_owned(a);
65327         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65328         a_conv.is_owned = false;
65329         LDKRoute b_conv;
65330         b_conv.inner = untag_ptr(b);
65331         b_conv.is_owned = ptr_is_owned(b);
65332         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65333         b_conv.is_owned = false;
65334         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
65335         return ret_conv;
65336 }
65337
65338 int64_t  CS_LDK_Route_get_total_fees(int64_t this_arg) {
65339         LDKRoute this_arg_conv;
65340         this_arg_conv.inner = untag_ptr(this_arg);
65341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65343         this_arg_conv.is_owned = false;
65344         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
65345         return ret_conv;
65346 }
65347
65348 int64_t  CS_LDK_Route_get_total_amount(int64_t this_arg) {
65349         LDKRoute this_arg_conv;
65350         this_arg_conv.inner = untag_ptr(this_arg);
65351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65353         this_arg_conv.is_owned = false;
65354         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
65355         return ret_conv;
65356 }
65357
65358 int8_tArray  CS_LDK_Route_write(int64_t obj) {
65359         LDKRoute obj_conv;
65360         obj_conv.inner = untag_ptr(obj);
65361         obj_conv.is_owned = ptr_is_owned(obj);
65362         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65363         obj_conv.is_owned = false;
65364         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
65365         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65366         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65367         CVec_u8Z_free(ret_var);
65368         return ret_arr;
65369 }
65370
65371 int64_t  CS_LDK_Route_read(int8_tArray ser) {
65372         LDKu8slice ser_ref;
65373         ser_ref.datalen = ser->arr_len;
65374         ser_ref.data = ser->elems;
65375         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
65376         *ret_conv = Route_read(ser_ref);
65377         FREE(ser);
65378         return tag_ptr(ret_conv, true);
65379 }
65380
65381 void  CS_LDK_RouteParameters_free(int64_t this_obj) {
65382         LDKRouteParameters this_obj_conv;
65383         this_obj_conv.inner = untag_ptr(this_obj);
65384         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65386         RouteParameters_free(this_obj_conv);
65387 }
65388
65389 int64_t  CS_LDK_RouteParameters_get_payment_params(int64_t this_ptr) {
65390         LDKRouteParameters this_ptr_conv;
65391         this_ptr_conv.inner = untag_ptr(this_ptr);
65392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65394         this_ptr_conv.is_owned = false;
65395         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
65396         int64_t ret_ref = 0;
65397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65399         return ret_ref;
65400 }
65401
65402 void  CS_LDK_RouteParameters_set_payment_params(int64_t this_ptr, int64_t val) {
65403         LDKRouteParameters this_ptr_conv;
65404         this_ptr_conv.inner = untag_ptr(this_ptr);
65405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65407         this_ptr_conv.is_owned = false;
65408         LDKPaymentParameters val_conv;
65409         val_conv.inner = untag_ptr(val);
65410         val_conv.is_owned = ptr_is_owned(val);
65411         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65412         val_conv = PaymentParameters_clone(&val_conv);
65413         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
65414 }
65415
65416 int64_t  CS_LDK_RouteParameters_get_final_value_msat(int64_t this_ptr) {
65417         LDKRouteParameters this_ptr_conv;
65418         this_ptr_conv.inner = untag_ptr(this_ptr);
65419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65421         this_ptr_conv.is_owned = false;
65422         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
65423         return ret_conv;
65424 }
65425
65426 void  CS_LDK_RouteParameters_set_final_value_msat(int64_t this_ptr, int64_t val) {
65427         LDKRouteParameters this_ptr_conv;
65428         this_ptr_conv.inner = untag_ptr(this_ptr);
65429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65431         this_ptr_conv.is_owned = false;
65432         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
65433 }
65434
65435 int64_t  CS_LDK_RouteParameters_get_max_total_routing_fee_msat(int64_t this_ptr) {
65436         LDKRouteParameters this_ptr_conv;
65437         this_ptr_conv.inner = untag_ptr(this_ptr);
65438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65440         this_ptr_conv.is_owned = false;
65441         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65442         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
65443         int64_t ret_ref = tag_ptr(ret_copy, true);
65444         return ret_ref;
65445 }
65446
65447 void  CS_LDK_RouteParameters_set_max_total_routing_fee_msat(int64_t this_ptr, int64_t val) {
65448         LDKRouteParameters this_ptr_conv;
65449         this_ptr_conv.inner = untag_ptr(this_ptr);
65450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65452         this_ptr_conv.is_owned = false;
65453         void* val_ptr = untag_ptr(val);
65454         CHECK_ACCESS(val_ptr);
65455         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65456         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65457         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
65458 }
65459
65460 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) {
65461         LDKPaymentParameters payment_params_arg_conv;
65462         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
65463         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
65464         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
65465         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
65466         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
65467         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
65468         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
65469         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
65470         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
65471         int64_t ret_ref = 0;
65472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65474         return ret_ref;
65475 }
65476
65477 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
65478         LDKRouteParameters ret_var = RouteParameters_clone(arg);
65479         int64_t ret_ref = 0;
65480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65482         return ret_ref;
65483 }
65484 int64_t  CS_LDK_RouteParameters_clone_ptr(int64_t arg) {
65485         LDKRouteParameters arg_conv;
65486         arg_conv.inner = untag_ptr(arg);
65487         arg_conv.is_owned = ptr_is_owned(arg);
65488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65489         arg_conv.is_owned = false;
65490         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
65491         return ret_conv;
65492 }
65493
65494 int64_t  CS_LDK_RouteParameters_clone(int64_t orig) {
65495         LDKRouteParameters orig_conv;
65496         orig_conv.inner = untag_ptr(orig);
65497         orig_conv.is_owned = ptr_is_owned(orig);
65498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65499         orig_conv.is_owned = false;
65500         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
65501         int64_t ret_ref = 0;
65502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65504         return ret_ref;
65505 }
65506
65507 int64_t  CS_LDK_RouteParameters_hash(int64_t o) {
65508         LDKRouteParameters o_conv;
65509         o_conv.inner = untag_ptr(o);
65510         o_conv.is_owned = ptr_is_owned(o);
65511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65512         o_conv.is_owned = false;
65513         int64_t ret_conv = RouteParameters_hash(&o_conv);
65514         return ret_conv;
65515 }
65516
65517 jboolean  CS_LDK_RouteParameters_eq(int64_t a, int64_t b) {
65518         LDKRouteParameters a_conv;
65519         a_conv.inner = untag_ptr(a);
65520         a_conv.is_owned = ptr_is_owned(a);
65521         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65522         a_conv.is_owned = false;
65523         LDKRouteParameters b_conv;
65524         b_conv.inner = untag_ptr(b);
65525         b_conv.is_owned = ptr_is_owned(b);
65526         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65527         b_conv.is_owned = false;
65528         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
65529         return ret_conv;
65530 }
65531
65532 int64_t  CS_LDK_RouteParameters_from_payment_params_and_value(int64_t payment_params, int64_t final_value_msat) {
65533         LDKPaymentParameters payment_params_conv;
65534         payment_params_conv.inner = untag_ptr(payment_params);
65535         payment_params_conv.is_owned = ptr_is_owned(payment_params);
65536         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
65537         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
65538         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
65539         int64_t ret_ref = 0;
65540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65542         return ret_ref;
65543 }
65544
65545 int8_tArray  CS_LDK_RouteParameters_write(int64_t obj) {
65546         LDKRouteParameters obj_conv;
65547         obj_conv.inner = untag_ptr(obj);
65548         obj_conv.is_owned = ptr_is_owned(obj);
65549         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65550         obj_conv.is_owned = false;
65551         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
65552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65554         CVec_u8Z_free(ret_var);
65555         return ret_arr;
65556 }
65557
65558 int64_t  CS_LDK_RouteParameters_read(int8_tArray ser) {
65559         LDKu8slice ser_ref;
65560         ser_ref.datalen = ser->arr_len;
65561         ser_ref.data = ser->elems;
65562         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
65563         *ret_conv = RouteParameters_read(ser_ref);
65564         FREE(ser);
65565         return tag_ptr(ret_conv, true);
65566 }
65567
65568 void  CS_LDK_PaymentParameters_free(int64_t this_obj) {
65569         LDKPaymentParameters this_obj_conv;
65570         this_obj_conv.inner = untag_ptr(this_obj);
65571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65573         PaymentParameters_free(this_obj_conv);
65574 }
65575
65576 int64_t  CS_LDK_PaymentParameters_get_payee(int64_t this_ptr) {
65577         LDKPaymentParameters this_ptr_conv;
65578         this_ptr_conv.inner = untag_ptr(this_ptr);
65579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65581         this_ptr_conv.is_owned = false;
65582         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65583         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
65584         int64_t ret_ref = tag_ptr(ret_copy, true);
65585         return ret_ref;
65586 }
65587
65588 void  CS_LDK_PaymentParameters_set_payee(int64_t this_ptr, int64_t val) {
65589         LDKPaymentParameters this_ptr_conv;
65590         this_ptr_conv.inner = untag_ptr(this_ptr);
65591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65593         this_ptr_conv.is_owned = false;
65594         void* val_ptr = untag_ptr(val);
65595         CHECK_ACCESS(val_ptr);
65596         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
65597         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
65598         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
65599 }
65600
65601 int64_t  CS_LDK_PaymentParameters_get_expiry_time(int64_t this_ptr) {
65602         LDKPaymentParameters this_ptr_conv;
65603         this_ptr_conv.inner = untag_ptr(this_ptr);
65604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65606         this_ptr_conv.is_owned = false;
65607         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65608         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
65609         int64_t ret_ref = tag_ptr(ret_copy, true);
65610         return ret_ref;
65611 }
65612
65613 void  CS_LDK_PaymentParameters_set_expiry_time(int64_t this_ptr, int64_t val) {
65614         LDKPaymentParameters this_ptr_conv;
65615         this_ptr_conv.inner = untag_ptr(this_ptr);
65616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65618         this_ptr_conv.is_owned = false;
65619         void* val_ptr = untag_ptr(val);
65620         CHECK_ACCESS(val_ptr);
65621         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
65622         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
65623         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
65624 }
65625
65626 int32_t  CS_LDK_PaymentParameters_get_max_total_cltv_expiry_delta(int64_t this_ptr) {
65627         LDKPaymentParameters this_ptr_conv;
65628         this_ptr_conv.inner = untag_ptr(this_ptr);
65629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65631         this_ptr_conv.is_owned = false;
65632         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
65633         return ret_conv;
65634 }
65635
65636 void  CS_LDK_PaymentParameters_set_max_total_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
65637         LDKPaymentParameters this_ptr_conv;
65638         this_ptr_conv.inner = untag_ptr(this_ptr);
65639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65641         this_ptr_conv.is_owned = false;
65642         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
65643 }
65644
65645 int8_t  CS_LDK_PaymentParameters_get_max_path_count(int64_t this_ptr) {
65646         LDKPaymentParameters this_ptr_conv;
65647         this_ptr_conv.inner = untag_ptr(this_ptr);
65648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65650         this_ptr_conv.is_owned = false;
65651         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
65652         return ret_conv;
65653 }
65654
65655 void  CS_LDK_PaymentParameters_set_max_path_count(int64_t this_ptr, int8_t val) {
65656         LDKPaymentParameters this_ptr_conv;
65657         this_ptr_conv.inner = untag_ptr(this_ptr);
65658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65660         this_ptr_conv.is_owned = false;
65661         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
65662 }
65663
65664 int8_t  CS_LDK_PaymentParameters_get_max_channel_saturation_power_of_half(int64_t this_ptr) {
65665         LDKPaymentParameters 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         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
65671         return ret_conv;
65672 }
65673
65674 void  CS_LDK_PaymentParameters_set_max_channel_saturation_power_of_half(int64_t this_ptr, int8_t val) {
65675         LDKPaymentParameters this_ptr_conv;
65676         this_ptr_conv.inner = untag_ptr(this_ptr);
65677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65679         this_ptr_conv.is_owned = false;
65680         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
65681 }
65682
65683 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_channels(int64_t this_ptr) {
65684         LDKPaymentParameters this_ptr_conv;
65685         this_ptr_conv.inner = untag_ptr(this_ptr);
65686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65688         this_ptr_conv.is_owned = false;
65689         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
65690         int64_tArray ret_arr = NULL;
65691         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65692         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65693         for (size_t g = 0; g < ret_var.datalen; g++) {
65694                 int64_t ret_conv_6_conv = ret_var.data[g];
65695                 ret_arr_ptr[g] = ret_conv_6_conv;
65696         }
65697         
65698         FREE(ret_var.data);
65699         return ret_arr;
65700 }
65701
65702 void  CS_LDK_PaymentParameters_set_previously_failed_channels(int64_t this_ptr, int64_tArray val) {
65703         LDKPaymentParameters this_ptr_conv;
65704         this_ptr_conv.inner = untag_ptr(this_ptr);
65705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65707         this_ptr_conv.is_owned = false;
65708         LDKCVec_u64Z val_constr;
65709         val_constr.datalen = val->arr_len;
65710         if (val_constr.datalen > 0)
65711                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65712         else
65713                 val_constr.data = NULL;
65714         int64_t* val_vals = val->elems;
65715         for (size_t g = 0; g < val_constr.datalen; g++) {
65716                 int64_t val_conv_6 = val_vals[g];
65717                 val_constr.data[g] = val_conv_6;
65718         }
65719         FREE(val);
65720         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
65721 }
65722
65723 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_blinded_path_idxs(int64_t this_ptr) {
65724         LDKPaymentParameters this_ptr_conv;
65725         this_ptr_conv.inner = untag_ptr(this_ptr);
65726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65728         this_ptr_conv.is_owned = false;
65729         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
65730         int64_tArray ret_arr = NULL;
65731         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65732         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65733         for (size_t g = 0; g < ret_var.datalen; g++) {
65734                 int64_t ret_conv_6_conv = ret_var.data[g];
65735                 ret_arr_ptr[g] = ret_conv_6_conv;
65736         }
65737         
65738         FREE(ret_var.data);
65739         return ret_arr;
65740 }
65741
65742 void  CS_LDK_PaymentParameters_set_previously_failed_blinded_path_idxs(int64_t this_ptr, int64_tArray val) {
65743         LDKPaymentParameters this_ptr_conv;
65744         this_ptr_conv.inner = untag_ptr(this_ptr);
65745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65747         this_ptr_conv.is_owned = false;
65748         LDKCVec_u64Z val_constr;
65749         val_constr.datalen = val->arr_len;
65750         if (val_constr.datalen > 0)
65751                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65752         else
65753                 val_constr.data = NULL;
65754         int64_t* val_vals = val->elems;
65755         for (size_t g = 0; g < val_constr.datalen; g++) {
65756                 int64_t val_conv_6 = val_vals[g];
65757                 val_constr.data[g] = val_conv_6;
65758         }
65759         FREE(val);
65760         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
65761 }
65762
65763 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) {
65764         void* payee_arg_ptr = untag_ptr(payee_arg);
65765         CHECK_ACCESS(payee_arg_ptr);
65766         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
65767         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
65768         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
65769         CHECK_ACCESS(expiry_time_arg_ptr);
65770         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
65771         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
65772         LDKCVec_u64Z previously_failed_channels_arg_constr;
65773         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
65774         if (previously_failed_channels_arg_constr.datalen > 0)
65775                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65776         else
65777                 previously_failed_channels_arg_constr.data = NULL;
65778         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
65779         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
65780                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
65781                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
65782         }
65783         FREE(previously_failed_channels_arg);
65784         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
65785         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
65786         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
65787                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
65788         else
65789                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
65790         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
65791         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
65792                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
65793                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
65794         }
65795         FREE(previously_failed_blinded_path_idxs_arg);
65796         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);
65797         int64_t ret_ref = 0;
65798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65800         return ret_ref;
65801 }
65802
65803 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
65804         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
65805         int64_t ret_ref = 0;
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65808         return ret_ref;
65809 }
65810 int64_t  CS_LDK_PaymentParameters_clone_ptr(int64_t arg) {
65811         LDKPaymentParameters arg_conv;
65812         arg_conv.inner = untag_ptr(arg);
65813         arg_conv.is_owned = ptr_is_owned(arg);
65814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65815         arg_conv.is_owned = false;
65816         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
65817         return ret_conv;
65818 }
65819
65820 int64_t  CS_LDK_PaymentParameters_clone(int64_t orig) {
65821         LDKPaymentParameters orig_conv;
65822         orig_conv.inner = untag_ptr(orig);
65823         orig_conv.is_owned = ptr_is_owned(orig);
65824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65825         orig_conv.is_owned = false;
65826         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
65827         int64_t ret_ref = 0;
65828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65830         return ret_ref;
65831 }
65832
65833 int64_t  CS_LDK_PaymentParameters_hash(int64_t o) {
65834         LDKPaymentParameters o_conv;
65835         o_conv.inner = untag_ptr(o);
65836         o_conv.is_owned = ptr_is_owned(o);
65837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65838         o_conv.is_owned = false;
65839         int64_t ret_conv = PaymentParameters_hash(&o_conv);
65840         return ret_conv;
65841 }
65842
65843 jboolean  CS_LDK_PaymentParameters_eq(int64_t a, int64_t b) {
65844         LDKPaymentParameters a_conv;
65845         a_conv.inner = untag_ptr(a);
65846         a_conv.is_owned = ptr_is_owned(a);
65847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65848         a_conv.is_owned = false;
65849         LDKPaymentParameters b_conv;
65850         b_conv.inner = untag_ptr(b);
65851         b_conv.is_owned = ptr_is_owned(b);
65852         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65853         b_conv.is_owned = false;
65854         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
65855         return ret_conv;
65856 }
65857
65858 int8_tArray  CS_LDK_PaymentParameters_write(int64_t obj) {
65859         LDKPaymentParameters obj_conv;
65860         obj_conv.inner = untag_ptr(obj);
65861         obj_conv.is_owned = ptr_is_owned(obj);
65862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65863         obj_conv.is_owned = false;
65864         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
65865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65867         CVec_u8Z_free(ret_var);
65868         return ret_arr;
65869 }
65870
65871 int64_t  CS_LDK_PaymentParameters_read(int8_tArray ser, int32_t arg) {
65872         LDKu8slice ser_ref;
65873         ser_ref.datalen = ser->arr_len;
65874         ser_ref.data = ser->elems;
65875         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
65876         *ret_conv = PaymentParameters_read(ser_ref, arg);
65877         FREE(ser);
65878         return tag_ptr(ret_conv, true);
65879 }
65880
65881 int64_t  CS_LDK_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
65882         LDKPublicKey payee_pubkey_ref;
65883         CHECK(payee_pubkey->arr_len == 33);
65884         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65885         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
65886         int64_t ret_ref = 0;
65887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65889         return ret_ref;
65890 }
65891
65892 int64_t  CS_LDK_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
65893         LDKPublicKey payee_pubkey_ref;
65894         CHECK(payee_pubkey->arr_len == 33);
65895         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
65896         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
65897         int64_t ret_ref = 0;
65898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65900         return ret_ref;
65901 }
65902
65903 int64_t  CS_LDK_PaymentParameters_from_bolt12_invoice(int64_t invoice) {
65904         LDKBolt12Invoice invoice_conv;
65905         invoice_conv.inner = untag_ptr(invoice);
65906         invoice_conv.is_owned = ptr_is_owned(invoice);
65907         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
65908         invoice_conv.is_owned = false;
65909         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
65910         int64_t ret_ref = 0;
65911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65913         return ret_ref;
65914 }
65915
65916 int64_t  CS_LDK_PaymentParameters_blinded(int64_tArray blinded_route_hints) {
65917         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
65918         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
65919         if (blinded_route_hints_constr.datalen > 0)
65920                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65921         else
65922                 blinded_route_hints_constr.data = NULL;
65923         int64_t* blinded_route_hints_vals = blinded_route_hints->elems;
65924         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
65925                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
65926                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
65927                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
65928                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
65929                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
65930                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
65931         }
65932         FREE(blinded_route_hints);
65933         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
65934         int64_t ret_ref = 0;
65935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65937         return ret_ref;
65938 }
65939
65940 void  CS_LDK_Payee_free(int64_t this_ptr) {
65941         if (!ptr_is_owned(this_ptr)) return;
65942         void* this_ptr_ptr = untag_ptr(this_ptr);
65943         CHECK_ACCESS(this_ptr_ptr);
65944         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
65945         FREE(untag_ptr(this_ptr));
65946         Payee_free(this_ptr_conv);
65947 }
65948
65949 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
65950         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65951         *ret_copy = Payee_clone(arg);
65952         int64_t ret_ref = tag_ptr(ret_copy, true);
65953         return ret_ref;
65954 }
65955 int64_t  CS_LDK_Payee_clone_ptr(int64_t arg) {
65956         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
65957         int64_t ret_conv = Payee_clone_ptr(arg_conv);
65958         return ret_conv;
65959 }
65960
65961 int64_t  CS_LDK_Payee_clone(int64_t orig) {
65962         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
65963         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65964         *ret_copy = Payee_clone(orig_conv);
65965         int64_t ret_ref = tag_ptr(ret_copy, true);
65966         return ret_ref;
65967 }
65968
65969 int64_t  CS_LDK_Payee_blinded(int64_tArray route_hints, int64_t features) {
65970         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
65971         route_hints_constr.datalen = route_hints->arr_len;
65972         if (route_hints_constr.datalen > 0)
65973                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
65974         else
65975                 route_hints_constr.data = NULL;
65976         int64_t* route_hints_vals = route_hints->elems;
65977         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
65978                 int64_t route_hints_conv_37 = route_hints_vals[l];
65979                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
65980                 CHECK_ACCESS(route_hints_conv_37_ptr);
65981                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
65982                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
65983                 route_hints_constr.data[l] = route_hints_conv_37_conv;
65984         }
65985         FREE(route_hints);
65986         LDKBolt12InvoiceFeatures features_conv;
65987         features_conv.inner = untag_ptr(features);
65988         features_conv.is_owned = ptr_is_owned(features);
65989         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
65990         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
65991         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
65992         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
65993         int64_t ret_ref = tag_ptr(ret_copy, true);
65994         return ret_ref;
65995 }
65996
65997 int64_t  CS_LDK_Payee_clear(int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
65998         LDKPublicKey node_id_ref;
65999         CHECK(node_id->arr_len == 33);
66000         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
66001         LDKCVec_RouteHintZ route_hints_constr;
66002         route_hints_constr.datalen = route_hints->arr_len;
66003         if (route_hints_constr.datalen > 0)
66004                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
66005         else
66006                 route_hints_constr.data = NULL;
66007         int64_t* route_hints_vals = route_hints->elems;
66008         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
66009                 int64_t route_hints_conv_11 = route_hints_vals[l];
66010                 LDKRouteHint route_hints_conv_11_conv;
66011                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
66012                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
66013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
66014                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
66015                 route_hints_constr.data[l] = route_hints_conv_11_conv;
66016         }
66017         FREE(route_hints);
66018         LDKBolt11InvoiceFeatures features_conv;
66019         features_conv.inner = untag_ptr(features);
66020         features_conv.is_owned = ptr_is_owned(features);
66021         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
66022         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
66023         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
66024         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
66025         int64_t ret_ref = tag_ptr(ret_copy, true);
66026         return ret_ref;
66027 }
66028
66029 int64_t  CS_LDK_Payee_hash(int64_t o) {
66030         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
66031         int64_t ret_conv = Payee_hash(o_conv);
66032         return ret_conv;
66033 }
66034
66035 jboolean  CS_LDK_Payee_eq(int64_t a, int64_t b) {
66036         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
66037         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
66038         jboolean ret_conv = Payee_eq(a_conv, b_conv);
66039         return ret_conv;
66040 }
66041
66042 void  CS_LDK_RouteHint_free(int64_t this_obj) {
66043         LDKRouteHint this_obj_conv;
66044         this_obj_conv.inner = untag_ptr(this_obj);
66045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66047         RouteHint_free(this_obj_conv);
66048 }
66049
66050 int64_tArray  CS_LDK_RouteHint_get_a(int64_t this_ptr) {
66051         LDKRouteHint this_ptr_conv;
66052         this_ptr_conv.inner = untag_ptr(this_ptr);
66053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66055         this_ptr_conv.is_owned = false;
66056         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
66057         int64_tArray ret_arr = NULL;
66058         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66059         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66060         for (size_t o = 0; o < ret_var.datalen; o++) {
66061                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
66062                 int64_t ret_conv_14_ref = 0;
66063                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
66064                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
66065                 ret_arr_ptr[o] = ret_conv_14_ref;
66066         }
66067         
66068         FREE(ret_var.data);
66069         return ret_arr;
66070 }
66071
66072 void  CS_LDK_RouteHint_set_a(int64_t this_ptr, int64_tArray val) {
66073         LDKRouteHint this_ptr_conv;
66074         this_ptr_conv.inner = untag_ptr(this_ptr);
66075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66077         this_ptr_conv.is_owned = false;
66078         LDKCVec_RouteHintHopZ val_constr;
66079         val_constr.datalen = val->arr_len;
66080         if (val_constr.datalen > 0)
66081                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
66082         else
66083                 val_constr.data = NULL;
66084         int64_t* val_vals = val->elems;
66085         for (size_t o = 0; o < val_constr.datalen; o++) {
66086                 int64_t val_conv_14 = val_vals[o];
66087                 LDKRouteHintHop val_conv_14_conv;
66088                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
66089                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
66090                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
66091                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
66092                 val_constr.data[o] = val_conv_14_conv;
66093         }
66094         FREE(val);
66095         RouteHint_set_a(&this_ptr_conv, val_constr);
66096 }
66097
66098 int64_t  CS_LDK_RouteHint_new(int64_tArray a_arg) {
66099         LDKCVec_RouteHintHopZ a_arg_constr;
66100         a_arg_constr.datalen = a_arg->arr_len;
66101         if (a_arg_constr.datalen > 0)
66102                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
66103         else
66104                 a_arg_constr.data = NULL;
66105         int64_t* a_arg_vals = a_arg->elems;
66106         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
66107                 int64_t a_arg_conv_14 = a_arg_vals[o];
66108                 LDKRouteHintHop a_arg_conv_14_conv;
66109                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
66110                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
66111                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
66112                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
66113                 a_arg_constr.data[o] = a_arg_conv_14_conv;
66114         }
66115         FREE(a_arg);
66116         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
66117         int64_t ret_ref = 0;
66118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66120         return ret_ref;
66121 }
66122
66123 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
66124         LDKRouteHint ret_var = RouteHint_clone(arg);
66125         int64_t ret_ref = 0;
66126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66128         return ret_ref;
66129 }
66130 int64_t  CS_LDK_RouteHint_clone_ptr(int64_t arg) {
66131         LDKRouteHint arg_conv;
66132         arg_conv.inner = untag_ptr(arg);
66133         arg_conv.is_owned = ptr_is_owned(arg);
66134         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66135         arg_conv.is_owned = false;
66136         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
66137         return ret_conv;
66138 }
66139
66140 int64_t  CS_LDK_RouteHint_clone(int64_t orig) {
66141         LDKRouteHint orig_conv;
66142         orig_conv.inner = untag_ptr(orig);
66143         orig_conv.is_owned = ptr_is_owned(orig);
66144         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66145         orig_conv.is_owned = false;
66146         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
66147         int64_t ret_ref = 0;
66148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66150         return ret_ref;
66151 }
66152
66153 int64_t  CS_LDK_RouteHint_hash(int64_t o) {
66154         LDKRouteHint o_conv;
66155         o_conv.inner = untag_ptr(o);
66156         o_conv.is_owned = ptr_is_owned(o);
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66158         o_conv.is_owned = false;
66159         int64_t ret_conv = RouteHint_hash(&o_conv);
66160         return ret_conv;
66161 }
66162
66163 jboolean  CS_LDK_RouteHint_eq(int64_t a, int64_t b) {
66164         LDKRouteHint a_conv;
66165         a_conv.inner = untag_ptr(a);
66166         a_conv.is_owned = ptr_is_owned(a);
66167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66168         a_conv.is_owned = false;
66169         LDKRouteHint b_conv;
66170         b_conv.inner = untag_ptr(b);
66171         b_conv.is_owned = ptr_is_owned(b);
66172         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66173         b_conv.is_owned = false;
66174         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
66175         return ret_conv;
66176 }
66177
66178 int8_tArray  CS_LDK_RouteHint_write(int64_t obj) {
66179         LDKRouteHint obj_conv;
66180         obj_conv.inner = untag_ptr(obj);
66181         obj_conv.is_owned = ptr_is_owned(obj);
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66183         obj_conv.is_owned = false;
66184         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
66185         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66186         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66187         CVec_u8Z_free(ret_var);
66188         return ret_arr;
66189 }
66190
66191 int64_t  CS_LDK_RouteHint_read(int8_tArray ser) {
66192         LDKu8slice ser_ref;
66193         ser_ref.datalen = ser->arr_len;
66194         ser_ref.data = ser->elems;
66195         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
66196         *ret_conv = RouteHint_read(ser_ref);
66197         FREE(ser);
66198         return tag_ptr(ret_conv, true);
66199 }
66200
66201 void  CS_LDK_RouteHintHop_free(int64_t this_obj) {
66202         LDKRouteHintHop this_obj_conv;
66203         this_obj_conv.inner = untag_ptr(this_obj);
66204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66206         RouteHintHop_free(this_obj_conv);
66207 }
66208
66209 int8_tArray  CS_LDK_RouteHintHop_get_src_node_id(int64_t this_ptr) {
66210         LDKRouteHintHop this_ptr_conv;
66211         this_ptr_conv.inner = untag_ptr(this_ptr);
66212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66214         this_ptr_conv.is_owned = false;
66215         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66216         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
66217         return ret_arr;
66218 }
66219
66220 void  CS_LDK_RouteHintHop_set_src_node_id(int64_t this_ptr, int8_tArray val) {
66221         LDKRouteHintHop this_ptr_conv;
66222         this_ptr_conv.inner = untag_ptr(this_ptr);
66223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66225         this_ptr_conv.is_owned = false;
66226         LDKPublicKey val_ref;
66227         CHECK(val->arr_len == 33);
66228         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
66229         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
66230 }
66231
66232 int64_t  CS_LDK_RouteHintHop_get_short_channel_id(int64_t this_ptr) {
66233         LDKRouteHintHop this_ptr_conv;
66234         this_ptr_conv.inner = untag_ptr(this_ptr);
66235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66237         this_ptr_conv.is_owned = false;
66238         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
66239         return ret_conv;
66240 }
66241
66242 void  CS_LDK_RouteHintHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
66243         LDKRouteHintHop this_ptr_conv;
66244         this_ptr_conv.inner = untag_ptr(this_ptr);
66245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66247         this_ptr_conv.is_owned = false;
66248         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
66249 }
66250
66251 int64_t  CS_LDK_RouteHintHop_get_fees(int64_t this_ptr) {
66252         LDKRouteHintHop this_ptr_conv;
66253         this_ptr_conv.inner = untag_ptr(this_ptr);
66254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66256         this_ptr_conv.is_owned = false;
66257         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
66258         int64_t ret_ref = 0;
66259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66261         return ret_ref;
66262 }
66263
66264 void  CS_LDK_RouteHintHop_set_fees(int64_t this_ptr, int64_t val) {
66265         LDKRouteHintHop this_ptr_conv;
66266         this_ptr_conv.inner = untag_ptr(this_ptr);
66267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66269         this_ptr_conv.is_owned = false;
66270         LDKRoutingFees val_conv;
66271         val_conv.inner = untag_ptr(val);
66272         val_conv.is_owned = ptr_is_owned(val);
66273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66274         val_conv = RoutingFees_clone(&val_conv);
66275         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
66276 }
66277
66278 int16_t  CS_LDK_RouteHintHop_get_cltv_expiry_delta(int64_t this_ptr) {
66279         LDKRouteHintHop this_ptr_conv;
66280         this_ptr_conv.inner = untag_ptr(this_ptr);
66281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66283         this_ptr_conv.is_owned = false;
66284         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
66285         return ret_conv;
66286 }
66287
66288 void  CS_LDK_RouteHintHop_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
66289         LDKRouteHintHop this_ptr_conv;
66290         this_ptr_conv.inner = untag_ptr(this_ptr);
66291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66293         this_ptr_conv.is_owned = false;
66294         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
66295 }
66296
66297 int64_t  CS_LDK_RouteHintHop_get_htlc_minimum_msat(int64_t this_ptr) {
66298         LDKRouteHintHop this_ptr_conv;
66299         this_ptr_conv.inner = untag_ptr(this_ptr);
66300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66302         this_ptr_conv.is_owned = false;
66303         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66304         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
66305         int64_t ret_ref = tag_ptr(ret_copy, true);
66306         return ret_ref;
66307 }
66308
66309 void  CS_LDK_RouteHintHop_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
66310         LDKRouteHintHop this_ptr_conv;
66311         this_ptr_conv.inner = untag_ptr(this_ptr);
66312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66314         this_ptr_conv.is_owned = false;
66315         void* val_ptr = untag_ptr(val);
66316         CHECK_ACCESS(val_ptr);
66317         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66318         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66319         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
66320 }
66321
66322 int64_t  CS_LDK_RouteHintHop_get_htlc_maximum_msat(int64_t this_ptr) {
66323         LDKRouteHintHop this_ptr_conv;
66324         this_ptr_conv.inner = untag_ptr(this_ptr);
66325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66327         this_ptr_conv.is_owned = false;
66328         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66329         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
66330         int64_t ret_ref = tag_ptr(ret_copy, true);
66331         return ret_ref;
66332 }
66333
66334 void  CS_LDK_RouteHintHop_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
66335         LDKRouteHintHop this_ptr_conv;
66336         this_ptr_conv.inner = untag_ptr(this_ptr);
66337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66339         this_ptr_conv.is_owned = false;
66340         void* val_ptr = untag_ptr(val);
66341         CHECK_ACCESS(val_ptr);
66342         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
66343         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
66344         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
66345 }
66346
66347 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) {
66348         LDKPublicKey src_node_id_arg_ref;
66349         CHECK(src_node_id_arg->arr_len == 33);
66350         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
66351         LDKRoutingFees fees_arg_conv;
66352         fees_arg_conv.inner = untag_ptr(fees_arg);
66353         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
66354         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
66355         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
66356         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
66357         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
66358         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
66359         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
66360         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
66361         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
66362         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
66363         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
66364         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);
66365         int64_t ret_ref = 0;
66366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66368         return ret_ref;
66369 }
66370
66371 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
66372         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
66373         int64_t ret_ref = 0;
66374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66376         return ret_ref;
66377 }
66378 int64_t  CS_LDK_RouteHintHop_clone_ptr(int64_t arg) {
66379         LDKRouteHintHop arg_conv;
66380         arg_conv.inner = untag_ptr(arg);
66381         arg_conv.is_owned = ptr_is_owned(arg);
66382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66383         arg_conv.is_owned = false;
66384         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
66385         return ret_conv;
66386 }
66387
66388 int64_t  CS_LDK_RouteHintHop_clone(int64_t orig) {
66389         LDKRouteHintHop orig_conv;
66390         orig_conv.inner = untag_ptr(orig);
66391         orig_conv.is_owned = ptr_is_owned(orig);
66392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66393         orig_conv.is_owned = false;
66394         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
66395         int64_t ret_ref = 0;
66396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66398         return ret_ref;
66399 }
66400
66401 int64_t  CS_LDK_RouteHintHop_hash(int64_t o) {
66402         LDKRouteHintHop o_conv;
66403         o_conv.inner = untag_ptr(o);
66404         o_conv.is_owned = ptr_is_owned(o);
66405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66406         o_conv.is_owned = false;
66407         int64_t ret_conv = RouteHintHop_hash(&o_conv);
66408         return ret_conv;
66409 }
66410
66411 jboolean  CS_LDK_RouteHintHop_eq(int64_t a, int64_t b) {
66412         LDKRouteHintHop a_conv;
66413         a_conv.inner = untag_ptr(a);
66414         a_conv.is_owned = ptr_is_owned(a);
66415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66416         a_conv.is_owned = false;
66417         LDKRouteHintHop b_conv;
66418         b_conv.inner = untag_ptr(b);
66419         b_conv.is_owned = ptr_is_owned(b);
66420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66421         b_conv.is_owned = false;
66422         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
66423         return ret_conv;
66424 }
66425
66426 int8_tArray  CS_LDK_RouteHintHop_write(int64_t obj) {
66427         LDKRouteHintHop obj_conv;
66428         obj_conv.inner = untag_ptr(obj);
66429         obj_conv.is_owned = ptr_is_owned(obj);
66430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66431         obj_conv.is_owned = false;
66432         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
66433         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66434         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66435         CVec_u8Z_free(ret_var);
66436         return ret_arr;
66437 }
66438
66439 int64_t  CS_LDK_RouteHintHop_read(int8_tArray ser) {
66440         LDKu8slice ser_ref;
66441         ser_ref.datalen = ser->arr_len;
66442         ser_ref.data = ser->elems;
66443         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
66444         *ret_conv = RouteHintHop_read(ser_ref);
66445         FREE(ser);
66446         return tag_ptr(ret_conv, true);
66447 }
66448
66449 void  CS_LDK_FirstHopCandidate_free(int64_t this_obj) {
66450         LDKFirstHopCandidate this_obj_conv;
66451         this_obj_conv.inner = untag_ptr(this_obj);
66452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66454         FirstHopCandidate_free(this_obj_conv);
66455 }
66456
66457 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
66458         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
66459         int64_t ret_ref = 0;
66460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66462         return ret_ref;
66463 }
66464 int64_t  CS_LDK_FirstHopCandidate_clone_ptr(int64_t arg) {
66465         LDKFirstHopCandidate arg_conv;
66466         arg_conv.inner = untag_ptr(arg);
66467         arg_conv.is_owned = ptr_is_owned(arg);
66468         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66469         arg_conv.is_owned = false;
66470         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
66471         return ret_conv;
66472 }
66473
66474 int64_t  CS_LDK_FirstHopCandidate_clone(int64_t orig) {
66475         LDKFirstHopCandidate orig_conv;
66476         orig_conv.inner = untag_ptr(orig);
66477         orig_conv.is_owned = ptr_is_owned(orig);
66478         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66479         orig_conv.is_owned = false;
66480         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
66481         int64_t ret_ref = 0;
66482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66484         return ret_ref;
66485 }
66486
66487 void  CS_LDK_PublicHopCandidate_free(int64_t this_obj) {
66488         LDKPublicHopCandidate this_obj_conv;
66489         this_obj_conv.inner = untag_ptr(this_obj);
66490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66492         PublicHopCandidate_free(this_obj_conv);
66493 }
66494
66495 int64_t  CS_LDK_PublicHopCandidate_get_short_channel_id(int64_t this_ptr) {
66496         LDKPublicHopCandidate this_ptr_conv;
66497         this_ptr_conv.inner = untag_ptr(this_ptr);
66498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66500         this_ptr_conv.is_owned = false;
66501         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
66502         return ret_conv;
66503 }
66504
66505 void  CS_LDK_PublicHopCandidate_set_short_channel_id(int64_t this_ptr, int64_t val) {
66506         LDKPublicHopCandidate this_ptr_conv;
66507         this_ptr_conv.inner = untag_ptr(this_ptr);
66508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66510         this_ptr_conv.is_owned = false;
66511         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
66512 }
66513
66514 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
66515         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
66516         int64_t ret_ref = 0;
66517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66519         return ret_ref;
66520 }
66521 int64_t  CS_LDK_PublicHopCandidate_clone_ptr(int64_t arg) {
66522         LDKPublicHopCandidate arg_conv;
66523         arg_conv.inner = untag_ptr(arg);
66524         arg_conv.is_owned = ptr_is_owned(arg);
66525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66526         arg_conv.is_owned = false;
66527         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
66528         return ret_conv;
66529 }
66530
66531 int64_t  CS_LDK_PublicHopCandidate_clone(int64_t orig) {
66532         LDKPublicHopCandidate orig_conv;
66533         orig_conv.inner = untag_ptr(orig);
66534         orig_conv.is_owned = ptr_is_owned(orig);
66535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66536         orig_conv.is_owned = false;
66537         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
66538         int64_t ret_ref = 0;
66539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66541         return ret_ref;
66542 }
66543
66544 void  CS_LDK_PrivateHopCandidate_free(int64_t this_obj) {
66545         LDKPrivateHopCandidate this_obj_conv;
66546         this_obj_conv.inner = untag_ptr(this_obj);
66547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66549         PrivateHopCandidate_free(this_obj_conv);
66550 }
66551
66552 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
66553         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
66554         int64_t ret_ref = 0;
66555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66557         return ret_ref;
66558 }
66559 int64_t  CS_LDK_PrivateHopCandidate_clone_ptr(int64_t arg) {
66560         LDKPrivateHopCandidate arg_conv;
66561         arg_conv.inner = untag_ptr(arg);
66562         arg_conv.is_owned = ptr_is_owned(arg);
66563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66564         arg_conv.is_owned = false;
66565         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
66566         return ret_conv;
66567 }
66568
66569 int64_t  CS_LDK_PrivateHopCandidate_clone(int64_t orig) {
66570         LDKPrivateHopCandidate orig_conv;
66571         orig_conv.inner = untag_ptr(orig);
66572         orig_conv.is_owned = ptr_is_owned(orig);
66573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66574         orig_conv.is_owned = false;
66575         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
66576         int64_t ret_ref = 0;
66577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66579         return ret_ref;
66580 }
66581
66582 void  CS_LDK_BlindedPathCandidate_free(int64_t this_obj) {
66583         LDKBlindedPathCandidate this_obj_conv;
66584         this_obj_conv.inner = untag_ptr(this_obj);
66585         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66587         BlindedPathCandidate_free(this_obj_conv);
66588 }
66589
66590 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
66591         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
66592         int64_t ret_ref = 0;
66593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66595         return ret_ref;
66596 }
66597 int64_t  CS_LDK_BlindedPathCandidate_clone_ptr(int64_t arg) {
66598         LDKBlindedPathCandidate arg_conv;
66599         arg_conv.inner = untag_ptr(arg);
66600         arg_conv.is_owned = ptr_is_owned(arg);
66601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66602         arg_conv.is_owned = false;
66603         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
66604         return ret_conv;
66605 }
66606
66607 int64_t  CS_LDK_BlindedPathCandidate_clone(int64_t orig) {
66608         LDKBlindedPathCandidate orig_conv;
66609         orig_conv.inner = untag_ptr(orig);
66610         orig_conv.is_owned = ptr_is_owned(orig);
66611         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66612         orig_conv.is_owned = false;
66613         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
66614         int64_t ret_ref = 0;
66615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66617         return ret_ref;
66618 }
66619
66620 void  CS_LDK_OneHopBlindedPathCandidate_free(int64_t this_obj) {
66621         LDKOneHopBlindedPathCandidate this_obj_conv;
66622         this_obj_conv.inner = untag_ptr(this_obj);
66623         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66625         OneHopBlindedPathCandidate_free(this_obj_conv);
66626 }
66627
66628 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
66629         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
66630         int64_t ret_ref = 0;
66631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66633         return ret_ref;
66634 }
66635 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone_ptr(int64_t arg) {
66636         LDKOneHopBlindedPathCandidate arg_conv;
66637         arg_conv.inner = untag_ptr(arg);
66638         arg_conv.is_owned = ptr_is_owned(arg);
66639         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66640         arg_conv.is_owned = false;
66641         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
66642         return ret_conv;
66643 }
66644
66645 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone(int64_t orig) {
66646         LDKOneHopBlindedPathCandidate orig_conv;
66647         orig_conv.inner = untag_ptr(orig);
66648         orig_conv.is_owned = ptr_is_owned(orig);
66649         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66650         orig_conv.is_owned = false;
66651         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
66652         int64_t ret_ref = 0;
66653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66655         return ret_ref;
66656 }
66657
66658 void  CS_LDK_CandidateRouteHop_free(int64_t this_ptr) {
66659         if (!ptr_is_owned(this_ptr)) return;
66660         void* this_ptr_ptr = untag_ptr(this_ptr);
66661         CHECK_ACCESS(this_ptr_ptr);
66662         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
66663         FREE(untag_ptr(this_ptr));
66664         CandidateRouteHop_free(this_ptr_conv);
66665 }
66666
66667 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
66668         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66669         *ret_copy = CandidateRouteHop_clone(arg);
66670         int64_t ret_ref = tag_ptr(ret_copy, true);
66671         return ret_ref;
66672 }
66673 int64_t  CS_LDK_CandidateRouteHop_clone_ptr(int64_t arg) {
66674         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
66675         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
66676         return ret_conv;
66677 }
66678
66679 int64_t  CS_LDK_CandidateRouteHop_clone(int64_t orig) {
66680         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
66681         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66682         *ret_copy = CandidateRouteHop_clone(orig_conv);
66683         int64_t ret_ref = tag_ptr(ret_copy, true);
66684         return ret_ref;
66685 }
66686
66687 int64_t  CS_LDK_CandidateRouteHop_first_hop(int64_t a) {
66688         LDKFirstHopCandidate a_conv;
66689         a_conv.inner = untag_ptr(a);
66690         a_conv.is_owned = ptr_is_owned(a);
66691         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66692         a_conv = FirstHopCandidate_clone(&a_conv);
66693         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66694         *ret_copy = CandidateRouteHop_first_hop(a_conv);
66695         int64_t ret_ref = tag_ptr(ret_copy, true);
66696         return ret_ref;
66697 }
66698
66699 int64_t  CS_LDK_CandidateRouteHop_public_hop(int64_t a) {
66700         LDKPublicHopCandidate a_conv;
66701         a_conv.inner = untag_ptr(a);
66702         a_conv.is_owned = ptr_is_owned(a);
66703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66704         a_conv = PublicHopCandidate_clone(&a_conv);
66705         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66706         *ret_copy = CandidateRouteHop_public_hop(a_conv);
66707         int64_t ret_ref = tag_ptr(ret_copy, true);
66708         return ret_ref;
66709 }
66710
66711 int64_t  CS_LDK_CandidateRouteHop_private_hop(int64_t a) {
66712         LDKPrivateHopCandidate a_conv;
66713         a_conv.inner = untag_ptr(a);
66714         a_conv.is_owned = ptr_is_owned(a);
66715         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66716         a_conv = PrivateHopCandidate_clone(&a_conv);
66717         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66718         *ret_copy = CandidateRouteHop_private_hop(a_conv);
66719         int64_t ret_ref = tag_ptr(ret_copy, true);
66720         return ret_ref;
66721 }
66722
66723 int64_t  CS_LDK_CandidateRouteHop_blinded(int64_t a) {
66724         LDKBlindedPathCandidate a_conv;
66725         a_conv.inner = untag_ptr(a);
66726         a_conv.is_owned = ptr_is_owned(a);
66727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66728         a_conv = BlindedPathCandidate_clone(&a_conv);
66729         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66730         *ret_copy = CandidateRouteHop_blinded(a_conv);
66731         int64_t ret_ref = tag_ptr(ret_copy, true);
66732         return ret_ref;
66733 }
66734
66735 int64_t  CS_LDK_CandidateRouteHop_one_hop_blinded(int64_t a) {
66736         LDKOneHopBlindedPathCandidate a_conv;
66737         a_conv.inner = untag_ptr(a);
66738         a_conv.is_owned = ptr_is_owned(a);
66739         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66740         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
66741         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
66742         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
66743         int64_t ret_ref = tag_ptr(ret_copy, true);
66744         return ret_ref;
66745 }
66746
66747 int64_t  CS_LDK_CandidateRouteHop_globally_unique_short_channel_id(int64_t this_arg) {
66748         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66749         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66750         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
66751         int64_t ret_ref = tag_ptr(ret_copy, true);
66752         return ret_ref;
66753 }
66754
66755 int32_t  CS_LDK_CandidateRouteHop_cltv_expiry_delta(int64_t this_arg) {
66756         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66757         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
66758         return ret_conv;
66759 }
66760
66761 int64_t  CS_LDK_CandidateRouteHop_htlc_minimum_msat(int64_t this_arg) {
66762         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66763         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
66764         return ret_conv;
66765 }
66766
66767 int64_t  CS_LDK_CandidateRouteHop_fees(int64_t this_arg) {
66768         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66769         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
66770         int64_t ret_ref = 0;
66771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66773         return ret_ref;
66774 }
66775
66776 int64_t  CS_LDK_CandidateRouteHop_source(int64_t this_arg) {
66777         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66778         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
66779         int64_t ret_ref = 0;
66780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66782         return ret_ref;
66783 }
66784
66785 int64_t  CS_LDK_CandidateRouteHop_target(int64_t this_arg) {
66786         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
66787         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
66788         int64_t ret_ref = 0;
66789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66791         return ret_ref;
66792 }
66793
66794 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) {
66795         LDKPublicKey our_node_pubkey_ref;
66796         CHECK(our_node_pubkey->arr_len == 33);
66797         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66798         LDKRouteParameters route_params_conv;
66799         route_params_conv.inner = untag_ptr(route_params);
66800         route_params_conv.is_owned = ptr_is_owned(route_params);
66801         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66802         route_params_conv.is_owned = false;
66803         LDKNetworkGraph network_graph_conv;
66804         network_graph_conv.inner = untag_ptr(network_graph);
66805         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66806         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66807         network_graph_conv.is_owned = false;
66808         LDKCVec_ChannelDetailsZ first_hops_constr;
66809         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
66810         if (first_hops != NULL) {
66811                 first_hops_constr.datalen = first_hops->arr_len;
66812                 if (first_hops_constr.datalen > 0)
66813                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
66814                 else
66815                         first_hops_constr.data = NULL;
66816                 int64_t* first_hops_vals = first_hops->elems;
66817                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
66818                         int64_t first_hops_conv_16 = first_hops_vals[q];
66819                         LDKChannelDetails first_hops_conv_16_conv;
66820                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
66821                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
66822                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
66823                         first_hops_conv_16_conv.is_owned = false;
66824                         first_hops_constr.data[q] = first_hops_conv_16_conv;
66825                 }
66826                 FREE(first_hops);
66827                 first_hops_ptr = &first_hops_constr;
66828         }
66829         void* logger_ptr = untag_ptr(logger);
66830         CHECK_ACCESS(logger_ptr);
66831         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66832         if (logger_conv.free == LDKLogger_JCalls_free) {
66833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66834                 LDKLogger_JCalls_cloned(&logger_conv);
66835         }
66836         void* scorer_ptr = untag_ptr(scorer);
66837         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
66838         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
66839         LDKProbabilisticScoringFeeParameters score_params_conv;
66840         score_params_conv.inner = untag_ptr(score_params);
66841         score_params_conv.is_owned = ptr_is_owned(score_params);
66842         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
66843         score_params_conv.is_owned = false;
66844         uint8_t random_seed_bytes_arr[32];
66845         CHECK(random_seed_bytes->arr_len == 32);
66846         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66847         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66848         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66849         *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);
66850         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
66851         return tag_ptr(ret_conv, true);
66852 }
66853
66854 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) {
66855         LDKPublicKey our_node_pubkey_ref;
66856         CHECK(our_node_pubkey->arr_len == 33);
66857         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
66858         LDKCVec_PublicKeyZ hops_constr;
66859         hops_constr.datalen = hops->arr_len;
66860         if (hops_constr.datalen > 0)
66861                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
66862         else
66863                 hops_constr.data = NULL;
66864         int8_tArray* hops_vals = (void*) hops->elems;
66865         for (size_t i = 0; i < hops_constr.datalen; i++) {
66866                 int8_tArray hops_conv_8 = hops_vals[i];
66867                 LDKPublicKey hops_conv_8_ref;
66868                 CHECK(hops_conv_8->arr_len == 33);
66869                 memcpy(hops_conv_8_ref.compressed_form, hops_conv_8->elems, 33); FREE(hops_conv_8);
66870                 hops_constr.data[i] = hops_conv_8_ref;
66871         }
66872         FREE(hops);
66873         LDKRouteParameters route_params_conv;
66874         route_params_conv.inner = untag_ptr(route_params);
66875         route_params_conv.is_owned = ptr_is_owned(route_params);
66876         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
66877         route_params_conv.is_owned = false;
66878         LDKNetworkGraph network_graph_conv;
66879         network_graph_conv.inner = untag_ptr(network_graph);
66880         network_graph_conv.is_owned = ptr_is_owned(network_graph);
66881         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
66882         network_graph_conv.is_owned = false;
66883         void* logger_ptr = untag_ptr(logger);
66884         CHECK_ACCESS(logger_ptr);
66885         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66886         if (logger_conv.free == LDKLogger_JCalls_free) {
66887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66888                 LDKLogger_JCalls_cloned(&logger_conv);
66889         }
66890         uint8_t random_seed_bytes_arr[32];
66891         CHECK(random_seed_bytes->arr_len == 32);
66892         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
66893         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
66894         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
66895         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
66896         return tag_ptr(ret_conv, true);
66897 }
66898
66899 void  CS_LDK_ScoreLookUp_free(int64_t this_ptr) {
66900         if (!ptr_is_owned(this_ptr)) return;
66901         void* this_ptr_ptr = untag_ptr(this_ptr);
66902         CHECK_ACCESS(this_ptr_ptr);
66903         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
66904         FREE(untag_ptr(this_ptr));
66905         ScoreLookUp_free(this_ptr_conv);
66906 }
66907
66908 void  CS_LDK_ScoreUpdate_free(int64_t this_ptr) {
66909         if (!ptr_is_owned(this_ptr)) return;
66910         void* this_ptr_ptr = untag_ptr(this_ptr);
66911         CHECK_ACCESS(this_ptr_ptr);
66912         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
66913         FREE(untag_ptr(this_ptr));
66914         ScoreUpdate_free(this_ptr_conv);
66915 }
66916
66917 void  CS_LDK_Score_free(int64_t this_ptr) {
66918         if (!ptr_is_owned(this_ptr)) return;
66919         void* this_ptr_ptr = untag_ptr(this_ptr);
66920         CHECK_ACCESS(this_ptr_ptr);
66921         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
66922         FREE(untag_ptr(this_ptr));
66923         Score_free(this_ptr_conv);
66924 }
66925
66926 void  CS_LDK_LockableScore_free(int64_t this_ptr) {
66927         if (!ptr_is_owned(this_ptr)) return;
66928         void* this_ptr_ptr = untag_ptr(this_ptr);
66929         CHECK_ACCESS(this_ptr_ptr);
66930         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
66931         FREE(untag_ptr(this_ptr));
66932         LockableScore_free(this_ptr_conv);
66933 }
66934
66935 void  CS_LDK_WriteableScore_free(int64_t this_ptr) {
66936         if (!ptr_is_owned(this_ptr)) return;
66937         void* this_ptr_ptr = untag_ptr(this_ptr);
66938         CHECK_ACCESS(this_ptr_ptr);
66939         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
66940         FREE(untag_ptr(this_ptr));
66941         WriteableScore_free(this_ptr_conv);
66942 }
66943
66944 void  CS_LDK_MultiThreadedLockableScore_free(int64_t this_obj) {
66945         LDKMultiThreadedLockableScore this_obj_conv;
66946         this_obj_conv.inner = untag_ptr(this_obj);
66947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66949         MultiThreadedLockableScore_free(this_obj_conv);
66950 }
66951
66952 int64_t  CS_LDK_MultiThreadedLockableScore_as_LockableScore(int64_t this_arg) {
66953         LDKMultiThreadedLockableScore this_arg_conv;
66954         this_arg_conv.inner = untag_ptr(this_arg);
66955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66957         this_arg_conv.is_owned = false;
66958         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
66959         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
66960         return tag_ptr(ret_ret, true);
66961 }
66962
66963 int8_tArray  CS_LDK_MultiThreadedLockableScore_write(int64_t obj) {
66964         LDKMultiThreadedLockableScore obj_conv;
66965         obj_conv.inner = untag_ptr(obj);
66966         obj_conv.is_owned = ptr_is_owned(obj);
66967         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66968         obj_conv.is_owned = false;
66969         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
66970         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66971         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66972         CVec_u8Z_free(ret_var);
66973         return ret_arr;
66974 }
66975
66976 int64_t  CS_LDK_MultiThreadedLockableScore_as_WriteableScore(int64_t this_arg) {
66977         LDKMultiThreadedLockableScore this_arg_conv;
66978         this_arg_conv.inner = untag_ptr(this_arg);
66979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66981         this_arg_conv.is_owned = false;
66982         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
66983         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
66984         return tag_ptr(ret_ret, true);
66985 }
66986
66987 int64_t  CS_LDK_MultiThreadedLockableScore_new(int64_t score) {
66988         void* score_ptr = untag_ptr(score);
66989         CHECK_ACCESS(score_ptr);
66990         LDKScore score_conv = *(LDKScore*)(score_ptr);
66991         if (score_conv.free == LDKScore_JCalls_free) {
66992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66993                 LDKScore_JCalls_cloned(&score_conv);
66994         }
66995         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
66996         int64_t ret_ref = 0;
66997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66999         return ret_ref;
67000 }
67001
67002 void  CS_LDK_MultiThreadedScoreLockRead_free(int64_t this_obj) {
67003         LDKMultiThreadedScoreLockRead this_obj_conv;
67004         this_obj_conv.inner = untag_ptr(this_obj);
67005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67007         MultiThreadedScoreLockRead_free(this_obj_conv);
67008 }
67009
67010 void  CS_LDK_MultiThreadedScoreLockWrite_free(int64_t this_obj) {
67011         LDKMultiThreadedScoreLockWrite this_obj_conv;
67012         this_obj_conv.inner = untag_ptr(this_obj);
67013         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67015         MultiThreadedScoreLockWrite_free(this_obj_conv);
67016 }
67017
67018 int64_t  CS_LDK_MultiThreadedScoreLockRead_as_ScoreLookUp(int64_t this_arg) {
67019         LDKMultiThreadedScoreLockRead this_arg_conv;
67020         this_arg_conv.inner = untag_ptr(this_arg);
67021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67023         this_arg_conv.is_owned = false;
67024         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67025         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
67026         return tag_ptr(ret_ret, true);
67027 }
67028
67029 int8_tArray  CS_LDK_MultiThreadedScoreLockWrite_write(int64_t obj) {
67030         LDKMultiThreadedScoreLockWrite obj_conv;
67031         obj_conv.inner = untag_ptr(obj);
67032         obj_conv.is_owned = ptr_is_owned(obj);
67033         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67034         obj_conv.is_owned = false;
67035         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
67036         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67037         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67038         CVec_u8Z_free(ret_var);
67039         return ret_arr;
67040 }
67041
67042 int64_t  CS_LDK_MultiThreadedScoreLockWrite_as_ScoreUpdate(int64_t this_arg) {
67043         LDKMultiThreadedScoreLockWrite this_arg_conv;
67044         this_arg_conv.inner = untag_ptr(this_arg);
67045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67047         this_arg_conv.is_owned = false;
67048         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67049         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
67050         return tag_ptr(ret_ret, true);
67051 }
67052
67053 void  CS_LDK_ChannelUsage_free(int64_t this_obj) {
67054         LDKChannelUsage this_obj_conv;
67055         this_obj_conv.inner = untag_ptr(this_obj);
67056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67058         ChannelUsage_free(this_obj_conv);
67059 }
67060
67061 int64_t  CS_LDK_ChannelUsage_get_amount_msat(int64_t this_ptr) {
67062         LDKChannelUsage this_ptr_conv;
67063         this_ptr_conv.inner = untag_ptr(this_ptr);
67064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67066         this_ptr_conv.is_owned = false;
67067         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
67068         return ret_conv;
67069 }
67070
67071 void  CS_LDK_ChannelUsage_set_amount_msat(int64_t this_ptr, int64_t val) {
67072         LDKChannelUsage this_ptr_conv;
67073         this_ptr_conv.inner = untag_ptr(this_ptr);
67074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67076         this_ptr_conv.is_owned = false;
67077         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
67078 }
67079
67080 int64_t  CS_LDK_ChannelUsage_get_inflight_htlc_msat(int64_t this_ptr) {
67081         LDKChannelUsage this_ptr_conv;
67082         this_ptr_conv.inner = untag_ptr(this_ptr);
67083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67085         this_ptr_conv.is_owned = false;
67086         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
67087         return ret_conv;
67088 }
67089
67090 void  CS_LDK_ChannelUsage_set_inflight_htlc_msat(int64_t this_ptr, int64_t val) {
67091         LDKChannelUsage this_ptr_conv;
67092         this_ptr_conv.inner = untag_ptr(this_ptr);
67093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67095         this_ptr_conv.is_owned = false;
67096         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
67097 }
67098
67099 int64_t  CS_LDK_ChannelUsage_get_effective_capacity(int64_t this_ptr) {
67100         LDKChannelUsage this_ptr_conv;
67101         this_ptr_conv.inner = untag_ptr(this_ptr);
67102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67104         this_ptr_conv.is_owned = false;
67105         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
67106         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
67107         int64_t ret_ref = tag_ptr(ret_copy, true);
67108         return ret_ref;
67109 }
67110
67111 void  CS_LDK_ChannelUsage_set_effective_capacity(int64_t this_ptr, int64_t val) {
67112         LDKChannelUsage this_ptr_conv;
67113         this_ptr_conv.inner = untag_ptr(this_ptr);
67114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67116         this_ptr_conv.is_owned = false;
67117         void* val_ptr = untag_ptr(val);
67118         CHECK_ACCESS(val_ptr);
67119         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
67120         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
67121         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
67122 }
67123
67124 int64_t  CS_LDK_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
67125         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
67126         CHECK_ACCESS(effective_capacity_arg_ptr);
67127         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
67128         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
67129         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
67130         int64_t ret_ref = 0;
67131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67133         return ret_ref;
67134 }
67135
67136 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
67137         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
67138         int64_t ret_ref = 0;
67139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67141         return ret_ref;
67142 }
67143 int64_t  CS_LDK_ChannelUsage_clone_ptr(int64_t arg) {
67144         LDKChannelUsage arg_conv;
67145         arg_conv.inner = untag_ptr(arg);
67146         arg_conv.is_owned = ptr_is_owned(arg);
67147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67148         arg_conv.is_owned = false;
67149         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
67150         return ret_conv;
67151 }
67152
67153 int64_t  CS_LDK_ChannelUsage_clone(int64_t orig) {
67154         LDKChannelUsage orig_conv;
67155         orig_conv.inner = untag_ptr(orig);
67156         orig_conv.is_owned = ptr_is_owned(orig);
67157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67158         orig_conv.is_owned = false;
67159         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
67160         int64_t ret_ref = 0;
67161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67163         return ret_ref;
67164 }
67165
67166 void  CS_LDK_FixedPenaltyScorer_free(int64_t this_obj) {
67167         LDKFixedPenaltyScorer this_obj_conv;
67168         this_obj_conv.inner = untag_ptr(this_obj);
67169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67171         FixedPenaltyScorer_free(this_obj_conv);
67172 }
67173
67174 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
67175         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
67176         int64_t ret_ref = 0;
67177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67179         return ret_ref;
67180 }
67181 int64_t  CS_LDK_FixedPenaltyScorer_clone_ptr(int64_t arg) {
67182         LDKFixedPenaltyScorer arg_conv;
67183         arg_conv.inner = untag_ptr(arg);
67184         arg_conv.is_owned = ptr_is_owned(arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67186         arg_conv.is_owned = false;
67187         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
67188         return ret_conv;
67189 }
67190
67191 int64_t  CS_LDK_FixedPenaltyScorer_clone(int64_t orig) {
67192         LDKFixedPenaltyScorer orig_conv;
67193         orig_conv.inner = untag_ptr(orig);
67194         orig_conv.is_owned = ptr_is_owned(orig);
67195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67196         orig_conv.is_owned = false;
67197         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
67198         int64_t ret_ref = 0;
67199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67201         return ret_ref;
67202 }
67203
67204 int64_t  CS_LDK_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
67205         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
67206         int64_t ret_ref = 0;
67207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67209         return ret_ref;
67210 }
67211
67212 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreLookUp(int64_t this_arg) {
67213         LDKFixedPenaltyScorer this_arg_conv;
67214         this_arg_conv.inner = untag_ptr(this_arg);
67215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67217         this_arg_conv.is_owned = false;
67218         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67219         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
67220         return tag_ptr(ret_ret, true);
67221 }
67222
67223 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreUpdate(int64_t this_arg) {
67224         LDKFixedPenaltyScorer this_arg_conv;
67225         this_arg_conv.inner = untag_ptr(this_arg);
67226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67228         this_arg_conv.is_owned = false;
67229         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67230         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
67231         return tag_ptr(ret_ret, true);
67232 }
67233
67234 int8_tArray  CS_LDK_FixedPenaltyScorer_write(int64_t obj) {
67235         LDKFixedPenaltyScorer obj_conv;
67236         obj_conv.inner = untag_ptr(obj);
67237         obj_conv.is_owned = ptr_is_owned(obj);
67238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67239         obj_conv.is_owned = false;
67240         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
67241         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67242         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67243         CVec_u8Z_free(ret_var);
67244         return ret_arr;
67245 }
67246
67247 int64_t  CS_LDK_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
67248         LDKu8slice ser_ref;
67249         ser_ref.datalen = ser->arr_len;
67250         ser_ref.data = ser->elems;
67251         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
67252         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
67253         FREE(ser);
67254         return tag_ptr(ret_conv, true);
67255 }
67256
67257 void  CS_LDK_ProbabilisticScorer_free(int64_t this_obj) {
67258         LDKProbabilisticScorer this_obj_conv;
67259         this_obj_conv.inner = untag_ptr(this_obj);
67260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67262         ProbabilisticScorer_free(this_obj_conv);
67263 }
67264
67265 void  CS_LDK_ProbabilisticScoringFeeParameters_free(int64_t this_obj) {
67266         LDKProbabilisticScoringFeeParameters this_obj_conv;
67267         this_obj_conv.inner = untag_ptr(this_obj);
67268         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67270         ProbabilisticScoringFeeParameters_free(this_obj_conv);
67271 }
67272
67273 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_msat(int64_t this_ptr) {
67274         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67275         this_ptr_conv.inner = untag_ptr(this_ptr);
67276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67278         this_ptr_conv.is_owned = false;
67279         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
67280         return ret_conv;
67281 }
67282
67283 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_msat(int64_t this_ptr, int64_t val) {
67284         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67285         this_ptr_conv.inner = untag_ptr(this_ptr);
67286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67288         this_ptr_conv.is_owned = false;
67289         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
67290 }
67291
67292 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(int64_t this_ptr) {
67293         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67294         this_ptr_conv.inner = untag_ptr(this_ptr);
67295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67297         this_ptr_conv.is_owned = false;
67298         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
67299         return ret_conv;
67300 }
67301
67302 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67303         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67304         this_ptr_conv.inner = untag_ptr(this_ptr);
67305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67307         this_ptr_conv.is_owned = false;
67308         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67309 }
67310
67311 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
67312         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67313         this_ptr_conv.inner = untag_ptr(this_ptr);
67314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67316         this_ptr_conv.is_owned = false;
67317         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
67318         return ret_conv;
67319 }
67320
67321 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
67322         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67323         this_ptr_conv.inner = untag_ptr(this_ptr);
67324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67326         this_ptr_conv.is_owned = false;
67327         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
67328 }
67329
67330 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
67331         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67332         this_ptr_conv.inner = untag_ptr(this_ptr);
67333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67335         this_ptr_conv.is_owned = false;
67336         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
67337         return ret_conv;
67338 }
67339
67340 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67341         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67342         this_ptr_conv.inner = untag_ptr(this_ptr);
67343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67345         this_ptr_conv.is_owned = false;
67346         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67347 }
67348
67349 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
67350         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67351         this_ptr_conv.inner = untag_ptr(this_ptr);
67352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67354         this_ptr_conv.is_owned = false;
67355         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
67356         return ret_conv;
67357 }
67358
67359 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
67360         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67361         this_ptr_conv.inner = untag_ptr(this_ptr);
67362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67364         this_ptr_conv.is_owned = false;
67365         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
67366 }
67367
67368 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
67369         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67370         this_ptr_conv.inner = untag_ptr(this_ptr);
67371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67373         this_ptr_conv.is_owned = false;
67374         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
67375         return ret_conv;
67376 }
67377
67378 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
67379         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67380         this_ptr_conv.inner = untag_ptr(this_ptr);
67381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67383         this_ptr_conv.is_owned = false;
67384         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
67385 }
67386
67387 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(int64_t this_ptr) {
67388         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67389         this_ptr_conv.inner = untag_ptr(this_ptr);
67390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67392         this_ptr_conv.is_owned = false;
67393         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
67394         return ret_conv;
67395 }
67396
67397 void  CS_LDK_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(int64_t this_ptr, int64_t val) {
67398         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67399         this_ptr_conv.inner = untag_ptr(this_ptr);
67400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67402         this_ptr_conv.is_owned = false;
67403         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
67404 }
67405
67406 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(int64_t this_ptr) {
67407         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67408         this_ptr_conv.inner = untag_ptr(this_ptr);
67409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67411         this_ptr_conv.is_owned = false;
67412         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
67413         return ret_conv;
67414 }
67415
67416 void  CS_LDK_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(int64_t this_ptr, int64_t val) {
67417         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67418         this_ptr_conv.inner = untag_ptr(this_ptr);
67419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67421         this_ptr_conv.is_owned = false;
67422         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
67423 }
67424
67425 jboolean  CS_LDK_ProbabilisticScoringFeeParameters_get_linear_success_probability(int64_t this_ptr) {
67426         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67427         this_ptr_conv.inner = untag_ptr(this_ptr);
67428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67430         this_ptr_conv.is_owned = false;
67431         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
67432         return ret_conv;
67433 }
67434
67435 void  CS_LDK_ProbabilisticScoringFeeParameters_set_linear_success_probability(int64_t this_ptr, jboolean val) {
67436         LDKProbabilisticScoringFeeParameters this_ptr_conv;
67437         this_ptr_conv.inner = untag_ptr(this_ptr);
67438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67440         this_ptr_conv.is_owned = false;
67441         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
67442 }
67443
67444 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
67445         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
67446         int64_t ret_ref = 0;
67447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67449         return ret_ref;
67450 }
67451 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone_ptr(int64_t arg) {
67452         LDKProbabilisticScoringFeeParameters arg_conv;
67453         arg_conv.inner = untag_ptr(arg);
67454         arg_conv.is_owned = ptr_is_owned(arg);
67455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67456         arg_conv.is_owned = false;
67457         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
67458         return ret_conv;
67459 }
67460
67461 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone(int64_t orig) {
67462         LDKProbabilisticScoringFeeParameters orig_conv;
67463         orig_conv.inner = untag_ptr(orig);
67464         orig_conv.is_owned = ptr_is_owned(orig);
67465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67466         orig_conv.is_owned = false;
67467         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
67468         int64_t ret_ref = 0;
67469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67471         return ret_ref;
67472 }
67473
67474 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_default() {
67475         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
67476         int64_t ret_ref = 0;
67477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67479         return ret_ref;
67480 }
67481
67482 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned(int64_t this_arg, int64_t node_id) {
67483         LDKProbabilisticScoringFeeParameters this_arg_conv;
67484         this_arg_conv.inner = untag_ptr(this_arg);
67485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67487         this_arg_conv.is_owned = false;
67488         LDKNodeId node_id_conv;
67489         node_id_conv.inner = untag_ptr(node_id);
67490         node_id_conv.is_owned = ptr_is_owned(node_id);
67491         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67492         node_id_conv.is_owned = false;
67493         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
67494 }
67495
67496 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned_from_list(int64_t this_arg, int64_tArray node_ids) {
67497         LDKProbabilisticScoringFeeParameters this_arg_conv;
67498         this_arg_conv.inner = untag_ptr(this_arg);
67499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67501         this_arg_conv.is_owned = false;
67502         LDKCVec_NodeIdZ node_ids_constr;
67503         node_ids_constr.datalen = node_ids->arr_len;
67504         if (node_ids_constr.datalen > 0)
67505                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
67506         else
67507                 node_ids_constr.data = NULL;
67508         int64_t* node_ids_vals = node_ids->elems;
67509         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
67510                 int64_t node_ids_conv_8 = node_ids_vals[i];
67511                 LDKNodeId node_ids_conv_8_conv;
67512                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
67513                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
67514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
67515                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
67516                 node_ids_constr.data[i] = node_ids_conv_8_conv;
67517         }
67518         FREE(node_ids);
67519         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
67520 }
67521
67522 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_banned(int64_t this_arg, int64_t node_id) {
67523         LDKProbabilisticScoringFeeParameters this_arg_conv;
67524         this_arg_conv.inner = untag_ptr(this_arg);
67525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67527         this_arg_conv.is_owned = false;
67528         LDKNodeId node_id_conv;
67529         node_id_conv.inner = untag_ptr(node_id);
67530         node_id_conv.is_owned = ptr_is_owned(node_id);
67531         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67532         node_id_conv.is_owned = false;
67533         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
67534 }
67535
67536 void  CS_LDK_ProbabilisticScoringFeeParameters_set_manual_penalty(int64_t this_arg, int64_t node_id, int64_t penalty) {
67537         LDKProbabilisticScoringFeeParameters this_arg_conv;
67538         this_arg_conv.inner = untag_ptr(this_arg);
67539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67541         this_arg_conv.is_owned = false;
67542         LDKNodeId node_id_conv;
67543         node_id_conv.inner = untag_ptr(node_id);
67544         node_id_conv.is_owned = ptr_is_owned(node_id);
67545         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67546         node_id_conv.is_owned = false;
67547         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
67548 }
67549
67550 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_manual_penalty(int64_t this_arg, int64_t node_id) {
67551         LDKProbabilisticScoringFeeParameters this_arg_conv;
67552         this_arg_conv.inner = untag_ptr(this_arg);
67553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67555         this_arg_conv.is_owned = false;
67556         LDKNodeId node_id_conv;
67557         node_id_conv.inner = untag_ptr(node_id);
67558         node_id_conv.is_owned = ptr_is_owned(node_id);
67559         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
67560         node_id_conv.is_owned = false;
67561         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
67562 }
67563
67564 void  CS_LDK_ProbabilisticScoringFeeParameters_clear_manual_penalties(int64_t this_arg) {
67565         LDKProbabilisticScoringFeeParameters this_arg_conv;
67566         this_arg_conv.inner = untag_ptr(this_arg);
67567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67569         this_arg_conv.is_owned = false;
67570         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
67571 }
67572
67573 void  CS_LDK_ProbabilisticScoringDecayParameters_free(int64_t this_obj) {
67574         LDKProbabilisticScoringDecayParameters this_obj_conv;
67575         this_obj_conv.inner = untag_ptr(this_obj);
67576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67578         ProbabilisticScoringDecayParameters_free(this_obj_conv);
67579 }
67580
67581 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(int64_t this_ptr) {
67582         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67583         this_ptr_conv.inner = untag_ptr(this_ptr);
67584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67586         this_ptr_conv.is_owned = false;
67587         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
67588         return ret_conv;
67589 }
67590
67591 void  CS_LDK_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(int64_t this_ptr, int64_t val) {
67592         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67593         this_ptr_conv.inner = untag_ptr(this_ptr);
67594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67596         this_ptr_conv.is_owned = false;
67597         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
67598 }
67599
67600 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(int64_t this_ptr) {
67601         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67602         this_ptr_conv.inner = untag_ptr(this_ptr);
67603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67605         this_ptr_conv.is_owned = false;
67606         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
67607         return ret_conv;
67608 }
67609
67610 void  CS_LDK_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(int64_t this_ptr, int64_t val) {
67611         LDKProbabilisticScoringDecayParameters this_ptr_conv;
67612         this_ptr_conv.inner = untag_ptr(this_ptr);
67613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67615         this_ptr_conv.is_owned = false;
67616         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
67617 }
67618
67619 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_new(int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
67620         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
67621         int64_t ret_ref = 0;
67622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67624         return ret_ref;
67625 }
67626
67627 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
67628         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
67629         int64_t ret_ref = 0;
67630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67632         return ret_ref;
67633 }
67634 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone_ptr(int64_t arg) {
67635         LDKProbabilisticScoringDecayParameters arg_conv;
67636         arg_conv.inner = untag_ptr(arg);
67637         arg_conv.is_owned = ptr_is_owned(arg);
67638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67639         arg_conv.is_owned = false;
67640         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
67641         return ret_conv;
67642 }
67643
67644 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone(int64_t orig) {
67645         LDKProbabilisticScoringDecayParameters orig_conv;
67646         orig_conv.inner = untag_ptr(orig);
67647         orig_conv.is_owned = ptr_is_owned(orig);
67648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67649         orig_conv.is_owned = false;
67650         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
67651         int64_t ret_ref = 0;
67652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67654         return ret_ref;
67655 }
67656
67657 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_default() {
67658         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
67659         int64_t ret_ref = 0;
67660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67662         return ret_ref;
67663 }
67664
67665 int64_t  CS_LDK_ProbabilisticScorer_new(int64_t decay_params, int64_t network_graph, int64_t logger) {
67666         LDKProbabilisticScoringDecayParameters decay_params_conv;
67667         decay_params_conv.inner = untag_ptr(decay_params);
67668         decay_params_conv.is_owned = ptr_is_owned(decay_params);
67669         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
67670         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
67671         LDKNetworkGraph network_graph_conv;
67672         network_graph_conv.inner = untag_ptr(network_graph);
67673         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67674         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67675         network_graph_conv.is_owned = false;
67676         void* logger_ptr = untag_ptr(logger);
67677         CHECK_ACCESS(logger_ptr);
67678         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67679         if (logger_conv.free == LDKLogger_JCalls_free) {
67680                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67681                 LDKLogger_JCalls_cloned(&logger_conv);
67682         }
67683         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
67684         int64_t ret_ref = 0;
67685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67687         return ret_ref;
67688 }
67689
67690 void  CS_LDK_ProbabilisticScorer_debug_log_liquidity_stats(int64_t this_arg) {
67691         LDKProbabilisticScorer this_arg_conv;
67692         this_arg_conv.inner = untag_ptr(this_arg);
67693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67695         this_arg_conv.is_owned = false;
67696         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
67697 }
67698
67699 int64_t  CS_LDK_ProbabilisticScorer_estimated_channel_liquidity_range(int64_t this_arg, int64_t scid, int64_t target) {
67700         LDKProbabilisticScorer this_arg_conv;
67701         this_arg_conv.inner = untag_ptr(this_arg);
67702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67704         this_arg_conv.is_owned = false;
67705         LDKNodeId target_conv;
67706         target_conv.inner = untag_ptr(target);
67707         target_conv.is_owned = ptr_is_owned(target);
67708         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67709         target_conv.is_owned = false;
67710         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
67711         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
67712         int64_t ret_ref = tag_ptr(ret_copy, true);
67713         return ret_ref;
67714 }
67715
67716 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(int64_t this_arg, int64_t scid, int64_t target) {
67717         LDKProbabilisticScorer this_arg_conv;
67718         this_arg_conv.inner = untag_ptr(this_arg);
67719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67721         this_arg_conv.is_owned = false;
67722         LDKNodeId target_conv;
67723         target_conv.inner = untag_ptr(target);
67724         target_conv.is_owned = ptr_is_owned(target);
67725         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67726         target_conv.is_owned = false;
67727         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
67728         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
67729         int64_t ret_ref = tag_ptr(ret_copy, true);
67730         return ret_ref;
67731 }
67732
67733 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) {
67734         LDKProbabilisticScorer this_arg_conv;
67735         this_arg_conv.inner = untag_ptr(this_arg);
67736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67738         this_arg_conv.is_owned = false;
67739         LDKNodeId target_conv;
67740         target_conv.inner = untag_ptr(target);
67741         target_conv.is_owned = ptr_is_owned(target);
67742         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
67743         target_conv.is_owned = false;
67744         LDKProbabilisticScoringFeeParameters params_conv;
67745         params_conv.inner = untag_ptr(params);
67746         params_conv.is_owned = ptr_is_owned(params);
67747         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
67748         params_conv.is_owned = false;
67749         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
67750         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
67751         int64_t ret_ref = tag_ptr(ret_copy, true);
67752         return ret_ref;
67753 }
67754
67755 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreLookUp(int64_t this_arg) {
67756         LDKProbabilisticScorer this_arg_conv;
67757         this_arg_conv.inner = untag_ptr(this_arg);
67758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67760         this_arg_conv.is_owned = false;
67761         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
67762         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
67763         return tag_ptr(ret_ret, true);
67764 }
67765
67766 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreUpdate(int64_t this_arg) {
67767         LDKProbabilisticScorer this_arg_conv;
67768         this_arg_conv.inner = untag_ptr(this_arg);
67769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67771         this_arg_conv.is_owned = false;
67772         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
67773         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
67774         return tag_ptr(ret_ret, true);
67775 }
67776
67777 int64_t  CS_LDK_ProbabilisticScorer_as_Score(int64_t this_arg) {
67778         LDKProbabilisticScorer this_arg_conv;
67779         this_arg_conv.inner = untag_ptr(this_arg);
67780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67782         this_arg_conv.is_owned = false;
67783         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
67784         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
67785         return tag_ptr(ret_ret, true);
67786 }
67787
67788 int8_tArray  CS_LDK_ProbabilisticScorer_write(int64_t obj) {
67789         LDKProbabilisticScorer obj_conv;
67790         obj_conv.inner = untag_ptr(obj);
67791         obj_conv.is_owned = ptr_is_owned(obj);
67792         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67793         obj_conv.is_owned = false;
67794         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
67795         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67796         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67797         CVec_u8Z_free(ret_var);
67798         return ret_arr;
67799 }
67800
67801 int64_t  CS_LDK_ProbabilisticScorer_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
67802         LDKu8slice ser_ref;
67803         ser_ref.datalen = ser->arr_len;
67804         ser_ref.data = ser->elems;
67805         LDKProbabilisticScoringDecayParameters arg_a_conv;
67806         arg_a_conv.inner = untag_ptr(arg_a);
67807         arg_a_conv.is_owned = ptr_is_owned(arg_a);
67808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
67809         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
67810         LDKNetworkGraph arg_b_conv;
67811         arg_b_conv.inner = untag_ptr(arg_b);
67812         arg_b_conv.is_owned = ptr_is_owned(arg_b);
67813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
67814         arg_b_conv.is_owned = false;
67815         void* arg_c_ptr = untag_ptr(arg_c);
67816         CHECK_ACCESS(arg_c_ptr);
67817         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
67818         if (arg_c_conv.free == LDKLogger_JCalls_free) {
67819                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67820                 LDKLogger_JCalls_cloned(&arg_c_conv);
67821         }
67822         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
67823         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
67824         FREE(ser);
67825         return tag_ptr(ret_conv, true);
67826 }
67827
67828 void  CS_LDK_DelayedPaymentOutputDescriptor_free(int64_t this_obj) {
67829         LDKDelayedPaymentOutputDescriptor this_obj_conv;
67830         this_obj_conv.inner = untag_ptr(this_obj);
67831         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67833         DelayedPaymentOutputDescriptor_free(this_obj_conv);
67834 }
67835
67836 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
67837         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67838         this_ptr_conv.inner = untag_ptr(this_ptr);
67839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67841         this_ptr_conv.is_owned = false;
67842         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
67843         int64_t ret_ref = 0;
67844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67846         return ret_ref;
67847 }
67848
67849 void  CS_LDK_DelayedPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
67850         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67851         this_ptr_conv.inner = untag_ptr(this_ptr);
67852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67854         this_ptr_conv.is_owned = false;
67855         LDKOutPoint val_conv;
67856         val_conv.inner = untag_ptr(val);
67857         val_conv.is_owned = ptr_is_owned(val);
67858         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67859         val_conv = OutPoint_clone(&val_conv);
67860         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
67861 }
67862
67863 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_per_commitment_point(int64_t this_ptr) {
67864         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67865         this_ptr_conv.inner = untag_ptr(this_ptr);
67866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67868         this_ptr_conv.is_owned = false;
67869         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67870         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
67871         return ret_arr;
67872 }
67873
67874 void  CS_LDK_DelayedPaymentOutputDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
67875         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67876         this_ptr_conv.inner = untag_ptr(this_ptr);
67877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67879         this_ptr_conv.is_owned = false;
67880         LDKPublicKey val_ref;
67881         CHECK(val->arr_len == 33);
67882         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
67883         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
67884 }
67885
67886 int16_t  CS_LDK_DelayedPaymentOutputDescriptor_get_to_self_delay(int64_t this_ptr) {
67887         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67888         this_ptr_conv.inner = untag_ptr(this_ptr);
67889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67891         this_ptr_conv.is_owned = false;
67892         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
67893         return ret_conv;
67894 }
67895
67896 void  CS_LDK_DelayedPaymentOutputDescriptor_set_to_self_delay(int64_t this_ptr, int16_t val) {
67897         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67898         this_ptr_conv.inner = untag_ptr(this_ptr);
67899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67901         this_ptr_conv.is_owned = false;
67902         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
67903 }
67904
67905 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_output(int64_t this_ptr) {
67906         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67907         this_ptr_conv.inner = untag_ptr(this_ptr);
67908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67910         this_ptr_conv.is_owned = false;
67911         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
67912         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
67913         return tag_ptr(ret_ref, true);
67914 }
67915
67916 void  CS_LDK_DelayedPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
67917         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67918         this_ptr_conv.inner = untag_ptr(this_ptr);
67919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67921         this_ptr_conv.is_owned = false;
67922         void* val_ptr = untag_ptr(val);
67923         CHECK_ACCESS(val_ptr);
67924         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
67925         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
67926         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
67927 }
67928
67929 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_revocation_pubkey(int64_t this_ptr) {
67930         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67931         this_ptr_conv.inner = untag_ptr(this_ptr);
67932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67934         this_ptr_conv.is_owned = false;
67935         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
67936         int64_t ret_ref = 0;
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67939         return ret_ref;
67940 }
67941
67942 void  CS_LDK_DelayedPaymentOutputDescriptor_set_revocation_pubkey(int64_t this_ptr, int64_t val) {
67943         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67944         this_ptr_conv.inner = untag_ptr(this_ptr);
67945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67947         this_ptr_conv.is_owned = false;
67948         LDKRevocationKey val_conv;
67949         val_conv.inner = untag_ptr(val);
67950         val_conv.is_owned = ptr_is_owned(val);
67951         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67952         val_conv = RevocationKey_clone(&val_conv);
67953         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
67954 }
67955
67956 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
67957         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67958         this_ptr_conv.inner = untag_ptr(this_ptr);
67959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67961         this_ptr_conv.is_owned = false;
67962         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67963         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
67964         return ret_arr;
67965 }
67966
67967 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
67968         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67969         this_ptr_conv.inner = untag_ptr(this_ptr);
67970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67972         this_ptr_conv.is_owned = false;
67973         LDKThirtyTwoBytes val_ref;
67974         CHECK(val->arr_len == 32);
67975         memcpy(val_ref.data, val->elems, 32); FREE(val);
67976         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
67977 }
67978
67979 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
67980         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67981         this_ptr_conv.inner = untag_ptr(this_ptr);
67982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67984         this_ptr_conv.is_owned = false;
67985         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
67986         return ret_conv;
67987 }
67988
67989 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
67990         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
67991         this_ptr_conv.inner = untag_ptr(this_ptr);
67992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67994         this_ptr_conv.is_owned = false;
67995         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
67996 }
67997
67998 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) {
67999         LDKOutPoint outpoint_arg_conv;
68000         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
68001         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
68002         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
68003         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
68004         LDKPublicKey per_commitment_point_arg_ref;
68005         CHECK(per_commitment_point_arg->arr_len == 33);
68006         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
68007         void* output_arg_ptr = untag_ptr(output_arg);
68008         CHECK_ACCESS(output_arg_ptr);
68009         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
68010         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
68011         LDKRevocationKey revocation_pubkey_arg_conv;
68012         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
68013         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
68014         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
68015         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
68016         LDKThirtyTwoBytes channel_keys_id_arg_ref;
68017         CHECK(channel_keys_id_arg->arr_len == 32);
68018         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
68019         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);
68020         int64_t ret_ref = 0;
68021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68023         return ret_ref;
68024 }
68025
68026 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
68027         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
68028         int64_t ret_ref = 0;
68029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68031         return ret_ref;
68032 }
68033 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone_ptr(int64_t arg) {
68034         LDKDelayedPaymentOutputDescriptor arg_conv;
68035         arg_conv.inner = untag_ptr(arg);
68036         arg_conv.is_owned = ptr_is_owned(arg);
68037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68038         arg_conv.is_owned = false;
68039         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
68040         return ret_conv;
68041 }
68042
68043 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone(int64_t orig) {
68044         LDKDelayedPaymentOutputDescriptor orig_conv;
68045         orig_conv.inner = untag_ptr(orig);
68046         orig_conv.is_owned = ptr_is_owned(orig);
68047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68048         orig_conv.is_owned = false;
68049         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
68050         int64_t ret_ref = 0;
68051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68053         return ret_ref;
68054 }
68055
68056 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_hash(int64_t o) {
68057         LDKDelayedPaymentOutputDescriptor o_conv;
68058         o_conv.inner = untag_ptr(o);
68059         o_conv.is_owned = ptr_is_owned(o);
68060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68061         o_conv.is_owned = false;
68062         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
68063         return ret_conv;
68064 }
68065
68066 jboolean  CS_LDK_DelayedPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
68067         LDKDelayedPaymentOutputDescriptor a_conv;
68068         a_conv.inner = untag_ptr(a);
68069         a_conv.is_owned = ptr_is_owned(a);
68070         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68071         a_conv.is_owned = false;
68072         LDKDelayedPaymentOutputDescriptor b_conv;
68073         b_conv.inner = untag_ptr(b);
68074         b_conv.is_owned = ptr_is_owned(b);
68075         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68076         b_conv.is_owned = false;
68077         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
68078         return ret_conv;
68079 }
68080
68081 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_write(int64_t obj) {
68082         LDKDelayedPaymentOutputDescriptor obj_conv;
68083         obj_conv.inner = untag_ptr(obj);
68084         obj_conv.is_owned = ptr_is_owned(obj);
68085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68086         obj_conv.is_owned = false;
68087         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
68088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68090         CVec_u8Z_free(ret_var);
68091         return ret_arr;
68092 }
68093
68094 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
68095         LDKu8slice ser_ref;
68096         ser_ref.datalen = ser->arr_len;
68097         ser_ref.data = ser->elems;
68098         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
68099         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
68100         FREE(ser);
68101         return tag_ptr(ret_conv, true);
68102 }
68103
68104 void  CS_LDK_StaticPaymentOutputDescriptor_free(int64_t this_obj) {
68105         LDKStaticPaymentOutputDescriptor this_obj_conv;
68106         this_obj_conv.inner = untag_ptr(this_obj);
68107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68109         StaticPaymentOutputDescriptor_free(this_obj_conv);
68110 }
68111
68112 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
68113         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68114         this_ptr_conv.inner = untag_ptr(this_ptr);
68115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68117         this_ptr_conv.is_owned = false;
68118         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
68119         int64_t ret_ref = 0;
68120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68122         return ret_ref;
68123 }
68124
68125 void  CS_LDK_StaticPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
68126         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68127         this_ptr_conv.inner = untag_ptr(this_ptr);
68128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68130         this_ptr_conv.is_owned = false;
68131         LDKOutPoint val_conv;
68132         val_conv.inner = untag_ptr(val);
68133         val_conv.is_owned = ptr_is_owned(val);
68134         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68135         val_conv = OutPoint_clone(&val_conv);
68136         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
68137 }
68138
68139 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_output(int64_t this_ptr) {
68140         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68141         this_ptr_conv.inner = untag_ptr(this_ptr);
68142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68144         this_ptr_conv.is_owned = false;
68145         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68146         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
68147         return tag_ptr(ret_ref, true);
68148 }
68149
68150 void  CS_LDK_StaticPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
68151         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68152         this_ptr_conv.inner = untag_ptr(this_ptr);
68153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68155         this_ptr_conv.is_owned = false;
68156         void* val_ptr = untag_ptr(val);
68157         CHECK_ACCESS(val_ptr);
68158         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
68159         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
68160         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
68161 }
68162
68163 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
68164         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68165         this_ptr_conv.inner = untag_ptr(this_ptr);
68166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68168         this_ptr_conv.is_owned = false;
68169         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68170         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
68171         return ret_arr;
68172 }
68173
68174 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
68175         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68176         this_ptr_conv.inner = untag_ptr(this_ptr);
68177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68179         this_ptr_conv.is_owned = false;
68180         LDKThirtyTwoBytes val_ref;
68181         CHECK(val->arr_len == 32);
68182         memcpy(val_ref.data, val->elems, 32); FREE(val);
68183         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
68184 }
68185
68186 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
68187         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68188         this_ptr_conv.inner = untag_ptr(this_ptr);
68189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68191         this_ptr_conv.is_owned = false;
68192         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
68193         return ret_conv;
68194 }
68195
68196 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
68197         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68198         this_ptr_conv.inner = untag_ptr(this_ptr);
68199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68201         this_ptr_conv.is_owned = false;
68202         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
68203 }
68204
68205 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
68206         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68207         this_ptr_conv.inner = untag_ptr(this_ptr);
68208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68210         this_ptr_conv.is_owned = false;
68211         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
68212         int64_t ret_ref = 0;
68213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68215         return ret_ref;
68216 }
68217
68218 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
68219         LDKStaticPaymentOutputDescriptor this_ptr_conv;
68220         this_ptr_conv.inner = untag_ptr(this_ptr);
68221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68223         this_ptr_conv.is_owned = false;
68224         LDKChannelTransactionParameters val_conv;
68225         val_conv.inner = untag_ptr(val);
68226         val_conv.is_owned = ptr_is_owned(val);
68227         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68228         val_conv = ChannelTransactionParameters_clone(&val_conv);
68229         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
68230 }
68231
68232 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) {
68233         LDKOutPoint outpoint_arg_conv;
68234         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
68235         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
68236         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
68237         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
68238         void* output_arg_ptr = untag_ptr(output_arg);
68239         CHECK_ACCESS(output_arg_ptr);
68240         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
68241         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
68242         LDKThirtyTwoBytes channel_keys_id_arg_ref;
68243         CHECK(channel_keys_id_arg->arr_len == 32);
68244         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
68245         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
68246         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
68247         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
68248         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
68249         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
68250         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);
68251         int64_t ret_ref = 0;
68252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68254         return ret_ref;
68255 }
68256
68257 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
68258         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
68259         int64_t ret_ref = 0;
68260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68262         return ret_ref;
68263 }
68264 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone_ptr(int64_t arg) {
68265         LDKStaticPaymentOutputDescriptor arg_conv;
68266         arg_conv.inner = untag_ptr(arg);
68267         arg_conv.is_owned = ptr_is_owned(arg);
68268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68269         arg_conv.is_owned = false;
68270         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
68271         return ret_conv;
68272 }
68273
68274 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone(int64_t orig) {
68275         LDKStaticPaymentOutputDescriptor orig_conv;
68276         orig_conv.inner = untag_ptr(orig);
68277         orig_conv.is_owned = ptr_is_owned(orig);
68278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68279         orig_conv.is_owned = false;
68280         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
68281         int64_t ret_ref = 0;
68282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68284         return ret_ref;
68285 }
68286
68287 int64_t  CS_LDK_StaticPaymentOutputDescriptor_hash(int64_t o) {
68288         LDKStaticPaymentOutputDescriptor o_conv;
68289         o_conv.inner = untag_ptr(o);
68290         o_conv.is_owned = ptr_is_owned(o);
68291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68292         o_conv.is_owned = false;
68293         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
68294         return ret_conv;
68295 }
68296
68297 jboolean  CS_LDK_StaticPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
68298         LDKStaticPaymentOutputDescriptor a_conv;
68299         a_conv.inner = untag_ptr(a);
68300         a_conv.is_owned = ptr_is_owned(a);
68301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68302         a_conv.is_owned = false;
68303         LDKStaticPaymentOutputDescriptor b_conv;
68304         b_conv.inner = untag_ptr(b);
68305         b_conv.is_owned = ptr_is_owned(b);
68306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68307         b_conv.is_owned = false;
68308         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
68309         return ret_conv;
68310 }
68311
68312 int64_t  CS_LDK_StaticPaymentOutputDescriptor_witness_script(int64_t this_arg) {
68313         LDKStaticPaymentOutputDescriptor this_arg_conv;
68314         this_arg_conv.inner = untag_ptr(this_arg);
68315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68317         this_arg_conv.is_owned = false;
68318         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68319         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
68320         int64_t ret_ref = tag_ptr(ret_copy, true);
68321         return ret_ref;
68322 }
68323
68324 int64_t  CS_LDK_StaticPaymentOutputDescriptor_max_witness_length(int64_t this_arg) {
68325         LDKStaticPaymentOutputDescriptor this_arg_conv;
68326         this_arg_conv.inner = untag_ptr(this_arg);
68327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68329         this_arg_conv.is_owned = false;
68330         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
68331         return ret_conv;
68332 }
68333
68334 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_write(int64_t obj) {
68335         LDKStaticPaymentOutputDescriptor obj_conv;
68336         obj_conv.inner = untag_ptr(obj);
68337         obj_conv.is_owned = ptr_is_owned(obj);
68338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68339         obj_conv.is_owned = false;
68340         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
68341         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68342         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68343         CVec_u8Z_free(ret_var);
68344         return ret_arr;
68345 }
68346
68347 int64_t  CS_LDK_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
68348         LDKu8slice ser_ref;
68349         ser_ref.datalen = ser->arr_len;
68350         ser_ref.data = ser->elems;
68351         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
68352         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
68353         FREE(ser);
68354         return tag_ptr(ret_conv, true);
68355 }
68356
68357 void  CS_LDK_SpendableOutputDescriptor_free(int64_t this_ptr) {
68358         if (!ptr_is_owned(this_ptr)) return;
68359         void* this_ptr_ptr = untag_ptr(this_ptr);
68360         CHECK_ACCESS(this_ptr_ptr);
68361         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
68362         FREE(untag_ptr(this_ptr));
68363         SpendableOutputDescriptor_free(this_ptr_conv);
68364 }
68365
68366 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
68367         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68368         *ret_copy = SpendableOutputDescriptor_clone(arg);
68369         int64_t ret_ref = tag_ptr(ret_copy, true);
68370         return ret_ref;
68371 }
68372 int64_t  CS_LDK_SpendableOutputDescriptor_clone_ptr(int64_t arg) {
68373         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
68374         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
68375         return ret_conv;
68376 }
68377
68378 int64_t  CS_LDK_SpendableOutputDescriptor_clone(int64_t orig) {
68379         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
68380         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68381         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
68382         int64_t ret_ref = tag_ptr(ret_copy, true);
68383         return ret_ref;
68384 }
68385
68386 int64_t  CS_LDK_SpendableOutputDescriptor_static_output(int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
68387         LDKOutPoint outpoint_conv;
68388         outpoint_conv.inner = untag_ptr(outpoint);
68389         outpoint_conv.is_owned = ptr_is_owned(outpoint);
68390         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
68391         outpoint_conv = OutPoint_clone(&outpoint_conv);
68392         void* output_ptr = untag_ptr(output);
68393         CHECK_ACCESS(output_ptr);
68394         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
68395         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
68396         LDKThirtyTwoBytes channel_keys_id_ref;
68397         CHECK(channel_keys_id->arr_len == 32);
68398         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
68399         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68400         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
68401         int64_t ret_ref = tag_ptr(ret_copy, true);
68402         return ret_ref;
68403 }
68404
68405 int64_t  CS_LDK_SpendableOutputDescriptor_delayed_payment_output(int64_t a) {
68406         LDKDelayedPaymentOutputDescriptor a_conv;
68407         a_conv.inner = untag_ptr(a);
68408         a_conv.is_owned = ptr_is_owned(a);
68409         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68410         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
68411         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68412         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
68413         int64_t ret_ref = tag_ptr(ret_copy, true);
68414         return ret_ref;
68415 }
68416
68417 int64_t  CS_LDK_SpendableOutputDescriptor_static_payment_output(int64_t a) {
68418         LDKStaticPaymentOutputDescriptor a_conv;
68419         a_conv.inner = untag_ptr(a);
68420         a_conv.is_owned = ptr_is_owned(a);
68421         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68422         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
68423         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
68424         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
68425         int64_t ret_ref = tag_ptr(ret_copy, true);
68426         return ret_ref;
68427 }
68428
68429 int64_t  CS_LDK_SpendableOutputDescriptor_hash(int64_t o) {
68430         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
68431         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
68432         return ret_conv;
68433 }
68434
68435 jboolean  CS_LDK_SpendableOutputDescriptor_eq(int64_t a, int64_t b) {
68436         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
68437         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
68438         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
68439         return ret_conv;
68440 }
68441
68442 int8_tArray  CS_LDK_SpendableOutputDescriptor_write(int64_t obj) {
68443         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
68444         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
68445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68447         CVec_u8Z_free(ret_var);
68448         return ret_arr;
68449 }
68450
68451 int64_t  CS_LDK_SpendableOutputDescriptor_read(int8_tArray ser) {
68452         LDKu8slice ser_ref;
68453         ser_ref.datalen = ser->arr_len;
68454         ser_ref.data = ser->elems;
68455         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
68456         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
68457         FREE(ser);
68458         return tag_ptr(ret_conv, true);
68459 }
68460
68461 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) {
68462         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
68463         descriptors_constr.datalen = descriptors->arr_len;
68464         if (descriptors_constr.datalen > 0)
68465                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
68466         else
68467                 descriptors_constr.data = NULL;
68468         int64_t* descriptors_vals = descriptors->elems;
68469         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
68470                 int64_t descriptors_conv_27 = descriptors_vals[b];
68471                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
68472                 CHECK_ACCESS(descriptors_conv_27_ptr);
68473                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
68474                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
68475                 descriptors_constr.data[b] = descriptors_conv_27_conv;
68476         }
68477         FREE(descriptors);
68478         LDKCVec_TxOutZ outputs_constr;
68479         outputs_constr.datalen = outputs->arr_len;
68480         if (outputs_constr.datalen > 0)
68481                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
68482         else
68483                 outputs_constr.data = NULL;
68484         int64_t* outputs_vals = outputs->elems;
68485         for (size_t h = 0; h < outputs_constr.datalen; h++) {
68486                 int64_t outputs_conv_7 = outputs_vals[h];
68487                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
68488                 CHECK_ACCESS(outputs_conv_7_ptr);
68489                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
68490                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
68491                 outputs_constr.data[h] = outputs_conv_7_conv;
68492         }
68493         FREE(outputs);
68494         LDKCVec_u8Z change_destination_script_ref;
68495         change_destination_script_ref.datalen = change_destination_script->arr_len;
68496         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
68497         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
68498         void* locktime_ptr = untag_ptr(locktime);
68499         CHECK_ACCESS(locktime_ptr);
68500         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
68501         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
68502         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
68503         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
68504         return tag_ptr(ret_conv, true);
68505 }
68506
68507 void  CS_LDK_ChannelDerivationParameters_free(int64_t this_obj) {
68508         LDKChannelDerivationParameters this_obj_conv;
68509         this_obj_conv.inner = untag_ptr(this_obj);
68510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68512         ChannelDerivationParameters_free(this_obj_conv);
68513 }
68514
68515 int64_t  CS_LDK_ChannelDerivationParameters_get_value_satoshis(int64_t this_ptr) {
68516         LDKChannelDerivationParameters this_ptr_conv;
68517         this_ptr_conv.inner = untag_ptr(this_ptr);
68518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68520         this_ptr_conv.is_owned = false;
68521         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
68522         return ret_conv;
68523 }
68524
68525 void  CS_LDK_ChannelDerivationParameters_set_value_satoshis(int64_t this_ptr, int64_t val) {
68526         LDKChannelDerivationParameters this_ptr_conv;
68527         this_ptr_conv.inner = untag_ptr(this_ptr);
68528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68530         this_ptr_conv.is_owned = false;
68531         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
68532 }
68533
68534 int8_tArray  CS_LDK_ChannelDerivationParameters_get_keys_id(int64_t this_ptr) {
68535         LDKChannelDerivationParameters this_ptr_conv;
68536         this_ptr_conv.inner = untag_ptr(this_ptr);
68537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68539         this_ptr_conv.is_owned = false;
68540         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68541         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
68542         return ret_arr;
68543 }
68544
68545 void  CS_LDK_ChannelDerivationParameters_set_keys_id(int64_t this_ptr, int8_tArray val) {
68546         LDKChannelDerivationParameters this_ptr_conv;
68547         this_ptr_conv.inner = untag_ptr(this_ptr);
68548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68550         this_ptr_conv.is_owned = false;
68551         LDKThirtyTwoBytes val_ref;
68552         CHECK(val->arr_len == 32);
68553         memcpy(val_ref.data, val->elems, 32); FREE(val);
68554         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
68555 }
68556
68557 int64_t  CS_LDK_ChannelDerivationParameters_get_transaction_parameters(int64_t this_ptr) {
68558         LDKChannelDerivationParameters 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         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
68564         int64_t ret_ref = 0;
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68567         return ret_ref;
68568 }
68569
68570 void  CS_LDK_ChannelDerivationParameters_set_transaction_parameters(int64_t this_ptr, int64_t val) {
68571         LDKChannelDerivationParameters this_ptr_conv;
68572         this_ptr_conv.inner = untag_ptr(this_ptr);
68573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68575         this_ptr_conv.is_owned = false;
68576         LDKChannelTransactionParameters val_conv;
68577         val_conv.inner = untag_ptr(val);
68578         val_conv.is_owned = ptr_is_owned(val);
68579         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68580         val_conv = ChannelTransactionParameters_clone(&val_conv);
68581         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
68582 }
68583
68584 int64_t  CS_LDK_ChannelDerivationParameters_new(int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
68585         LDKThirtyTwoBytes keys_id_arg_ref;
68586         CHECK(keys_id_arg->arr_len == 32);
68587         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
68588         LDKChannelTransactionParameters transaction_parameters_arg_conv;
68589         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
68590         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
68591         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
68592         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
68593         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
68594         int64_t ret_ref = 0;
68595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68597         return ret_ref;
68598 }
68599
68600 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
68601         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
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 int64_t  CS_LDK_ChannelDerivationParameters_clone_ptr(int64_t arg) {
68608         LDKChannelDerivationParameters arg_conv;
68609         arg_conv.inner = untag_ptr(arg);
68610         arg_conv.is_owned = ptr_is_owned(arg);
68611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68612         arg_conv.is_owned = false;
68613         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
68614         return ret_conv;
68615 }
68616
68617 int64_t  CS_LDK_ChannelDerivationParameters_clone(int64_t orig) {
68618         LDKChannelDerivationParameters orig_conv;
68619         orig_conv.inner = untag_ptr(orig);
68620         orig_conv.is_owned = ptr_is_owned(orig);
68621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68622         orig_conv.is_owned = false;
68623         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
68624         int64_t ret_ref = 0;
68625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68627         return ret_ref;
68628 }
68629
68630 jboolean  CS_LDK_ChannelDerivationParameters_eq(int64_t a, int64_t b) {
68631         LDKChannelDerivationParameters a_conv;
68632         a_conv.inner = untag_ptr(a);
68633         a_conv.is_owned = ptr_is_owned(a);
68634         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68635         a_conv.is_owned = false;
68636         LDKChannelDerivationParameters b_conv;
68637         b_conv.inner = untag_ptr(b);
68638         b_conv.is_owned = ptr_is_owned(b);
68639         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68640         b_conv.is_owned = false;
68641         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
68642         return ret_conv;
68643 }
68644
68645 int8_tArray  CS_LDK_ChannelDerivationParameters_write(int64_t obj) {
68646         LDKChannelDerivationParameters obj_conv;
68647         obj_conv.inner = untag_ptr(obj);
68648         obj_conv.is_owned = ptr_is_owned(obj);
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68650         obj_conv.is_owned = false;
68651         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
68652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68654         CVec_u8Z_free(ret_var);
68655         return ret_arr;
68656 }
68657
68658 int64_t  CS_LDK_ChannelDerivationParameters_read(int8_tArray ser) {
68659         LDKu8slice ser_ref;
68660         ser_ref.datalen = ser->arr_len;
68661         ser_ref.data = ser->elems;
68662         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
68663         *ret_conv = ChannelDerivationParameters_read(ser_ref);
68664         FREE(ser);
68665         return tag_ptr(ret_conv, true);
68666 }
68667
68668 void  CS_LDK_HTLCDescriptor_free(int64_t this_obj) {
68669         LDKHTLCDescriptor this_obj_conv;
68670         this_obj_conv.inner = untag_ptr(this_obj);
68671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68673         HTLCDescriptor_free(this_obj_conv);
68674 }
68675
68676 int64_t  CS_LDK_HTLCDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
68677         LDKHTLCDescriptor this_ptr_conv;
68678         this_ptr_conv.inner = untag_ptr(this_ptr);
68679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68681         this_ptr_conv.is_owned = false;
68682         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
68683         int64_t ret_ref = 0;
68684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68686         return ret_ref;
68687 }
68688
68689 void  CS_LDK_HTLCDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
68690         LDKHTLCDescriptor this_ptr_conv;
68691         this_ptr_conv.inner = untag_ptr(this_ptr);
68692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68694         this_ptr_conv.is_owned = false;
68695         LDKChannelDerivationParameters val_conv;
68696         val_conv.inner = untag_ptr(val);
68697         val_conv.is_owned = ptr_is_owned(val);
68698         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68699         val_conv = ChannelDerivationParameters_clone(&val_conv);
68700         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
68701 }
68702
68703 int64_t  CS_LDK_HTLCDescriptor_get_per_commitment_number(int64_t this_ptr) {
68704         LDKHTLCDescriptor this_ptr_conv;
68705         this_ptr_conv.inner = untag_ptr(this_ptr);
68706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68708         this_ptr_conv.is_owned = false;
68709         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
68710         return ret_conv;
68711 }
68712
68713 void  CS_LDK_HTLCDescriptor_set_per_commitment_number(int64_t this_ptr, int64_t val) {
68714         LDKHTLCDescriptor this_ptr_conv;
68715         this_ptr_conv.inner = untag_ptr(this_ptr);
68716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68718         this_ptr_conv.is_owned = false;
68719         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
68720 }
68721
68722 int8_tArray  CS_LDK_HTLCDescriptor_get_per_commitment_point(int64_t this_ptr) {
68723         LDKHTLCDescriptor this_ptr_conv;
68724         this_ptr_conv.inner = untag_ptr(this_ptr);
68725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68727         this_ptr_conv.is_owned = false;
68728         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68729         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
68730         return ret_arr;
68731 }
68732
68733 void  CS_LDK_HTLCDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
68734         LDKHTLCDescriptor this_ptr_conv;
68735         this_ptr_conv.inner = untag_ptr(this_ptr);
68736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68738         this_ptr_conv.is_owned = false;
68739         LDKPublicKey val_ref;
68740         CHECK(val->arr_len == 33);
68741         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68742         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
68743 }
68744
68745 int32_t  CS_LDK_HTLCDescriptor_get_feerate_per_kw(int64_t this_ptr) {
68746         LDKHTLCDescriptor this_ptr_conv;
68747         this_ptr_conv.inner = untag_ptr(this_ptr);
68748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68750         this_ptr_conv.is_owned = false;
68751         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
68752         return ret_conv;
68753 }
68754
68755 void  CS_LDK_HTLCDescriptor_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
68756         LDKHTLCDescriptor this_ptr_conv;
68757         this_ptr_conv.inner = untag_ptr(this_ptr);
68758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68760         this_ptr_conv.is_owned = false;
68761         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
68762 }
68763
68764 int64_t  CS_LDK_HTLCDescriptor_get_htlc(int64_t this_ptr) {
68765         LDKHTLCDescriptor this_ptr_conv;
68766         this_ptr_conv.inner = untag_ptr(this_ptr);
68767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68769         this_ptr_conv.is_owned = false;
68770         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
68771         int64_t ret_ref = 0;
68772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68774         return ret_ref;
68775 }
68776
68777 void  CS_LDK_HTLCDescriptor_set_htlc(int64_t this_ptr, int64_t val) {
68778         LDKHTLCDescriptor this_ptr_conv;
68779         this_ptr_conv.inner = untag_ptr(this_ptr);
68780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68782         this_ptr_conv.is_owned = false;
68783         LDKHTLCOutputInCommitment val_conv;
68784         val_conv.inner = untag_ptr(val);
68785         val_conv.is_owned = ptr_is_owned(val);
68786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68787         val_conv = HTLCOutputInCommitment_clone(&val_conv);
68788         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
68789 }
68790
68791 int64_t  CS_LDK_HTLCDescriptor_get_preimage(int64_t this_ptr) {
68792         LDKHTLCDescriptor this_ptr_conv;
68793         this_ptr_conv.inner = untag_ptr(this_ptr);
68794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68796         this_ptr_conv.is_owned = false;
68797         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
68798         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
68799         int64_t ret_ref = tag_ptr(ret_copy, true);
68800         return ret_ref;
68801 }
68802
68803 void  CS_LDK_HTLCDescriptor_set_preimage(int64_t this_ptr, int64_t val) {
68804         LDKHTLCDescriptor this_ptr_conv;
68805         this_ptr_conv.inner = untag_ptr(this_ptr);
68806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68808         this_ptr_conv.is_owned = false;
68809         void* val_ptr = untag_ptr(val);
68810         CHECK_ACCESS(val_ptr);
68811         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
68812         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
68813         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
68814 }
68815
68816 int8_tArray  CS_LDK_HTLCDescriptor_get_counterparty_sig(int64_t this_ptr) {
68817         LDKHTLCDescriptor this_ptr_conv;
68818         this_ptr_conv.inner = untag_ptr(this_ptr);
68819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68821         this_ptr_conv.is_owned = false;
68822         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
68823         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
68824         return ret_arr;
68825 }
68826
68827 void  CS_LDK_HTLCDescriptor_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
68828         LDKHTLCDescriptor this_ptr_conv;
68829         this_ptr_conv.inner = untag_ptr(this_ptr);
68830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68832         this_ptr_conv.is_owned = false;
68833         LDKECDSASignature val_ref;
68834         CHECK(val->arr_len == 64);
68835         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
68836         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
68837 }
68838
68839 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
68840         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
68841         int64_t ret_ref = 0;
68842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68844         return ret_ref;
68845 }
68846 int64_t  CS_LDK_HTLCDescriptor_clone_ptr(int64_t arg) {
68847         LDKHTLCDescriptor arg_conv;
68848         arg_conv.inner = untag_ptr(arg);
68849         arg_conv.is_owned = ptr_is_owned(arg);
68850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68851         arg_conv.is_owned = false;
68852         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
68853         return ret_conv;
68854 }
68855
68856 int64_t  CS_LDK_HTLCDescriptor_clone(int64_t orig) {
68857         LDKHTLCDescriptor orig_conv;
68858         orig_conv.inner = untag_ptr(orig);
68859         orig_conv.is_owned = ptr_is_owned(orig);
68860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68861         orig_conv.is_owned = false;
68862         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
68863         int64_t ret_ref = 0;
68864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68866         return ret_ref;
68867 }
68868
68869 jboolean  CS_LDK_HTLCDescriptor_eq(int64_t a, int64_t b) {
68870         LDKHTLCDescriptor a_conv;
68871         a_conv.inner = untag_ptr(a);
68872         a_conv.is_owned = ptr_is_owned(a);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68874         a_conv.is_owned = false;
68875         LDKHTLCDescriptor b_conv;
68876         b_conv.inner = untag_ptr(b);
68877         b_conv.is_owned = ptr_is_owned(b);
68878         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68879         b_conv.is_owned = false;
68880         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
68881         return ret_conv;
68882 }
68883
68884 int8_tArray  CS_LDK_HTLCDescriptor_write(int64_t obj) {
68885         LDKHTLCDescriptor obj_conv;
68886         obj_conv.inner = untag_ptr(obj);
68887         obj_conv.is_owned = ptr_is_owned(obj);
68888         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68889         obj_conv.is_owned = false;
68890         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
68891         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68892         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68893         CVec_u8Z_free(ret_var);
68894         return ret_arr;
68895 }
68896
68897 int64_t  CS_LDK_HTLCDescriptor_read(int8_tArray ser) {
68898         LDKu8slice ser_ref;
68899         ser_ref.datalen = ser->arr_len;
68900         ser_ref.data = ser->elems;
68901         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
68902         *ret_conv = HTLCDescriptor_read(ser_ref);
68903         FREE(ser);
68904         return tag_ptr(ret_conv, true);
68905 }
68906
68907 int64_t  CS_LDK_HTLCDescriptor_outpoint(int64_t this_arg) {
68908         LDKHTLCDescriptor this_arg_conv;
68909         this_arg_conv.inner = untag_ptr(this_arg);
68910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68912         this_arg_conv.is_owned = false;
68913         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
68914         int64_t ret_ref = 0;
68915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68917         return ret_ref;
68918 }
68919
68920 int64_t  CS_LDK_HTLCDescriptor_previous_utxo(int64_t this_arg) {
68921         LDKHTLCDescriptor this_arg_conv;
68922         this_arg_conv.inner = untag_ptr(this_arg);
68923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68925         this_arg_conv.is_owned = false;
68926         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68927         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
68928         return tag_ptr(ret_ref, true);
68929 }
68930
68931 int64_t  CS_LDK_HTLCDescriptor_unsigned_tx_input(int64_t this_arg) {
68932         LDKHTLCDescriptor this_arg_conv;
68933         this_arg_conv.inner = untag_ptr(this_arg);
68934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68936         this_arg_conv.is_owned = false;
68937         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
68938         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
68939         return tag_ptr(ret_ref, true);
68940 }
68941
68942 int64_t  CS_LDK_HTLCDescriptor_tx_output(int64_t this_arg) {
68943         LDKHTLCDescriptor this_arg_conv;
68944         this_arg_conv.inner = untag_ptr(this_arg);
68945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68947         this_arg_conv.is_owned = false;
68948         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
68949         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
68950         return tag_ptr(ret_ref, true);
68951 }
68952
68953 int8_tArray  CS_LDK_HTLCDescriptor_witness_script(int64_t this_arg) {
68954         LDKHTLCDescriptor this_arg_conv;
68955         this_arg_conv.inner = untag_ptr(this_arg);
68956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68958         this_arg_conv.is_owned = false;
68959         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
68960         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68961         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68962         CVec_u8Z_free(ret_var);
68963         return ret_arr;
68964 }
68965
68966 int8_tArray  CS_LDK_HTLCDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
68967         LDKHTLCDescriptor this_arg_conv;
68968         this_arg_conv.inner = untag_ptr(this_arg);
68969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68971         this_arg_conv.is_owned = false;
68972         LDKECDSASignature signature_ref;
68973         CHECK(signature->arr_len == 64);
68974         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
68975         LDKu8slice witness_script_ref;
68976         witness_script_ref.datalen = witness_script->arr_len;
68977         witness_script_ref.data = witness_script->elems;
68978         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
68979         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68980         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68981         Witness_free(ret_var);
68982         FREE(witness_script);
68983         return ret_arr;
68984 }
68985
68986 int64_t  CS_LDK_HTLCDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
68987         LDKHTLCDescriptor this_arg_conv;
68988         this_arg_conv.inner = untag_ptr(this_arg);
68989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68991         this_arg_conv.is_owned = false;
68992         void* signer_provider_ptr = untag_ptr(signer_provider);
68993         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
68994         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
68995         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
68996         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
68997         return tag_ptr(ret_ret, true);
68998 }
68999
69000 void  CS_LDK_ChannelSigner_free(int64_t this_ptr) {
69001         if (!ptr_is_owned(this_ptr)) return;
69002         void* this_ptr_ptr = untag_ptr(this_ptr);
69003         CHECK_ACCESS(this_ptr_ptr);
69004         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
69005         FREE(untag_ptr(this_ptr));
69006         ChannelSigner_free(this_ptr_conv);
69007 }
69008
69009 int32_t  CS_LDK_Recipient_clone(int64_t orig) {
69010         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
69011         int32_t ret_conv = LDKRecipient_to_cs(Recipient_clone(orig_conv));
69012         return ret_conv;
69013 }
69014
69015 int32_t  CS_LDK_Recipient_node() {
69016         int32_t ret_conv = LDKRecipient_to_cs(Recipient_node());
69017         return ret_conv;
69018 }
69019
69020 int32_t  CS_LDK_Recipient_phantom_node() {
69021         int32_t ret_conv = LDKRecipient_to_cs(Recipient_phantom_node());
69022         return ret_conv;
69023 }
69024
69025 void  CS_LDK_EntropySource_free(int64_t this_ptr) {
69026         if (!ptr_is_owned(this_ptr)) return;
69027         void* this_ptr_ptr = untag_ptr(this_ptr);
69028         CHECK_ACCESS(this_ptr_ptr);
69029         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
69030         FREE(untag_ptr(this_ptr));
69031         EntropySource_free(this_ptr_conv);
69032 }
69033
69034 void  CS_LDK_NodeSigner_free(int64_t this_ptr) {
69035         if (!ptr_is_owned(this_ptr)) return;
69036         void* this_ptr_ptr = untag_ptr(this_ptr);
69037         CHECK_ACCESS(this_ptr_ptr);
69038         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
69039         FREE(untag_ptr(this_ptr));
69040         NodeSigner_free(this_ptr_conv);
69041 }
69042
69043 void  CS_LDK_SignerProvider_free(int64_t this_ptr) {
69044         if (!ptr_is_owned(this_ptr)) return;
69045         void* this_ptr_ptr = untag_ptr(this_ptr);
69046         CHECK_ACCESS(this_ptr_ptr);
69047         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
69048         FREE(untag_ptr(this_ptr));
69049         SignerProvider_free(this_ptr_conv);
69050 }
69051
69052 void  CS_LDK_InMemorySigner_free(int64_t this_obj) {
69053         LDKInMemorySigner this_obj_conv;
69054         this_obj_conv.inner = untag_ptr(this_obj);
69055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69057         InMemorySigner_free(this_obj_conv);
69058 }
69059
69060 int8_tArray  CS_LDK_InMemorySigner_get_funding_key(int64_t this_ptr) {
69061         LDKInMemorySigner this_ptr_conv;
69062         this_ptr_conv.inner = untag_ptr(this_ptr);
69063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69065         this_ptr_conv.is_owned = false;
69066         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69067         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
69068         return ret_arr;
69069 }
69070
69071 void  CS_LDK_InMemorySigner_set_funding_key(int64_t this_ptr, int8_tArray val) {
69072         LDKInMemorySigner this_ptr_conv;
69073         this_ptr_conv.inner = untag_ptr(this_ptr);
69074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69076         this_ptr_conv.is_owned = false;
69077         LDKSecretKey val_ref;
69078         CHECK(val->arr_len == 32);
69079         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69080         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
69081 }
69082
69083 int8_tArray  CS_LDK_InMemorySigner_get_revocation_base_key(int64_t this_ptr) {
69084         LDKInMemorySigner this_ptr_conv;
69085         this_ptr_conv.inner = untag_ptr(this_ptr);
69086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69088         this_ptr_conv.is_owned = false;
69089         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69090         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
69091         return ret_arr;
69092 }
69093
69094 void  CS_LDK_InMemorySigner_set_revocation_base_key(int64_t this_ptr, int8_tArray val) {
69095         LDKInMemorySigner this_ptr_conv;
69096         this_ptr_conv.inner = untag_ptr(this_ptr);
69097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69099         this_ptr_conv.is_owned = false;
69100         LDKSecretKey val_ref;
69101         CHECK(val->arr_len == 32);
69102         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69103         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
69104 }
69105
69106 int8_tArray  CS_LDK_InMemorySigner_get_payment_key(int64_t this_ptr) {
69107         LDKInMemorySigner this_ptr_conv;
69108         this_ptr_conv.inner = untag_ptr(this_ptr);
69109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69111         this_ptr_conv.is_owned = false;
69112         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69113         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
69114         return ret_arr;
69115 }
69116
69117 void  CS_LDK_InMemorySigner_set_payment_key(int64_t this_ptr, int8_tArray val) {
69118         LDKInMemorySigner this_ptr_conv;
69119         this_ptr_conv.inner = untag_ptr(this_ptr);
69120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69122         this_ptr_conv.is_owned = false;
69123         LDKSecretKey val_ref;
69124         CHECK(val->arr_len == 32);
69125         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69126         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
69127 }
69128
69129 int8_tArray  CS_LDK_InMemorySigner_get_delayed_payment_base_key(int64_t this_ptr) {
69130         LDKInMemorySigner this_ptr_conv;
69131         this_ptr_conv.inner = untag_ptr(this_ptr);
69132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69134         this_ptr_conv.is_owned = false;
69135         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69136         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
69137         return ret_arr;
69138 }
69139
69140 void  CS_LDK_InMemorySigner_set_delayed_payment_base_key(int64_t this_ptr, int8_tArray val) {
69141         LDKInMemorySigner this_ptr_conv;
69142         this_ptr_conv.inner = untag_ptr(this_ptr);
69143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69145         this_ptr_conv.is_owned = false;
69146         LDKSecretKey val_ref;
69147         CHECK(val->arr_len == 32);
69148         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69149         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
69150 }
69151
69152 int8_tArray  CS_LDK_InMemorySigner_get_htlc_base_key(int64_t this_ptr) {
69153         LDKInMemorySigner this_ptr_conv;
69154         this_ptr_conv.inner = untag_ptr(this_ptr);
69155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69157         this_ptr_conv.is_owned = false;
69158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69159         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
69160         return ret_arr;
69161 }
69162
69163 void  CS_LDK_InMemorySigner_set_htlc_base_key(int64_t this_ptr, int8_tArray val) {
69164         LDKInMemorySigner this_ptr_conv;
69165         this_ptr_conv.inner = untag_ptr(this_ptr);
69166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69168         this_ptr_conv.is_owned = false;
69169         LDKSecretKey val_ref;
69170         CHECK(val->arr_len == 32);
69171         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
69172         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
69173 }
69174
69175 int8_tArray  CS_LDK_InMemorySigner_get_commitment_seed(int64_t this_ptr) {
69176         LDKInMemorySigner this_ptr_conv;
69177         this_ptr_conv.inner = untag_ptr(this_ptr);
69178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69180         this_ptr_conv.is_owned = false;
69181         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69182         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
69183         return ret_arr;
69184 }
69185
69186 void  CS_LDK_InMemorySigner_set_commitment_seed(int64_t this_ptr, int8_tArray val) {
69187         LDKInMemorySigner this_ptr_conv;
69188         this_ptr_conv.inner = untag_ptr(this_ptr);
69189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69191         this_ptr_conv.is_owned = false;
69192         LDKThirtyTwoBytes val_ref;
69193         CHECK(val->arr_len == 32);
69194         memcpy(val_ref.data, val->elems, 32); FREE(val);
69195         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
69196 }
69197
69198 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
69199         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
69200         int64_t ret_ref = 0;
69201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69203         return ret_ref;
69204 }
69205 int64_t  CS_LDK_InMemorySigner_clone_ptr(int64_t arg) {
69206         LDKInMemorySigner arg_conv;
69207         arg_conv.inner = untag_ptr(arg);
69208         arg_conv.is_owned = ptr_is_owned(arg);
69209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69210         arg_conv.is_owned = false;
69211         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
69212         return ret_conv;
69213 }
69214
69215 int64_t  CS_LDK_InMemorySigner_clone(int64_t orig) {
69216         LDKInMemorySigner orig_conv;
69217         orig_conv.inner = untag_ptr(orig);
69218         orig_conv.is_owned = ptr_is_owned(orig);
69219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69220         orig_conv.is_owned = false;
69221         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
69222         int64_t ret_ref = 0;
69223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69225         return ret_ref;
69226 }
69227
69228 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) {
69229         LDKSecretKey funding_key_ref;
69230         CHECK(funding_key->arr_len == 32);
69231         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
69232         LDKSecretKey revocation_base_key_ref;
69233         CHECK(revocation_base_key->arr_len == 32);
69234         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
69235         LDKSecretKey payment_key_ref;
69236         CHECK(payment_key->arr_len == 32);
69237         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
69238         LDKSecretKey delayed_payment_base_key_ref;
69239         CHECK(delayed_payment_base_key->arr_len == 32);
69240         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
69241         LDKSecretKey htlc_base_key_ref;
69242         CHECK(htlc_base_key->arr_len == 32);
69243         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
69244         LDKThirtyTwoBytes commitment_seed_ref;
69245         CHECK(commitment_seed->arr_len == 32);
69246         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
69247         LDKThirtyTwoBytes channel_keys_id_ref;
69248         CHECK(channel_keys_id->arr_len == 32);
69249         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
69250         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
69251         CHECK(rand_bytes_unique_start->arr_len == 32);
69252         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
69253         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);
69254         int64_t ret_ref = 0;
69255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69257         return ret_ref;
69258 }
69259
69260 int64_t  CS_LDK_InMemorySigner_counterparty_pubkeys(int64_t this_arg) {
69261         LDKInMemorySigner this_arg_conv;
69262         this_arg_conv.inner = untag_ptr(this_arg);
69263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69265         this_arg_conv.is_owned = false;
69266         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
69267         int64_t ret_ref = 0;
69268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69270         return ret_ref;
69271 }
69272
69273 int64_t  CS_LDK_InMemorySigner_counterparty_selected_contest_delay(int64_t this_arg) {
69274         LDKInMemorySigner this_arg_conv;
69275         this_arg_conv.inner = untag_ptr(this_arg);
69276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69278         this_arg_conv.is_owned = false;
69279         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
69280         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
69281         int64_t ret_ref = tag_ptr(ret_copy, true);
69282         return ret_ref;
69283 }
69284
69285 int64_t  CS_LDK_InMemorySigner_holder_selected_contest_delay(int64_t this_arg) {
69286         LDKInMemorySigner this_arg_conv;
69287         this_arg_conv.inner = untag_ptr(this_arg);
69288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69290         this_arg_conv.is_owned = false;
69291         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
69292         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
69293         int64_t ret_ref = tag_ptr(ret_copy, true);
69294         return ret_ref;
69295 }
69296
69297 int64_t  CS_LDK_InMemorySigner_is_outbound(int64_t this_arg) {
69298         LDKInMemorySigner this_arg_conv;
69299         this_arg_conv.inner = untag_ptr(this_arg);
69300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69302         this_arg_conv.is_owned = false;
69303         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
69304         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
69305         int64_t ret_ref = tag_ptr(ret_copy, true);
69306         return ret_ref;
69307 }
69308
69309 int64_t  CS_LDK_InMemorySigner_funding_outpoint(int64_t this_arg) {
69310         LDKInMemorySigner this_arg_conv;
69311         this_arg_conv.inner = untag_ptr(this_arg);
69312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69314         this_arg_conv.is_owned = false;
69315         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
69316         int64_t ret_ref = 0;
69317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69319         return ret_ref;
69320 }
69321
69322 int64_t  CS_LDK_InMemorySigner_get_channel_parameters(int64_t this_arg) {
69323         LDKInMemorySigner this_arg_conv;
69324         this_arg_conv.inner = untag_ptr(this_arg);
69325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69327         this_arg_conv.is_owned = false;
69328         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
69329         int64_t ret_ref = 0;
69330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69332         return ret_ref;
69333 }
69334
69335 int64_t  CS_LDK_InMemorySigner_channel_type_features(int64_t this_arg) {
69336         LDKInMemorySigner this_arg_conv;
69337         this_arg_conv.inner = untag_ptr(this_arg);
69338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69340         this_arg_conv.is_owned = false;
69341         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
69342         int64_t ret_ref = 0;
69343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69345         return ret_ref;
69346 }
69347
69348 int64_t  CS_LDK_InMemorySigner_sign_counterparty_payment_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
69349         LDKInMemorySigner this_arg_conv;
69350         this_arg_conv.inner = untag_ptr(this_arg);
69351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69353         this_arg_conv.is_owned = false;
69354         LDKTransaction spend_tx_ref;
69355         spend_tx_ref.datalen = spend_tx->arr_len;
69356         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
69357         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
69358         spend_tx_ref.data_is_owned = true;
69359         LDKStaticPaymentOutputDescriptor descriptor_conv;
69360         descriptor_conv.inner = untag_ptr(descriptor);
69361         descriptor_conv.is_owned = ptr_is_owned(descriptor);
69362         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
69363         descriptor_conv.is_owned = false;
69364         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
69365         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
69366         return tag_ptr(ret_conv, true);
69367 }
69368
69369 int64_t  CS_LDK_InMemorySigner_sign_dynamic_p2wsh_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
69370         LDKInMemorySigner this_arg_conv;
69371         this_arg_conv.inner = untag_ptr(this_arg);
69372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69374         this_arg_conv.is_owned = false;
69375         LDKTransaction spend_tx_ref;
69376         spend_tx_ref.datalen = spend_tx->arr_len;
69377         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
69378         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
69379         spend_tx_ref.data_is_owned = true;
69380         LDKDelayedPaymentOutputDescriptor descriptor_conv;
69381         descriptor_conv.inner = untag_ptr(descriptor);
69382         descriptor_conv.is_owned = ptr_is_owned(descriptor);
69383         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
69384         descriptor_conv.is_owned = false;
69385         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
69386         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
69387         return tag_ptr(ret_conv, true);
69388 }
69389
69390 int64_t  CS_LDK_InMemorySigner_as_EntropySource(int64_t this_arg) {
69391         LDKInMemorySigner this_arg_conv;
69392         this_arg_conv.inner = untag_ptr(this_arg);
69393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69395         this_arg_conv.is_owned = false;
69396         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69397         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
69398         return tag_ptr(ret_ret, true);
69399 }
69400
69401 int64_t  CS_LDK_InMemorySigner_as_ChannelSigner(int64_t this_arg) {
69402         LDKInMemorySigner this_arg_conv;
69403         this_arg_conv.inner = untag_ptr(this_arg);
69404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69406         this_arg_conv.is_owned = false;
69407         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
69408         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
69409         return tag_ptr(ret_ret, true);
69410 }
69411
69412 int64_t  CS_LDK_InMemorySigner_as_EcdsaChannelSigner(int64_t this_arg) {
69413         LDKInMemorySigner this_arg_conv;
69414         this_arg_conv.inner = untag_ptr(this_arg);
69415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69417         this_arg_conv.is_owned = false;
69418         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
69419         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
69420         return tag_ptr(ret_ret, true);
69421 }
69422
69423 int64_t  CS_LDK_InMemorySigner_as_WriteableEcdsaChannelSigner(int64_t this_arg) {
69424         LDKInMemorySigner this_arg_conv;
69425         this_arg_conv.inner = untag_ptr(this_arg);
69426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69428         this_arg_conv.is_owned = false;
69429         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69430         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
69431         return tag_ptr(ret_ret, true);
69432 }
69433
69434 int8_tArray  CS_LDK_InMemorySigner_write(int64_t obj) {
69435         LDKInMemorySigner obj_conv;
69436         obj_conv.inner = untag_ptr(obj);
69437         obj_conv.is_owned = ptr_is_owned(obj);
69438         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69439         obj_conv.is_owned = false;
69440         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
69441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69443         CVec_u8Z_free(ret_var);
69444         return ret_arr;
69445 }
69446
69447 int64_t  CS_LDK_InMemorySigner_read(int8_tArray ser, int64_t arg) {
69448         LDKu8slice ser_ref;
69449         ser_ref.datalen = ser->arr_len;
69450         ser_ref.data = ser->elems;
69451         void* arg_ptr = untag_ptr(arg);
69452         CHECK_ACCESS(arg_ptr);
69453         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
69454         if (arg_conv.free == LDKEntropySource_JCalls_free) {
69455                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69456                 LDKEntropySource_JCalls_cloned(&arg_conv);
69457         }
69458         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
69459         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
69460         FREE(ser);
69461         return tag_ptr(ret_conv, true);
69462 }
69463
69464 void  CS_LDK_KeysManager_free(int64_t this_obj) {
69465         LDKKeysManager this_obj_conv;
69466         this_obj_conv.inner = untag_ptr(this_obj);
69467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69469         KeysManager_free(this_obj_conv);
69470 }
69471
69472 int64_t  CS_LDK_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
69473         uint8_t seed_arr[32];
69474         CHECK(seed->arr_len == 32);
69475         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69476         uint8_t (*seed_ref)[32] = &seed_arr;
69477         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
69478         int64_t ret_ref = 0;
69479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69481         return ret_ref;
69482 }
69483
69484 int8_tArray  CS_LDK_KeysManager_get_node_secret_key(int64_t this_arg) {
69485         LDKKeysManager this_arg_conv;
69486         this_arg_conv.inner = untag_ptr(this_arg);
69487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69489         this_arg_conv.is_owned = false;
69490         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69491         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69492         return ret_arr;
69493 }
69494
69495 int64_t  CS_LDK_KeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
69496         LDKKeysManager this_arg_conv;
69497         this_arg_conv.inner = untag_ptr(this_arg);
69498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69500         this_arg_conv.is_owned = false;
69501         uint8_t params_arr[32];
69502         CHECK(params->arr_len == 32);
69503         memcpy(params_arr, params->elems, 32); FREE(params);
69504         uint8_t (*params_ref)[32] = &params_arr;
69505         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69506         int64_t ret_ref = 0;
69507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69509         return ret_ref;
69510 }
69511
69512 int64_t  CS_LDK_KeysManager_sign_spendable_outputs_psbt(int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
69513         LDKKeysManager this_arg_conv;
69514         this_arg_conv.inner = untag_ptr(this_arg);
69515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69517         this_arg_conv.is_owned = false;
69518         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69519         descriptors_constr.datalen = descriptors->arr_len;
69520         if (descriptors_constr.datalen > 0)
69521                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69522         else
69523                 descriptors_constr.data = NULL;
69524         int64_t* descriptors_vals = descriptors->elems;
69525         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69526                 int64_t descriptors_conv_27 = descriptors_vals[b];
69527                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69528                 CHECK_ACCESS(descriptors_conv_27_ptr);
69529                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69530                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69531                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69532         }
69533         FREE(descriptors);
69534         LDKCVec_u8Z psbt_ref;
69535         psbt_ref.datalen = psbt->arr_len;
69536         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
69537         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
69538         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
69539         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
69540         return tag_ptr(ret_conv, true);
69541 }
69542
69543 int64_t  CS_LDK_KeysManager_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) {
69544         LDKKeysManager this_arg_conv;
69545         this_arg_conv.inner = untag_ptr(this_arg);
69546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69548         this_arg_conv.is_owned = false;
69549         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69550         descriptors_constr.datalen = descriptors->arr_len;
69551         if (descriptors_constr.datalen > 0)
69552                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69553         else
69554                 descriptors_constr.data = NULL;
69555         int64_t* descriptors_vals = descriptors->elems;
69556         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69557                 int64_t descriptors_conv_27 = descriptors_vals[b];
69558                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69559                 CHECK_ACCESS(descriptors_conv_27_ptr);
69560                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69561                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69562                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69563         }
69564         FREE(descriptors);
69565         LDKCVec_TxOutZ outputs_constr;
69566         outputs_constr.datalen = outputs->arr_len;
69567         if (outputs_constr.datalen > 0)
69568                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69569         else
69570                 outputs_constr.data = NULL;
69571         int64_t* outputs_vals = outputs->elems;
69572         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69573                 int64_t outputs_conv_7 = outputs_vals[h];
69574                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69575                 CHECK_ACCESS(outputs_conv_7_ptr);
69576                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69577                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69578                 outputs_constr.data[h] = outputs_conv_7_conv;
69579         }
69580         FREE(outputs);
69581         LDKCVec_u8Z change_destination_script_ref;
69582         change_destination_script_ref.datalen = change_destination_script->arr_len;
69583         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69584         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69585         void* locktime_ptr = untag_ptr(locktime);
69586         CHECK_ACCESS(locktime_ptr);
69587         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69588         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69589         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69590         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69591         return tag_ptr(ret_conv, true);
69592 }
69593
69594 int64_t  CS_LDK_KeysManager_as_EntropySource(int64_t this_arg) {
69595         LDKKeysManager this_arg_conv;
69596         this_arg_conv.inner = untag_ptr(this_arg);
69597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69599         this_arg_conv.is_owned = false;
69600         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69601         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
69602         return tag_ptr(ret_ret, true);
69603 }
69604
69605 int64_t  CS_LDK_KeysManager_as_NodeSigner(int64_t this_arg) {
69606         LDKKeysManager this_arg_conv;
69607         this_arg_conv.inner = untag_ptr(this_arg);
69608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69610         this_arg_conv.is_owned = false;
69611         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69612         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
69613         return tag_ptr(ret_ret, true);
69614 }
69615
69616 int64_t  CS_LDK_KeysManager_as_SignerProvider(int64_t this_arg) {
69617         LDKKeysManager this_arg_conv;
69618         this_arg_conv.inner = untag_ptr(this_arg);
69619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69621         this_arg_conv.is_owned = false;
69622         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69623         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
69624         return tag_ptr(ret_ret, true);
69625 }
69626
69627 void  CS_LDK_PhantomKeysManager_free(int64_t this_obj) {
69628         LDKPhantomKeysManager this_obj_conv;
69629         this_obj_conv.inner = untag_ptr(this_obj);
69630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69632         PhantomKeysManager_free(this_obj_conv);
69633 }
69634
69635 int64_t  CS_LDK_PhantomKeysManager_as_EntropySource(int64_t this_arg) {
69636         LDKPhantomKeysManager this_arg_conv;
69637         this_arg_conv.inner = untag_ptr(this_arg);
69638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69640         this_arg_conv.is_owned = false;
69641         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
69642         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
69643         return tag_ptr(ret_ret, true);
69644 }
69645
69646 int64_t  CS_LDK_PhantomKeysManager_as_NodeSigner(int64_t this_arg) {
69647         LDKPhantomKeysManager this_arg_conv;
69648         this_arg_conv.inner = untag_ptr(this_arg);
69649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69651         this_arg_conv.is_owned = false;
69652         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
69653         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
69654         return tag_ptr(ret_ret, true);
69655 }
69656
69657 int64_t  CS_LDK_PhantomKeysManager_as_SignerProvider(int64_t this_arg) {
69658         LDKPhantomKeysManager this_arg_conv;
69659         this_arg_conv.inner = untag_ptr(this_arg);
69660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69662         this_arg_conv.is_owned = false;
69663         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
69664         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
69665         return tag_ptr(ret_ret, true);
69666 }
69667
69668 int64_t  CS_LDK_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
69669         uint8_t seed_arr[32];
69670         CHECK(seed->arr_len == 32);
69671         memcpy(seed_arr, seed->elems, 32); FREE(seed);
69672         uint8_t (*seed_ref)[32] = &seed_arr;
69673         uint8_t cross_node_seed_arr[32];
69674         CHECK(cross_node_seed->arr_len == 32);
69675         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
69676         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
69677         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
69678         int64_t ret_ref = 0;
69679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69681         return ret_ref;
69682 }
69683
69684 int64_t  CS_LDK_PhantomKeysManager_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) {
69685         LDKPhantomKeysManager this_arg_conv;
69686         this_arg_conv.inner = untag_ptr(this_arg);
69687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69689         this_arg_conv.is_owned = false;
69690         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
69691         descriptors_constr.datalen = descriptors->arr_len;
69692         if (descriptors_constr.datalen > 0)
69693                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
69694         else
69695                 descriptors_constr.data = NULL;
69696         int64_t* descriptors_vals = descriptors->elems;
69697         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
69698                 int64_t descriptors_conv_27 = descriptors_vals[b];
69699                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
69700                 CHECK_ACCESS(descriptors_conv_27_ptr);
69701                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
69702                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
69703                 descriptors_constr.data[b] = descriptors_conv_27_conv;
69704         }
69705         FREE(descriptors);
69706         LDKCVec_TxOutZ outputs_constr;
69707         outputs_constr.datalen = outputs->arr_len;
69708         if (outputs_constr.datalen > 0)
69709                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
69710         else
69711                 outputs_constr.data = NULL;
69712         int64_t* outputs_vals = outputs->elems;
69713         for (size_t h = 0; h < outputs_constr.datalen; h++) {
69714                 int64_t outputs_conv_7 = outputs_vals[h];
69715                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
69716                 CHECK_ACCESS(outputs_conv_7_ptr);
69717                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
69718                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
69719                 outputs_constr.data[h] = outputs_conv_7_conv;
69720         }
69721         FREE(outputs);
69722         LDKCVec_u8Z change_destination_script_ref;
69723         change_destination_script_ref.datalen = change_destination_script->arr_len;
69724         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
69725         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
69726         void* locktime_ptr = untag_ptr(locktime);
69727         CHECK_ACCESS(locktime_ptr);
69728         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
69729         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
69730         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
69731         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
69732         return tag_ptr(ret_conv, true);
69733 }
69734
69735 int64_t  CS_LDK_PhantomKeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
69736         LDKPhantomKeysManager this_arg_conv;
69737         this_arg_conv.inner = untag_ptr(this_arg);
69738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69740         this_arg_conv.is_owned = false;
69741         uint8_t params_arr[32];
69742         CHECK(params->arr_len == 32);
69743         memcpy(params_arr, params->elems, 32); FREE(params);
69744         uint8_t (*params_ref)[32] = &params_arr;
69745         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
69746         int64_t ret_ref = 0;
69747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69749         return ret_ref;
69750 }
69751
69752 int8_tArray  CS_LDK_PhantomKeysManager_get_node_secret_key(int64_t this_arg) {
69753         LDKPhantomKeysManager this_arg_conv;
69754         this_arg_conv.inner = untag_ptr(this_arg);
69755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69757         this_arg_conv.is_owned = false;
69758         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69759         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
69760         return ret_arr;
69761 }
69762
69763 int8_tArray  CS_LDK_PhantomKeysManager_get_phantom_node_secret_key(int64_t this_arg) {
69764         LDKPhantomKeysManager this_arg_conv;
69765         this_arg_conv.inner = untag_ptr(this_arg);
69766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69768         this_arg_conv.is_owned = false;
69769         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69770         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
69771         return ret_arr;
69772 }
69773
69774 void  CS_LDK_EcdsaChannelSigner_free(int64_t this_ptr) {
69775         if (!ptr_is_owned(this_ptr)) return;
69776         void* this_ptr_ptr = untag_ptr(this_ptr);
69777         CHECK_ACCESS(this_ptr_ptr);
69778         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
69779         FREE(untag_ptr(this_ptr));
69780         EcdsaChannelSigner_free(this_ptr_conv);
69781 }
69782
69783 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
69784         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69785         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
69786         return tag_ptr(ret_ret, true);
69787 }
69788 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone_ptr(int64_t arg) {
69789         void* arg_ptr = untag_ptr(arg);
69790         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69791         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
69792         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
69793         return ret_conv;
69794 }
69795
69796 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone(int64_t orig) {
69797         void* orig_ptr = untag_ptr(orig);
69798         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69799         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
69800         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
69801         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
69802         return tag_ptr(ret_ret, true);
69803 }
69804
69805 void  CS_LDK_WriteableEcdsaChannelSigner_free(int64_t this_ptr) {
69806         if (!ptr_is_owned(this_ptr)) return;
69807         void* this_ptr_ptr = untag_ptr(this_ptr);
69808         CHECK_ACCESS(this_ptr_ptr);
69809         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
69810         FREE(untag_ptr(this_ptr));
69811         WriteableEcdsaChannelSigner_free(this_ptr_conv);
69812 }
69813
69814 void  CS_LDK_OnionMessenger_free(int64_t this_obj) {
69815         LDKOnionMessenger this_obj_conv;
69816         this_obj_conv.inner = untag_ptr(this_obj);
69817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69819         OnionMessenger_free(this_obj_conv);
69820 }
69821
69822 void  CS_LDK_MessageRouter_free(int64_t this_ptr) {
69823         if (!ptr_is_owned(this_ptr)) return;
69824         void* this_ptr_ptr = untag_ptr(this_ptr);
69825         CHECK_ACCESS(this_ptr_ptr);
69826         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
69827         FREE(untag_ptr(this_ptr));
69828         MessageRouter_free(this_ptr_conv);
69829 }
69830
69831 void  CS_LDK_DefaultMessageRouter_free(int64_t this_obj) {
69832         LDKDefaultMessageRouter this_obj_conv;
69833         this_obj_conv.inner = untag_ptr(this_obj);
69834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69836         DefaultMessageRouter_free(this_obj_conv);
69837 }
69838
69839 int64_t  CS_LDK_DefaultMessageRouter_new(int64_t network_graph, int64_t entropy_source) {
69840         LDKNetworkGraph network_graph_conv;
69841         network_graph_conv.inner = untag_ptr(network_graph);
69842         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69843         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69844         network_graph_conv.is_owned = false;
69845         void* entropy_source_ptr = untag_ptr(entropy_source);
69846         CHECK_ACCESS(entropy_source_ptr);
69847         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69848         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69849                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69850                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69851         }
69852         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
69853         int64_t ret_ref = 0;
69854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69856         return ret_ref;
69857 }
69858
69859 int64_t  CS_LDK_DefaultMessageRouter_as_MessageRouter(int64_t this_arg) {
69860         LDKDefaultMessageRouter this_arg_conv;
69861         this_arg_conv.inner = untag_ptr(this_arg);
69862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69864         this_arg_conv.is_owned = false;
69865         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69866         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
69867         return tag_ptr(ret_ret, true);
69868 }
69869
69870 void  CS_LDK_OnionMessagePath_free(int64_t this_obj) {
69871         LDKOnionMessagePath this_obj_conv;
69872         this_obj_conv.inner = untag_ptr(this_obj);
69873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69875         OnionMessagePath_free(this_obj_conv);
69876 }
69877
69878 ptrArray  CS_LDK_OnionMessagePath_get_intermediate_nodes(int64_t this_ptr) {
69879         LDKOnionMessagePath this_ptr_conv;
69880         this_ptr_conv.inner = untag_ptr(this_ptr);
69881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69883         this_ptr_conv.is_owned = false;
69884         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
69885         ptrArray ret_arr = NULL;
69886         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
69887         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
69888         for (size_t i = 0; i < ret_var.datalen; i++) {
69889                 int8_tArray ret_conv_8_arr = init_int8_tArray(33, __LINE__);
69890                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compressed_form, 33);
69891                 ret_arr_ptr[i] = ret_conv_8_arr;
69892         }
69893         
69894         FREE(ret_var.data);
69895         return ret_arr;
69896 }
69897
69898 void  CS_LDK_OnionMessagePath_set_intermediate_nodes(int64_t this_ptr, ptrArray val) {
69899         LDKOnionMessagePath this_ptr_conv;
69900         this_ptr_conv.inner = untag_ptr(this_ptr);
69901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69903         this_ptr_conv.is_owned = false;
69904         LDKCVec_PublicKeyZ val_constr;
69905         val_constr.datalen = val->arr_len;
69906         if (val_constr.datalen > 0)
69907                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69908         else
69909                 val_constr.data = NULL;
69910         int8_tArray* val_vals = (void*) val->elems;
69911         for (size_t i = 0; i < val_constr.datalen; i++) {
69912                 int8_tArray val_conv_8 = val_vals[i];
69913                 LDKPublicKey val_conv_8_ref;
69914                 CHECK(val_conv_8->arr_len == 33);
69915                 memcpy(val_conv_8_ref.compressed_form, val_conv_8->elems, 33); FREE(val_conv_8);
69916                 val_constr.data[i] = val_conv_8_ref;
69917         }
69918         FREE(val);
69919         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
69920 }
69921
69922 int64_t  CS_LDK_OnionMessagePath_get_destination(int64_t this_ptr) {
69923         LDKOnionMessagePath this_ptr_conv;
69924         this_ptr_conv.inner = untag_ptr(this_ptr);
69925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69927         this_ptr_conv.is_owned = false;
69928         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
69929         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
69930         int64_t ret_ref = tag_ptr(ret_copy, true);
69931         return ret_ref;
69932 }
69933
69934 void  CS_LDK_OnionMessagePath_set_destination(int64_t this_ptr, int64_t val) {
69935         LDKOnionMessagePath this_ptr_conv;
69936         this_ptr_conv.inner = untag_ptr(this_ptr);
69937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69939         this_ptr_conv.is_owned = false;
69940         void* val_ptr = untag_ptr(val);
69941         CHECK_ACCESS(val_ptr);
69942         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
69943         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
69944         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
69945 }
69946
69947 int64_t  CS_LDK_OnionMessagePath_get_first_node_addresses(int64_t this_ptr) {
69948         LDKOnionMessagePath this_ptr_conv;
69949         this_ptr_conv.inner = untag_ptr(this_ptr);
69950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69952         this_ptr_conv.is_owned = false;
69953         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69954         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
69955         int64_t ret_ref = tag_ptr(ret_copy, true);
69956         return ret_ref;
69957 }
69958
69959 void  CS_LDK_OnionMessagePath_set_first_node_addresses(int64_t this_ptr, int64_t val) {
69960         LDKOnionMessagePath this_ptr_conv;
69961         this_ptr_conv.inner = untag_ptr(this_ptr);
69962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69964         this_ptr_conv.is_owned = false;
69965         void* val_ptr = untag_ptr(val);
69966         CHECK_ACCESS(val_ptr);
69967         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
69968         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
69969         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
69970 }
69971
69972 int64_t  CS_LDK_OnionMessagePath_new(ptrArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
69973         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
69974         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
69975         if (intermediate_nodes_arg_constr.datalen > 0)
69976                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
69977         else
69978                 intermediate_nodes_arg_constr.data = NULL;
69979         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
69980         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
69981                 int8_tArray intermediate_nodes_arg_conv_8 = intermediate_nodes_arg_vals[i];
69982                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
69983                 CHECK(intermediate_nodes_arg_conv_8->arr_len == 33);
69984                 memcpy(intermediate_nodes_arg_conv_8_ref.compressed_form, intermediate_nodes_arg_conv_8->elems, 33); FREE(intermediate_nodes_arg_conv_8);
69985                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
69986         }
69987         FREE(intermediate_nodes_arg);
69988         void* destination_arg_ptr = untag_ptr(destination_arg);
69989         CHECK_ACCESS(destination_arg_ptr);
69990         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
69991         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
69992         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
69993         CHECK_ACCESS(first_node_addresses_arg_ptr);
69994         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
69995         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
69996         int64_t ret_ref = 0;
69997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69999         return ret_ref;
70000 }
70001
70002 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
70003         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
70004         int64_t ret_ref = 0;
70005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70007         return ret_ref;
70008 }
70009 int64_t  CS_LDK_OnionMessagePath_clone_ptr(int64_t arg) {
70010         LDKOnionMessagePath arg_conv;
70011         arg_conv.inner = untag_ptr(arg);
70012         arg_conv.is_owned = ptr_is_owned(arg);
70013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70014         arg_conv.is_owned = false;
70015         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
70016         return ret_conv;
70017 }
70018
70019 int64_t  CS_LDK_OnionMessagePath_clone(int64_t orig) {
70020         LDKOnionMessagePath orig_conv;
70021         orig_conv.inner = untag_ptr(orig);
70022         orig_conv.is_owned = ptr_is_owned(orig);
70023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70024         orig_conv.is_owned = false;
70025         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
70026         int64_t ret_ref = 0;
70027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70029         return ret_ref;
70030 }
70031
70032 int8_tArray  CS_LDK_OnionMessagePath_first_node(int64_t this_arg) {
70033         LDKOnionMessagePath this_arg_conv;
70034         this_arg_conv.inner = untag_ptr(this_arg);
70035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70037         this_arg_conv.is_owned = false;
70038         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70039         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
70040         return ret_arr;
70041 }
70042
70043 void  CS_LDK_Destination_free(int64_t this_ptr) {
70044         if (!ptr_is_owned(this_ptr)) return;
70045         void* this_ptr_ptr = untag_ptr(this_ptr);
70046         CHECK_ACCESS(this_ptr_ptr);
70047         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
70048         FREE(untag_ptr(this_ptr));
70049         Destination_free(this_ptr_conv);
70050 }
70051
70052 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
70053         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70054         *ret_copy = Destination_clone(arg);
70055         int64_t ret_ref = tag_ptr(ret_copy, true);
70056         return ret_ref;
70057 }
70058 int64_t  CS_LDK_Destination_clone_ptr(int64_t arg) {
70059         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
70060         int64_t ret_conv = Destination_clone_ptr(arg_conv);
70061         return ret_conv;
70062 }
70063
70064 int64_t  CS_LDK_Destination_clone(int64_t orig) {
70065         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
70066         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70067         *ret_copy = Destination_clone(orig_conv);
70068         int64_t ret_ref = tag_ptr(ret_copy, true);
70069         return ret_ref;
70070 }
70071
70072 int64_t  CS_LDK_Destination_node(int8_tArray a) {
70073         LDKPublicKey a_ref;
70074         CHECK(a->arr_len == 33);
70075         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70076         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70077         *ret_copy = Destination_node(a_ref);
70078         int64_t ret_ref = tag_ptr(ret_copy, true);
70079         return ret_ref;
70080 }
70081
70082 int64_t  CS_LDK_Destination_blinded_path(int64_t a) {
70083         LDKBlindedPath a_conv;
70084         a_conv.inner = untag_ptr(a);
70085         a_conv.is_owned = ptr_is_owned(a);
70086         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70087         a_conv = BlindedPath_clone(&a_conv);
70088         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
70089         *ret_copy = Destination_blinded_path(a_conv);
70090         int64_t ret_ref = tag_ptr(ret_copy, true);
70091         return ret_ref;
70092 }
70093
70094 void  CS_LDK_SendSuccess_free(int64_t this_ptr) {
70095         if (!ptr_is_owned(this_ptr)) return;
70096         void* this_ptr_ptr = untag_ptr(this_ptr);
70097         CHECK_ACCESS(this_ptr_ptr);
70098         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
70099         FREE(untag_ptr(this_ptr));
70100         SendSuccess_free(this_ptr_conv);
70101 }
70102
70103 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
70104         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70105         *ret_copy = SendSuccess_clone(arg);
70106         int64_t ret_ref = tag_ptr(ret_copy, true);
70107         return ret_ref;
70108 }
70109 int64_t  CS_LDK_SendSuccess_clone_ptr(int64_t arg) {
70110         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
70111         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
70112         return ret_conv;
70113 }
70114
70115 int64_t  CS_LDK_SendSuccess_clone(int64_t orig) {
70116         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
70117         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70118         *ret_copy = SendSuccess_clone(orig_conv);
70119         int64_t ret_ref = tag_ptr(ret_copy, true);
70120         return ret_ref;
70121 }
70122
70123 int64_t  CS_LDK_SendSuccess_buffered() {
70124         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70125         *ret_copy = SendSuccess_buffered();
70126         int64_t ret_ref = tag_ptr(ret_copy, true);
70127         return ret_ref;
70128 }
70129
70130 int64_t  CS_LDK_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
70131         LDKPublicKey a_ref;
70132         CHECK(a->arr_len == 33);
70133         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70134         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
70135         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
70136         int64_t ret_ref = tag_ptr(ret_copy, true);
70137         return ret_ref;
70138 }
70139
70140 jboolean  CS_LDK_SendSuccess_eq(int64_t a, int64_t b) {
70141         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
70142         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
70143         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
70144         return ret_conv;
70145 }
70146
70147 void  CS_LDK_SendError_free(int64_t this_ptr) {
70148         if (!ptr_is_owned(this_ptr)) return;
70149         void* this_ptr_ptr = untag_ptr(this_ptr);
70150         CHECK_ACCESS(this_ptr_ptr);
70151         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
70152         FREE(untag_ptr(this_ptr));
70153         SendError_free(this_ptr_conv);
70154 }
70155
70156 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
70157         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70158         *ret_copy = SendError_clone(arg);
70159         int64_t ret_ref = tag_ptr(ret_copy, true);
70160         return ret_ref;
70161 }
70162 int64_t  CS_LDK_SendError_clone_ptr(int64_t arg) {
70163         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
70164         int64_t ret_conv = SendError_clone_ptr(arg_conv);
70165         return ret_conv;
70166 }
70167
70168 int64_t  CS_LDK_SendError_clone(int64_t orig) {
70169         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
70170         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70171         *ret_copy = SendError_clone(orig_conv);
70172         int64_t ret_ref = tag_ptr(ret_copy, true);
70173         return ret_ref;
70174 }
70175
70176 int64_t  CS_LDK_SendError_secp256k1(int32_t a) {
70177         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
70178         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70179         *ret_copy = SendError_secp256k1(a_conv);
70180         int64_t ret_ref = tag_ptr(ret_copy, true);
70181         return ret_ref;
70182 }
70183
70184 int64_t  CS_LDK_SendError_too_big_packet() {
70185         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70186         *ret_copy = SendError_too_big_packet();
70187         int64_t ret_ref = tag_ptr(ret_copy, true);
70188         return ret_ref;
70189 }
70190
70191 int64_t  CS_LDK_SendError_too_few_blinded_hops() {
70192         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70193         *ret_copy = SendError_too_few_blinded_hops();
70194         int64_t ret_ref = tag_ptr(ret_copy, true);
70195         return ret_ref;
70196 }
70197
70198 int64_t  CS_LDK_SendError_invalid_first_hop(int8_tArray a) {
70199         LDKPublicKey a_ref;
70200         CHECK(a->arr_len == 33);
70201         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70202         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70203         *ret_copy = SendError_invalid_first_hop(a_ref);
70204         int64_t ret_ref = tag_ptr(ret_copy, true);
70205         return ret_ref;
70206 }
70207
70208 int64_t  CS_LDK_SendError_path_not_found() {
70209         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70210         *ret_copy = SendError_path_not_found();
70211         int64_t ret_ref = tag_ptr(ret_copy, true);
70212         return ret_ref;
70213 }
70214
70215 int64_t  CS_LDK_SendError_invalid_message() {
70216         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70217         *ret_copy = SendError_invalid_message();
70218         int64_t ret_ref = tag_ptr(ret_copy, true);
70219         return ret_ref;
70220 }
70221
70222 int64_t  CS_LDK_SendError_buffer_full() {
70223         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70224         *ret_copy = SendError_buffer_full();
70225         int64_t ret_ref = tag_ptr(ret_copy, true);
70226         return ret_ref;
70227 }
70228
70229 int64_t  CS_LDK_SendError_get_node_id_failed() {
70230         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70231         *ret_copy = SendError_get_node_id_failed();
70232         int64_t ret_ref = tag_ptr(ret_copy, true);
70233         return ret_ref;
70234 }
70235
70236 int64_t  CS_LDK_SendError_blinded_path_advance_failed() {
70237         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
70238         *ret_copy = SendError_blinded_path_advance_failed();
70239         int64_t ret_ref = tag_ptr(ret_copy, true);
70240         return ret_ref;
70241 }
70242
70243 jboolean  CS_LDK_SendError_eq(int64_t a, int64_t b) {
70244         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
70245         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
70246         jboolean ret_conv = SendError_eq(a_conv, b_conv);
70247         return ret_conv;
70248 }
70249
70250 void  CS_LDK_CustomOnionMessageHandler_free(int64_t this_ptr) {
70251         if (!ptr_is_owned(this_ptr)) return;
70252         void* this_ptr_ptr = untag_ptr(this_ptr);
70253         CHECK_ACCESS(this_ptr_ptr);
70254         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
70255         FREE(untag_ptr(this_ptr));
70256         CustomOnionMessageHandler_free(this_ptr_conv);
70257 }
70258
70259 void  CS_LDK_PeeledOnion_free(int64_t this_ptr) {
70260         if (!ptr_is_owned(this_ptr)) return;
70261         void* this_ptr_ptr = untag_ptr(this_ptr);
70262         CHECK_ACCESS(this_ptr_ptr);
70263         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
70264         FREE(untag_ptr(this_ptr));
70265         PeeledOnion_free(this_ptr_conv);
70266 }
70267
70268 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
70269         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70270         *ret_copy = PeeledOnion_clone(arg);
70271         int64_t ret_ref = tag_ptr(ret_copy, true);
70272         return ret_ref;
70273 }
70274 int64_t  CS_LDK_PeeledOnion_clone_ptr(int64_t arg) {
70275         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
70276         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
70277         return ret_conv;
70278 }
70279
70280 int64_t  CS_LDK_PeeledOnion_clone(int64_t orig) {
70281         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
70282         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70283         *ret_copy = PeeledOnion_clone(orig_conv);
70284         int64_t ret_ref = tag_ptr(ret_copy, true);
70285         return ret_ref;
70286 }
70287
70288 int64_t  CS_LDK_PeeledOnion_forward(int8_tArray a, int64_t b) {
70289         LDKPublicKey a_ref;
70290         CHECK(a->arr_len == 33);
70291         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
70292         LDKOnionMessage b_conv;
70293         b_conv.inner = untag_ptr(b);
70294         b_conv.is_owned = ptr_is_owned(b);
70295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70296         b_conv = OnionMessage_clone(&b_conv);
70297         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70298         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
70299         int64_t ret_ref = tag_ptr(ret_copy, true);
70300         return ret_ref;
70301 }
70302
70303 int64_t  CS_LDK_PeeledOnion_receive(int64_t a, int8_tArray b, int64_t c) {
70304         void* a_ptr = untag_ptr(a);
70305         CHECK_ACCESS(a_ptr);
70306         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
70307         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
70308         LDKThirtyTwoBytes b_ref;
70309         CHECK(b->arr_len == 32);
70310         memcpy(b_ref.data, b->elems, 32); FREE(b);
70311         LDKBlindedPath c_conv;
70312         c_conv.inner = untag_ptr(c);
70313         c_conv.is_owned = ptr_is_owned(c);
70314         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
70315         c_conv = BlindedPath_clone(&c_conv);
70316         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
70317         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
70318         int64_t ret_ref = tag_ptr(ret_copy, true);
70319         return ret_ref;
70320 }
70321
70322 int64_t  CS_LDK_create_onion_message(int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
70323         void* entropy_source_ptr = untag_ptr(entropy_source);
70324         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
70325         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
70326         void* node_signer_ptr = untag_ptr(node_signer);
70327         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
70328         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
70329         LDKOnionMessagePath path_conv;
70330         path_conv.inner = untag_ptr(path);
70331         path_conv.is_owned = ptr_is_owned(path);
70332         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
70333         path_conv = OnionMessagePath_clone(&path_conv);
70334         void* contents_ptr = untag_ptr(contents);
70335         CHECK_ACCESS(contents_ptr);
70336         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
70337         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
70338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70339                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
70340         }
70341         LDKBlindedPath reply_path_conv;
70342         reply_path_conv.inner = untag_ptr(reply_path);
70343         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70344         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70345         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70346         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
70347         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
70348         return tag_ptr(ret_conv, true);
70349 }
70350
70351 int64_t  CS_LDK_peel_onion_message(int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
70352         LDKOnionMessage msg_conv;
70353         msg_conv.inner = untag_ptr(msg);
70354         msg_conv.is_owned = ptr_is_owned(msg);
70355         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
70356         msg_conv.is_owned = false;
70357         void* node_signer_ptr = untag_ptr(node_signer);
70358         CHECK_ACCESS(node_signer_ptr);
70359         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70360         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70362                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70363         }
70364         void* logger_ptr = untag_ptr(logger);
70365         CHECK_ACCESS(logger_ptr);
70366         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70367         if (logger_conv.free == LDKLogger_JCalls_free) {
70368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70369                 LDKLogger_JCalls_cloned(&logger_conv);
70370         }
70371         void* custom_handler_ptr = untag_ptr(custom_handler);
70372         CHECK_ACCESS(custom_handler_ptr);
70373         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
70374         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
70375                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70376                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
70377         }
70378         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
70379         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
70380         return tag_ptr(ret_conv, true);
70381 }
70382
70383 int64_t  CS_LDK_OnionMessenger_new(int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
70384         void* entropy_source_ptr = untag_ptr(entropy_source);
70385         CHECK_ACCESS(entropy_source_ptr);
70386         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
70387         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
70388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70389                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
70390         }
70391         void* node_signer_ptr = untag_ptr(node_signer);
70392         CHECK_ACCESS(node_signer_ptr);
70393         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
70394         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
70395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70396                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
70397         }
70398         void* logger_ptr = untag_ptr(logger);
70399         CHECK_ACCESS(logger_ptr);
70400         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
70401         if (logger_conv.free == LDKLogger_JCalls_free) {
70402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70403                 LDKLogger_JCalls_cloned(&logger_conv);
70404         }
70405         void* message_router_ptr = untag_ptr(message_router);
70406         CHECK_ACCESS(message_router_ptr);
70407         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
70408         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
70409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70410                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
70411         }
70412         void* offers_handler_ptr = untag_ptr(offers_handler);
70413         CHECK_ACCESS(offers_handler_ptr);
70414         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
70415         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
70416                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70417                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
70418         }
70419         void* custom_handler_ptr = untag_ptr(custom_handler);
70420         CHECK_ACCESS(custom_handler_ptr);
70421         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
70422         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
70423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70424                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
70425         }
70426         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
70427         int64_t ret_ref = 0;
70428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70430         return ret_ref;
70431 }
70432
70433 int64_t  CS_LDK_OnionMessenger_send_onion_message(int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
70434         LDKOnionMessenger this_arg_conv;
70435         this_arg_conv.inner = untag_ptr(this_arg);
70436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70438         this_arg_conv.is_owned = false;
70439         void* contents_ptr = untag_ptr(contents);
70440         CHECK_ACCESS(contents_ptr);
70441         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
70442         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
70443                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70444                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
70445         }
70446         void* destination_ptr = untag_ptr(destination);
70447         CHECK_ACCESS(destination_ptr);
70448         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
70449         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
70450         LDKBlindedPath reply_path_conv;
70451         reply_path_conv.inner = untag_ptr(reply_path);
70452         reply_path_conv.is_owned = ptr_is_owned(reply_path);
70453         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
70454         reply_path_conv = BlindedPath_clone(&reply_path_conv);
70455         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
70456         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
70457         return tag_ptr(ret_conv, true);
70458 }
70459
70460 int64_t  CS_LDK_OnionMessenger_as_OnionMessageHandler(int64_t this_arg) {
70461         LDKOnionMessenger this_arg_conv;
70462         this_arg_conv.inner = untag_ptr(this_arg);
70463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70465         this_arg_conv.is_owned = false;
70466         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
70467         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
70468         return tag_ptr(ret_ret, true);
70469 }
70470
70471 void  CS_LDK_OffersMessageHandler_free(int64_t this_ptr) {
70472         if (!ptr_is_owned(this_ptr)) return;
70473         void* this_ptr_ptr = untag_ptr(this_ptr);
70474         CHECK_ACCESS(this_ptr_ptr);
70475         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
70476         FREE(untag_ptr(this_ptr));
70477         OffersMessageHandler_free(this_ptr_conv);
70478 }
70479
70480 void  CS_LDK_OffersMessage_free(int64_t this_ptr) {
70481         if (!ptr_is_owned(this_ptr)) return;
70482         void* this_ptr_ptr = untag_ptr(this_ptr);
70483         CHECK_ACCESS(this_ptr_ptr);
70484         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
70485         FREE(untag_ptr(this_ptr));
70486         OffersMessage_free(this_ptr_conv);
70487 }
70488
70489 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
70490         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70491         *ret_copy = OffersMessage_clone(arg);
70492         int64_t ret_ref = tag_ptr(ret_copy, true);
70493         return ret_ref;
70494 }
70495 int64_t  CS_LDK_OffersMessage_clone_ptr(int64_t arg) {
70496         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
70497         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
70498         return ret_conv;
70499 }
70500
70501 int64_t  CS_LDK_OffersMessage_clone(int64_t orig) {
70502         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
70503         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70504         *ret_copy = OffersMessage_clone(orig_conv);
70505         int64_t ret_ref = tag_ptr(ret_copy, true);
70506         return ret_ref;
70507 }
70508
70509 int64_t  CS_LDK_OffersMessage_invoice_request(int64_t a) {
70510         LDKInvoiceRequest a_conv;
70511         a_conv.inner = untag_ptr(a);
70512         a_conv.is_owned = ptr_is_owned(a);
70513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70514         a_conv = InvoiceRequest_clone(&a_conv);
70515         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70516         *ret_copy = OffersMessage_invoice_request(a_conv);
70517         int64_t ret_ref = tag_ptr(ret_copy, true);
70518         return ret_ref;
70519 }
70520
70521 int64_t  CS_LDK_OffersMessage_invoice(int64_t a) {
70522         LDKBolt12Invoice a_conv;
70523         a_conv.inner = untag_ptr(a);
70524         a_conv.is_owned = ptr_is_owned(a);
70525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70526         a_conv = Bolt12Invoice_clone(&a_conv);
70527         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70528         *ret_copy = OffersMessage_invoice(a_conv);
70529         int64_t ret_ref = tag_ptr(ret_copy, true);
70530         return ret_ref;
70531 }
70532
70533 int64_t  CS_LDK_OffersMessage_invoice_error(int64_t a) {
70534         LDKInvoiceError a_conv;
70535         a_conv.inner = untag_ptr(a);
70536         a_conv.is_owned = ptr_is_owned(a);
70537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70538         a_conv = InvoiceError_clone(&a_conv);
70539         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
70540         *ret_copy = OffersMessage_invoice_error(a_conv);
70541         int64_t ret_ref = tag_ptr(ret_copy, true);
70542         return ret_ref;
70543 }
70544
70545 jboolean  CS_LDK_OffersMessage_is_known_type(int64_t tlv_type) {
70546         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
70547         return ret_conv;
70548 }
70549
70550 int64_t  CS_LDK_OffersMessage_as_OnionMessageContents(int64_t this_arg) {
70551         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
70552         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70553         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
70554         return tag_ptr(ret_ret, true);
70555 }
70556
70557 int8_tArray  CS_LDK_OffersMessage_write(int64_t obj) {
70558         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
70559         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
70560         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70561         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70562         CVec_u8Z_free(ret_var);
70563         return ret_arr;
70564 }
70565
70566 int64_t  CS_LDK_OffersMessage_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
70567         LDKu8slice ser_ref;
70568         ser_ref.datalen = ser->arr_len;
70569         ser_ref.data = ser->elems;
70570         void* arg_b_ptr = untag_ptr(arg_b);
70571         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
70572         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
70573         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
70574         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
70575         FREE(ser);
70576         return tag_ptr(ret_conv, true);
70577 }
70578
70579 void  CS_LDK_Packet_free(int64_t this_obj) {
70580         LDKPacket this_obj_conv;
70581         this_obj_conv.inner = untag_ptr(this_obj);
70582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70584         Packet_free(this_obj_conv);
70585 }
70586
70587 int8_t  CS_LDK_Packet_get_version(int64_t this_ptr) {
70588         LDKPacket this_ptr_conv;
70589         this_ptr_conv.inner = untag_ptr(this_ptr);
70590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70592         this_ptr_conv.is_owned = false;
70593         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
70594         return ret_conv;
70595 }
70596
70597 void  CS_LDK_Packet_set_version(int64_t this_ptr, int8_t val) {
70598         LDKPacket this_ptr_conv;
70599         this_ptr_conv.inner = untag_ptr(this_ptr);
70600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70602         this_ptr_conv.is_owned = false;
70603         Packet_set_version(&this_ptr_conv, val);
70604 }
70605
70606 int8_tArray  CS_LDK_Packet_get_public_key(int64_t this_ptr) {
70607         LDKPacket this_ptr_conv;
70608         this_ptr_conv.inner = untag_ptr(this_ptr);
70609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70611         this_ptr_conv.is_owned = false;
70612         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70613         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
70614         return ret_arr;
70615 }
70616
70617 void  CS_LDK_Packet_set_public_key(int64_t this_ptr, int8_tArray val) {
70618         LDKPacket 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         LDKPublicKey val_ref;
70624         CHECK(val->arr_len == 33);
70625         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70626         Packet_set_public_key(&this_ptr_conv, val_ref);
70627 }
70628
70629 int8_tArray  CS_LDK_Packet_get_hop_data(int64_t this_ptr) {
70630         LDKPacket this_ptr_conv;
70631         this_ptr_conv.inner = untag_ptr(this_ptr);
70632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70634         this_ptr_conv.is_owned = false;
70635         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
70636         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70637         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70638         CVec_u8Z_free(ret_var);
70639         return ret_arr;
70640 }
70641
70642 void  CS_LDK_Packet_set_hop_data(int64_t this_ptr, int8_tArray val) {
70643         LDKPacket this_ptr_conv;
70644         this_ptr_conv.inner = untag_ptr(this_ptr);
70645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70647         this_ptr_conv.is_owned = false;
70648         LDKCVec_u8Z val_ref;
70649         val_ref.datalen = val->arr_len;
70650         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
70651         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
70652         Packet_set_hop_data(&this_ptr_conv, val_ref);
70653 }
70654
70655 int8_tArray  CS_LDK_Packet_get_hmac(int64_t this_ptr) {
70656         LDKPacket this_ptr_conv;
70657         this_ptr_conv.inner = untag_ptr(this_ptr);
70658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70660         this_ptr_conv.is_owned = false;
70661         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
70662         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
70663         return ret_arr;
70664 }
70665
70666 void  CS_LDK_Packet_set_hmac(int64_t this_ptr, int8_tArray val) {
70667         LDKPacket this_ptr_conv;
70668         this_ptr_conv.inner = untag_ptr(this_ptr);
70669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70671         this_ptr_conv.is_owned = false;
70672         LDKThirtyTwoBytes val_ref;
70673         CHECK(val->arr_len == 32);
70674         memcpy(val_ref.data, val->elems, 32); FREE(val);
70675         Packet_set_hmac(&this_ptr_conv, val_ref);
70676 }
70677
70678 int64_t  CS_LDK_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
70679         LDKPublicKey public_key_arg_ref;
70680         CHECK(public_key_arg->arr_len == 33);
70681         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
70682         LDKCVec_u8Z hop_data_arg_ref;
70683         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
70684         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
70685         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
70686         LDKThirtyTwoBytes hmac_arg_ref;
70687         CHECK(hmac_arg->arr_len == 32);
70688         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
70689         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
70690         int64_t ret_ref = 0;
70691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70693         return ret_ref;
70694 }
70695
70696 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
70697         LDKPacket ret_var = Packet_clone(arg);
70698         int64_t ret_ref = 0;
70699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70701         return ret_ref;
70702 }
70703 int64_t  CS_LDK_Packet_clone_ptr(int64_t arg) {
70704         LDKPacket arg_conv;
70705         arg_conv.inner = untag_ptr(arg);
70706         arg_conv.is_owned = ptr_is_owned(arg);
70707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70708         arg_conv.is_owned = false;
70709         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
70710         return ret_conv;
70711 }
70712
70713 int64_t  CS_LDK_Packet_clone(int64_t orig) {
70714         LDKPacket orig_conv;
70715         orig_conv.inner = untag_ptr(orig);
70716         orig_conv.is_owned = ptr_is_owned(orig);
70717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70718         orig_conv.is_owned = false;
70719         LDKPacket ret_var = Packet_clone(&orig_conv);
70720         int64_t ret_ref = 0;
70721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70723         return ret_ref;
70724 }
70725
70726 int64_t  CS_LDK_Packet_hash(int64_t o) {
70727         LDKPacket o_conv;
70728         o_conv.inner = untag_ptr(o);
70729         o_conv.is_owned = ptr_is_owned(o);
70730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70731         o_conv.is_owned = false;
70732         int64_t ret_conv = Packet_hash(&o_conv);
70733         return ret_conv;
70734 }
70735
70736 jboolean  CS_LDK_Packet_eq(int64_t a, int64_t b) {
70737         LDKPacket a_conv;
70738         a_conv.inner = untag_ptr(a);
70739         a_conv.is_owned = ptr_is_owned(a);
70740         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70741         a_conv.is_owned = false;
70742         LDKPacket b_conv;
70743         b_conv.inner = untag_ptr(b);
70744         b_conv.is_owned = ptr_is_owned(b);
70745         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70746         b_conv.is_owned = false;
70747         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
70748         return ret_conv;
70749 }
70750
70751 int8_tArray  CS_LDK_Packet_write(int64_t obj) {
70752         LDKPacket obj_conv;
70753         obj_conv.inner = untag_ptr(obj);
70754         obj_conv.is_owned = ptr_is_owned(obj);
70755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70756         obj_conv.is_owned = false;
70757         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
70758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70760         CVec_u8Z_free(ret_var);
70761         return ret_arr;
70762 }
70763
70764 void  CS_LDK_ParsedOnionMessageContents_free(int64_t this_ptr) {
70765         if (!ptr_is_owned(this_ptr)) return;
70766         void* this_ptr_ptr = untag_ptr(this_ptr);
70767         CHECK_ACCESS(this_ptr_ptr);
70768         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
70769         FREE(untag_ptr(this_ptr));
70770         ParsedOnionMessageContents_free(this_ptr_conv);
70771 }
70772
70773 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
70774         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70775         *ret_copy = ParsedOnionMessageContents_clone(arg);
70776         int64_t ret_ref = tag_ptr(ret_copy, true);
70777         return ret_ref;
70778 }
70779 int64_t  CS_LDK_ParsedOnionMessageContents_clone_ptr(int64_t arg) {
70780         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
70781         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
70782         return ret_conv;
70783 }
70784
70785 int64_t  CS_LDK_ParsedOnionMessageContents_clone(int64_t orig) {
70786         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
70787         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70788         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
70789         int64_t ret_ref = tag_ptr(ret_copy, true);
70790         return ret_ref;
70791 }
70792
70793 int64_t  CS_LDK_ParsedOnionMessageContents_offers(int64_t a) {
70794         void* a_ptr = untag_ptr(a);
70795         CHECK_ACCESS(a_ptr);
70796         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
70797         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
70798         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70799         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
70800         int64_t ret_ref = tag_ptr(ret_copy, true);
70801         return ret_ref;
70802 }
70803
70804 int64_t  CS_LDK_ParsedOnionMessageContents_custom(int64_t a) {
70805         void* a_ptr = untag_ptr(a);
70806         CHECK_ACCESS(a_ptr);
70807         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
70808         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
70809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
70810                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
70811         }
70812         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
70813         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
70814         int64_t ret_ref = tag_ptr(ret_copy, true);
70815         return ret_ref;
70816 }
70817
70818 int64_t  CS_LDK_ParsedOnionMessageContents_as_OnionMessageContents(int64_t this_arg) {
70819         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
70820         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70821         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
70822         return tag_ptr(ret_ret, true);
70823 }
70824
70825 int8_tArray  CS_LDK_ParsedOnionMessageContents_write(int64_t obj) {
70826         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
70827         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
70828         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70829         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70830         CVec_u8Z_free(ret_var);
70831         return ret_arr;
70832 }
70833
70834 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
70835         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70836         *ret_ret = OnionMessageContents_clone(arg);
70837         return tag_ptr(ret_ret, true);
70838 }
70839 int64_t  CS_LDK_OnionMessageContents_clone_ptr(int64_t arg) {
70840         void* arg_ptr = untag_ptr(arg);
70841         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
70842         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
70843         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
70844         return ret_conv;
70845 }
70846
70847 int64_t  CS_LDK_OnionMessageContents_clone(int64_t orig) {
70848         void* orig_ptr = untag_ptr(orig);
70849         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
70850         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
70851         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
70852         *ret_ret = OnionMessageContents_clone(orig_conv);
70853         return tag_ptr(ret_ret, true);
70854 }
70855
70856 void  CS_LDK_OnionMessageContents_free(int64_t this_ptr) {
70857         if (!ptr_is_owned(this_ptr)) return;
70858         void* this_ptr_ptr = untag_ptr(this_ptr);
70859         CHECK_ACCESS(this_ptr_ptr);
70860         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
70861         FREE(untag_ptr(this_ptr));
70862         OnionMessageContents_free(this_ptr_conv);
70863 }
70864
70865 void  CS_LDK_BlindedPath_free(int64_t this_obj) {
70866         LDKBlindedPath this_obj_conv;
70867         this_obj_conv.inner = untag_ptr(this_obj);
70868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70870         BlindedPath_free(this_obj_conv);
70871 }
70872
70873 int8_tArray  CS_LDK_BlindedPath_get_introduction_node_id(int64_t this_ptr) {
70874         LDKBlindedPath this_ptr_conv;
70875         this_ptr_conv.inner = untag_ptr(this_ptr);
70876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70878         this_ptr_conv.is_owned = false;
70879         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70880         memcpy(ret_arr->elems, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form, 33);
70881         return ret_arr;
70882 }
70883
70884 void  CS_LDK_BlindedPath_set_introduction_node_id(int64_t this_ptr, int8_tArray val) {
70885         LDKBlindedPath this_ptr_conv;
70886         this_ptr_conv.inner = untag_ptr(this_ptr);
70887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70889         this_ptr_conv.is_owned = false;
70890         LDKPublicKey val_ref;
70891         CHECK(val->arr_len == 33);
70892         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70893         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
70894 }
70895
70896 int8_tArray  CS_LDK_BlindedPath_get_blinding_point(int64_t this_ptr) {
70897         LDKBlindedPath this_ptr_conv;
70898         this_ptr_conv.inner = untag_ptr(this_ptr);
70899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70901         this_ptr_conv.is_owned = false;
70902         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
70903         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
70904         return ret_arr;
70905 }
70906
70907 void  CS_LDK_BlindedPath_set_blinding_point(int64_t this_ptr, int8_tArray val) {
70908         LDKBlindedPath this_ptr_conv;
70909         this_ptr_conv.inner = untag_ptr(this_ptr);
70910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70912         this_ptr_conv.is_owned = false;
70913         LDKPublicKey val_ref;
70914         CHECK(val->arr_len == 33);
70915         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
70916         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
70917 }
70918
70919 int64_tArray  CS_LDK_BlindedPath_get_blinded_hops(int64_t this_ptr) {
70920         LDKBlindedPath this_ptr_conv;
70921         this_ptr_conv.inner = untag_ptr(this_ptr);
70922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70924         this_ptr_conv.is_owned = false;
70925         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
70926         int64_tArray ret_arr = NULL;
70927         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70928         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70929         for (size_t m = 0; m < ret_var.datalen; m++) {
70930                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70931                 int64_t ret_conv_12_ref = 0;
70932                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70933                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70934                 ret_arr_ptr[m] = ret_conv_12_ref;
70935         }
70936         
70937         FREE(ret_var.data);
70938         return ret_arr;
70939 }
70940
70941 void  CS_LDK_BlindedPath_set_blinded_hops(int64_t this_ptr, int64_tArray val) {
70942         LDKBlindedPath this_ptr_conv;
70943         this_ptr_conv.inner = untag_ptr(this_ptr);
70944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70946         this_ptr_conv.is_owned = false;
70947         LDKCVec_BlindedHopZ val_constr;
70948         val_constr.datalen = val->arr_len;
70949         if (val_constr.datalen > 0)
70950                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70951         else
70952                 val_constr.data = NULL;
70953         int64_t* val_vals = val->elems;
70954         for (size_t m = 0; m < val_constr.datalen; m++) {
70955                 int64_t val_conv_12 = val_vals[m];
70956                 LDKBlindedHop val_conv_12_conv;
70957                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70958                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70959                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70960                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70961                 val_constr.data[m] = val_conv_12_conv;
70962         }
70963         FREE(val);
70964         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
70965 }
70966
70967 int64_t  CS_LDK_BlindedPath_new(int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
70968         LDKPublicKey introduction_node_id_arg_ref;
70969         CHECK(introduction_node_id_arg->arr_len == 33);
70970         memcpy(introduction_node_id_arg_ref.compressed_form, introduction_node_id_arg->elems, 33); FREE(introduction_node_id_arg);
70971         LDKPublicKey blinding_point_arg_ref;
70972         CHECK(blinding_point_arg->arr_len == 33);
70973         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
70974         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
70975         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
70976         if (blinded_hops_arg_constr.datalen > 0)
70977                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70978         else
70979                 blinded_hops_arg_constr.data = NULL;
70980         int64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
70981         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
70982                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
70983                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
70984                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
70985                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
70986                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
70987                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
70988                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
70989         }
70990         FREE(blinded_hops_arg);
70991         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
70992         int64_t ret_ref = 0;
70993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70995         return ret_ref;
70996 }
70997
70998 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
70999         LDKBlindedPath ret_var = BlindedPath_clone(arg);
71000         int64_t ret_ref = 0;
71001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71003         return ret_ref;
71004 }
71005 int64_t  CS_LDK_BlindedPath_clone_ptr(int64_t arg) {
71006         LDKBlindedPath arg_conv;
71007         arg_conv.inner = untag_ptr(arg);
71008         arg_conv.is_owned = ptr_is_owned(arg);
71009         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71010         arg_conv.is_owned = false;
71011         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
71012         return ret_conv;
71013 }
71014
71015 int64_t  CS_LDK_BlindedPath_clone(int64_t orig) {
71016         LDKBlindedPath orig_conv;
71017         orig_conv.inner = untag_ptr(orig);
71018         orig_conv.is_owned = ptr_is_owned(orig);
71019         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71020         orig_conv.is_owned = false;
71021         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
71022         int64_t ret_ref = 0;
71023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71025         return ret_ref;
71026 }
71027
71028 int64_t  CS_LDK_BlindedPath_hash(int64_t o) {
71029         LDKBlindedPath o_conv;
71030         o_conv.inner = untag_ptr(o);
71031         o_conv.is_owned = ptr_is_owned(o);
71032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71033         o_conv.is_owned = false;
71034         int64_t ret_conv = BlindedPath_hash(&o_conv);
71035         return ret_conv;
71036 }
71037
71038 jboolean  CS_LDK_BlindedPath_eq(int64_t a, int64_t b) {
71039         LDKBlindedPath a_conv;
71040         a_conv.inner = untag_ptr(a);
71041         a_conv.is_owned = ptr_is_owned(a);
71042         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71043         a_conv.is_owned = false;
71044         LDKBlindedPath b_conv;
71045         b_conv.inner = untag_ptr(b);
71046         b_conv.is_owned = ptr_is_owned(b);
71047         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71048         b_conv.is_owned = false;
71049         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
71050         return ret_conv;
71051 }
71052
71053 void  CS_LDK_BlindedHop_free(int64_t this_obj) {
71054         LDKBlindedHop this_obj_conv;
71055         this_obj_conv.inner = untag_ptr(this_obj);
71056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71058         BlindedHop_free(this_obj_conv);
71059 }
71060
71061 int8_tArray  CS_LDK_BlindedHop_get_blinded_node_id(int64_t this_ptr) {
71062         LDKBlindedHop this_ptr_conv;
71063         this_ptr_conv.inner = untag_ptr(this_ptr);
71064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71066         this_ptr_conv.is_owned = false;
71067         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71068         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
71069         return ret_arr;
71070 }
71071
71072 void  CS_LDK_BlindedHop_set_blinded_node_id(int64_t this_ptr, int8_tArray val) {
71073         LDKBlindedHop this_ptr_conv;
71074         this_ptr_conv.inner = untag_ptr(this_ptr);
71075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71077         this_ptr_conv.is_owned = false;
71078         LDKPublicKey val_ref;
71079         CHECK(val->arr_len == 33);
71080         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71081         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
71082 }
71083
71084 int8_tArray  CS_LDK_BlindedHop_get_encrypted_payload(int64_t this_ptr) {
71085         LDKBlindedHop this_ptr_conv;
71086         this_ptr_conv.inner = untag_ptr(this_ptr);
71087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71089         this_ptr_conv.is_owned = false;
71090         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
71091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71093         CVec_u8Z_free(ret_var);
71094         return ret_arr;
71095 }
71096
71097 void  CS_LDK_BlindedHop_set_encrypted_payload(int64_t this_ptr, int8_tArray val) {
71098         LDKBlindedHop this_ptr_conv;
71099         this_ptr_conv.inner = untag_ptr(this_ptr);
71100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71102         this_ptr_conv.is_owned = false;
71103         LDKCVec_u8Z val_ref;
71104         val_ref.datalen = val->arr_len;
71105         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
71106         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
71107         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
71108 }
71109
71110 int64_t  CS_LDK_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
71111         LDKPublicKey blinded_node_id_arg_ref;
71112         CHECK(blinded_node_id_arg->arr_len == 33);
71113         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
71114         LDKCVec_u8Z encrypted_payload_arg_ref;
71115         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
71116         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
71117         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
71118         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
71119         int64_t ret_ref = 0;
71120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71122         return ret_ref;
71123 }
71124
71125 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
71126         LDKBlindedHop ret_var = BlindedHop_clone(arg);
71127         int64_t ret_ref = 0;
71128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71130         return ret_ref;
71131 }
71132 int64_t  CS_LDK_BlindedHop_clone_ptr(int64_t arg) {
71133         LDKBlindedHop arg_conv;
71134         arg_conv.inner = untag_ptr(arg);
71135         arg_conv.is_owned = ptr_is_owned(arg);
71136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71137         arg_conv.is_owned = false;
71138         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
71139         return ret_conv;
71140 }
71141
71142 int64_t  CS_LDK_BlindedHop_clone(int64_t orig) {
71143         LDKBlindedHop orig_conv;
71144         orig_conv.inner = untag_ptr(orig);
71145         orig_conv.is_owned = ptr_is_owned(orig);
71146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71147         orig_conv.is_owned = false;
71148         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
71149         int64_t ret_ref = 0;
71150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71152         return ret_ref;
71153 }
71154
71155 int64_t  CS_LDK_BlindedHop_hash(int64_t o) {
71156         LDKBlindedHop o_conv;
71157         o_conv.inner = untag_ptr(o);
71158         o_conv.is_owned = ptr_is_owned(o);
71159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71160         o_conv.is_owned = false;
71161         int64_t ret_conv = BlindedHop_hash(&o_conv);
71162         return ret_conv;
71163 }
71164
71165 jboolean  CS_LDK_BlindedHop_eq(int64_t a, int64_t b) {
71166         LDKBlindedHop a_conv;
71167         a_conv.inner = untag_ptr(a);
71168         a_conv.is_owned = ptr_is_owned(a);
71169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71170         a_conv.is_owned = false;
71171         LDKBlindedHop b_conv;
71172         b_conv.inner = untag_ptr(b);
71173         b_conv.is_owned = ptr_is_owned(b);
71174         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71175         b_conv.is_owned = false;
71176         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
71177         return ret_conv;
71178 }
71179
71180 int64_t  CS_LDK_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, int64_t entropy_source) {
71181         LDKPublicKey recipient_node_id_ref;
71182         CHECK(recipient_node_id->arr_len == 33);
71183         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
71184         void* entropy_source_ptr = untag_ptr(entropy_source);
71185         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71186         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71187         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
71188         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
71189         return tag_ptr(ret_conv, true);
71190 }
71191
71192 int64_t  CS_LDK_BlindedPath_new_for_message(ptrArray node_pks, int64_t entropy_source) {
71193         LDKCVec_PublicKeyZ node_pks_constr;
71194         node_pks_constr.datalen = node_pks->arr_len;
71195         if (node_pks_constr.datalen > 0)
71196                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
71197         else
71198                 node_pks_constr.data = NULL;
71199         int8_tArray* node_pks_vals = (void*) node_pks->elems;
71200         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
71201                 int8_tArray node_pks_conv_8 = node_pks_vals[i];
71202                 LDKPublicKey node_pks_conv_8_ref;
71203                 CHECK(node_pks_conv_8->arr_len == 33);
71204                 memcpy(node_pks_conv_8_ref.compressed_form, node_pks_conv_8->elems, 33); FREE(node_pks_conv_8);
71205                 node_pks_constr.data[i] = node_pks_conv_8_ref;
71206         }
71207         FREE(node_pks);
71208         void* entropy_source_ptr = untag_ptr(entropy_source);
71209         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71210         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71211         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
71212         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
71213         return tag_ptr(ret_conv, true);
71214 }
71215
71216 int64_t  CS_LDK_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
71217         LDKPublicKey payee_node_id_ref;
71218         CHECK(payee_node_id->arr_len == 33);
71219         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
71220         LDKReceiveTlvs payee_tlvs_conv;
71221         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
71222         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
71223         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
71224         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
71225         void* entropy_source_ptr = untag_ptr(entropy_source);
71226         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71227         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71228         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
71229         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
71230         return tag_ptr(ret_conv, true);
71231 }
71232
71233 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, int64_t entropy_source) {
71234         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
71235         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
71236         if (intermediate_nodes_constr.datalen > 0)
71237                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
71238         else
71239                 intermediate_nodes_constr.data = NULL;
71240         int64_t* intermediate_nodes_vals = intermediate_nodes->elems;
71241         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
71242                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
71243                 LDKForwardNode intermediate_nodes_conv_13_conv;
71244                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
71245                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
71246                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
71247                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
71248                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
71249         }
71250         FREE(intermediate_nodes);
71251         LDKPublicKey payee_node_id_ref;
71252         CHECK(payee_node_id->arr_len == 33);
71253         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
71254         LDKReceiveTlvs payee_tlvs_conv;
71255         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
71256         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
71257         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
71258         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
71259         void* entropy_source_ptr = untag_ptr(entropy_source);
71260         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
71261         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
71262         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
71263         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
71264         return tag_ptr(ret_conv, true);
71265 }
71266
71267 int8_tArray  CS_LDK_BlindedPath_write(int64_t obj) {
71268         LDKBlindedPath obj_conv;
71269         obj_conv.inner = untag_ptr(obj);
71270         obj_conv.is_owned = ptr_is_owned(obj);
71271         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71272         obj_conv.is_owned = false;
71273         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
71274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71276         CVec_u8Z_free(ret_var);
71277         return ret_arr;
71278 }
71279
71280 int64_t  CS_LDK_BlindedPath_read(int8_tArray ser) {
71281         LDKu8slice ser_ref;
71282         ser_ref.datalen = ser->arr_len;
71283         ser_ref.data = ser->elems;
71284         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
71285         *ret_conv = BlindedPath_read(ser_ref);
71286         FREE(ser);
71287         return tag_ptr(ret_conv, true);
71288 }
71289
71290 int8_tArray  CS_LDK_BlindedHop_write(int64_t obj) {
71291         LDKBlindedHop obj_conv;
71292         obj_conv.inner = untag_ptr(obj);
71293         obj_conv.is_owned = ptr_is_owned(obj);
71294         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71295         obj_conv.is_owned = false;
71296         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
71297         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71298         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71299         CVec_u8Z_free(ret_var);
71300         return ret_arr;
71301 }
71302
71303 int64_t  CS_LDK_BlindedHop_read(int8_tArray ser) {
71304         LDKu8slice ser_ref;
71305         ser_ref.datalen = ser->arr_len;
71306         ser_ref.data = ser->elems;
71307         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
71308         *ret_conv = BlindedHop_read(ser_ref);
71309         FREE(ser);
71310         return tag_ptr(ret_conv, true);
71311 }
71312
71313 void  CS_LDK_ForwardNode_free(int64_t this_obj) {
71314         LDKForwardNode this_obj_conv;
71315         this_obj_conv.inner = untag_ptr(this_obj);
71316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71318         ForwardNode_free(this_obj_conv);
71319 }
71320
71321 int64_t  CS_LDK_ForwardNode_get_tlvs(int64_t this_ptr) {
71322         LDKForwardNode this_ptr_conv;
71323         this_ptr_conv.inner = untag_ptr(this_ptr);
71324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71326         this_ptr_conv.is_owned = false;
71327         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
71328         int64_t ret_ref = 0;
71329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71331         return ret_ref;
71332 }
71333
71334 void  CS_LDK_ForwardNode_set_tlvs(int64_t this_ptr, int64_t val) {
71335         LDKForwardNode this_ptr_conv;
71336         this_ptr_conv.inner = untag_ptr(this_ptr);
71337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71339         this_ptr_conv.is_owned = false;
71340         LDKForwardTlvs val_conv;
71341         val_conv.inner = untag_ptr(val);
71342         val_conv.is_owned = ptr_is_owned(val);
71343         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71344         val_conv = ForwardTlvs_clone(&val_conv);
71345         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
71346 }
71347
71348 int8_tArray  CS_LDK_ForwardNode_get_node_id(int64_t this_ptr) {
71349         LDKForwardNode this_ptr_conv;
71350         this_ptr_conv.inner = untag_ptr(this_ptr);
71351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71353         this_ptr_conv.is_owned = false;
71354         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71355         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
71356         return ret_arr;
71357 }
71358
71359 void  CS_LDK_ForwardNode_set_node_id(int64_t this_ptr, int8_tArray val) {
71360         LDKForwardNode this_ptr_conv;
71361         this_ptr_conv.inner = untag_ptr(this_ptr);
71362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71364         this_ptr_conv.is_owned = false;
71365         LDKPublicKey val_ref;
71366         CHECK(val->arr_len == 33);
71367         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71368         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
71369 }
71370
71371 int64_t  CS_LDK_ForwardNode_get_htlc_maximum_msat(int64_t this_ptr) {
71372         LDKForwardNode this_ptr_conv;
71373         this_ptr_conv.inner = untag_ptr(this_ptr);
71374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71376         this_ptr_conv.is_owned = false;
71377         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
71378         return ret_conv;
71379 }
71380
71381 void  CS_LDK_ForwardNode_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
71382         LDKForwardNode this_ptr_conv;
71383         this_ptr_conv.inner = untag_ptr(this_ptr);
71384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71386         this_ptr_conv.is_owned = false;
71387         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
71388 }
71389
71390 int64_t  CS_LDK_ForwardNode_new(int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
71391         LDKForwardTlvs tlvs_arg_conv;
71392         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
71393         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
71394         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
71395         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
71396         LDKPublicKey node_id_arg_ref;
71397         CHECK(node_id_arg->arr_len == 33);
71398         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
71399         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
71400         int64_t ret_ref = 0;
71401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71403         return ret_ref;
71404 }
71405
71406 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
71407         LDKForwardNode ret_var = ForwardNode_clone(arg);
71408         int64_t ret_ref = 0;
71409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71411         return ret_ref;
71412 }
71413 int64_t  CS_LDK_ForwardNode_clone_ptr(int64_t arg) {
71414         LDKForwardNode arg_conv;
71415         arg_conv.inner = untag_ptr(arg);
71416         arg_conv.is_owned = ptr_is_owned(arg);
71417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71418         arg_conv.is_owned = false;
71419         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
71420         return ret_conv;
71421 }
71422
71423 int64_t  CS_LDK_ForwardNode_clone(int64_t orig) {
71424         LDKForwardNode orig_conv;
71425         orig_conv.inner = untag_ptr(orig);
71426         orig_conv.is_owned = ptr_is_owned(orig);
71427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71428         orig_conv.is_owned = false;
71429         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
71430         int64_t ret_ref = 0;
71431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71433         return ret_ref;
71434 }
71435
71436 void  CS_LDK_ForwardTlvs_free(int64_t this_obj) {
71437         LDKForwardTlvs this_obj_conv;
71438         this_obj_conv.inner = untag_ptr(this_obj);
71439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71441         ForwardTlvs_free(this_obj_conv);
71442 }
71443
71444 int64_t  CS_LDK_ForwardTlvs_get_short_channel_id(int64_t this_ptr) {
71445         LDKForwardTlvs this_ptr_conv;
71446         this_ptr_conv.inner = untag_ptr(this_ptr);
71447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71449         this_ptr_conv.is_owned = false;
71450         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
71451         return ret_conv;
71452 }
71453
71454 void  CS_LDK_ForwardTlvs_set_short_channel_id(int64_t this_ptr, int64_t val) {
71455         LDKForwardTlvs this_ptr_conv;
71456         this_ptr_conv.inner = untag_ptr(this_ptr);
71457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71459         this_ptr_conv.is_owned = false;
71460         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
71461 }
71462
71463 int64_t  CS_LDK_ForwardTlvs_get_payment_relay(int64_t this_ptr) {
71464         LDKForwardTlvs this_ptr_conv;
71465         this_ptr_conv.inner = untag_ptr(this_ptr);
71466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71468         this_ptr_conv.is_owned = false;
71469         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
71470         int64_t ret_ref = 0;
71471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71473         return ret_ref;
71474 }
71475
71476 void  CS_LDK_ForwardTlvs_set_payment_relay(int64_t this_ptr, int64_t val) {
71477         LDKForwardTlvs this_ptr_conv;
71478         this_ptr_conv.inner = untag_ptr(this_ptr);
71479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71481         this_ptr_conv.is_owned = false;
71482         LDKPaymentRelay val_conv;
71483         val_conv.inner = untag_ptr(val);
71484         val_conv.is_owned = ptr_is_owned(val);
71485         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71486         val_conv = PaymentRelay_clone(&val_conv);
71487         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
71488 }
71489
71490 int64_t  CS_LDK_ForwardTlvs_get_payment_constraints(int64_t this_ptr) {
71491         LDKForwardTlvs this_ptr_conv;
71492         this_ptr_conv.inner = untag_ptr(this_ptr);
71493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71495         this_ptr_conv.is_owned = false;
71496         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
71497         int64_t ret_ref = 0;
71498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71500         return ret_ref;
71501 }
71502
71503 void  CS_LDK_ForwardTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
71504         LDKForwardTlvs this_ptr_conv;
71505         this_ptr_conv.inner = untag_ptr(this_ptr);
71506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71508         this_ptr_conv.is_owned = false;
71509         LDKPaymentConstraints val_conv;
71510         val_conv.inner = untag_ptr(val);
71511         val_conv.is_owned = ptr_is_owned(val);
71512         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71513         val_conv = PaymentConstraints_clone(&val_conv);
71514         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71515 }
71516
71517 int64_t  CS_LDK_ForwardTlvs_get_features(int64_t this_ptr) {
71518         LDKForwardTlvs this_ptr_conv;
71519         this_ptr_conv.inner = untag_ptr(this_ptr);
71520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71522         this_ptr_conv.is_owned = false;
71523         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
71524         int64_t ret_ref = 0;
71525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71527         return ret_ref;
71528 }
71529
71530 void  CS_LDK_ForwardTlvs_set_features(int64_t this_ptr, int64_t val) {
71531         LDKForwardTlvs this_ptr_conv;
71532         this_ptr_conv.inner = untag_ptr(this_ptr);
71533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71535         this_ptr_conv.is_owned = false;
71536         LDKBlindedHopFeatures val_conv;
71537         val_conv.inner = untag_ptr(val);
71538         val_conv.is_owned = ptr_is_owned(val);
71539         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71540         val_conv = BlindedHopFeatures_clone(&val_conv);
71541         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
71542 }
71543
71544 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) {
71545         LDKPaymentRelay payment_relay_arg_conv;
71546         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
71547         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
71548         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
71549         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
71550         LDKPaymentConstraints payment_constraints_arg_conv;
71551         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71552         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71553         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71554         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71555         LDKBlindedHopFeatures features_arg_conv;
71556         features_arg_conv.inner = untag_ptr(features_arg);
71557         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71558         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71559         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71560         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
71561         int64_t ret_ref = 0;
71562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71564         return ret_ref;
71565 }
71566
71567 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
71568         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
71569         int64_t ret_ref = 0;
71570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71572         return ret_ref;
71573 }
71574 int64_t  CS_LDK_ForwardTlvs_clone_ptr(int64_t arg) {
71575         LDKForwardTlvs arg_conv;
71576         arg_conv.inner = untag_ptr(arg);
71577         arg_conv.is_owned = ptr_is_owned(arg);
71578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71579         arg_conv.is_owned = false;
71580         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
71581         return ret_conv;
71582 }
71583
71584 int64_t  CS_LDK_ForwardTlvs_clone(int64_t orig) {
71585         LDKForwardTlvs orig_conv;
71586         orig_conv.inner = untag_ptr(orig);
71587         orig_conv.is_owned = ptr_is_owned(orig);
71588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71589         orig_conv.is_owned = false;
71590         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
71591         int64_t ret_ref = 0;
71592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71594         return ret_ref;
71595 }
71596
71597 void  CS_LDK_ReceiveTlvs_free(int64_t this_obj) {
71598         LDKReceiveTlvs this_obj_conv;
71599         this_obj_conv.inner = untag_ptr(this_obj);
71600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71602         ReceiveTlvs_free(this_obj_conv);
71603 }
71604
71605 int8_tArray  CS_LDK_ReceiveTlvs_get_payment_secret(int64_t this_ptr) {
71606         LDKReceiveTlvs this_ptr_conv;
71607         this_ptr_conv.inner = untag_ptr(this_ptr);
71608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71610         this_ptr_conv.is_owned = false;
71611         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71612         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
71613         return ret_arr;
71614 }
71615
71616 void  CS_LDK_ReceiveTlvs_set_payment_secret(int64_t this_ptr, int8_tArray val) {
71617         LDKReceiveTlvs this_ptr_conv;
71618         this_ptr_conv.inner = untag_ptr(this_ptr);
71619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71621         this_ptr_conv.is_owned = false;
71622         LDKThirtyTwoBytes val_ref;
71623         CHECK(val->arr_len == 32);
71624         memcpy(val_ref.data, val->elems, 32); FREE(val);
71625         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
71626 }
71627
71628 int64_t  CS_LDK_ReceiveTlvs_get_payment_constraints(int64_t this_ptr) {
71629         LDKReceiveTlvs this_ptr_conv;
71630         this_ptr_conv.inner = untag_ptr(this_ptr);
71631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71633         this_ptr_conv.is_owned = false;
71634         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
71635         int64_t ret_ref = 0;
71636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71638         return ret_ref;
71639 }
71640
71641 void  CS_LDK_ReceiveTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
71642         LDKReceiveTlvs this_ptr_conv;
71643         this_ptr_conv.inner = untag_ptr(this_ptr);
71644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71646         this_ptr_conv.is_owned = false;
71647         LDKPaymentConstraints val_conv;
71648         val_conv.inner = untag_ptr(val);
71649         val_conv.is_owned = ptr_is_owned(val);
71650         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71651         val_conv = PaymentConstraints_clone(&val_conv);
71652         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
71653 }
71654
71655 int64_t  CS_LDK_ReceiveTlvs_new(int8_tArray payment_secret_arg, int64_t payment_constraints_arg) {
71656         LDKThirtyTwoBytes payment_secret_arg_ref;
71657         CHECK(payment_secret_arg->arr_len == 32);
71658         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
71659         LDKPaymentConstraints payment_constraints_arg_conv;
71660         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
71661         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
71662         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
71663         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
71664         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
71665         int64_t ret_ref = 0;
71666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71668         return ret_ref;
71669 }
71670
71671 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
71672         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
71673         int64_t ret_ref = 0;
71674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71676         return ret_ref;
71677 }
71678 int64_t  CS_LDK_ReceiveTlvs_clone_ptr(int64_t arg) {
71679         LDKReceiveTlvs arg_conv;
71680         arg_conv.inner = untag_ptr(arg);
71681         arg_conv.is_owned = ptr_is_owned(arg);
71682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71683         arg_conv.is_owned = false;
71684         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
71685         return ret_conv;
71686 }
71687
71688 int64_t  CS_LDK_ReceiveTlvs_clone(int64_t orig) {
71689         LDKReceiveTlvs orig_conv;
71690         orig_conv.inner = untag_ptr(orig);
71691         orig_conv.is_owned = ptr_is_owned(orig);
71692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71693         orig_conv.is_owned = false;
71694         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
71695         int64_t ret_ref = 0;
71696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71698         return ret_ref;
71699 }
71700
71701 void  CS_LDK_PaymentRelay_free(int64_t this_obj) {
71702         LDKPaymentRelay this_obj_conv;
71703         this_obj_conv.inner = untag_ptr(this_obj);
71704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71706         PaymentRelay_free(this_obj_conv);
71707 }
71708
71709 int16_t  CS_LDK_PaymentRelay_get_cltv_expiry_delta(int64_t this_ptr) {
71710         LDKPaymentRelay this_ptr_conv;
71711         this_ptr_conv.inner = untag_ptr(this_ptr);
71712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71714         this_ptr_conv.is_owned = false;
71715         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
71716         return ret_conv;
71717 }
71718
71719 void  CS_LDK_PaymentRelay_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
71720         LDKPaymentRelay this_ptr_conv;
71721         this_ptr_conv.inner = untag_ptr(this_ptr);
71722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71724         this_ptr_conv.is_owned = false;
71725         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
71726 }
71727
71728 int32_t  CS_LDK_PaymentRelay_get_fee_proportional_millionths(int64_t this_ptr) {
71729         LDKPaymentRelay this_ptr_conv;
71730         this_ptr_conv.inner = untag_ptr(this_ptr);
71731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71733         this_ptr_conv.is_owned = false;
71734         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
71735         return ret_conv;
71736 }
71737
71738 void  CS_LDK_PaymentRelay_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
71739         LDKPaymentRelay this_ptr_conv;
71740         this_ptr_conv.inner = untag_ptr(this_ptr);
71741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71743         this_ptr_conv.is_owned = false;
71744         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
71745 }
71746
71747 int32_t  CS_LDK_PaymentRelay_get_fee_base_msat(int64_t this_ptr) {
71748         LDKPaymentRelay this_ptr_conv;
71749         this_ptr_conv.inner = untag_ptr(this_ptr);
71750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71752         this_ptr_conv.is_owned = false;
71753         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
71754         return ret_conv;
71755 }
71756
71757 void  CS_LDK_PaymentRelay_set_fee_base_msat(int64_t this_ptr, int32_t val) {
71758         LDKPaymentRelay this_ptr_conv;
71759         this_ptr_conv.inner = untag_ptr(this_ptr);
71760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71762         this_ptr_conv.is_owned = false;
71763         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
71764 }
71765
71766 int64_t  CS_LDK_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
71767         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
71768         int64_t ret_ref = 0;
71769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71771         return ret_ref;
71772 }
71773
71774 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
71775         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
71776         int64_t ret_ref = 0;
71777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71779         return ret_ref;
71780 }
71781 int64_t  CS_LDK_PaymentRelay_clone_ptr(int64_t arg) {
71782         LDKPaymentRelay arg_conv;
71783         arg_conv.inner = untag_ptr(arg);
71784         arg_conv.is_owned = ptr_is_owned(arg);
71785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71786         arg_conv.is_owned = false;
71787         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
71788         return ret_conv;
71789 }
71790
71791 int64_t  CS_LDK_PaymentRelay_clone(int64_t orig) {
71792         LDKPaymentRelay orig_conv;
71793         orig_conv.inner = untag_ptr(orig);
71794         orig_conv.is_owned = ptr_is_owned(orig);
71795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71796         orig_conv.is_owned = false;
71797         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
71798         int64_t ret_ref = 0;
71799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71801         return ret_ref;
71802 }
71803
71804 void  CS_LDK_PaymentConstraints_free(int64_t this_obj) {
71805         LDKPaymentConstraints this_obj_conv;
71806         this_obj_conv.inner = untag_ptr(this_obj);
71807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71809         PaymentConstraints_free(this_obj_conv);
71810 }
71811
71812 int32_t  CS_LDK_PaymentConstraints_get_max_cltv_expiry(int64_t this_ptr) {
71813         LDKPaymentConstraints this_ptr_conv;
71814         this_ptr_conv.inner = untag_ptr(this_ptr);
71815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71817         this_ptr_conv.is_owned = false;
71818         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
71819         return ret_conv;
71820 }
71821
71822 void  CS_LDK_PaymentConstraints_set_max_cltv_expiry(int64_t this_ptr, int32_t val) {
71823         LDKPaymentConstraints this_ptr_conv;
71824         this_ptr_conv.inner = untag_ptr(this_ptr);
71825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71827         this_ptr_conv.is_owned = false;
71828         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
71829 }
71830
71831 int64_t  CS_LDK_PaymentConstraints_get_htlc_minimum_msat(int64_t this_ptr) {
71832         LDKPaymentConstraints this_ptr_conv;
71833         this_ptr_conv.inner = untag_ptr(this_ptr);
71834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71836         this_ptr_conv.is_owned = false;
71837         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
71838         return ret_conv;
71839 }
71840
71841 void  CS_LDK_PaymentConstraints_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
71842         LDKPaymentConstraints this_ptr_conv;
71843         this_ptr_conv.inner = untag_ptr(this_ptr);
71844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71846         this_ptr_conv.is_owned = false;
71847         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
71848 }
71849
71850 int64_t  CS_LDK_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
71851         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
71852         int64_t ret_ref = 0;
71853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71855         return ret_ref;
71856 }
71857
71858 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
71859         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
71860         int64_t ret_ref = 0;
71861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71863         return ret_ref;
71864 }
71865 int64_t  CS_LDK_PaymentConstraints_clone_ptr(int64_t arg) {
71866         LDKPaymentConstraints arg_conv;
71867         arg_conv.inner = untag_ptr(arg);
71868         arg_conv.is_owned = ptr_is_owned(arg);
71869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71870         arg_conv.is_owned = false;
71871         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
71872         return ret_conv;
71873 }
71874
71875 int64_t  CS_LDK_PaymentConstraints_clone(int64_t orig) {
71876         LDKPaymentConstraints orig_conv;
71877         orig_conv.inner = untag_ptr(orig);
71878         orig_conv.is_owned = ptr_is_owned(orig);
71879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71880         orig_conv.is_owned = false;
71881         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
71882         int64_t ret_ref = 0;
71883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71885         return ret_ref;
71886 }
71887
71888 int8_tArray  CS_LDK_ForwardTlvs_write(int64_t obj) {
71889         LDKForwardTlvs obj_conv;
71890         obj_conv.inner = untag_ptr(obj);
71891         obj_conv.is_owned = ptr_is_owned(obj);
71892         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71893         obj_conv.is_owned = false;
71894         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
71895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71897         CVec_u8Z_free(ret_var);
71898         return ret_arr;
71899 }
71900
71901 int8_tArray  CS_LDK_ReceiveTlvs_write(int64_t obj) {
71902         LDKReceiveTlvs obj_conv;
71903         obj_conv.inner = untag_ptr(obj);
71904         obj_conv.is_owned = ptr_is_owned(obj);
71905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71906         obj_conv.is_owned = false;
71907         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
71908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71910         CVec_u8Z_free(ret_var);
71911         return ret_arr;
71912 }
71913
71914 int8_tArray  CS_LDK_PaymentRelay_write(int64_t obj) {
71915         LDKPaymentRelay obj_conv;
71916         obj_conv.inner = untag_ptr(obj);
71917         obj_conv.is_owned = ptr_is_owned(obj);
71918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71919         obj_conv.is_owned = false;
71920         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
71921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71923         CVec_u8Z_free(ret_var);
71924         return ret_arr;
71925 }
71926
71927 int64_t  CS_LDK_PaymentRelay_read(int8_tArray ser) {
71928         LDKu8slice ser_ref;
71929         ser_ref.datalen = ser->arr_len;
71930         ser_ref.data = ser->elems;
71931         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
71932         *ret_conv = PaymentRelay_read(ser_ref);
71933         FREE(ser);
71934         return tag_ptr(ret_conv, true);
71935 }
71936
71937 int8_tArray  CS_LDK_PaymentConstraints_write(int64_t obj) {
71938         LDKPaymentConstraints obj_conv;
71939         obj_conv.inner = untag_ptr(obj);
71940         obj_conv.is_owned = ptr_is_owned(obj);
71941         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71942         obj_conv.is_owned = false;
71943         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
71944         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71945         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71946         CVec_u8Z_free(ret_var);
71947         return ret_arr;
71948 }
71949
71950 int64_t  CS_LDK_PaymentConstraints_read(int8_tArray ser) {
71951         LDKu8slice ser_ref;
71952         ser_ref.datalen = ser->arr_len;
71953         ser_ref.data = ser->elems;
71954         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
71955         *ret_conv = PaymentConstraints_read(ser_ref);
71956         FREE(ser);
71957         return tag_ptr(ret_conv, true);
71958 }
71959
71960 void  CS_LDK_PaymentPurpose_free(int64_t this_ptr) {
71961         if (!ptr_is_owned(this_ptr)) return;
71962         void* this_ptr_ptr = untag_ptr(this_ptr);
71963         CHECK_ACCESS(this_ptr_ptr);
71964         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
71965         FREE(untag_ptr(this_ptr));
71966         PaymentPurpose_free(this_ptr_conv);
71967 }
71968
71969 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
71970         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71971         *ret_copy = PaymentPurpose_clone(arg);
71972         int64_t ret_ref = tag_ptr(ret_copy, true);
71973         return ret_ref;
71974 }
71975 int64_t  CS_LDK_PaymentPurpose_clone_ptr(int64_t arg) {
71976         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
71977         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
71978         return ret_conv;
71979 }
71980
71981 int64_t  CS_LDK_PaymentPurpose_clone(int64_t orig) {
71982         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
71983         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71984         *ret_copy = PaymentPurpose_clone(orig_conv);
71985         int64_t ret_ref = tag_ptr(ret_copy, true);
71986         return ret_ref;
71987 }
71988
71989 int64_t  CS_LDK_PaymentPurpose_invoice_payment(int64_t payment_preimage, int8_tArray payment_secret) {
71990         void* payment_preimage_ptr = untag_ptr(payment_preimage);
71991         CHECK_ACCESS(payment_preimage_ptr);
71992         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
71993         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
71994         LDKThirtyTwoBytes payment_secret_ref;
71995         CHECK(payment_secret->arr_len == 32);
71996         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
71997         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
71998         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
71999         int64_t ret_ref = tag_ptr(ret_copy, true);
72000         return ret_ref;
72001 }
72002
72003 int64_t  CS_LDK_PaymentPurpose_spontaneous_payment(int8_tArray a) {
72004         LDKThirtyTwoBytes a_ref;
72005         CHECK(a->arr_len == 32);
72006         memcpy(a_ref.data, a->elems, 32); FREE(a);
72007         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
72008         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
72009         int64_t ret_ref = tag_ptr(ret_copy, true);
72010         return ret_ref;
72011 }
72012
72013 jboolean  CS_LDK_PaymentPurpose_eq(int64_t a, int64_t b) {
72014         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
72015         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
72016         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
72017         return ret_conv;
72018 }
72019
72020 int64_t  CS_LDK_PaymentPurpose_preimage(int64_t this_arg) {
72021         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
72022         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
72023         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
72024         int64_t ret_ref = tag_ptr(ret_copy, true);
72025         return ret_ref;
72026 }
72027
72028 int8_tArray  CS_LDK_PaymentPurpose_write(int64_t obj) {
72029         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
72030         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
72031         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72032         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72033         CVec_u8Z_free(ret_var);
72034         return ret_arr;
72035 }
72036
72037 int64_t  CS_LDK_PaymentPurpose_read(int8_tArray ser) {
72038         LDKu8slice ser_ref;
72039         ser_ref.datalen = ser->arr_len;
72040         ser_ref.data = ser->elems;
72041         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
72042         *ret_conv = PaymentPurpose_read(ser_ref);
72043         FREE(ser);
72044         return tag_ptr(ret_conv, true);
72045 }
72046
72047 void  CS_LDK_ClaimedHTLC_free(int64_t this_obj) {
72048         LDKClaimedHTLC this_obj_conv;
72049         this_obj_conv.inner = untag_ptr(this_obj);
72050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72052         ClaimedHTLC_free(this_obj_conv);
72053 }
72054
72055 int8_tArray  CS_LDK_ClaimedHTLC_get_channel_id(int64_t this_ptr) {
72056         LDKClaimedHTLC this_ptr_conv;
72057         this_ptr_conv.inner = untag_ptr(this_ptr);
72058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72060         this_ptr_conv.is_owned = false;
72061         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
72062         memcpy(ret_arr->elems, *ClaimedHTLC_get_channel_id(&this_ptr_conv), 32);
72063         return ret_arr;
72064 }
72065
72066 void  CS_LDK_ClaimedHTLC_set_channel_id(int64_t this_ptr, int8_tArray val) {
72067         LDKClaimedHTLC this_ptr_conv;
72068         this_ptr_conv.inner = untag_ptr(this_ptr);
72069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72071         this_ptr_conv.is_owned = false;
72072         LDKThirtyTwoBytes val_ref;
72073         CHECK(val->arr_len == 32);
72074         memcpy(val_ref.data, val->elems, 32); FREE(val);
72075         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
72076 }
72077
72078 int8_tArray  CS_LDK_ClaimedHTLC_get_user_channel_id(int64_t this_ptr) {
72079         LDKClaimedHTLC this_ptr_conv;
72080         this_ptr_conv.inner = untag_ptr(this_ptr);
72081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72083         this_ptr_conv.is_owned = false;
72084         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
72085         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
72086         return ret_arr;
72087 }
72088
72089 void  CS_LDK_ClaimedHTLC_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
72090         LDKClaimedHTLC this_ptr_conv;
72091         this_ptr_conv.inner = untag_ptr(this_ptr);
72092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72094         this_ptr_conv.is_owned = false;
72095         LDKU128 val_ref;
72096         CHECK(val->arr_len == 16);
72097         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
72098         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
72099 }
72100
72101 int32_t  CS_LDK_ClaimedHTLC_get_cltv_expiry(int64_t this_ptr) {
72102         LDKClaimedHTLC this_ptr_conv;
72103         this_ptr_conv.inner = untag_ptr(this_ptr);
72104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72106         this_ptr_conv.is_owned = false;
72107         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
72108         return ret_conv;
72109 }
72110
72111 void  CS_LDK_ClaimedHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
72112         LDKClaimedHTLC this_ptr_conv;
72113         this_ptr_conv.inner = untag_ptr(this_ptr);
72114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72116         this_ptr_conv.is_owned = false;
72117         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
72118 }
72119
72120 int64_t  CS_LDK_ClaimedHTLC_get_value_msat(int64_t this_ptr) {
72121         LDKClaimedHTLC this_ptr_conv;
72122         this_ptr_conv.inner = untag_ptr(this_ptr);
72123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72125         this_ptr_conv.is_owned = false;
72126         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
72127         return ret_conv;
72128 }
72129
72130 void  CS_LDK_ClaimedHTLC_set_value_msat(int64_t this_ptr, int64_t val) {
72131         LDKClaimedHTLC this_ptr_conv;
72132         this_ptr_conv.inner = untag_ptr(this_ptr);
72133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72135         this_ptr_conv.is_owned = false;
72136         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
72137 }
72138
72139 int64_t  CS_LDK_ClaimedHTLC_get_counterparty_skimmed_fee_msat(int64_t this_ptr) {
72140         LDKClaimedHTLC this_ptr_conv;
72141         this_ptr_conv.inner = untag_ptr(this_ptr);
72142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72144         this_ptr_conv.is_owned = false;
72145         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
72146         return ret_conv;
72147 }
72148
72149 void  CS_LDK_ClaimedHTLC_set_counterparty_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
72150         LDKClaimedHTLC this_ptr_conv;
72151         this_ptr_conv.inner = untag_ptr(this_ptr);
72152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72154         this_ptr_conv.is_owned = false;
72155         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
72156 }
72157
72158 int64_t  CS_LDK_ClaimedHTLC_new(int8_tArray 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) {
72159         LDKThirtyTwoBytes channel_id_arg_ref;
72160         CHECK(channel_id_arg->arr_len == 32);
72161         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
72162         LDKU128 user_channel_id_arg_ref;
72163         CHECK(user_channel_id_arg->arr_len == 16);
72164         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
72165         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
72166         int64_t ret_ref = 0;
72167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72169         return ret_ref;
72170 }
72171
72172 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
72173         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
72174         int64_t ret_ref = 0;
72175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72177         return ret_ref;
72178 }
72179 int64_t  CS_LDK_ClaimedHTLC_clone_ptr(int64_t arg) {
72180         LDKClaimedHTLC arg_conv;
72181         arg_conv.inner = untag_ptr(arg);
72182         arg_conv.is_owned = ptr_is_owned(arg);
72183         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72184         arg_conv.is_owned = false;
72185         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
72186         return ret_conv;
72187 }
72188
72189 int64_t  CS_LDK_ClaimedHTLC_clone(int64_t orig) {
72190         LDKClaimedHTLC orig_conv;
72191         orig_conv.inner = untag_ptr(orig);
72192         orig_conv.is_owned = ptr_is_owned(orig);
72193         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72194         orig_conv.is_owned = false;
72195         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
72196         int64_t ret_ref = 0;
72197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72199         return ret_ref;
72200 }
72201
72202 jboolean  CS_LDK_ClaimedHTLC_eq(int64_t a, int64_t b) {
72203         LDKClaimedHTLC a_conv;
72204         a_conv.inner = untag_ptr(a);
72205         a_conv.is_owned = ptr_is_owned(a);
72206         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72207         a_conv.is_owned = false;
72208         LDKClaimedHTLC b_conv;
72209         b_conv.inner = untag_ptr(b);
72210         b_conv.is_owned = ptr_is_owned(b);
72211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72212         b_conv.is_owned = false;
72213         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
72214         return ret_conv;
72215 }
72216
72217 int8_tArray  CS_LDK_ClaimedHTLC_write(int64_t obj) {
72218         LDKClaimedHTLC obj_conv;
72219         obj_conv.inner = untag_ptr(obj);
72220         obj_conv.is_owned = ptr_is_owned(obj);
72221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72222         obj_conv.is_owned = false;
72223         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
72224         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72225         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72226         CVec_u8Z_free(ret_var);
72227         return ret_arr;
72228 }
72229
72230 int64_t  CS_LDK_ClaimedHTLC_read(int8_tArray ser) {
72231         LDKu8slice ser_ref;
72232         ser_ref.datalen = ser->arr_len;
72233         ser_ref.data = ser->elems;
72234         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
72235         *ret_conv = ClaimedHTLC_read(ser_ref);
72236         FREE(ser);
72237         return tag_ptr(ret_conv, true);
72238 }
72239
72240 void  CS_LDK_PathFailure_free(int64_t this_ptr) {
72241         if (!ptr_is_owned(this_ptr)) return;
72242         void* this_ptr_ptr = untag_ptr(this_ptr);
72243         CHECK_ACCESS(this_ptr_ptr);
72244         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
72245         FREE(untag_ptr(this_ptr));
72246         PathFailure_free(this_ptr_conv);
72247 }
72248
72249 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
72250         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72251         *ret_copy = PathFailure_clone(arg);
72252         int64_t ret_ref = tag_ptr(ret_copy, true);
72253         return ret_ref;
72254 }
72255 int64_t  CS_LDK_PathFailure_clone_ptr(int64_t arg) {
72256         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
72257         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
72258         return ret_conv;
72259 }
72260
72261 int64_t  CS_LDK_PathFailure_clone(int64_t orig) {
72262         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
72263         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72264         *ret_copy = PathFailure_clone(orig_conv);
72265         int64_t ret_ref = tag_ptr(ret_copy, true);
72266         return ret_ref;
72267 }
72268
72269 int64_t  CS_LDK_PathFailure_initial_send(int64_t err) {
72270         void* err_ptr = untag_ptr(err);
72271         CHECK_ACCESS(err_ptr);
72272         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
72273         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
72274         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72275         *ret_copy = PathFailure_initial_send(err_conv);
72276         int64_t ret_ref = tag_ptr(ret_copy, true);
72277         return ret_ref;
72278 }
72279
72280 int64_t  CS_LDK_PathFailure_on_path(int64_t network_update) {
72281         void* network_update_ptr = untag_ptr(network_update);
72282         CHECK_ACCESS(network_update_ptr);
72283         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
72284         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
72285         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
72286         *ret_copy = PathFailure_on_path(network_update_conv);
72287         int64_t ret_ref = tag_ptr(ret_copy, true);
72288         return ret_ref;
72289 }
72290
72291 jboolean  CS_LDK_PathFailure_eq(int64_t a, int64_t b) {
72292         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
72293         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
72294         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
72295         return ret_conv;
72296 }
72297
72298 int8_tArray  CS_LDK_PathFailure_write(int64_t obj) {
72299         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
72300         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
72301         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72302         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72303         CVec_u8Z_free(ret_var);
72304         return ret_arr;
72305 }
72306
72307 int64_t  CS_LDK_PathFailure_read(int8_tArray ser) {
72308         LDKu8slice ser_ref;
72309         ser_ref.datalen = ser->arr_len;
72310         ser_ref.data = ser->elems;
72311         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
72312         *ret_conv = PathFailure_read(ser_ref);
72313         FREE(ser);
72314         return tag_ptr(ret_conv, true);
72315 }
72316
72317 void  CS_LDK_ClosureReason_free(int64_t this_ptr) {
72318         if (!ptr_is_owned(this_ptr)) return;
72319         void* this_ptr_ptr = untag_ptr(this_ptr);
72320         CHECK_ACCESS(this_ptr_ptr);
72321         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
72322         FREE(untag_ptr(this_ptr));
72323         ClosureReason_free(this_ptr_conv);
72324 }
72325
72326 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
72327         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72328         *ret_copy = ClosureReason_clone(arg);
72329         int64_t ret_ref = tag_ptr(ret_copy, true);
72330         return ret_ref;
72331 }
72332 int64_t  CS_LDK_ClosureReason_clone_ptr(int64_t arg) {
72333         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
72334         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
72335         return ret_conv;
72336 }
72337
72338 int64_t  CS_LDK_ClosureReason_clone(int64_t orig) {
72339         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
72340         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72341         *ret_copy = ClosureReason_clone(orig_conv);
72342         int64_t ret_ref = tag_ptr(ret_copy, true);
72343         return ret_ref;
72344 }
72345
72346 int64_t  CS_LDK_ClosureReason_counterparty_force_closed(int64_t peer_msg) {
72347         LDKUntrustedString peer_msg_conv;
72348         peer_msg_conv.inner = untag_ptr(peer_msg);
72349         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
72350         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
72351         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
72352         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72353         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
72354         int64_t ret_ref = tag_ptr(ret_copy, true);
72355         return ret_ref;
72356 }
72357
72358 int64_t  CS_LDK_ClosureReason_holder_force_closed() {
72359         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72360         *ret_copy = ClosureReason_holder_force_closed();
72361         int64_t ret_ref = tag_ptr(ret_copy, true);
72362         return ret_ref;
72363 }
72364
72365 int64_t  CS_LDK_ClosureReason_cooperative_closure() {
72366         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72367         *ret_copy = ClosureReason_cooperative_closure();
72368         int64_t ret_ref = tag_ptr(ret_copy, true);
72369         return ret_ref;
72370 }
72371
72372 int64_t  CS_LDK_ClosureReason_commitment_tx_confirmed() {
72373         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72374         *ret_copy = ClosureReason_commitment_tx_confirmed();
72375         int64_t ret_ref = tag_ptr(ret_copy, true);
72376         return ret_ref;
72377 }
72378
72379 int64_t  CS_LDK_ClosureReason_funding_timed_out() {
72380         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72381         *ret_copy = ClosureReason_funding_timed_out();
72382         int64_t ret_ref = tag_ptr(ret_copy, true);
72383         return ret_ref;
72384 }
72385
72386 int64_t  CS_LDK_ClosureReason_processing_error(jstring err) {
72387         LDKStr err_conv = str_ref_to_owned_c(err);
72388         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72389         *ret_copy = ClosureReason_processing_error(err_conv);
72390         int64_t ret_ref = tag_ptr(ret_copy, true);
72391         return ret_ref;
72392 }
72393
72394 int64_t  CS_LDK_ClosureReason_disconnected_peer() {
72395         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72396         *ret_copy = ClosureReason_disconnected_peer();
72397         int64_t ret_ref = tag_ptr(ret_copy, true);
72398         return ret_ref;
72399 }
72400
72401 int64_t  CS_LDK_ClosureReason_outdated_channel_manager() {
72402         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72403         *ret_copy = ClosureReason_outdated_channel_manager();
72404         int64_t ret_ref = tag_ptr(ret_copy, true);
72405         return ret_ref;
72406 }
72407
72408 int64_t  CS_LDK_ClosureReason_counterparty_coop_closed_unfunded_channel() {
72409         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72410         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
72411         int64_t ret_ref = tag_ptr(ret_copy, true);
72412         return ret_ref;
72413 }
72414
72415 int64_t  CS_LDK_ClosureReason_funding_batch_closure() {
72416         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
72417         *ret_copy = ClosureReason_funding_batch_closure();
72418         int64_t ret_ref = tag_ptr(ret_copy, true);
72419         return ret_ref;
72420 }
72421
72422 jboolean  CS_LDK_ClosureReason_eq(int64_t a, int64_t b) {
72423         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
72424         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
72425         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
72426         return ret_conv;
72427 }
72428
72429 int8_tArray  CS_LDK_ClosureReason_write(int64_t obj) {
72430         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
72431         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
72432         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72433         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72434         CVec_u8Z_free(ret_var);
72435         return ret_arr;
72436 }
72437
72438 int64_t  CS_LDK_ClosureReason_read(int8_tArray ser) {
72439         LDKu8slice ser_ref;
72440         ser_ref.datalen = ser->arr_len;
72441         ser_ref.data = ser->elems;
72442         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
72443         *ret_conv = ClosureReason_read(ser_ref);
72444         FREE(ser);
72445         return tag_ptr(ret_conv, true);
72446 }
72447
72448 void  CS_LDK_HTLCDestination_free(int64_t this_ptr) {
72449         if (!ptr_is_owned(this_ptr)) return;
72450         void* this_ptr_ptr = untag_ptr(this_ptr);
72451         CHECK_ACCESS(this_ptr_ptr);
72452         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
72453         FREE(untag_ptr(this_ptr));
72454         HTLCDestination_free(this_ptr_conv);
72455 }
72456
72457 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
72458         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72459         *ret_copy = HTLCDestination_clone(arg);
72460         int64_t ret_ref = tag_ptr(ret_copy, true);
72461         return ret_ref;
72462 }
72463 int64_t  CS_LDK_HTLCDestination_clone_ptr(int64_t arg) {
72464         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
72465         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
72466         return ret_conv;
72467 }
72468
72469 int64_t  CS_LDK_HTLCDestination_clone(int64_t orig) {
72470         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
72471         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72472         *ret_copy = HTLCDestination_clone(orig_conv);
72473         int64_t ret_ref = tag_ptr(ret_copy, true);
72474         return ret_ref;
72475 }
72476
72477 int64_t  CS_LDK_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
72478         LDKPublicKey node_id_ref;
72479         CHECK(node_id->arr_len == 33);
72480         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72481         LDKThirtyTwoBytes channel_id_ref;
72482         CHECK(channel_id->arr_len == 32);
72483         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72484         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72485         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
72486         int64_t ret_ref = tag_ptr(ret_copy, true);
72487         return ret_ref;
72488 }
72489
72490 int64_t  CS_LDK_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
72491         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72492         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
72493         int64_t ret_ref = tag_ptr(ret_copy, true);
72494         return ret_ref;
72495 }
72496
72497 int64_t  CS_LDK_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
72498         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72499         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
72500         int64_t ret_ref = tag_ptr(ret_copy, true);
72501         return ret_ref;
72502 }
72503
72504 int64_t  CS_LDK_HTLCDestination_failed_payment(int8_tArray payment_hash) {
72505         LDKThirtyTwoBytes payment_hash_ref;
72506         CHECK(payment_hash->arr_len == 32);
72507         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72508         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
72509         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
72510         int64_t ret_ref = tag_ptr(ret_copy, true);
72511         return ret_ref;
72512 }
72513
72514 jboolean  CS_LDK_HTLCDestination_eq(int64_t a, int64_t b) {
72515         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
72516         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
72517         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
72518         return ret_conv;
72519 }
72520
72521 int8_tArray  CS_LDK_HTLCDestination_write(int64_t obj) {
72522         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
72523         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
72524         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72525         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72526         CVec_u8Z_free(ret_var);
72527         return ret_arr;
72528 }
72529
72530 int64_t  CS_LDK_HTLCDestination_read(int8_tArray ser) {
72531         LDKu8slice ser_ref;
72532         ser_ref.datalen = ser->arr_len;
72533         ser_ref.data = ser->elems;
72534         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
72535         *ret_conv = HTLCDestination_read(ser_ref);
72536         FREE(ser);
72537         return tag_ptr(ret_conv, true);
72538 }
72539
72540 int32_t  CS_LDK_PaymentFailureReason_clone(int64_t orig) {
72541         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
72542         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_clone(orig_conv));
72543         return ret_conv;
72544 }
72545
72546 int32_t  CS_LDK_PaymentFailureReason_recipient_rejected() {
72547         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_recipient_rejected());
72548         return ret_conv;
72549 }
72550
72551 int32_t  CS_LDK_PaymentFailureReason_user_abandoned() {
72552         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_user_abandoned());
72553         return ret_conv;
72554 }
72555
72556 int32_t  CS_LDK_PaymentFailureReason_retries_exhausted() {
72557         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_retries_exhausted());
72558         return ret_conv;
72559 }
72560
72561 int32_t  CS_LDK_PaymentFailureReason_payment_expired() {
72562         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_payment_expired());
72563         return ret_conv;
72564 }
72565
72566 int32_t  CS_LDK_PaymentFailureReason_route_not_found() {
72567         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_route_not_found());
72568         return ret_conv;
72569 }
72570
72571 int32_t  CS_LDK_PaymentFailureReason_unexpected_error() {
72572         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_unexpected_error());
72573         return ret_conv;
72574 }
72575
72576 jboolean  CS_LDK_PaymentFailureReason_eq(int64_t a, int64_t b) {
72577         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
72578         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
72579         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
72580         return ret_conv;
72581 }
72582
72583 int8_tArray  CS_LDK_PaymentFailureReason_write(int64_t obj) {
72584         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
72585         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
72586         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72587         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72588         CVec_u8Z_free(ret_var);
72589         return ret_arr;
72590 }
72591
72592 int64_t  CS_LDK_PaymentFailureReason_read(int8_tArray ser) {
72593         LDKu8slice ser_ref;
72594         ser_ref.datalen = ser->arr_len;
72595         ser_ref.data = ser->elems;
72596         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
72597         *ret_conv = PaymentFailureReason_read(ser_ref);
72598         FREE(ser);
72599         return tag_ptr(ret_conv, true);
72600 }
72601
72602 void  CS_LDK_Event_free(int64_t this_ptr) {
72603         if (!ptr_is_owned(this_ptr)) return;
72604         void* this_ptr_ptr = untag_ptr(this_ptr);
72605         CHECK_ACCESS(this_ptr_ptr);
72606         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
72607         FREE(untag_ptr(this_ptr));
72608         Event_free(this_ptr_conv);
72609 }
72610
72611 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
72612         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72613         *ret_copy = Event_clone(arg);
72614         int64_t ret_ref = tag_ptr(ret_copy, true);
72615         return ret_ref;
72616 }
72617 int64_t  CS_LDK_Event_clone_ptr(int64_t arg) {
72618         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
72619         int64_t ret_conv = Event_clone_ptr(arg_conv);
72620         return ret_conv;
72621 }
72622
72623 int64_t  CS_LDK_Event_clone(int64_t orig) {
72624         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
72625         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72626         *ret_copy = Event_clone(orig_conv);
72627         int64_t ret_ref = tag_ptr(ret_copy, true);
72628         return ret_ref;
72629 }
72630
72631 int64_t  CS_LDK_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
72632         LDKThirtyTwoBytes temporary_channel_id_ref;
72633         CHECK(temporary_channel_id->arr_len == 32);
72634         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
72635         LDKPublicKey counterparty_node_id_ref;
72636         CHECK(counterparty_node_id->arr_len == 33);
72637         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72638         LDKCVec_u8Z output_script_ref;
72639         output_script_ref.datalen = output_script->arr_len;
72640         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
72641         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
72642         LDKU128 user_channel_id_ref;
72643         CHECK(user_channel_id->arr_len == 16);
72644         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72645         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72646         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
72647         int64_t ret_ref = tag_ptr(ret_copy, true);
72648         return ret_ref;
72649 }
72650
72651 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) {
72652         LDKPublicKey receiver_node_id_ref;
72653         CHECK(receiver_node_id->arr_len == 33);
72654         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72655         LDKThirtyTwoBytes payment_hash_ref;
72656         CHECK(payment_hash->arr_len == 32);
72657         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72658         LDKRecipientOnionFields onion_fields_conv;
72659         onion_fields_conv.inner = untag_ptr(onion_fields);
72660         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
72661         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
72662         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
72663         void* purpose_ptr = untag_ptr(purpose);
72664         CHECK_ACCESS(purpose_ptr);
72665         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72666         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72667         void* via_channel_id_ptr = untag_ptr(via_channel_id);
72668         CHECK_ACCESS(via_channel_id_ptr);
72669         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
72670         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
72671         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
72672         CHECK_ACCESS(via_user_channel_id_ptr);
72673         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
72674         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
72675         void* claim_deadline_ptr = untag_ptr(claim_deadline);
72676         CHECK_ACCESS(claim_deadline_ptr);
72677         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
72678         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
72679         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72680         *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);
72681         int64_t ret_ref = tag_ptr(ret_copy, true);
72682         return ret_ref;
72683 }
72684
72685 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) {
72686         LDKPublicKey receiver_node_id_ref;
72687         CHECK(receiver_node_id->arr_len == 33);
72688         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
72689         LDKThirtyTwoBytes payment_hash_ref;
72690         CHECK(payment_hash->arr_len == 32);
72691         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72692         void* purpose_ptr = untag_ptr(purpose);
72693         CHECK_ACCESS(purpose_ptr);
72694         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
72695         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
72696         LDKCVec_ClaimedHTLCZ htlcs_constr;
72697         htlcs_constr.datalen = htlcs->arr_len;
72698         if (htlcs_constr.datalen > 0)
72699                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
72700         else
72701                 htlcs_constr.data = NULL;
72702         int64_t* htlcs_vals = htlcs->elems;
72703         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
72704                 int64_t htlcs_conv_13 = htlcs_vals[n];
72705                 LDKClaimedHTLC htlcs_conv_13_conv;
72706                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
72707                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
72708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
72709                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
72710                 htlcs_constr.data[n] = htlcs_conv_13_conv;
72711         }
72712         FREE(htlcs);
72713         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
72714         CHECK_ACCESS(sender_intended_total_msat_ptr);
72715         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
72716         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
72717         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72718         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
72719         int64_t ret_ref = tag_ptr(ret_copy, true);
72720         return ret_ref;
72721 }
72722
72723 int64_t  CS_LDK_Event_connection_needed(int8_tArray node_id, int64_tArray addresses) {
72724         LDKPublicKey node_id_ref;
72725         CHECK(node_id->arr_len == 33);
72726         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
72727         LDKCVec_SocketAddressZ addresses_constr;
72728         addresses_constr.datalen = addresses->arr_len;
72729         if (addresses_constr.datalen > 0)
72730                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
72731         else
72732                 addresses_constr.data = NULL;
72733         int64_t* addresses_vals = addresses->elems;
72734         for (size_t p = 0; p < addresses_constr.datalen; p++) {
72735                 int64_t addresses_conv_15 = addresses_vals[p];
72736                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
72737                 CHECK_ACCESS(addresses_conv_15_ptr);
72738                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
72739                 addresses_constr.data[p] = addresses_conv_15_conv;
72740         }
72741         FREE(addresses);
72742         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72743         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
72744         int64_t ret_ref = tag_ptr(ret_copy, true);
72745         return ret_ref;
72746 }
72747
72748 int64_t  CS_LDK_Event_invoice_request_failed(int8_tArray payment_id) {
72749         LDKThirtyTwoBytes payment_id_ref;
72750         CHECK(payment_id->arr_len == 32);
72751         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72752         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72753         *ret_copy = Event_invoice_request_failed(payment_id_ref);
72754         int64_t ret_ref = tag_ptr(ret_copy, true);
72755         return ret_ref;
72756 }
72757
72758 int64_t  CS_LDK_Event_payment_sent(int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
72759         void* payment_id_ptr = untag_ptr(payment_id);
72760         CHECK_ACCESS(payment_id_ptr);
72761         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72762         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72763         LDKThirtyTwoBytes payment_preimage_ref;
72764         CHECK(payment_preimage->arr_len == 32);
72765         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
72766         LDKThirtyTwoBytes payment_hash_ref;
72767         CHECK(payment_hash->arr_len == 32);
72768         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72769         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
72770         CHECK_ACCESS(fee_paid_msat_ptr);
72771         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
72772         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
72773         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72774         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
72775         int64_t ret_ref = tag_ptr(ret_copy, true);
72776         return ret_ref;
72777 }
72778
72779 int64_t  CS_LDK_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
72780         LDKThirtyTwoBytes payment_id_ref;
72781         CHECK(payment_id->arr_len == 32);
72782         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72783         LDKThirtyTwoBytes payment_hash_ref;
72784         CHECK(payment_hash->arr_len == 32);
72785         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72786         void* reason_ptr = untag_ptr(reason);
72787         CHECK_ACCESS(reason_ptr);
72788         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
72789         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
72790         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72791         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
72792         int64_t ret_ref = tag_ptr(ret_copy, true);
72793         return ret_ref;
72794 }
72795
72796 int64_t  CS_LDK_Event_payment_path_successful(int8_tArray payment_id, int64_t payment_hash, int64_t path) {
72797         LDKThirtyTwoBytes payment_id_ref;
72798         CHECK(payment_id->arr_len == 32);
72799         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72800         void* payment_hash_ptr = untag_ptr(payment_hash);
72801         CHECK_ACCESS(payment_hash_ptr);
72802         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
72803         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
72804         LDKPath path_conv;
72805         path_conv.inner = untag_ptr(path);
72806         path_conv.is_owned = ptr_is_owned(path);
72807         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72808         path_conv = Path_clone(&path_conv);
72809         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72810         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
72811         int64_t ret_ref = tag_ptr(ret_copy, true);
72812         return ret_ref;
72813 }
72814
72815 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) {
72816         void* payment_id_ptr = untag_ptr(payment_id);
72817         CHECK_ACCESS(payment_id_ptr);
72818         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
72819         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
72820         LDKThirtyTwoBytes payment_hash_ref;
72821         CHECK(payment_hash->arr_len == 32);
72822         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72823         void* failure_ptr = untag_ptr(failure);
72824         CHECK_ACCESS(failure_ptr);
72825         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
72826         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
72827         LDKPath path_conv;
72828         path_conv.inner = untag_ptr(path);
72829         path_conv.is_owned = ptr_is_owned(path);
72830         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72831         path_conv = Path_clone(&path_conv);
72832         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72833         CHECK_ACCESS(short_channel_id_ptr);
72834         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72835         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72836         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72837         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
72838         int64_t ret_ref = tag_ptr(ret_copy, true);
72839         return ret_ref;
72840 }
72841
72842 int64_t  CS_LDK_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
72843         LDKThirtyTwoBytes payment_id_ref;
72844         CHECK(payment_id->arr_len == 32);
72845         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72846         LDKThirtyTwoBytes payment_hash_ref;
72847         CHECK(payment_hash->arr_len == 32);
72848         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72849         LDKPath path_conv;
72850         path_conv.inner = untag_ptr(path);
72851         path_conv.is_owned = ptr_is_owned(path);
72852         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72853         path_conv = Path_clone(&path_conv);
72854         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72855         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
72856         int64_t ret_ref = tag_ptr(ret_copy, true);
72857         return ret_ref;
72858 }
72859
72860 int64_t  CS_LDK_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
72861         LDKThirtyTwoBytes payment_id_ref;
72862         CHECK(payment_id->arr_len == 32);
72863         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
72864         LDKThirtyTwoBytes payment_hash_ref;
72865         CHECK(payment_hash->arr_len == 32);
72866         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72867         LDKPath path_conv;
72868         path_conv.inner = untag_ptr(path);
72869         path_conv.is_owned = ptr_is_owned(path);
72870         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
72871         path_conv = Path_clone(&path_conv);
72872         void* short_channel_id_ptr = untag_ptr(short_channel_id);
72873         CHECK_ACCESS(short_channel_id_ptr);
72874         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
72875         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
72876         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72877         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
72878         int64_t ret_ref = tag_ptr(ret_copy, true);
72879         return ret_ref;
72880 }
72881
72882 int64_t  CS_LDK_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
72883         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72884         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
72885         int64_t ret_ref = tag_ptr(ret_copy, true);
72886         return ret_ref;
72887 }
72888
72889 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) {
72890         LDKThirtyTwoBytes intercept_id_ref;
72891         CHECK(intercept_id->arr_len == 32);
72892         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
72893         LDKThirtyTwoBytes payment_hash_ref;
72894         CHECK(payment_hash->arr_len == 32);
72895         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
72896         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72897         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
72898         int64_t ret_ref = tag_ptr(ret_copy, true);
72899         return ret_ref;
72900 }
72901
72902 int64_t  CS_LDK_Event_spendable_outputs(int64_tArray outputs, int64_t channel_id) {
72903         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
72904         outputs_constr.datalen = outputs->arr_len;
72905         if (outputs_constr.datalen > 0)
72906                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
72907         else
72908                 outputs_constr.data = NULL;
72909         int64_t* outputs_vals = outputs->elems;
72910         for (size_t b = 0; b < outputs_constr.datalen; b++) {
72911                 int64_t outputs_conv_27 = outputs_vals[b];
72912                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
72913                 CHECK_ACCESS(outputs_conv_27_ptr);
72914                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
72915                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
72916                 outputs_constr.data[b] = outputs_conv_27_conv;
72917         }
72918         FREE(outputs);
72919         void* channel_id_ptr = untag_ptr(channel_id);
72920         CHECK_ACCESS(channel_id_ptr);
72921         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
72922         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
72923         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72924         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
72925         int64_t ret_ref = tag_ptr(ret_copy, true);
72926         return ret_ref;
72927 }
72928
72929 int64_t  CS_LDK_Event_payment_forwarded(int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
72930         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
72931         CHECK_ACCESS(prev_channel_id_ptr);
72932         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
72933         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
72934         void* next_channel_id_ptr = untag_ptr(next_channel_id);
72935         CHECK_ACCESS(next_channel_id_ptr);
72936         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
72937         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
72938         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
72939         CHECK_ACCESS(fee_earned_msat_ptr);
72940         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
72941         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
72942         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
72943         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
72944         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
72945         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
72946         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72947         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
72948         int64_t ret_ref = tag_ptr(ret_copy, true);
72949         return ret_ref;
72950 }
72951
72952 int64_t  CS_LDK_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
72953         LDKThirtyTwoBytes channel_id_ref;
72954         CHECK(channel_id->arr_len == 32);
72955         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72956         LDKU128 user_channel_id_ref;
72957         CHECK(user_channel_id->arr_len == 16);
72958         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72959         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
72960         CHECK_ACCESS(former_temporary_channel_id_ptr);
72961         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
72962         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
72963         LDKPublicKey counterparty_node_id_ref;
72964         CHECK(counterparty_node_id->arr_len == 33);
72965         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72966         LDKOutPoint funding_txo_conv;
72967         funding_txo_conv.inner = untag_ptr(funding_txo);
72968         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
72969         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
72970         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
72971         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72972         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
72973         int64_t ret_ref = tag_ptr(ret_copy, true);
72974         return ret_ref;
72975 }
72976
72977 int64_t  CS_LDK_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
72978         LDKThirtyTwoBytes channel_id_ref;
72979         CHECK(channel_id->arr_len == 32);
72980         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
72981         LDKU128 user_channel_id_ref;
72982         CHECK(user_channel_id->arr_len == 16);
72983         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
72984         LDKPublicKey counterparty_node_id_ref;
72985         CHECK(counterparty_node_id->arr_len == 33);
72986         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
72987         LDKChannelTypeFeatures channel_type_conv;
72988         channel_type_conv.inner = untag_ptr(channel_type);
72989         channel_type_conv.is_owned = ptr_is_owned(channel_type);
72990         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
72991         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
72992         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
72993         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
72994         int64_t ret_ref = tag_ptr(ret_copy, true);
72995         return ret_ref;
72996 }
72997
72998 int64_t  CS_LDK_Event_channel_closed(int8_tArray 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) {
72999         LDKThirtyTwoBytes channel_id_ref;
73000         CHECK(channel_id->arr_len == 32);
73001         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
73002         LDKU128 user_channel_id_ref;
73003         CHECK(user_channel_id->arr_len == 16);
73004         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
73005         void* reason_ptr = untag_ptr(reason);
73006         CHECK_ACCESS(reason_ptr);
73007         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
73008         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
73009         LDKPublicKey counterparty_node_id_ref;
73010         CHECK(counterparty_node_id->arr_len == 33);
73011         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
73012         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
73013         CHECK_ACCESS(channel_capacity_sats_ptr);
73014         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
73015         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
73016         LDKOutPoint channel_funding_txo_conv;
73017         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
73018         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
73019         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
73020         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
73021         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73022         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
73023         int64_t ret_ref = tag_ptr(ret_copy, true);
73024         return ret_ref;
73025 }
73026
73027 int64_t  CS_LDK_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
73028         LDKThirtyTwoBytes channel_id_ref;
73029         CHECK(channel_id->arr_len == 32);
73030         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
73031         LDKTransaction transaction_ref;
73032         transaction_ref.datalen = transaction->arr_len;
73033         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
73034         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
73035         transaction_ref.data_is_owned = true;
73036         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73037         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
73038         int64_t ret_ref = tag_ptr(ret_copy, true);
73039         return ret_ref;
73040 }
73041
73042 int64_t  CS_LDK_Event_open_channel_request(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
73043         LDKThirtyTwoBytes temporary_channel_id_ref;
73044         CHECK(temporary_channel_id->arr_len == 32);
73045         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
73046         LDKPublicKey counterparty_node_id_ref;
73047         CHECK(counterparty_node_id->arr_len == 33);
73048         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
73049         LDKChannelTypeFeatures channel_type_conv;
73050         channel_type_conv.inner = untag_ptr(channel_type);
73051         channel_type_conv.is_owned = ptr_is_owned(channel_type);
73052         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
73053         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
73054         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73055         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
73056         int64_t ret_ref = tag_ptr(ret_copy, true);
73057         return ret_ref;
73058 }
73059
73060 int64_t  CS_LDK_Event_htlchandling_failed(int8_tArray prev_channel_id, int64_t failed_next_destination) {
73061         LDKThirtyTwoBytes prev_channel_id_ref;
73062         CHECK(prev_channel_id->arr_len == 32);
73063         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
73064         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
73065         CHECK_ACCESS(failed_next_destination_ptr);
73066         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
73067         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
73068         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73069         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
73070         int64_t ret_ref = tag_ptr(ret_copy, true);
73071         return ret_ref;
73072 }
73073
73074 int64_t  CS_LDK_Event_bump_transaction(int64_t a) {
73075         void* a_ptr = untag_ptr(a);
73076         CHECK_ACCESS(a_ptr);
73077         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
73078         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
73079         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
73080         *ret_copy = Event_bump_transaction(a_conv);
73081         int64_t ret_ref = tag_ptr(ret_copy, true);
73082         return ret_ref;
73083 }
73084
73085 jboolean  CS_LDK_Event_eq(int64_t a, int64_t b) {
73086         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
73087         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
73088         jboolean ret_conv = Event_eq(a_conv, b_conv);
73089         return ret_conv;
73090 }
73091
73092 int8_tArray  CS_LDK_Event_write(int64_t obj) {
73093         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
73094         LDKCVec_u8Z ret_var = Event_write(obj_conv);
73095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73097         CVec_u8Z_free(ret_var);
73098         return ret_arr;
73099 }
73100
73101 int64_t  CS_LDK_Event_read(int8_tArray ser) {
73102         LDKu8slice ser_ref;
73103         ser_ref.datalen = ser->arr_len;
73104         ser_ref.data = ser->elems;
73105         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
73106         *ret_conv = Event_read(ser_ref);
73107         FREE(ser);
73108         return tag_ptr(ret_conv, true);
73109 }
73110
73111 void  CS_LDK_MessageSendEvent_free(int64_t this_ptr) {
73112         if (!ptr_is_owned(this_ptr)) return;
73113         void* this_ptr_ptr = untag_ptr(this_ptr);
73114         CHECK_ACCESS(this_ptr_ptr);
73115         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
73116         FREE(untag_ptr(this_ptr));
73117         MessageSendEvent_free(this_ptr_conv);
73118 }
73119
73120 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
73121         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73122         *ret_copy = MessageSendEvent_clone(arg);
73123         int64_t ret_ref = tag_ptr(ret_copy, true);
73124         return ret_ref;
73125 }
73126 int64_t  CS_LDK_MessageSendEvent_clone_ptr(int64_t arg) {
73127         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
73128         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
73129         return ret_conv;
73130 }
73131
73132 int64_t  CS_LDK_MessageSendEvent_clone(int64_t orig) {
73133         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
73134         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73135         *ret_copy = MessageSendEvent_clone(orig_conv);
73136         int64_t ret_ref = tag_ptr(ret_copy, true);
73137         return ret_ref;
73138 }
73139
73140 int64_t  CS_LDK_MessageSendEvent_send_accept_channel(int8_tArray node_id, int64_t msg) {
73141         LDKPublicKey node_id_ref;
73142         CHECK(node_id->arr_len == 33);
73143         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73144         LDKAcceptChannel msg_conv;
73145         msg_conv.inner = untag_ptr(msg);
73146         msg_conv.is_owned = ptr_is_owned(msg);
73147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73148         msg_conv = AcceptChannel_clone(&msg_conv);
73149         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73150         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
73151         int64_t ret_ref = tag_ptr(ret_copy, true);
73152         return ret_ref;
73153 }
73154
73155 int64_t  CS_LDK_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, int64_t msg) {
73156         LDKPublicKey node_id_ref;
73157         CHECK(node_id->arr_len == 33);
73158         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73159         LDKAcceptChannelV2 msg_conv;
73160         msg_conv.inner = untag_ptr(msg);
73161         msg_conv.is_owned = ptr_is_owned(msg);
73162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73163         msg_conv = AcceptChannelV2_clone(&msg_conv);
73164         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73165         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
73166         int64_t ret_ref = tag_ptr(ret_copy, true);
73167         return ret_ref;
73168 }
73169
73170 int64_t  CS_LDK_MessageSendEvent_send_open_channel(int8_tArray node_id, int64_t msg) {
73171         LDKPublicKey node_id_ref;
73172         CHECK(node_id->arr_len == 33);
73173         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73174         LDKOpenChannel msg_conv;
73175         msg_conv.inner = untag_ptr(msg);
73176         msg_conv.is_owned = ptr_is_owned(msg);
73177         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73178         msg_conv = OpenChannel_clone(&msg_conv);
73179         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73180         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
73181         int64_t ret_ref = tag_ptr(ret_copy, true);
73182         return ret_ref;
73183 }
73184
73185 int64_t  CS_LDK_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, int64_t msg) {
73186         LDKPublicKey node_id_ref;
73187         CHECK(node_id->arr_len == 33);
73188         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73189         LDKOpenChannelV2 msg_conv;
73190         msg_conv.inner = untag_ptr(msg);
73191         msg_conv.is_owned = ptr_is_owned(msg);
73192         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73193         msg_conv = OpenChannelV2_clone(&msg_conv);
73194         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73195         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
73196         int64_t ret_ref = tag_ptr(ret_copy, true);
73197         return ret_ref;
73198 }
73199
73200 int64_t  CS_LDK_MessageSendEvent_send_funding_created(int8_tArray node_id, int64_t msg) {
73201         LDKPublicKey node_id_ref;
73202         CHECK(node_id->arr_len == 33);
73203         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73204         LDKFundingCreated msg_conv;
73205         msg_conv.inner = untag_ptr(msg);
73206         msg_conv.is_owned = ptr_is_owned(msg);
73207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73208         msg_conv = FundingCreated_clone(&msg_conv);
73209         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73210         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
73211         int64_t ret_ref = tag_ptr(ret_copy, true);
73212         return ret_ref;
73213 }
73214
73215 int64_t  CS_LDK_MessageSendEvent_send_funding_signed(int8_tArray node_id, int64_t msg) {
73216         LDKPublicKey node_id_ref;
73217         CHECK(node_id->arr_len == 33);
73218         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73219         LDKFundingSigned msg_conv;
73220         msg_conv.inner = untag_ptr(msg);
73221         msg_conv.is_owned = ptr_is_owned(msg);
73222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73223         msg_conv = FundingSigned_clone(&msg_conv);
73224         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73225         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
73226         int64_t ret_ref = tag_ptr(ret_copy, true);
73227         return ret_ref;
73228 }
73229
73230 int64_t  CS_LDK_MessageSendEvent_send_stfu(int8_tArray node_id, int64_t msg) {
73231         LDKPublicKey node_id_ref;
73232         CHECK(node_id->arr_len == 33);
73233         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73234         LDKStfu msg_conv;
73235         msg_conv.inner = untag_ptr(msg);
73236         msg_conv.is_owned = ptr_is_owned(msg);
73237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73238         msg_conv = Stfu_clone(&msg_conv);
73239         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73240         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
73241         int64_t ret_ref = tag_ptr(ret_copy, true);
73242         return ret_ref;
73243 }
73244
73245 int64_t  CS_LDK_MessageSendEvent_send_splice(int8_tArray node_id, int64_t msg) {
73246         LDKPublicKey node_id_ref;
73247         CHECK(node_id->arr_len == 33);
73248         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73249         LDKSplice msg_conv;
73250         msg_conv.inner = untag_ptr(msg);
73251         msg_conv.is_owned = ptr_is_owned(msg);
73252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73253         msg_conv = Splice_clone(&msg_conv);
73254         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73255         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
73256         int64_t ret_ref = tag_ptr(ret_copy, true);
73257         return ret_ref;
73258 }
73259
73260 int64_t  CS_LDK_MessageSendEvent_send_splice_ack(int8_tArray node_id, int64_t msg) {
73261         LDKPublicKey node_id_ref;
73262         CHECK(node_id->arr_len == 33);
73263         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73264         LDKSpliceAck msg_conv;
73265         msg_conv.inner = untag_ptr(msg);
73266         msg_conv.is_owned = ptr_is_owned(msg);
73267         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73268         msg_conv = SpliceAck_clone(&msg_conv);
73269         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73270         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
73271         int64_t ret_ref = tag_ptr(ret_copy, true);
73272         return ret_ref;
73273 }
73274
73275 int64_t  CS_LDK_MessageSendEvent_send_splice_locked(int8_tArray node_id, int64_t msg) {
73276         LDKPublicKey node_id_ref;
73277         CHECK(node_id->arr_len == 33);
73278         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73279         LDKSpliceLocked msg_conv;
73280         msg_conv.inner = untag_ptr(msg);
73281         msg_conv.is_owned = ptr_is_owned(msg);
73282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73283         msg_conv = SpliceLocked_clone(&msg_conv);
73284         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73285         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
73286         int64_t ret_ref = tag_ptr(ret_copy, true);
73287         return ret_ref;
73288 }
73289
73290 int64_t  CS_LDK_MessageSendEvent_send_tx_add_input(int8_tArray node_id, int64_t msg) {
73291         LDKPublicKey node_id_ref;
73292         CHECK(node_id->arr_len == 33);
73293         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73294         LDKTxAddInput msg_conv;
73295         msg_conv.inner = untag_ptr(msg);
73296         msg_conv.is_owned = ptr_is_owned(msg);
73297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73298         msg_conv = TxAddInput_clone(&msg_conv);
73299         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73300         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
73301         int64_t ret_ref = tag_ptr(ret_copy, true);
73302         return ret_ref;
73303 }
73304
73305 int64_t  CS_LDK_MessageSendEvent_send_tx_add_output(int8_tArray node_id, int64_t msg) {
73306         LDKPublicKey node_id_ref;
73307         CHECK(node_id->arr_len == 33);
73308         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73309         LDKTxAddOutput msg_conv;
73310         msg_conv.inner = untag_ptr(msg);
73311         msg_conv.is_owned = ptr_is_owned(msg);
73312         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73313         msg_conv = TxAddOutput_clone(&msg_conv);
73314         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73315         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
73316         int64_t ret_ref = tag_ptr(ret_copy, true);
73317         return ret_ref;
73318 }
73319
73320 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, int64_t msg) {
73321         LDKPublicKey node_id_ref;
73322         CHECK(node_id->arr_len == 33);
73323         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73324         LDKTxRemoveInput msg_conv;
73325         msg_conv.inner = untag_ptr(msg);
73326         msg_conv.is_owned = ptr_is_owned(msg);
73327         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73328         msg_conv = TxRemoveInput_clone(&msg_conv);
73329         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73330         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
73331         int64_t ret_ref = tag_ptr(ret_copy, true);
73332         return ret_ref;
73333 }
73334
73335 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, int64_t msg) {
73336         LDKPublicKey node_id_ref;
73337         CHECK(node_id->arr_len == 33);
73338         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73339         LDKTxRemoveOutput msg_conv;
73340         msg_conv.inner = untag_ptr(msg);
73341         msg_conv.is_owned = ptr_is_owned(msg);
73342         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73343         msg_conv = TxRemoveOutput_clone(&msg_conv);
73344         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73345         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
73346         int64_t ret_ref = tag_ptr(ret_copy, true);
73347         return ret_ref;
73348 }
73349
73350 int64_t  CS_LDK_MessageSendEvent_send_tx_complete(int8_tArray node_id, int64_t msg) {
73351         LDKPublicKey node_id_ref;
73352         CHECK(node_id->arr_len == 33);
73353         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73354         LDKTxComplete msg_conv;
73355         msg_conv.inner = untag_ptr(msg);
73356         msg_conv.is_owned = ptr_is_owned(msg);
73357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73358         msg_conv = TxComplete_clone(&msg_conv);
73359         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73360         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
73361         int64_t ret_ref = tag_ptr(ret_copy, true);
73362         return ret_ref;
73363 }
73364
73365 int64_t  CS_LDK_MessageSendEvent_send_tx_signatures(int8_tArray node_id, int64_t msg) {
73366         LDKPublicKey node_id_ref;
73367         CHECK(node_id->arr_len == 33);
73368         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73369         LDKTxSignatures msg_conv;
73370         msg_conv.inner = untag_ptr(msg);
73371         msg_conv.is_owned = ptr_is_owned(msg);
73372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73373         msg_conv = TxSignatures_clone(&msg_conv);
73374         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73375         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
73376         int64_t ret_ref = tag_ptr(ret_copy, true);
73377         return ret_ref;
73378 }
73379
73380 int64_t  CS_LDK_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, int64_t msg) {
73381         LDKPublicKey node_id_ref;
73382         CHECK(node_id->arr_len == 33);
73383         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73384         LDKTxInitRbf msg_conv;
73385         msg_conv.inner = untag_ptr(msg);
73386         msg_conv.is_owned = ptr_is_owned(msg);
73387         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73388         msg_conv = TxInitRbf_clone(&msg_conv);
73389         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73390         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
73391         int64_t ret_ref = tag_ptr(ret_copy, true);
73392         return ret_ref;
73393 }
73394
73395 int64_t  CS_LDK_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, int64_t msg) {
73396         LDKPublicKey node_id_ref;
73397         CHECK(node_id->arr_len == 33);
73398         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73399         LDKTxAckRbf msg_conv;
73400         msg_conv.inner = untag_ptr(msg);
73401         msg_conv.is_owned = ptr_is_owned(msg);
73402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73403         msg_conv = TxAckRbf_clone(&msg_conv);
73404         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73405         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
73406         int64_t ret_ref = tag_ptr(ret_copy, true);
73407         return ret_ref;
73408 }
73409
73410 int64_t  CS_LDK_MessageSendEvent_send_tx_abort(int8_tArray node_id, int64_t msg) {
73411         LDKPublicKey node_id_ref;
73412         CHECK(node_id->arr_len == 33);
73413         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73414         LDKTxAbort msg_conv;
73415         msg_conv.inner = untag_ptr(msg);
73416         msg_conv.is_owned = ptr_is_owned(msg);
73417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73418         msg_conv = TxAbort_clone(&msg_conv);
73419         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73420         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
73421         int64_t ret_ref = tag_ptr(ret_copy, true);
73422         return ret_ref;
73423 }
73424
73425 int64_t  CS_LDK_MessageSendEvent_send_channel_ready(int8_tArray node_id, int64_t msg) {
73426         LDKPublicKey node_id_ref;
73427         CHECK(node_id->arr_len == 33);
73428         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73429         LDKChannelReady msg_conv;
73430         msg_conv.inner = untag_ptr(msg);
73431         msg_conv.is_owned = ptr_is_owned(msg);
73432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73433         msg_conv = ChannelReady_clone(&msg_conv);
73434         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73435         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
73436         int64_t ret_ref = tag_ptr(ret_copy, true);
73437         return ret_ref;
73438 }
73439
73440 int64_t  CS_LDK_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, int64_t msg) {
73441         LDKPublicKey node_id_ref;
73442         CHECK(node_id->arr_len == 33);
73443         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73444         LDKAnnouncementSignatures msg_conv;
73445         msg_conv.inner = untag_ptr(msg);
73446         msg_conv.is_owned = ptr_is_owned(msg);
73447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73448         msg_conv = AnnouncementSignatures_clone(&msg_conv);
73449         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73450         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
73451         int64_t ret_ref = tag_ptr(ret_copy, true);
73452         return ret_ref;
73453 }
73454
73455 int64_t  CS_LDK_MessageSendEvent_update_htlcs(int8_tArray node_id, int64_t updates) {
73456         LDKPublicKey node_id_ref;
73457         CHECK(node_id->arr_len == 33);
73458         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73459         LDKCommitmentUpdate updates_conv;
73460         updates_conv.inner = untag_ptr(updates);
73461         updates_conv.is_owned = ptr_is_owned(updates);
73462         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
73463         updates_conv = CommitmentUpdate_clone(&updates_conv);
73464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73465         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
73466         int64_t ret_ref = tag_ptr(ret_copy, true);
73467         return ret_ref;
73468 }
73469
73470 int64_t  CS_LDK_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, int64_t msg) {
73471         LDKPublicKey node_id_ref;
73472         CHECK(node_id->arr_len == 33);
73473         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73474         LDKRevokeAndACK msg_conv;
73475         msg_conv.inner = untag_ptr(msg);
73476         msg_conv.is_owned = ptr_is_owned(msg);
73477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73478         msg_conv = RevokeAndACK_clone(&msg_conv);
73479         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73480         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
73481         int64_t ret_ref = tag_ptr(ret_copy, true);
73482         return ret_ref;
73483 }
73484
73485 int64_t  CS_LDK_MessageSendEvent_send_closing_signed(int8_tArray node_id, int64_t msg) {
73486         LDKPublicKey node_id_ref;
73487         CHECK(node_id->arr_len == 33);
73488         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73489         LDKClosingSigned msg_conv;
73490         msg_conv.inner = untag_ptr(msg);
73491         msg_conv.is_owned = ptr_is_owned(msg);
73492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73493         msg_conv = ClosingSigned_clone(&msg_conv);
73494         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73495         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
73496         int64_t ret_ref = tag_ptr(ret_copy, true);
73497         return ret_ref;
73498 }
73499
73500 int64_t  CS_LDK_MessageSendEvent_send_shutdown(int8_tArray node_id, int64_t msg) {
73501         LDKPublicKey node_id_ref;
73502         CHECK(node_id->arr_len == 33);
73503         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73504         LDKShutdown msg_conv;
73505         msg_conv.inner = untag_ptr(msg);
73506         msg_conv.is_owned = ptr_is_owned(msg);
73507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73508         msg_conv = Shutdown_clone(&msg_conv);
73509         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73510         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
73511         int64_t ret_ref = tag_ptr(ret_copy, true);
73512         return ret_ref;
73513 }
73514
73515 int64_t  CS_LDK_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, int64_t msg) {
73516         LDKPublicKey node_id_ref;
73517         CHECK(node_id->arr_len == 33);
73518         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73519         LDKChannelReestablish msg_conv;
73520         msg_conv.inner = untag_ptr(msg);
73521         msg_conv.is_owned = ptr_is_owned(msg);
73522         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73523         msg_conv = ChannelReestablish_clone(&msg_conv);
73524         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73525         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
73526         int64_t ret_ref = tag_ptr(ret_copy, true);
73527         return ret_ref;
73528 }
73529
73530 int64_t  CS_LDK_MessageSendEvent_send_channel_announcement(int8_tArray node_id, int64_t msg, int64_t update_msg) {
73531         LDKPublicKey node_id_ref;
73532         CHECK(node_id->arr_len == 33);
73533         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73534         LDKChannelAnnouncement msg_conv;
73535         msg_conv.inner = untag_ptr(msg);
73536         msg_conv.is_owned = ptr_is_owned(msg);
73537         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73538         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73539         LDKChannelUpdate update_msg_conv;
73540         update_msg_conv.inner = untag_ptr(update_msg);
73541         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73542         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73543         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73544         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73545         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
73546         int64_t ret_ref = tag_ptr(ret_copy, true);
73547         return ret_ref;
73548 }
73549
73550 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_announcement(int64_t msg, int64_t update_msg) {
73551         LDKChannelAnnouncement msg_conv;
73552         msg_conv.inner = untag_ptr(msg);
73553         msg_conv.is_owned = ptr_is_owned(msg);
73554         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73555         msg_conv = ChannelAnnouncement_clone(&msg_conv);
73556         LDKChannelUpdate update_msg_conv;
73557         update_msg_conv.inner = untag_ptr(update_msg);
73558         update_msg_conv.is_owned = ptr_is_owned(update_msg);
73559         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
73560         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
73561         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73562         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
73563         int64_t ret_ref = tag_ptr(ret_copy, true);
73564         return ret_ref;
73565 }
73566
73567 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_update(int64_t msg) {
73568         LDKChannelUpdate msg_conv;
73569         msg_conv.inner = untag_ptr(msg);
73570         msg_conv.is_owned = ptr_is_owned(msg);
73571         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73572         msg_conv = ChannelUpdate_clone(&msg_conv);
73573         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73574         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
73575         int64_t ret_ref = tag_ptr(ret_copy, true);
73576         return ret_ref;
73577 }
73578
73579 int64_t  CS_LDK_MessageSendEvent_broadcast_node_announcement(int64_t msg) {
73580         LDKNodeAnnouncement msg_conv;
73581         msg_conv.inner = untag_ptr(msg);
73582         msg_conv.is_owned = ptr_is_owned(msg);
73583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73584         msg_conv = NodeAnnouncement_clone(&msg_conv);
73585         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73586         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
73587         int64_t ret_ref = tag_ptr(ret_copy, true);
73588         return ret_ref;
73589 }
73590
73591 int64_t  CS_LDK_MessageSendEvent_send_channel_update(int8_tArray node_id, int64_t msg) {
73592         LDKPublicKey node_id_ref;
73593         CHECK(node_id->arr_len == 33);
73594         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73595         LDKChannelUpdate msg_conv;
73596         msg_conv.inner = untag_ptr(msg);
73597         msg_conv.is_owned = ptr_is_owned(msg);
73598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73599         msg_conv = ChannelUpdate_clone(&msg_conv);
73600         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73601         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
73602         int64_t ret_ref = tag_ptr(ret_copy, true);
73603         return ret_ref;
73604 }
73605
73606 int64_t  CS_LDK_MessageSendEvent_handle_error(int8_tArray node_id, int64_t action) {
73607         LDKPublicKey node_id_ref;
73608         CHECK(node_id->arr_len == 33);
73609         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73610         void* action_ptr = untag_ptr(action);
73611         CHECK_ACCESS(action_ptr);
73612         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
73613         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
73614         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73615         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
73616         int64_t ret_ref = tag_ptr(ret_copy, true);
73617         return ret_ref;
73618 }
73619
73620 int64_t  CS_LDK_MessageSendEvent_send_channel_range_query(int8_tArray node_id, int64_t msg) {
73621         LDKPublicKey node_id_ref;
73622         CHECK(node_id->arr_len == 33);
73623         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73624         LDKQueryChannelRange msg_conv;
73625         msg_conv.inner = untag_ptr(msg);
73626         msg_conv.is_owned = ptr_is_owned(msg);
73627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73628         msg_conv = QueryChannelRange_clone(&msg_conv);
73629         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73630         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
73631         int64_t ret_ref = tag_ptr(ret_copy, true);
73632         return ret_ref;
73633 }
73634
73635 int64_t  CS_LDK_MessageSendEvent_send_short_ids_query(int8_tArray node_id, int64_t msg) {
73636         LDKPublicKey node_id_ref;
73637         CHECK(node_id->arr_len == 33);
73638         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73639         LDKQueryShortChannelIds msg_conv;
73640         msg_conv.inner = untag_ptr(msg);
73641         msg_conv.is_owned = ptr_is_owned(msg);
73642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73643         msg_conv = QueryShortChannelIds_clone(&msg_conv);
73644         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73645         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
73646         int64_t ret_ref = tag_ptr(ret_copy, true);
73647         return ret_ref;
73648 }
73649
73650 int64_t  CS_LDK_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, int64_t msg) {
73651         LDKPublicKey node_id_ref;
73652         CHECK(node_id->arr_len == 33);
73653         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73654         LDKReplyChannelRange msg_conv;
73655         msg_conv.inner = untag_ptr(msg);
73656         msg_conv.is_owned = ptr_is_owned(msg);
73657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73658         msg_conv = ReplyChannelRange_clone(&msg_conv);
73659         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73660         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
73661         int64_t ret_ref = tag_ptr(ret_copy, true);
73662         return ret_ref;
73663 }
73664
73665 int64_t  CS_LDK_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, int64_t msg) {
73666         LDKPublicKey node_id_ref;
73667         CHECK(node_id->arr_len == 33);
73668         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73669         LDKGossipTimestampFilter msg_conv;
73670         msg_conv.inner = untag_ptr(msg);
73671         msg_conv.is_owned = ptr_is_owned(msg);
73672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73673         msg_conv = GossipTimestampFilter_clone(&msg_conv);
73674         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
73675         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
73676         int64_t ret_ref = tag_ptr(ret_copy, true);
73677         return ret_ref;
73678 }
73679
73680 void  CS_LDK_MessageSendEventsProvider_free(int64_t this_ptr) {
73681         if (!ptr_is_owned(this_ptr)) return;
73682         void* this_ptr_ptr = untag_ptr(this_ptr);
73683         CHECK_ACCESS(this_ptr_ptr);
73684         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
73685         FREE(untag_ptr(this_ptr));
73686         MessageSendEventsProvider_free(this_ptr_conv);
73687 }
73688
73689 void  CS_LDK_EventsProvider_free(int64_t this_ptr) {
73690         if (!ptr_is_owned(this_ptr)) return;
73691         void* this_ptr_ptr = untag_ptr(this_ptr);
73692         CHECK_ACCESS(this_ptr_ptr);
73693         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
73694         FREE(untag_ptr(this_ptr));
73695         EventsProvider_free(this_ptr_conv);
73696 }
73697
73698 void  CS_LDK_EventHandler_free(int64_t this_ptr) {
73699         if (!ptr_is_owned(this_ptr)) return;
73700         void* this_ptr_ptr = untag_ptr(this_ptr);
73701         CHECK_ACCESS(this_ptr_ptr);
73702         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
73703         FREE(untag_ptr(this_ptr));
73704         EventHandler_free(this_ptr_conv);
73705 }
73706
73707 void  CS_LDK_AnchorDescriptor_free(int64_t this_obj) {
73708         LDKAnchorDescriptor this_obj_conv;
73709         this_obj_conv.inner = untag_ptr(this_obj);
73710         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73712         AnchorDescriptor_free(this_obj_conv);
73713 }
73714
73715 int64_t  CS_LDK_AnchorDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
73716         LDKAnchorDescriptor this_ptr_conv;
73717         this_ptr_conv.inner = untag_ptr(this_ptr);
73718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73720         this_ptr_conv.is_owned = false;
73721         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73722         int64_t ret_ref = 0;
73723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73725         return ret_ref;
73726 }
73727
73728 void  CS_LDK_AnchorDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
73729         LDKAnchorDescriptor this_ptr_conv;
73730         this_ptr_conv.inner = untag_ptr(this_ptr);
73731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73733         this_ptr_conv.is_owned = false;
73734         LDKChannelDerivationParameters val_conv;
73735         val_conv.inner = untag_ptr(val);
73736         val_conv.is_owned = ptr_is_owned(val);
73737         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73738         val_conv = ChannelDerivationParameters_clone(&val_conv);
73739         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73740 }
73741
73742 int64_t  CS_LDK_AnchorDescriptor_get_outpoint(int64_t this_ptr) {
73743         LDKAnchorDescriptor this_ptr_conv;
73744         this_ptr_conv.inner = untag_ptr(this_ptr);
73745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73747         this_ptr_conv.is_owned = false;
73748         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
73749         int64_t ret_ref = 0;
73750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73752         return ret_ref;
73753 }
73754
73755 void  CS_LDK_AnchorDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
73756         LDKAnchorDescriptor this_ptr_conv;
73757         this_ptr_conv.inner = untag_ptr(this_ptr);
73758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73760         this_ptr_conv.is_owned = false;
73761         LDKOutPoint val_conv;
73762         val_conv.inner = untag_ptr(val);
73763         val_conv.is_owned = ptr_is_owned(val);
73764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73765         val_conv = OutPoint_clone(&val_conv);
73766         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73767 }
73768
73769 int64_t  CS_LDK_AnchorDescriptor_new(int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
73770         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
73771         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
73772         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
73773         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
73774         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
73775         LDKOutPoint outpoint_arg_conv;
73776         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73777         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73778         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73779         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73780         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
73781         int64_t ret_ref = 0;
73782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73784         return ret_ref;
73785 }
73786
73787 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
73788         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
73789         int64_t ret_ref = 0;
73790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73792         return ret_ref;
73793 }
73794 int64_t  CS_LDK_AnchorDescriptor_clone_ptr(int64_t arg) {
73795         LDKAnchorDescriptor arg_conv;
73796         arg_conv.inner = untag_ptr(arg);
73797         arg_conv.is_owned = ptr_is_owned(arg);
73798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73799         arg_conv.is_owned = false;
73800         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
73801         return ret_conv;
73802 }
73803
73804 int64_t  CS_LDK_AnchorDescriptor_clone(int64_t orig) {
73805         LDKAnchorDescriptor orig_conv;
73806         orig_conv.inner = untag_ptr(orig);
73807         orig_conv.is_owned = ptr_is_owned(orig);
73808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73809         orig_conv.is_owned = false;
73810         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
73811         int64_t ret_ref = 0;
73812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73814         return ret_ref;
73815 }
73816
73817 jboolean  CS_LDK_AnchorDescriptor_eq(int64_t a, int64_t b) {
73818         LDKAnchorDescriptor a_conv;
73819         a_conv.inner = untag_ptr(a);
73820         a_conv.is_owned = ptr_is_owned(a);
73821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73822         a_conv.is_owned = false;
73823         LDKAnchorDescriptor b_conv;
73824         b_conv.inner = untag_ptr(b);
73825         b_conv.is_owned = ptr_is_owned(b);
73826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73827         b_conv.is_owned = false;
73828         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
73829         return ret_conv;
73830 }
73831
73832 int64_t  CS_LDK_AnchorDescriptor_previous_utxo(int64_t this_arg) {
73833         LDKAnchorDescriptor this_arg_conv;
73834         this_arg_conv.inner = untag_ptr(this_arg);
73835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73837         this_arg_conv.is_owned = false;
73838         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73839         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
73840         return tag_ptr(ret_ref, true);
73841 }
73842
73843 int64_t  CS_LDK_AnchorDescriptor_unsigned_tx_input(int64_t this_arg) {
73844         LDKAnchorDescriptor this_arg_conv;
73845         this_arg_conv.inner = untag_ptr(this_arg);
73846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73848         this_arg_conv.is_owned = false;
73849         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
73850         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
73851         return tag_ptr(ret_ref, true);
73852 }
73853
73854 int8_tArray  CS_LDK_AnchorDescriptor_witness_script(int64_t this_arg) {
73855         LDKAnchorDescriptor this_arg_conv;
73856         this_arg_conv.inner = untag_ptr(this_arg);
73857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73859         this_arg_conv.is_owned = false;
73860         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
73861         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73862         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73863         CVec_u8Z_free(ret_var);
73864         return ret_arr;
73865 }
73866
73867 int8_tArray  CS_LDK_AnchorDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature) {
73868         LDKAnchorDescriptor this_arg_conv;
73869         this_arg_conv.inner = untag_ptr(this_arg);
73870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73872         this_arg_conv.is_owned = false;
73873         LDKECDSASignature signature_ref;
73874         CHECK(signature->arr_len == 64);
73875         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
73876         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
73877         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73878         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73879         Witness_free(ret_var);
73880         return ret_arr;
73881 }
73882
73883 int64_t  CS_LDK_AnchorDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
73884         LDKAnchorDescriptor this_arg_conv;
73885         this_arg_conv.inner = untag_ptr(this_arg);
73886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73888         this_arg_conv.is_owned = false;
73889         void* signer_provider_ptr = untag_ptr(signer_provider);
73890         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
73891         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
73892         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
73893         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
73894         return tag_ptr(ret_ret, true);
73895 }
73896
73897 void  CS_LDK_BumpTransactionEvent_free(int64_t this_ptr) {
73898         if (!ptr_is_owned(this_ptr)) return;
73899         void* this_ptr_ptr = untag_ptr(this_ptr);
73900         CHECK_ACCESS(this_ptr_ptr);
73901         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
73902         FREE(untag_ptr(this_ptr));
73903         BumpTransactionEvent_free(this_ptr_conv);
73904 }
73905
73906 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
73907         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73908         *ret_copy = BumpTransactionEvent_clone(arg);
73909         int64_t ret_ref = tag_ptr(ret_copy, true);
73910         return ret_ref;
73911 }
73912 int64_t  CS_LDK_BumpTransactionEvent_clone_ptr(int64_t arg) {
73913         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
73914         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
73915         return ret_conv;
73916 }
73917
73918 int64_t  CS_LDK_BumpTransactionEvent_clone(int64_t orig) {
73919         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
73920         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73921         *ret_copy = BumpTransactionEvent_clone(orig_conv);
73922         int64_t ret_ref = tag_ptr(ret_copy, true);
73923         return ret_ref;
73924 }
73925
73926 int64_t  CS_LDK_BumpTransactionEvent_channel_close(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) {
73927         LDKThirtyTwoBytes claim_id_ref;
73928         CHECK(claim_id->arr_len == 32);
73929         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73930         LDKTransaction commitment_tx_ref;
73931         commitment_tx_ref.datalen = commitment_tx->arr_len;
73932         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
73933         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
73934         commitment_tx_ref.data_is_owned = true;
73935         LDKAnchorDescriptor anchor_descriptor_conv;
73936         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
73937         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
73938         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
73939         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
73940         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
73941         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
73942         if (pending_htlcs_constr.datalen > 0)
73943                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
73944         else
73945                 pending_htlcs_constr.data = NULL;
73946         int64_t* pending_htlcs_vals = pending_htlcs->elems;
73947         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
73948                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
73949                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
73950                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
73951                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
73952                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
73953                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
73954                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
73955         }
73956         FREE(pending_htlcs);
73957         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73958         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
73959         int64_t ret_ref = tag_ptr(ret_copy, true);
73960         return ret_ref;
73961 }
73962
73963 int64_t  CS_LDK_BumpTransactionEvent_htlcresolution(int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
73964         LDKThirtyTwoBytes claim_id_ref;
73965         CHECK(claim_id->arr_len == 32);
73966         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
73967         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
73968         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
73969         if (htlc_descriptors_constr.datalen > 0)
73970                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
73971         else
73972                 htlc_descriptors_constr.data = NULL;
73973         int64_t* htlc_descriptors_vals = htlc_descriptors->elems;
73974         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
73975                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
73976                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
73977                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
73978                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
73979                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
73980                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
73981                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
73982         }
73983         FREE(htlc_descriptors);
73984         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
73985         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
73986         int64_t ret_ref = tag_ptr(ret_copy, true);
73987         return ret_ref;
73988 }
73989
73990 jboolean  CS_LDK_BumpTransactionEvent_eq(int64_t a, int64_t b) {
73991         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
73992         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
73993         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
73994         return ret_conv;
73995 }
73996
73997 void  CS_LDK_Input_free(int64_t this_obj) {
73998         LDKInput this_obj_conv;
73999         this_obj_conv.inner = untag_ptr(this_obj);
74000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74002         Input_free(this_obj_conv);
74003 }
74004
74005 int64_t  CS_LDK_Input_get_outpoint(int64_t this_ptr) {
74006         LDKInput this_ptr_conv;
74007         this_ptr_conv.inner = untag_ptr(this_ptr);
74008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74010         this_ptr_conv.is_owned = false;
74011         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
74012         int64_t ret_ref = 0;
74013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74015         return ret_ref;
74016 }
74017
74018 void  CS_LDK_Input_set_outpoint(int64_t this_ptr, int64_t val) {
74019         LDKInput this_ptr_conv;
74020         this_ptr_conv.inner = untag_ptr(this_ptr);
74021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74023         this_ptr_conv.is_owned = false;
74024         LDKOutPoint val_conv;
74025         val_conv.inner = untag_ptr(val);
74026         val_conv.is_owned = ptr_is_owned(val);
74027         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74028         val_conv = OutPoint_clone(&val_conv);
74029         Input_set_outpoint(&this_ptr_conv, val_conv);
74030 }
74031
74032 int64_t  CS_LDK_Input_get_previous_utxo(int64_t this_ptr) {
74033         LDKInput this_ptr_conv;
74034         this_ptr_conv.inner = untag_ptr(this_ptr);
74035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74037         this_ptr_conv.is_owned = false;
74038         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74039         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
74040         return tag_ptr(ret_ref, true);
74041 }
74042
74043 void  CS_LDK_Input_set_previous_utxo(int64_t this_ptr, int64_t val) {
74044         LDKInput this_ptr_conv;
74045         this_ptr_conv.inner = untag_ptr(this_ptr);
74046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74048         this_ptr_conv.is_owned = false;
74049         void* val_ptr = untag_ptr(val);
74050         CHECK_ACCESS(val_ptr);
74051         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74052         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74053         Input_set_previous_utxo(&this_ptr_conv, val_conv);
74054 }
74055
74056 int64_t  CS_LDK_Input_get_satisfaction_weight(int64_t this_ptr) {
74057         LDKInput this_ptr_conv;
74058         this_ptr_conv.inner = untag_ptr(this_ptr);
74059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74061         this_ptr_conv.is_owned = false;
74062         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
74063         return ret_conv;
74064 }
74065
74066 void  CS_LDK_Input_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
74067         LDKInput this_ptr_conv;
74068         this_ptr_conv.inner = untag_ptr(this_ptr);
74069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74071         this_ptr_conv.is_owned = false;
74072         Input_set_satisfaction_weight(&this_ptr_conv, val);
74073 }
74074
74075 int64_t  CS_LDK_Input_new(int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
74076         LDKOutPoint outpoint_arg_conv;
74077         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74078         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74079         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74080         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74081         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
74082         CHECK_ACCESS(previous_utxo_arg_ptr);
74083         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
74084         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
74085         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
74086         int64_t ret_ref = 0;
74087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74089         return ret_ref;
74090 }
74091
74092 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
74093         LDKInput ret_var = Input_clone(arg);
74094         int64_t ret_ref = 0;
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74097         return ret_ref;
74098 }
74099 int64_t  CS_LDK_Input_clone_ptr(int64_t arg) {
74100         LDKInput arg_conv;
74101         arg_conv.inner = untag_ptr(arg);
74102         arg_conv.is_owned = ptr_is_owned(arg);
74103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74104         arg_conv.is_owned = false;
74105         int64_t ret_conv = Input_clone_ptr(&arg_conv);
74106         return ret_conv;
74107 }
74108
74109 int64_t  CS_LDK_Input_clone(int64_t orig) {
74110         LDKInput orig_conv;
74111         orig_conv.inner = untag_ptr(orig);
74112         orig_conv.is_owned = ptr_is_owned(orig);
74113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74114         orig_conv.is_owned = false;
74115         LDKInput ret_var = Input_clone(&orig_conv);
74116         int64_t ret_ref = 0;
74117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74119         return ret_ref;
74120 }
74121
74122 int64_t  CS_LDK_Input_hash(int64_t o) {
74123         LDKInput o_conv;
74124         o_conv.inner = untag_ptr(o);
74125         o_conv.is_owned = ptr_is_owned(o);
74126         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74127         o_conv.is_owned = false;
74128         int64_t ret_conv = Input_hash(&o_conv);
74129         return ret_conv;
74130 }
74131
74132 jboolean  CS_LDK_Input_eq(int64_t a, int64_t b) {
74133         LDKInput a_conv;
74134         a_conv.inner = untag_ptr(a);
74135         a_conv.is_owned = ptr_is_owned(a);
74136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74137         a_conv.is_owned = false;
74138         LDKInput b_conv;
74139         b_conv.inner = untag_ptr(b);
74140         b_conv.is_owned = ptr_is_owned(b);
74141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74142         b_conv.is_owned = false;
74143         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
74144         return ret_conv;
74145 }
74146
74147 void  CS_LDK_Utxo_free(int64_t this_obj) {
74148         LDKUtxo this_obj_conv;
74149         this_obj_conv.inner = untag_ptr(this_obj);
74150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74152         Utxo_free(this_obj_conv);
74153 }
74154
74155 int64_t  CS_LDK_Utxo_get_outpoint(int64_t this_ptr) {
74156         LDKUtxo this_ptr_conv;
74157         this_ptr_conv.inner = untag_ptr(this_ptr);
74158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74160         this_ptr_conv.is_owned = false;
74161         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
74162         int64_t ret_ref = 0;
74163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74165         return ret_ref;
74166 }
74167
74168 void  CS_LDK_Utxo_set_outpoint(int64_t this_ptr, int64_t val) {
74169         LDKUtxo this_ptr_conv;
74170         this_ptr_conv.inner = untag_ptr(this_ptr);
74171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74173         this_ptr_conv.is_owned = false;
74174         LDKOutPoint val_conv;
74175         val_conv.inner = untag_ptr(val);
74176         val_conv.is_owned = ptr_is_owned(val);
74177         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74178         val_conv = OutPoint_clone(&val_conv);
74179         Utxo_set_outpoint(&this_ptr_conv, val_conv);
74180 }
74181
74182 int64_t  CS_LDK_Utxo_get_output(int64_t this_ptr) {
74183         LDKUtxo this_ptr_conv;
74184         this_ptr_conv.inner = untag_ptr(this_ptr);
74185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74187         this_ptr_conv.is_owned = false;
74188         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74189         *ret_ref = Utxo_get_output(&this_ptr_conv);
74190         return tag_ptr(ret_ref, true);
74191 }
74192
74193 void  CS_LDK_Utxo_set_output(int64_t this_ptr, int64_t val) {
74194         LDKUtxo this_ptr_conv;
74195         this_ptr_conv.inner = untag_ptr(this_ptr);
74196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74198         this_ptr_conv.is_owned = false;
74199         void* val_ptr = untag_ptr(val);
74200         CHECK_ACCESS(val_ptr);
74201         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
74202         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
74203         Utxo_set_output(&this_ptr_conv, val_conv);
74204 }
74205
74206 int64_t  CS_LDK_Utxo_get_satisfaction_weight(int64_t this_ptr) {
74207         LDKUtxo 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 = Utxo_get_satisfaction_weight(&this_ptr_conv);
74213         return ret_conv;
74214 }
74215
74216 void  CS_LDK_Utxo_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
74217         LDKUtxo 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         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
74223 }
74224
74225 int64_t  CS_LDK_Utxo_new(int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
74226         LDKOutPoint outpoint_arg_conv;
74227         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
74228         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
74229         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
74230         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
74231         void* output_arg_ptr = untag_ptr(output_arg);
74232         CHECK_ACCESS(output_arg_ptr);
74233         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
74234         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
74235         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
74236         int64_t ret_ref = 0;
74237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74239         return ret_ref;
74240 }
74241
74242 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
74243         LDKUtxo ret_var = Utxo_clone(arg);
74244         int64_t ret_ref = 0;
74245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74247         return ret_ref;
74248 }
74249 int64_t  CS_LDK_Utxo_clone_ptr(int64_t arg) {
74250         LDKUtxo arg_conv;
74251         arg_conv.inner = untag_ptr(arg);
74252         arg_conv.is_owned = ptr_is_owned(arg);
74253         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74254         arg_conv.is_owned = false;
74255         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
74256         return ret_conv;
74257 }
74258
74259 int64_t  CS_LDK_Utxo_clone(int64_t orig) {
74260         LDKUtxo orig_conv;
74261         orig_conv.inner = untag_ptr(orig);
74262         orig_conv.is_owned = ptr_is_owned(orig);
74263         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74264         orig_conv.is_owned = false;
74265         LDKUtxo ret_var = Utxo_clone(&orig_conv);
74266         int64_t ret_ref = 0;
74267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74269         return ret_ref;
74270 }
74271
74272 int64_t  CS_LDK_Utxo_hash(int64_t o) {
74273         LDKUtxo o_conv;
74274         o_conv.inner = untag_ptr(o);
74275         o_conv.is_owned = ptr_is_owned(o);
74276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74277         o_conv.is_owned = false;
74278         int64_t ret_conv = Utxo_hash(&o_conv);
74279         return ret_conv;
74280 }
74281
74282 jboolean  CS_LDK_Utxo_eq(int64_t a, int64_t b) {
74283         LDKUtxo a_conv;
74284         a_conv.inner = untag_ptr(a);
74285         a_conv.is_owned = ptr_is_owned(a);
74286         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74287         a_conv.is_owned = false;
74288         LDKUtxo b_conv;
74289         b_conv.inner = untag_ptr(b);
74290         b_conv.is_owned = ptr_is_owned(b);
74291         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74292         b_conv.is_owned = false;
74293         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
74294         return ret_conv;
74295 }
74296
74297 int64_t  CS_LDK_Utxo_new_p2pkh(int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
74298         LDKOutPoint outpoint_conv;
74299         outpoint_conv.inner = untag_ptr(outpoint);
74300         outpoint_conv.is_owned = ptr_is_owned(outpoint);
74301         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
74302         outpoint_conv = OutPoint_clone(&outpoint_conv);
74303         uint8_t pubkey_hash_arr[20];
74304         CHECK(pubkey_hash->arr_len == 20);
74305         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
74306         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
74307         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
74308         int64_t ret_ref = 0;
74309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74311         return ret_ref;
74312 }
74313
74314 void  CS_LDK_CoinSelection_free(int64_t this_obj) {
74315         LDKCoinSelection this_obj_conv;
74316         this_obj_conv.inner = untag_ptr(this_obj);
74317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74319         CoinSelection_free(this_obj_conv);
74320 }
74321
74322 int64_tArray  CS_LDK_CoinSelection_get_confirmed_utxos(int64_t this_ptr) {
74323         LDKCoinSelection this_ptr_conv;
74324         this_ptr_conv.inner = untag_ptr(this_ptr);
74325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74327         this_ptr_conv.is_owned = false;
74328         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
74329         int64_tArray ret_arr = NULL;
74330         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
74331         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
74332         for (size_t g = 0; g < ret_var.datalen; g++) {
74333                 LDKUtxo ret_conv_6_var = ret_var.data[g];
74334                 int64_t ret_conv_6_ref = 0;
74335                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
74336                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
74337                 ret_arr_ptr[g] = ret_conv_6_ref;
74338         }
74339         
74340         FREE(ret_var.data);
74341         return ret_arr;
74342 }
74343
74344 void  CS_LDK_CoinSelection_set_confirmed_utxos(int64_t this_ptr, int64_tArray val) {
74345         LDKCoinSelection this_ptr_conv;
74346         this_ptr_conv.inner = untag_ptr(this_ptr);
74347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74349         this_ptr_conv.is_owned = false;
74350         LDKCVec_UtxoZ val_constr;
74351         val_constr.datalen = val->arr_len;
74352         if (val_constr.datalen > 0)
74353                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
74354         else
74355                 val_constr.data = NULL;
74356         int64_t* val_vals = val->elems;
74357         for (size_t g = 0; g < val_constr.datalen; g++) {
74358                 int64_t val_conv_6 = val_vals[g];
74359                 LDKUtxo val_conv_6_conv;
74360                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
74361                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
74362                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
74363                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
74364                 val_constr.data[g] = val_conv_6_conv;
74365         }
74366         FREE(val);
74367         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
74368 }
74369
74370 int64_t  CS_LDK_CoinSelection_get_change_output(int64_t this_ptr) {
74371         LDKCoinSelection this_ptr_conv;
74372         this_ptr_conv.inner = untag_ptr(this_ptr);
74373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74375         this_ptr_conv.is_owned = false;
74376         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
74377         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
74378         int64_t ret_ref = tag_ptr(ret_copy, true);
74379         return ret_ref;
74380 }
74381
74382 void  CS_LDK_CoinSelection_set_change_output(int64_t this_ptr, int64_t val) {
74383         LDKCoinSelection this_ptr_conv;
74384         this_ptr_conv.inner = untag_ptr(this_ptr);
74385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74387         this_ptr_conv.is_owned = false;
74388         void* val_ptr = untag_ptr(val);
74389         CHECK_ACCESS(val_ptr);
74390         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
74391         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
74392         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
74393 }
74394
74395 int64_t  CS_LDK_CoinSelection_new(int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
74396         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
74397         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
74398         if (confirmed_utxos_arg_constr.datalen > 0)
74399                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
74400         else
74401                 confirmed_utxos_arg_constr.data = NULL;
74402         int64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
74403         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
74404                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
74405                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
74406                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
74407                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
74408                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
74409                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
74410                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
74411         }
74412         FREE(confirmed_utxos_arg);
74413         void* change_output_arg_ptr = untag_ptr(change_output_arg);
74414         CHECK_ACCESS(change_output_arg_ptr);
74415         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
74416         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
74417         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
74418         int64_t ret_ref = 0;
74419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74421         return ret_ref;
74422 }
74423
74424 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
74425         LDKCoinSelection ret_var = CoinSelection_clone(arg);
74426         int64_t ret_ref = 0;
74427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74429         return ret_ref;
74430 }
74431 int64_t  CS_LDK_CoinSelection_clone_ptr(int64_t arg) {
74432         LDKCoinSelection arg_conv;
74433         arg_conv.inner = untag_ptr(arg);
74434         arg_conv.is_owned = ptr_is_owned(arg);
74435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74436         arg_conv.is_owned = false;
74437         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
74438         return ret_conv;
74439 }
74440
74441 int64_t  CS_LDK_CoinSelection_clone(int64_t orig) {
74442         LDKCoinSelection orig_conv;
74443         orig_conv.inner = untag_ptr(orig);
74444         orig_conv.is_owned = ptr_is_owned(orig);
74445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74446         orig_conv.is_owned = false;
74447         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
74448         int64_t ret_ref = 0;
74449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74451         return ret_ref;
74452 }
74453
74454 void  CS_LDK_CoinSelectionSource_free(int64_t this_ptr) {
74455         if (!ptr_is_owned(this_ptr)) return;
74456         void* this_ptr_ptr = untag_ptr(this_ptr);
74457         CHECK_ACCESS(this_ptr_ptr);
74458         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
74459         FREE(untag_ptr(this_ptr));
74460         CoinSelectionSource_free(this_ptr_conv);
74461 }
74462
74463 void  CS_LDK_WalletSource_free(int64_t this_ptr) {
74464         if (!ptr_is_owned(this_ptr)) return;
74465         void* this_ptr_ptr = untag_ptr(this_ptr);
74466         CHECK_ACCESS(this_ptr_ptr);
74467         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
74468         FREE(untag_ptr(this_ptr));
74469         WalletSource_free(this_ptr_conv);
74470 }
74471
74472 void  CS_LDK_Wallet_free(int64_t this_obj) {
74473         LDKWallet this_obj_conv;
74474         this_obj_conv.inner = untag_ptr(this_obj);
74475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74477         Wallet_free(this_obj_conv);
74478 }
74479
74480 int64_t  CS_LDK_Wallet_new(int64_t source, int64_t logger) {
74481         void* source_ptr = untag_ptr(source);
74482         CHECK_ACCESS(source_ptr);
74483         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
74484         if (source_conv.free == LDKWalletSource_JCalls_free) {
74485                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74486                 LDKWalletSource_JCalls_cloned(&source_conv);
74487         }
74488         void* logger_ptr = untag_ptr(logger);
74489         CHECK_ACCESS(logger_ptr);
74490         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74491         if (logger_conv.free == LDKLogger_JCalls_free) {
74492                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74493                 LDKLogger_JCalls_cloned(&logger_conv);
74494         }
74495         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
74496         int64_t ret_ref = 0;
74497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74499         return ret_ref;
74500 }
74501
74502 int64_t  CS_LDK_Wallet_as_CoinSelectionSource(int64_t this_arg) {
74503         LDKWallet this_arg_conv;
74504         this_arg_conv.inner = untag_ptr(this_arg);
74505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74507         this_arg_conv.is_owned = false;
74508         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
74509         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
74510         return tag_ptr(ret_ret, true);
74511 }
74512
74513 void  CS_LDK_BumpTransactionEventHandler_free(int64_t this_obj) {
74514         LDKBumpTransactionEventHandler this_obj_conv;
74515         this_obj_conv.inner = untag_ptr(this_obj);
74516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74518         BumpTransactionEventHandler_free(this_obj_conv);
74519 }
74520
74521 int64_t  CS_LDK_BumpTransactionEventHandler_new(int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
74522         void* broadcaster_ptr = untag_ptr(broadcaster);
74523         CHECK_ACCESS(broadcaster_ptr);
74524         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
74525         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
74526                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74527                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
74528         }
74529         void* utxo_source_ptr = untag_ptr(utxo_source);
74530         CHECK_ACCESS(utxo_source_ptr);
74531         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
74532         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
74533                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74534                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
74535         }
74536         void* signer_provider_ptr = untag_ptr(signer_provider);
74537         CHECK_ACCESS(signer_provider_ptr);
74538         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
74539         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
74540                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74541                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
74542         }
74543         void* logger_ptr = untag_ptr(logger);
74544         CHECK_ACCESS(logger_ptr);
74545         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74546         if (logger_conv.free == LDKLogger_JCalls_free) {
74547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74548                 LDKLogger_JCalls_cloned(&logger_conv);
74549         }
74550         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
74551         int64_t ret_ref = 0;
74552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74554         return ret_ref;
74555 }
74556
74557 void  CS_LDK_BumpTransactionEventHandler_handle_event(int64_t this_arg, int64_t event) {
74558         LDKBumpTransactionEventHandler this_arg_conv;
74559         this_arg_conv.inner = untag_ptr(this_arg);
74560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74562         this_arg_conv.is_owned = false;
74563         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
74564         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
74565 }
74566
74567 void  CS_LDK_FilesystemStore_free(int64_t this_obj) {
74568         LDKFilesystemStore this_obj_conv;
74569         this_obj_conv.inner = untag_ptr(this_obj);
74570         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74572         FilesystemStore_free(this_obj_conv);
74573 }
74574
74575 int64_t  CS_LDK_FilesystemStore_new(jstring data_dir) {
74576         LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
74577         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
74578         int64_t ret_ref = 0;
74579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74581         return ret_ref;
74582 }
74583
74584 jstring  CS_LDK_FilesystemStore_get_data_dir(int64_t this_arg) {
74585         LDKFilesystemStore this_arg_conv;
74586         this_arg_conv.inner = untag_ptr(this_arg);
74587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74589         this_arg_conv.is_owned = false;
74590         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
74591         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
74592         Str_free(ret_str);
74593         return ret_conv;
74594 }
74595
74596 int64_t  CS_LDK_FilesystemStore_as_KVStore(int64_t this_arg) {
74597         LDKFilesystemStore this_arg_conv;
74598         this_arg_conv.inner = untag_ptr(this_arg);
74599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74601         this_arg_conv.is_owned = false;
74602         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
74603         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
74604         return tag_ptr(ret_ret, true);
74605 }
74606
74607 void  CS_LDK_BackgroundProcessor_free(int64_t this_obj) {
74608         LDKBackgroundProcessor this_obj_conv;
74609         this_obj_conv.inner = untag_ptr(this_obj);
74610         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74612         BackgroundProcessor_free(this_obj_conv);
74613 }
74614
74615 void  CS_LDK_GossipSync_free(int64_t this_ptr) {
74616         if (!ptr_is_owned(this_ptr)) return;
74617         void* this_ptr_ptr = untag_ptr(this_ptr);
74618         CHECK_ACCESS(this_ptr_ptr);
74619         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
74620         FREE(untag_ptr(this_ptr));
74621         GossipSync_free(this_ptr_conv);
74622 }
74623
74624 int64_t  CS_LDK_GossipSync_p2_p(int64_t a) {
74625         LDKP2PGossipSync a_conv;
74626         a_conv.inner = untag_ptr(a);
74627         a_conv.is_owned = ptr_is_owned(a);
74628         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74629         a_conv.is_owned = false;
74630         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74631         *ret_copy = GossipSync_p2_p(&a_conv);
74632         int64_t ret_ref = tag_ptr(ret_copy, true);
74633         return ret_ref;
74634 }
74635
74636 int64_t  CS_LDK_GossipSync_rapid(int64_t a) {
74637         LDKRapidGossipSync a_conv;
74638         a_conv.inner = untag_ptr(a);
74639         a_conv.is_owned = ptr_is_owned(a);
74640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74641         a_conv.is_owned = false;
74642         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74643         *ret_copy = GossipSync_rapid(&a_conv);
74644         int64_t ret_ref = tag_ptr(ret_copy, true);
74645         return ret_ref;
74646 }
74647
74648 int64_t  CS_LDK_GossipSync_none() {
74649         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
74650         *ret_copy = GossipSync_none();
74651         int64_t ret_ref = tag_ptr(ret_copy, true);
74652         return ret_ref;
74653 }
74654
74655 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) {
74656         void* persister_ptr = untag_ptr(persister);
74657         CHECK_ACCESS(persister_ptr);
74658         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
74659         if (persister_conv.free == LDKPersister_JCalls_free) {
74660                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74661                 LDKPersister_JCalls_cloned(&persister_conv);
74662         }
74663         void* event_handler_ptr = untag_ptr(event_handler);
74664         CHECK_ACCESS(event_handler_ptr);
74665         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
74666         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
74667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74668                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
74669         }
74670         LDKChainMonitor chain_monitor_conv;
74671         chain_monitor_conv.inner = untag_ptr(chain_monitor);
74672         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
74673         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
74674         chain_monitor_conv.is_owned = false;
74675         LDKChannelManager channel_manager_conv;
74676         channel_manager_conv.inner = untag_ptr(channel_manager);
74677         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
74678         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
74679         channel_manager_conv.is_owned = false;
74680         void* gossip_sync_ptr = untag_ptr(gossip_sync);
74681         CHECK_ACCESS(gossip_sync_ptr);
74682         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
74683         // WARNING: we may need a move here but no clone is available for LDKGossipSync
74684         LDKPeerManager peer_manager_conv;
74685         peer_manager_conv.inner = untag_ptr(peer_manager);
74686         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
74687         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
74688         peer_manager_conv.is_owned = false;
74689         void* logger_ptr = untag_ptr(logger);
74690         CHECK_ACCESS(logger_ptr);
74691         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74692         if (logger_conv.free == LDKLogger_JCalls_free) {
74693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74694                 LDKLogger_JCalls_cloned(&logger_conv);
74695         }
74696         void* scorer_ptr = untag_ptr(scorer);
74697         CHECK_ACCESS(scorer_ptr);
74698         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
74699         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
74700         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
74701                 // Manually implement clone for Java trait instances
74702                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
74703                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74704                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
74705                 }
74706         }
74707         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);
74708         int64_t ret_ref = 0;
74709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74711         return ret_ref;
74712 }
74713
74714 int64_t  CS_LDK_BackgroundProcessor_join(int64_t this_arg) {
74715         LDKBackgroundProcessor this_arg_conv;
74716         this_arg_conv.inner = untag_ptr(this_arg);
74717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74719         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
74720         
74721         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
74722         *ret_conv = BackgroundProcessor_join(this_arg_conv);
74723         return tag_ptr(ret_conv, true);
74724 }
74725
74726 int64_t  CS_LDK_BackgroundProcessor_stop(int64_t this_arg) {
74727         LDKBackgroundProcessor this_arg_conv;
74728         this_arg_conv.inner = untag_ptr(this_arg);
74729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74731         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
74732         
74733         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
74734         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
74735         return tag_ptr(ret_conv, true);
74736 }
74737
74738 void  CS_LDK_Bolt11ParseError_free(int64_t this_ptr) {
74739         if (!ptr_is_owned(this_ptr)) return;
74740         void* this_ptr_ptr = untag_ptr(this_ptr);
74741         CHECK_ACCESS(this_ptr_ptr);
74742         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
74743         FREE(untag_ptr(this_ptr));
74744         Bolt11ParseError_free(this_ptr_conv);
74745 }
74746
74747 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
74748         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74749         *ret_copy = Bolt11ParseError_clone(arg);
74750         int64_t ret_ref = tag_ptr(ret_copy, true);
74751         return ret_ref;
74752 }
74753 int64_t  CS_LDK_Bolt11ParseError_clone_ptr(int64_t arg) {
74754         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
74755         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
74756         return ret_conv;
74757 }
74758
74759 int64_t  CS_LDK_Bolt11ParseError_clone(int64_t orig) {
74760         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
74761         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74762         *ret_copy = Bolt11ParseError_clone(orig_conv);
74763         int64_t ret_ref = tag_ptr(ret_copy, true);
74764         return ret_ref;
74765 }
74766
74767 int64_t  CS_LDK_Bolt11ParseError_bech32_error(int64_t a) {
74768         void* a_ptr = untag_ptr(a);
74769         CHECK_ACCESS(a_ptr);
74770         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
74771         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
74772         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74773         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
74774         int64_t ret_ref = tag_ptr(ret_copy, true);
74775         return ret_ref;
74776 }
74777
74778 int64_t  CS_LDK_Bolt11ParseError_parse_amount_error(int32_t a) {
74779         
74780         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74781         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
74782         int64_t ret_ref = tag_ptr(ret_copy, true);
74783         return ret_ref;
74784 }
74785
74786 int64_t  CS_LDK_Bolt11ParseError_malformed_signature(int32_t a) {
74787         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
74788         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74789         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
74790         int64_t ret_ref = tag_ptr(ret_copy, true);
74791         return ret_ref;
74792 }
74793
74794 int64_t  CS_LDK_Bolt11ParseError_bad_prefix() {
74795         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74796         *ret_copy = Bolt11ParseError_bad_prefix();
74797         int64_t ret_ref = tag_ptr(ret_copy, true);
74798         return ret_ref;
74799 }
74800
74801 int64_t  CS_LDK_Bolt11ParseError_unknown_currency() {
74802         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74803         *ret_copy = Bolt11ParseError_unknown_currency();
74804         int64_t ret_ref = tag_ptr(ret_copy, true);
74805         return ret_ref;
74806 }
74807
74808 int64_t  CS_LDK_Bolt11ParseError_unknown_si_prefix() {
74809         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74810         *ret_copy = Bolt11ParseError_unknown_si_prefix();
74811         int64_t ret_ref = tag_ptr(ret_copy, true);
74812         return ret_ref;
74813 }
74814
74815 int64_t  CS_LDK_Bolt11ParseError_malformed_hrp() {
74816         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74817         *ret_copy = Bolt11ParseError_malformed_hrp();
74818         int64_t ret_ref = tag_ptr(ret_copy, true);
74819         return ret_ref;
74820 }
74821
74822 int64_t  CS_LDK_Bolt11ParseError_too_short_data_part() {
74823         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74824         *ret_copy = Bolt11ParseError_too_short_data_part();
74825         int64_t ret_ref = tag_ptr(ret_copy, true);
74826         return ret_ref;
74827 }
74828
74829 int64_t  CS_LDK_Bolt11ParseError_unexpected_end_of_tagged_fields() {
74830         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74831         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
74832         int64_t ret_ref = tag_ptr(ret_copy, true);
74833         return ret_ref;
74834 }
74835
74836 int64_t  CS_LDK_Bolt11ParseError_description_decode_error(int32_t a) {
74837         
74838         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74839         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
74840         int64_t ret_ref = tag_ptr(ret_copy, true);
74841         return ret_ref;
74842 }
74843
74844 int64_t  CS_LDK_Bolt11ParseError_padding_error() {
74845         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74846         *ret_copy = Bolt11ParseError_padding_error();
74847         int64_t ret_ref = tag_ptr(ret_copy, true);
74848         return ret_ref;
74849 }
74850
74851 int64_t  CS_LDK_Bolt11ParseError_integer_overflow_error() {
74852         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74853         *ret_copy = Bolt11ParseError_integer_overflow_error();
74854         int64_t ret_ref = tag_ptr(ret_copy, true);
74855         return ret_ref;
74856 }
74857
74858 int64_t  CS_LDK_Bolt11ParseError_invalid_seg_wit_program_length() {
74859         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74860         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
74861         int64_t ret_ref = tag_ptr(ret_copy, true);
74862         return ret_ref;
74863 }
74864
74865 int64_t  CS_LDK_Bolt11ParseError_invalid_pub_key_hash_length() {
74866         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74867         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
74868         int64_t ret_ref = tag_ptr(ret_copy, true);
74869         return ret_ref;
74870 }
74871
74872 int64_t  CS_LDK_Bolt11ParseError_invalid_script_hash_length() {
74873         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74874         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
74875         int64_t ret_ref = tag_ptr(ret_copy, true);
74876         return ret_ref;
74877 }
74878
74879 int64_t  CS_LDK_Bolt11ParseError_invalid_recovery_id() {
74880         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74881         *ret_copy = Bolt11ParseError_invalid_recovery_id();
74882         int64_t ret_ref = tag_ptr(ret_copy, true);
74883         return ret_ref;
74884 }
74885
74886 int64_t  CS_LDK_Bolt11ParseError_invalid_slice_length(jstring a) {
74887         LDKStr a_conv = str_ref_to_owned_c(a);
74888         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74889         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
74890         int64_t ret_ref = tag_ptr(ret_copy, true);
74891         return ret_ref;
74892 }
74893
74894 int64_t  CS_LDK_Bolt11ParseError_skip() {
74895         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
74896         *ret_copy = Bolt11ParseError_skip();
74897         int64_t ret_ref = tag_ptr(ret_copy, true);
74898         return ret_ref;
74899 }
74900
74901 jboolean  CS_LDK_Bolt11ParseError_eq(int64_t a, int64_t b) {
74902         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
74903         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
74904         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
74905         return ret_conv;
74906 }
74907
74908 void  CS_LDK_ParseOrSemanticError_free(int64_t this_ptr) {
74909         if (!ptr_is_owned(this_ptr)) return;
74910         void* this_ptr_ptr = untag_ptr(this_ptr);
74911         CHECK_ACCESS(this_ptr_ptr);
74912         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
74913         FREE(untag_ptr(this_ptr));
74914         ParseOrSemanticError_free(this_ptr_conv);
74915 }
74916
74917 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
74918         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74919         *ret_copy = ParseOrSemanticError_clone(arg);
74920         int64_t ret_ref = tag_ptr(ret_copy, true);
74921         return ret_ref;
74922 }
74923 int64_t  CS_LDK_ParseOrSemanticError_clone_ptr(int64_t arg) {
74924         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
74925         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
74926         return ret_conv;
74927 }
74928
74929 int64_t  CS_LDK_ParseOrSemanticError_clone(int64_t orig) {
74930         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
74931         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74932         *ret_copy = ParseOrSemanticError_clone(orig_conv);
74933         int64_t ret_ref = tag_ptr(ret_copy, true);
74934         return ret_ref;
74935 }
74936
74937 int64_t  CS_LDK_ParseOrSemanticError_parse_error(int64_t a) {
74938         void* a_ptr = untag_ptr(a);
74939         CHECK_ACCESS(a_ptr);
74940         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
74941         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
74942         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74943         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
74944         int64_t ret_ref = tag_ptr(ret_copy, true);
74945         return ret_ref;
74946 }
74947
74948 int64_t  CS_LDK_ParseOrSemanticError_semantic_error(int32_t a) {
74949         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_cs(a);
74950         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
74951         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
74952         int64_t ret_ref = tag_ptr(ret_copy, true);
74953         return ret_ref;
74954 }
74955
74956 jboolean  CS_LDK_ParseOrSemanticError_eq(int64_t a, int64_t b) {
74957         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
74958         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
74959         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
74960         return ret_conv;
74961 }
74962
74963 void  CS_LDK_Bolt11Invoice_free(int64_t this_obj) {
74964         LDKBolt11Invoice this_obj_conv;
74965         this_obj_conv.inner = untag_ptr(this_obj);
74966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74968         Bolt11Invoice_free(this_obj_conv);
74969 }
74970
74971 jboolean  CS_LDK_Bolt11Invoice_eq(int64_t a, int64_t b) {
74972         LDKBolt11Invoice a_conv;
74973         a_conv.inner = untag_ptr(a);
74974         a_conv.is_owned = ptr_is_owned(a);
74975         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74976         a_conv.is_owned = false;
74977         LDKBolt11Invoice b_conv;
74978         b_conv.inner = untag_ptr(b);
74979         b_conv.is_owned = ptr_is_owned(b);
74980         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74981         b_conv.is_owned = false;
74982         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
74983         return ret_conv;
74984 }
74985
74986 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
74987         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
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 int64_t  CS_LDK_Bolt11Invoice_clone_ptr(int64_t arg) {
74994         LDKBolt11Invoice arg_conv;
74995         arg_conv.inner = untag_ptr(arg);
74996         arg_conv.is_owned = ptr_is_owned(arg);
74997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74998         arg_conv.is_owned = false;
74999         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
75000         return ret_conv;
75001 }
75002
75003 int64_t  CS_LDK_Bolt11Invoice_clone(int64_t orig) {
75004         LDKBolt11Invoice orig_conv;
75005         orig_conv.inner = untag_ptr(orig);
75006         orig_conv.is_owned = ptr_is_owned(orig);
75007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75008         orig_conv.is_owned = false;
75009         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
75010         int64_t ret_ref = 0;
75011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75013         return ret_ref;
75014 }
75015
75016 int64_t  CS_LDK_Bolt11Invoice_hash(int64_t o) {
75017         LDKBolt11Invoice o_conv;
75018         o_conv.inner = untag_ptr(o);
75019         o_conv.is_owned = ptr_is_owned(o);
75020         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75021         o_conv.is_owned = false;
75022         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
75023         return ret_conv;
75024 }
75025
75026 void  CS_LDK_SignedRawBolt11Invoice_free(int64_t this_obj) {
75027         LDKSignedRawBolt11Invoice this_obj_conv;
75028         this_obj_conv.inner = untag_ptr(this_obj);
75029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75031         SignedRawBolt11Invoice_free(this_obj_conv);
75032 }
75033
75034 jboolean  CS_LDK_SignedRawBolt11Invoice_eq(int64_t a, int64_t b) {
75035         LDKSignedRawBolt11Invoice a_conv;
75036         a_conv.inner = untag_ptr(a);
75037         a_conv.is_owned = ptr_is_owned(a);
75038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75039         a_conv.is_owned = false;
75040         LDKSignedRawBolt11Invoice b_conv;
75041         b_conv.inner = untag_ptr(b);
75042         b_conv.is_owned = ptr_is_owned(b);
75043         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75044         b_conv.is_owned = false;
75045         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
75046         return ret_conv;
75047 }
75048
75049 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
75050         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
75051         int64_t ret_ref = 0;
75052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75054         return ret_ref;
75055 }
75056 int64_t  CS_LDK_SignedRawBolt11Invoice_clone_ptr(int64_t arg) {
75057         LDKSignedRawBolt11Invoice arg_conv;
75058         arg_conv.inner = untag_ptr(arg);
75059         arg_conv.is_owned = ptr_is_owned(arg);
75060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75061         arg_conv.is_owned = false;
75062         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
75063         return ret_conv;
75064 }
75065
75066 int64_t  CS_LDK_SignedRawBolt11Invoice_clone(int64_t orig) {
75067         LDKSignedRawBolt11Invoice orig_conv;
75068         orig_conv.inner = untag_ptr(orig);
75069         orig_conv.is_owned = ptr_is_owned(orig);
75070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75071         orig_conv.is_owned = false;
75072         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
75073         int64_t ret_ref = 0;
75074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75076         return ret_ref;
75077 }
75078
75079 int64_t  CS_LDK_SignedRawBolt11Invoice_hash(int64_t o) {
75080         LDKSignedRawBolt11Invoice o_conv;
75081         o_conv.inner = untag_ptr(o);
75082         o_conv.is_owned = ptr_is_owned(o);
75083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75084         o_conv.is_owned = false;
75085         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
75086         return ret_conv;
75087 }
75088
75089 void  CS_LDK_RawBolt11Invoice_free(int64_t this_obj) {
75090         LDKRawBolt11Invoice this_obj_conv;
75091         this_obj_conv.inner = untag_ptr(this_obj);
75092         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75094         RawBolt11Invoice_free(this_obj_conv);
75095 }
75096
75097 int64_t  CS_LDK_RawBolt11Invoice_get_data(int64_t this_ptr) {
75098         LDKRawBolt11Invoice this_ptr_conv;
75099         this_ptr_conv.inner = untag_ptr(this_ptr);
75100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75102         this_ptr_conv.is_owned = false;
75103         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
75104         int64_t ret_ref = 0;
75105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75107         return ret_ref;
75108 }
75109
75110 void  CS_LDK_RawBolt11Invoice_set_data(int64_t this_ptr, int64_t val) {
75111         LDKRawBolt11Invoice this_ptr_conv;
75112         this_ptr_conv.inner = untag_ptr(this_ptr);
75113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75115         this_ptr_conv.is_owned = false;
75116         LDKRawDataPart val_conv;
75117         val_conv.inner = untag_ptr(val);
75118         val_conv.is_owned = ptr_is_owned(val);
75119         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75120         val_conv = RawDataPart_clone(&val_conv);
75121         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
75122 }
75123
75124 jboolean  CS_LDK_RawBolt11Invoice_eq(int64_t a, int64_t b) {
75125         LDKRawBolt11Invoice a_conv;
75126         a_conv.inner = untag_ptr(a);
75127         a_conv.is_owned = ptr_is_owned(a);
75128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75129         a_conv.is_owned = false;
75130         LDKRawBolt11Invoice b_conv;
75131         b_conv.inner = untag_ptr(b);
75132         b_conv.is_owned = ptr_is_owned(b);
75133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75134         b_conv.is_owned = false;
75135         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
75136         return ret_conv;
75137 }
75138
75139 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
75140         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
75141         int64_t ret_ref = 0;
75142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75144         return ret_ref;
75145 }
75146 int64_t  CS_LDK_RawBolt11Invoice_clone_ptr(int64_t arg) {
75147         LDKRawBolt11Invoice arg_conv;
75148         arg_conv.inner = untag_ptr(arg);
75149         arg_conv.is_owned = ptr_is_owned(arg);
75150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75151         arg_conv.is_owned = false;
75152         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
75153         return ret_conv;
75154 }
75155
75156 int64_t  CS_LDK_RawBolt11Invoice_clone(int64_t orig) {
75157         LDKRawBolt11Invoice orig_conv;
75158         orig_conv.inner = untag_ptr(orig);
75159         orig_conv.is_owned = ptr_is_owned(orig);
75160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75161         orig_conv.is_owned = false;
75162         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
75163         int64_t ret_ref = 0;
75164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75166         return ret_ref;
75167 }
75168
75169 int64_t  CS_LDK_RawBolt11Invoice_hash(int64_t o) {
75170         LDKRawBolt11Invoice o_conv;
75171         o_conv.inner = untag_ptr(o);
75172         o_conv.is_owned = ptr_is_owned(o);
75173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75174         o_conv.is_owned = false;
75175         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
75176         return ret_conv;
75177 }
75178
75179 void  CS_LDK_RawDataPart_free(int64_t this_obj) {
75180         LDKRawDataPart this_obj_conv;
75181         this_obj_conv.inner = untag_ptr(this_obj);
75182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75184         RawDataPart_free(this_obj_conv);
75185 }
75186
75187 int64_t  CS_LDK_RawDataPart_get_timestamp(int64_t this_ptr) {
75188         LDKRawDataPart this_ptr_conv;
75189         this_ptr_conv.inner = untag_ptr(this_ptr);
75190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75192         this_ptr_conv.is_owned = false;
75193         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
75194         int64_t ret_ref = 0;
75195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75197         return ret_ref;
75198 }
75199
75200 void  CS_LDK_RawDataPart_set_timestamp(int64_t this_ptr, int64_t val) {
75201         LDKRawDataPart this_ptr_conv;
75202         this_ptr_conv.inner = untag_ptr(this_ptr);
75203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75205         this_ptr_conv.is_owned = false;
75206         LDKPositiveTimestamp val_conv;
75207         val_conv.inner = untag_ptr(val);
75208         val_conv.is_owned = ptr_is_owned(val);
75209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75210         val_conv = PositiveTimestamp_clone(&val_conv);
75211         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
75212 }
75213
75214 jboolean  CS_LDK_RawDataPart_eq(int64_t a, int64_t b) {
75215         LDKRawDataPart a_conv;
75216         a_conv.inner = untag_ptr(a);
75217         a_conv.is_owned = ptr_is_owned(a);
75218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75219         a_conv.is_owned = false;
75220         LDKRawDataPart b_conv;
75221         b_conv.inner = untag_ptr(b);
75222         b_conv.is_owned = ptr_is_owned(b);
75223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75224         b_conv.is_owned = false;
75225         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
75226         return ret_conv;
75227 }
75228
75229 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
75230         LDKRawDataPart ret_var = RawDataPart_clone(arg);
75231         int64_t ret_ref = 0;
75232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75234         return ret_ref;
75235 }
75236 int64_t  CS_LDK_RawDataPart_clone_ptr(int64_t arg) {
75237         LDKRawDataPart arg_conv;
75238         arg_conv.inner = untag_ptr(arg);
75239         arg_conv.is_owned = ptr_is_owned(arg);
75240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75241         arg_conv.is_owned = false;
75242         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
75243         return ret_conv;
75244 }
75245
75246 int64_t  CS_LDK_RawDataPart_clone(int64_t orig) {
75247         LDKRawDataPart orig_conv;
75248         orig_conv.inner = untag_ptr(orig);
75249         orig_conv.is_owned = ptr_is_owned(orig);
75250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75251         orig_conv.is_owned = false;
75252         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
75253         int64_t ret_ref = 0;
75254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75256         return ret_ref;
75257 }
75258
75259 int64_t  CS_LDK_RawDataPart_hash(int64_t o) {
75260         LDKRawDataPart o_conv;
75261         o_conv.inner = untag_ptr(o);
75262         o_conv.is_owned = ptr_is_owned(o);
75263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75264         o_conv.is_owned = false;
75265         int64_t ret_conv = RawDataPart_hash(&o_conv);
75266         return ret_conv;
75267 }
75268
75269 void  CS_LDK_PositiveTimestamp_free(int64_t this_obj) {
75270         LDKPositiveTimestamp this_obj_conv;
75271         this_obj_conv.inner = untag_ptr(this_obj);
75272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75274         PositiveTimestamp_free(this_obj_conv);
75275 }
75276
75277 jboolean  CS_LDK_PositiveTimestamp_eq(int64_t a, int64_t b) {
75278         LDKPositiveTimestamp a_conv;
75279         a_conv.inner = untag_ptr(a);
75280         a_conv.is_owned = ptr_is_owned(a);
75281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75282         a_conv.is_owned = false;
75283         LDKPositiveTimestamp b_conv;
75284         b_conv.inner = untag_ptr(b);
75285         b_conv.is_owned = ptr_is_owned(b);
75286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75287         b_conv.is_owned = false;
75288         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
75289         return ret_conv;
75290 }
75291
75292 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
75293         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
75294         int64_t ret_ref = 0;
75295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75297         return ret_ref;
75298 }
75299 int64_t  CS_LDK_PositiveTimestamp_clone_ptr(int64_t arg) {
75300         LDKPositiveTimestamp arg_conv;
75301         arg_conv.inner = untag_ptr(arg);
75302         arg_conv.is_owned = ptr_is_owned(arg);
75303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75304         arg_conv.is_owned = false;
75305         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
75306         return ret_conv;
75307 }
75308
75309 int64_t  CS_LDK_PositiveTimestamp_clone(int64_t orig) {
75310         LDKPositiveTimestamp orig_conv;
75311         orig_conv.inner = untag_ptr(orig);
75312         orig_conv.is_owned = ptr_is_owned(orig);
75313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75314         orig_conv.is_owned = false;
75315         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
75316         int64_t ret_ref = 0;
75317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75319         return ret_ref;
75320 }
75321
75322 int64_t  CS_LDK_PositiveTimestamp_hash(int64_t o) {
75323         LDKPositiveTimestamp o_conv;
75324         o_conv.inner = untag_ptr(o);
75325         o_conv.is_owned = ptr_is_owned(o);
75326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75327         o_conv.is_owned = false;
75328         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
75329         return ret_conv;
75330 }
75331
75332 int32_t  CS_LDK_SiPrefix_clone(int64_t orig) {
75333         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
75334         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_clone(orig_conv));
75335         return ret_conv;
75336 }
75337
75338 int32_t  CS_LDK_SiPrefix_milli() {
75339         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_milli());
75340         return ret_conv;
75341 }
75342
75343 int32_t  CS_LDK_SiPrefix_micro() {
75344         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_micro());
75345         return ret_conv;
75346 }
75347
75348 int32_t  CS_LDK_SiPrefix_nano() {
75349         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_nano());
75350         return ret_conv;
75351 }
75352
75353 int32_t  CS_LDK_SiPrefix_pico() {
75354         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_pico());
75355         return ret_conv;
75356 }
75357
75358 jboolean  CS_LDK_SiPrefix_eq(int64_t a, int64_t b) {
75359         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
75360         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
75361         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
75362         return ret_conv;
75363 }
75364
75365 int64_t  CS_LDK_SiPrefix_hash(int64_t o) {
75366         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
75367         int64_t ret_conv = SiPrefix_hash(o_conv);
75368         return ret_conv;
75369 }
75370
75371 int64_t  CS_LDK_SiPrefix_multiplier(int64_t this_arg) {
75372         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
75373         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
75374         return ret_conv;
75375 }
75376
75377 int32_t  CS_LDK_Currency_clone(int64_t orig) {
75378         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
75379         int32_t ret_conv = LDKCurrency_to_cs(Currency_clone(orig_conv));
75380         return ret_conv;
75381 }
75382
75383 int32_t  CS_LDK_Currency_bitcoin() {
75384         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin());
75385         return ret_conv;
75386 }
75387
75388 int32_t  CS_LDK_Currency_bitcoin_testnet() {
75389         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin_testnet());
75390         return ret_conv;
75391 }
75392
75393 int32_t  CS_LDK_Currency_regtest() {
75394         int32_t ret_conv = LDKCurrency_to_cs(Currency_regtest());
75395         return ret_conv;
75396 }
75397
75398 int32_t  CS_LDK_Currency_simnet() {
75399         int32_t ret_conv = LDKCurrency_to_cs(Currency_simnet());
75400         return ret_conv;
75401 }
75402
75403 int32_t  CS_LDK_Currency_signet() {
75404         int32_t ret_conv = LDKCurrency_to_cs(Currency_signet());
75405         return ret_conv;
75406 }
75407
75408 int64_t  CS_LDK_Currency_hash(int64_t o) {
75409         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
75410         int64_t ret_conv = Currency_hash(o_conv);
75411         return ret_conv;
75412 }
75413
75414 jboolean  CS_LDK_Currency_eq(int64_t a, int64_t b) {
75415         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
75416         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
75417         jboolean ret_conv = Currency_eq(a_conv, b_conv);
75418         return ret_conv;
75419 }
75420
75421 void  CS_LDK_Sha256_free(int64_t this_obj) {
75422         LDKSha256 this_obj_conv;
75423         this_obj_conv.inner = untag_ptr(this_obj);
75424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75426         Sha256_free(this_obj_conv);
75427 }
75428
75429 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
75430         LDKSha256 ret_var = Sha256_clone(arg);
75431         int64_t ret_ref = 0;
75432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75434         return ret_ref;
75435 }
75436 int64_t  CS_LDK_Sha256_clone_ptr(int64_t arg) {
75437         LDKSha256 arg_conv;
75438         arg_conv.inner = untag_ptr(arg);
75439         arg_conv.is_owned = ptr_is_owned(arg);
75440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75441         arg_conv.is_owned = false;
75442         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
75443         return ret_conv;
75444 }
75445
75446 int64_t  CS_LDK_Sha256_clone(int64_t orig) {
75447         LDKSha256 orig_conv;
75448         orig_conv.inner = untag_ptr(orig);
75449         orig_conv.is_owned = ptr_is_owned(orig);
75450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75451         orig_conv.is_owned = false;
75452         LDKSha256 ret_var = Sha256_clone(&orig_conv);
75453         int64_t ret_ref = 0;
75454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75456         return ret_ref;
75457 }
75458
75459 int64_t  CS_LDK_Sha256_hash(int64_t o) {
75460         LDKSha256 o_conv;
75461         o_conv.inner = untag_ptr(o);
75462         o_conv.is_owned = ptr_is_owned(o);
75463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75464         o_conv.is_owned = false;
75465         int64_t ret_conv = Sha256_hash(&o_conv);
75466         return ret_conv;
75467 }
75468
75469 jboolean  CS_LDK_Sha256_eq(int64_t a, int64_t b) {
75470         LDKSha256 a_conv;
75471         a_conv.inner = untag_ptr(a);
75472         a_conv.is_owned = ptr_is_owned(a);
75473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75474         a_conv.is_owned = false;
75475         LDKSha256 b_conv;
75476         b_conv.inner = untag_ptr(b);
75477         b_conv.is_owned = ptr_is_owned(b);
75478         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75479         b_conv.is_owned = false;
75480         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
75481         return ret_conv;
75482 }
75483
75484 int64_t  CS_LDK_Sha256_from_bytes(int8_tArray bytes) {
75485         uint8_t bytes_arr[32];
75486         CHECK(bytes->arr_len == 32);
75487         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
75488         uint8_t (*bytes_ref)[32] = &bytes_arr;
75489         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
75490         int64_t ret_ref = 0;
75491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75493         return ret_ref;
75494 }
75495
75496 void  CS_LDK_Description_free(int64_t this_obj) {
75497         LDKDescription this_obj_conv;
75498         this_obj_conv.inner = untag_ptr(this_obj);
75499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75501         Description_free(this_obj_conv);
75502 }
75503
75504 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
75505         LDKDescription ret_var = Description_clone(arg);
75506         int64_t ret_ref = 0;
75507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75509         return ret_ref;
75510 }
75511 int64_t  CS_LDK_Description_clone_ptr(int64_t arg) {
75512         LDKDescription arg_conv;
75513         arg_conv.inner = untag_ptr(arg);
75514         arg_conv.is_owned = ptr_is_owned(arg);
75515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75516         arg_conv.is_owned = false;
75517         int64_t ret_conv = Description_clone_ptr(&arg_conv);
75518         return ret_conv;
75519 }
75520
75521 int64_t  CS_LDK_Description_clone(int64_t orig) {
75522         LDKDescription orig_conv;
75523         orig_conv.inner = untag_ptr(orig);
75524         orig_conv.is_owned = ptr_is_owned(orig);
75525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75526         orig_conv.is_owned = false;
75527         LDKDescription ret_var = Description_clone(&orig_conv);
75528         int64_t ret_ref = 0;
75529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75531         return ret_ref;
75532 }
75533
75534 int64_t  CS_LDK_Description_hash(int64_t o) {
75535         LDKDescription o_conv;
75536         o_conv.inner = untag_ptr(o);
75537         o_conv.is_owned = ptr_is_owned(o);
75538         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75539         o_conv.is_owned = false;
75540         int64_t ret_conv = Description_hash(&o_conv);
75541         return ret_conv;
75542 }
75543
75544 jboolean  CS_LDK_Description_eq(int64_t a, int64_t b) {
75545         LDKDescription a_conv;
75546         a_conv.inner = untag_ptr(a);
75547         a_conv.is_owned = ptr_is_owned(a);
75548         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75549         a_conv.is_owned = false;
75550         LDKDescription b_conv;
75551         b_conv.inner = untag_ptr(b);
75552         b_conv.is_owned = ptr_is_owned(b);
75553         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75554         b_conv.is_owned = false;
75555         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
75556         return ret_conv;
75557 }
75558
75559 void  CS_LDK_PayeePubKey_free(int64_t this_obj) {
75560         LDKPayeePubKey this_obj_conv;
75561         this_obj_conv.inner = untag_ptr(this_obj);
75562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75564         PayeePubKey_free(this_obj_conv);
75565 }
75566
75567 int8_tArray  CS_LDK_PayeePubKey_get_a(int64_t this_ptr) {
75568         LDKPayeePubKey this_ptr_conv;
75569         this_ptr_conv.inner = untag_ptr(this_ptr);
75570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75572         this_ptr_conv.is_owned = false;
75573         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75574         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
75575         return ret_arr;
75576 }
75577
75578 void  CS_LDK_PayeePubKey_set_a(int64_t this_ptr, int8_tArray val) {
75579         LDKPayeePubKey this_ptr_conv;
75580         this_ptr_conv.inner = untag_ptr(this_ptr);
75581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75583         this_ptr_conv.is_owned = false;
75584         LDKPublicKey val_ref;
75585         CHECK(val->arr_len == 33);
75586         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75587         PayeePubKey_set_a(&this_ptr_conv, val_ref);
75588 }
75589
75590 int64_t  CS_LDK_PayeePubKey_new(int8_tArray a_arg) {
75591         LDKPublicKey a_arg_ref;
75592         CHECK(a_arg->arr_len == 33);
75593         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
75594         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
75595         int64_t ret_ref = 0;
75596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75598         return ret_ref;
75599 }
75600
75601 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
75602         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
75603         int64_t ret_ref = 0;
75604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75606         return ret_ref;
75607 }
75608 int64_t  CS_LDK_PayeePubKey_clone_ptr(int64_t arg) {
75609         LDKPayeePubKey arg_conv;
75610         arg_conv.inner = untag_ptr(arg);
75611         arg_conv.is_owned = ptr_is_owned(arg);
75612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75613         arg_conv.is_owned = false;
75614         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
75615         return ret_conv;
75616 }
75617
75618 int64_t  CS_LDK_PayeePubKey_clone(int64_t orig) {
75619         LDKPayeePubKey orig_conv;
75620         orig_conv.inner = untag_ptr(orig);
75621         orig_conv.is_owned = ptr_is_owned(orig);
75622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75623         orig_conv.is_owned = false;
75624         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
75625         int64_t ret_ref = 0;
75626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75628         return ret_ref;
75629 }
75630
75631 int64_t  CS_LDK_PayeePubKey_hash(int64_t o) {
75632         LDKPayeePubKey o_conv;
75633         o_conv.inner = untag_ptr(o);
75634         o_conv.is_owned = ptr_is_owned(o);
75635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75636         o_conv.is_owned = false;
75637         int64_t ret_conv = PayeePubKey_hash(&o_conv);
75638         return ret_conv;
75639 }
75640
75641 jboolean  CS_LDK_PayeePubKey_eq(int64_t a, int64_t b) {
75642         LDKPayeePubKey a_conv;
75643         a_conv.inner = untag_ptr(a);
75644         a_conv.is_owned = ptr_is_owned(a);
75645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75646         a_conv.is_owned = false;
75647         LDKPayeePubKey b_conv;
75648         b_conv.inner = untag_ptr(b);
75649         b_conv.is_owned = ptr_is_owned(b);
75650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75651         b_conv.is_owned = false;
75652         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
75653         return ret_conv;
75654 }
75655
75656 void  CS_LDK_ExpiryTime_free(int64_t this_obj) {
75657         LDKExpiryTime this_obj_conv;
75658         this_obj_conv.inner = untag_ptr(this_obj);
75659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75661         ExpiryTime_free(this_obj_conv);
75662 }
75663
75664 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
75665         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
75666         int64_t ret_ref = 0;
75667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75669         return ret_ref;
75670 }
75671 int64_t  CS_LDK_ExpiryTime_clone_ptr(int64_t arg) {
75672         LDKExpiryTime arg_conv;
75673         arg_conv.inner = untag_ptr(arg);
75674         arg_conv.is_owned = ptr_is_owned(arg);
75675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75676         arg_conv.is_owned = false;
75677         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
75678         return ret_conv;
75679 }
75680
75681 int64_t  CS_LDK_ExpiryTime_clone(int64_t orig) {
75682         LDKExpiryTime orig_conv;
75683         orig_conv.inner = untag_ptr(orig);
75684         orig_conv.is_owned = ptr_is_owned(orig);
75685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75686         orig_conv.is_owned = false;
75687         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
75688         int64_t ret_ref = 0;
75689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75691         return ret_ref;
75692 }
75693
75694 int64_t  CS_LDK_ExpiryTime_hash(int64_t o) {
75695         LDKExpiryTime o_conv;
75696         o_conv.inner = untag_ptr(o);
75697         o_conv.is_owned = ptr_is_owned(o);
75698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75699         o_conv.is_owned = false;
75700         int64_t ret_conv = ExpiryTime_hash(&o_conv);
75701         return ret_conv;
75702 }
75703
75704 jboolean  CS_LDK_ExpiryTime_eq(int64_t a, int64_t b) {
75705         LDKExpiryTime a_conv;
75706         a_conv.inner = untag_ptr(a);
75707         a_conv.is_owned = ptr_is_owned(a);
75708         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75709         a_conv.is_owned = false;
75710         LDKExpiryTime b_conv;
75711         b_conv.inner = untag_ptr(b);
75712         b_conv.is_owned = ptr_is_owned(b);
75713         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75714         b_conv.is_owned = false;
75715         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
75716         return ret_conv;
75717 }
75718
75719 void  CS_LDK_MinFinalCltvExpiryDelta_free(int64_t this_obj) {
75720         LDKMinFinalCltvExpiryDelta this_obj_conv;
75721         this_obj_conv.inner = untag_ptr(this_obj);
75722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75724         MinFinalCltvExpiryDelta_free(this_obj_conv);
75725 }
75726
75727 int64_t  CS_LDK_MinFinalCltvExpiryDelta_get_a(int64_t this_ptr) {
75728         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75729         this_ptr_conv.inner = untag_ptr(this_ptr);
75730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75732         this_ptr_conv.is_owned = false;
75733         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
75734         return ret_conv;
75735 }
75736
75737 void  CS_LDK_MinFinalCltvExpiryDelta_set_a(int64_t this_ptr, int64_t val) {
75738         LDKMinFinalCltvExpiryDelta this_ptr_conv;
75739         this_ptr_conv.inner = untag_ptr(this_ptr);
75740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75742         this_ptr_conv.is_owned = false;
75743         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
75744 }
75745
75746 int64_t  CS_LDK_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
75747         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
75748         int64_t ret_ref = 0;
75749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75751         return ret_ref;
75752 }
75753
75754 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
75755         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
75756         int64_t ret_ref = 0;
75757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75759         return ret_ref;
75760 }
75761 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone_ptr(int64_t arg) {
75762         LDKMinFinalCltvExpiryDelta arg_conv;
75763         arg_conv.inner = untag_ptr(arg);
75764         arg_conv.is_owned = ptr_is_owned(arg);
75765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75766         arg_conv.is_owned = false;
75767         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
75768         return ret_conv;
75769 }
75770
75771 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone(int64_t orig) {
75772         LDKMinFinalCltvExpiryDelta orig_conv;
75773         orig_conv.inner = untag_ptr(orig);
75774         orig_conv.is_owned = ptr_is_owned(orig);
75775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75776         orig_conv.is_owned = false;
75777         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
75778         int64_t ret_ref = 0;
75779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75781         return ret_ref;
75782 }
75783
75784 int64_t  CS_LDK_MinFinalCltvExpiryDelta_hash(int64_t o) {
75785         LDKMinFinalCltvExpiryDelta o_conv;
75786         o_conv.inner = untag_ptr(o);
75787         o_conv.is_owned = ptr_is_owned(o);
75788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75789         o_conv.is_owned = false;
75790         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
75791         return ret_conv;
75792 }
75793
75794 jboolean  CS_LDK_MinFinalCltvExpiryDelta_eq(int64_t a, int64_t b) {
75795         LDKMinFinalCltvExpiryDelta a_conv;
75796         a_conv.inner = untag_ptr(a);
75797         a_conv.is_owned = ptr_is_owned(a);
75798         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75799         a_conv.is_owned = false;
75800         LDKMinFinalCltvExpiryDelta b_conv;
75801         b_conv.inner = untag_ptr(b);
75802         b_conv.is_owned = ptr_is_owned(b);
75803         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75804         b_conv.is_owned = false;
75805         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
75806         return ret_conv;
75807 }
75808
75809 void  CS_LDK_Fallback_free(int64_t this_ptr) {
75810         if (!ptr_is_owned(this_ptr)) return;
75811         void* this_ptr_ptr = untag_ptr(this_ptr);
75812         CHECK_ACCESS(this_ptr_ptr);
75813         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
75814         FREE(untag_ptr(this_ptr));
75815         Fallback_free(this_ptr_conv);
75816 }
75817
75818 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
75819         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75820         *ret_copy = Fallback_clone(arg);
75821         int64_t ret_ref = tag_ptr(ret_copy, true);
75822         return ret_ref;
75823 }
75824 int64_t  CS_LDK_Fallback_clone_ptr(int64_t arg) {
75825         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
75826         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
75827         return ret_conv;
75828 }
75829
75830 int64_t  CS_LDK_Fallback_clone(int64_t orig) {
75831         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
75832         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75833         *ret_copy = Fallback_clone(orig_conv);
75834         int64_t ret_ref = tag_ptr(ret_copy, true);
75835         return ret_ref;
75836 }
75837
75838 int64_t  CS_LDK_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
75839         
75840         LDKCVec_u8Z program_ref;
75841         program_ref.datalen = program->arr_len;
75842         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
75843         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
75844         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75845         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
75846         int64_t ret_ref = tag_ptr(ret_copy, true);
75847         return ret_ref;
75848 }
75849
75850 int64_t  CS_LDK_Fallback_pub_key_hash(int8_tArray a) {
75851         LDKTwentyBytes a_ref;
75852         CHECK(a->arr_len == 20);
75853         memcpy(a_ref.data, a->elems, 20); FREE(a);
75854         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75855         *ret_copy = Fallback_pub_key_hash(a_ref);
75856         int64_t ret_ref = tag_ptr(ret_copy, true);
75857         return ret_ref;
75858 }
75859
75860 int64_t  CS_LDK_Fallback_script_hash(int8_tArray a) {
75861         LDKTwentyBytes a_ref;
75862         CHECK(a->arr_len == 20);
75863         memcpy(a_ref.data, a->elems, 20); FREE(a);
75864         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
75865         *ret_copy = Fallback_script_hash(a_ref);
75866         int64_t ret_ref = tag_ptr(ret_copy, true);
75867         return ret_ref;
75868 }
75869
75870 int64_t  CS_LDK_Fallback_hash(int64_t o) {
75871         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
75872         int64_t ret_conv = Fallback_hash(o_conv);
75873         return ret_conv;
75874 }
75875
75876 jboolean  CS_LDK_Fallback_eq(int64_t a, int64_t b) {
75877         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
75878         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
75879         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
75880         return ret_conv;
75881 }
75882
75883 void  CS_LDK_Bolt11InvoiceSignature_free(int64_t this_obj) {
75884         LDKBolt11InvoiceSignature this_obj_conv;
75885         this_obj_conv.inner = untag_ptr(this_obj);
75886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75888         Bolt11InvoiceSignature_free(this_obj_conv);
75889 }
75890
75891 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
75892         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
75893         int64_t ret_ref = 0;
75894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75896         return ret_ref;
75897 }
75898 int64_t  CS_LDK_Bolt11InvoiceSignature_clone_ptr(int64_t arg) {
75899         LDKBolt11InvoiceSignature arg_conv;
75900         arg_conv.inner = untag_ptr(arg);
75901         arg_conv.is_owned = ptr_is_owned(arg);
75902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75903         arg_conv.is_owned = false;
75904         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
75905         return ret_conv;
75906 }
75907
75908 int64_t  CS_LDK_Bolt11InvoiceSignature_clone(int64_t orig) {
75909         LDKBolt11InvoiceSignature orig_conv;
75910         orig_conv.inner = untag_ptr(orig);
75911         orig_conv.is_owned = ptr_is_owned(orig);
75912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75913         orig_conv.is_owned = false;
75914         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
75915         int64_t ret_ref = 0;
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75918         return ret_ref;
75919 }
75920
75921 int64_t  CS_LDK_Bolt11InvoiceSignature_hash(int64_t o) {
75922         LDKBolt11InvoiceSignature o_conv;
75923         o_conv.inner = untag_ptr(o);
75924         o_conv.is_owned = ptr_is_owned(o);
75925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75926         o_conv.is_owned = false;
75927         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
75928         return ret_conv;
75929 }
75930
75931 jboolean  CS_LDK_Bolt11InvoiceSignature_eq(int64_t a, int64_t b) {
75932         LDKBolt11InvoiceSignature a_conv;
75933         a_conv.inner = untag_ptr(a);
75934         a_conv.is_owned = ptr_is_owned(a);
75935         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75936         a_conv.is_owned = false;
75937         LDKBolt11InvoiceSignature b_conv;
75938         b_conv.inner = untag_ptr(b);
75939         b_conv.is_owned = ptr_is_owned(b);
75940         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75941         b_conv.is_owned = false;
75942         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
75943         return ret_conv;
75944 }
75945
75946 void  CS_LDK_PrivateRoute_free(int64_t this_obj) {
75947         LDKPrivateRoute this_obj_conv;
75948         this_obj_conv.inner = untag_ptr(this_obj);
75949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75951         PrivateRoute_free(this_obj_conv);
75952 }
75953
75954 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
75955         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
75956         int64_t ret_ref = 0;
75957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75959         return ret_ref;
75960 }
75961 int64_t  CS_LDK_PrivateRoute_clone_ptr(int64_t arg) {
75962         LDKPrivateRoute arg_conv;
75963         arg_conv.inner = untag_ptr(arg);
75964         arg_conv.is_owned = ptr_is_owned(arg);
75965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75966         arg_conv.is_owned = false;
75967         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
75968         return ret_conv;
75969 }
75970
75971 int64_t  CS_LDK_PrivateRoute_clone(int64_t orig) {
75972         LDKPrivateRoute orig_conv;
75973         orig_conv.inner = untag_ptr(orig);
75974         orig_conv.is_owned = ptr_is_owned(orig);
75975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75976         orig_conv.is_owned = false;
75977         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
75978         int64_t ret_ref = 0;
75979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75981         return ret_ref;
75982 }
75983
75984 int64_t  CS_LDK_PrivateRoute_hash(int64_t o) {
75985         LDKPrivateRoute o_conv;
75986         o_conv.inner = untag_ptr(o);
75987         o_conv.is_owned = ptr_is_owned(o);
75988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75989         o_conv.is_owned = false;
75990         int64_t ret_conv = PrivateRoute_hash(&o_conv);
75991         return ret_conv;
75992 }
75993
75994 jboolean  CS_LDK_PrivateRoute_eq(int64_t a, int64_t b) {
75995         LDKPrivateRoute a_conv;
75996         a_conv.inner = untag_ptr(a);
75997         a_conv.is_owned = ptr_is_owned(a);
75998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75999         a_conv.is_owned = false;
76000         LDKPrivateRoute b_conv;
76001         b_conv.inner = untag_ptr(b);
76002         b_conv.is_owned = ptr_is_owned(b);
76003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76004         b_conv.is_owned = false;
76005         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
76006         return ret_conv;
76007 }
76008
76009 int64_t  CS_LDK_SignedRawBolt11Invoice_into_parts(int64_t this_arg) {
76010         LDKSignedRawBolt11Invoice this_arg_conv;
76011         this_arg_conv.inner = untag_ptr(this_arg);
76012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76014         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
76015         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
76016         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
76017         return tag_ptr(ret_conv, true);
76018 }
76019
76020 int64_t  CS_LDK_SignedRawBolt11Invoice_raw_invoice(int64_t this_arg) {
76021         LDKSignedRawBolt11Invoice this_arg_conv;
76022         this_arg_conv.inner = untag_ptr(this_arg);
76023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76025         this_arg_conv.is_owned = false;
76026         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
76027         int64_t ret_ref = 0;
76028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76030         return ret_ref;
76031 }
76032
76033 int8_tArray  CS_LDK_SignedRawBolt11Invoice_signable_hash(int64_t this_arg) {
76034         LDKSignedRawBolt11Invoice this_arg_conv;
76035         this_arg_conv.inner = untag_ptr(this_arg);
76036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76038         this_arg_conv.is_owned = false;
76039         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76040         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
76041         return ret_arr;
76042 }
76043
76044 int64_t  CS_LDK_SignedRawBolt11Invoice_signature(int64_t this_arg) {
76045         LDKSignedRawBolt11Invoice this_arg_conv;
76046         this_arg_conv.inner = untag_ptr(this_arg);
76047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76049         this_arg_conv.is_owned = false;
76050         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
76051         int64_t ret_ref = 0;
76052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76054         return ret_ref;
76055 }
76056
76057 int64_t  CS_LDK_SignedRawBolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
76058         LDKSignedRawBolt11Invoice this_arg_conv;
76059         this_arg_conv.inner = untag_ptr(this_arg);
76060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76062         this_arg_conv.is_owned = false;
76063         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
76064         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
76065         return tag_ptr(ret_conv, true);
76066 }
76067
76068 jboolean  CS_LDK_SignedRawBolt11Invoice_check_signature(int64_t this_arg) {
76069         LDKSignedRawBolt11Invoice this_arg_conv;
76070         this_arg_conv.inner = untag_ptr(this_arg);
76071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76073         this_arg_conv.is_owned = false;
76074         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
76075         return ret_conv;
76076 }
76077
76078 int8_tArray  CS_LDK_RawBolt11Invoice_signable_hash(int64_t this_arg) {
76079         LDKRawBolt11Invoice this_arg_conv;
76080         this_arg_conv.inner = untag_ptr(this_arg);
76081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76083         this_arg_conv.is_owned = false;
76084         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76085         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
76086         return ret_arr;
76087 }
76088
76089 int64_t  CS_LDK_RawBolt11Invoice_payment_hash(int64_t this_arg) {
76090         LDKRawBolt11Invoice this_arg_conv;
76091         this_arg_conv.inner = untag_ptr(this_arg);
76092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76094         this_arg_conv.is_owned = false;
76095         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
76096         int64_t ret_ref = 0;
76097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76099         return ret_ref;
76100 }
76101
76102 int64_t  CS_LDK_RawBolt11Invoice_description(int64_t this_arg) {
76103         LDKRawBolt11Invoice this_arg_conv;
76104         this_arg_conv.inner = untag_ptr(this_arg);
76105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76107         this_arg_conv.is_owned = false;
76108         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
76109         int64_t ret_ref = 0;
76110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76112         return ret_ref;
76113 }
76114
76115 int64_t  CS_LDK_RawBolt11Invoice_payee_pub_key(int64_t this_arg) {
76116         LDKRawBolt11Invoice this_arg_conv;
76117         this_arg_conv.inner = untag_ptr(this_arg);
76118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76120         this_arg_conv.is_owned = false;
76121         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
76122         int64_t ret_ref = 0;
76123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76125         return ret_ref;
76126 }
76127
76128 int64_t  CS_LDK_RawBolt11Invoice_description_hash(int64_t this_arg) {
76129         LDKRawBolt11Invoice this_arg_conv;
76130         this_arg_conv.inner = untag_ptr(this_arg);
76131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76133         this_arg_conv.is_owned = false;
76134         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
76135         int64_t ret_ref = 0;
76136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76138         return ret_ref;
76139 }
76140
76141 int64_t  CS_LDK_RawBolt11Invoice_expiry_time(int64_t this_arg) {
76142         LDKRawBolt11Invoice this_arg_conv;
76143         this_arg_conv.inner = untag_ptr(this_arg);
76144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76146         this_arg_conv.is_owned = false;
76147         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
76148         int64_t ret_ref = 0;
76149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76151         return ret_ref;
76152 }
76153
76154 int64_t  CS_LDK_RawBolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
76155         LDKRawBolt11Invoice this_arg_conv;
76156         this_arg_conv.inner = untag_ptr(this_arg);
76157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76159         this_arg_conv.is_owned = false;
76160         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
76161         int64_t ret_ref = 0;
76162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76164         return ret_ref;
76165 }
76166
76167 int64_t  CS_LDK_RawBolt11Invoice_payment_secret(int64_t this_arg) {
76168         LDKRawBolt11Invoice this_arg_conv;
76169         this_arg_conv.inner = untag_ptr(this_arg);
76170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76172         this_arg_conv.is_owned = false;
76173         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
76174         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
76175         int64_t ret_ref = tag_ptr(ret_copy, true);
76176         return ret_ref;
76177 }
76178
76179 int64_t  CS_LDK_RawBolt11Invoice_payment_metadata(int64_t this_arg) {
76180         LDKRawBolt11Invoice this_arg_conv;
76181         this_arg_conv.inner = untag_ptr(this_arg);
76182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76184         this_arg_conv.is_owned = false;
76185         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
76186         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
76187         int64_t ret_ref = tag_ptr(ret_copy, true);
76188         return ret_ref;
76189 }
76190
76191 int64_t  CS_LDK_RawBolt11Invoice_features(int64_t this_arg) {
76192         LDKRawBolt11Invoice this_arg_conv;
76193         this_arg_conv.inner = untag_ptr(this_arg);
76194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76196         this_arg_conv.is_owned = false;
76197         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
76198         int64_t ret_ref = 0;
76199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76201         return ret_ref;
76202 }
76203
76204 int64_tArray  CS_LDK_RawBolt11Invoice_private_routes(int64_t this_arg) {
76205         LDKRawBolt11Invoice this_arg_conv;
76206         this_arg_conv.inner = untag_ptr(this_arg);
76207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76209         this_arg_conv.is_owned = false;
76210         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
76211         int64_tArray ret_arr = NULL;
76212         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76213         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76214         for (size_t o = 0; o < ret_var.datalen; o++) {
76215                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76216                 int64_t ret_conv_14_ref = 0;
76217                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76218                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76219                 ret_arr_ptr[o] = ret_conv_14_ref;
76220         }
76221         
76222         FREE(ret_var.data);
76223         return ret_arr;
76224 }
76225
76226 int64_t  CS_LDK_RawBolt11Invoice_amount_pico_btc(int64_t this_arg) {
76227         LDKRawBolt11Invoice this_arg_conv;
76228         this_arg_conv.inner = untag_ptr(this_arg);
76229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76231         this_arg_conv.is_owned = false;
76232         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76233         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
76234         int64_t ret_ref = tag_ptr(ret_copy, true);
76235         return ret_ref;
76236 }
76237
76238 int32_t  CS_LDK_RawBolt11Invoice_currency(int64_t this_arg) {
76239         LDKRawBolt11Invoice this_arg_conv;
76240         this_arg_conv.inner = untag_ptr(this_arg);
76241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76243         this_arg_conv.is_owned = false;
76244         int32_t ret_conv = LDKCurrency_to_cs(RawBolt11Invoice_currency(&this_arg_conv));
76245         return ret_conv;
76246 }
76247
76248 int64_t  CS_LDK_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
76249         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76250         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
76251         return tag_ptr(ret_conv, true);
76252 }
76253
76254 int64_t  CS_LDK_PositiveTimestamp_from_system_time(int64_t time) {
76255         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76256         *ret_conv = PositiveTimestamp_from_system_time(time);
76257         return tag_ptr(ret_conv, true);
76258 }
76259
76260 int64_t  CS_LDK_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
76261         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
76262         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
76263         return tag_ptr(ret_conv, true);
76264 }
76265
76266 int64_t  CS_LDK_PositiveTimestamp_as_unix_timestamp(int64_t this_arg) {
76267         LDKPositiveTimestamp this_arg_conv;
76268         this_arg_conv.inner = untag_ptr(this_arg);
76269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76271         this_arg_conv.is_owned = false;
76272         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
76273         return ret_conv;
76274 }
76275
76276 int64_t  CS_LDK_PositiveTimestamp_as_duration_since_epoch(int64_t this_arg) {
76277         LDKPositiveTimestamp this_arg_conv;
76278         this_arg_conv.inner = untag_ptr(this_arg);
76279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76281         this_arg_conv.is_owned = false;
76282         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
76283         return ret_conv;
76284 }
76285
76286 int64_t  CS_LDK_PositiveTimestamp_as_time(int64_t this_arg) {
76287         LDKPositiveTimestamp this_arg_conv;
76288         this_arg_conv.inner = untag_ptr(this_arg);
76289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76291         this_arg_conv.is_owned = false;
76292         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
76293         return ret_conv;
76294 }
76295
76296 int8_tArray  CS_LDK_Bolt11Invoice_signable_hash(int64_t this_arg) {
76297         LDKBolt11Invoice this_arg_conv;
76298         this_arg_conv.inner = untag_ptr(this_arg);
76299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76301         this_arg_conv.is_owned = false;
76302         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76303         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
76304         return ret_arr;
76305 }
76306
76307 int64_t  CS_LDK_Bolt11Invoice_into_signed_raw(int64_t this_arg) {
76308         LDKBolt11Invoice this_arg_conv;
76309         this_arg_conv.inner = untag_ptr(this_arg);
76310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76312         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
76313         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
76314         int64_t ret_ref = 0;
76315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76317         return ret_ref;
76318 }
76319
76320 int64_t  CS_LDK_Bolt11Invoice_check_signature(int64_t this_arg) {
76321         LDKBolt11Invoice this_arg_conv;
76322         this_arg_conv.inner = untag_ptr(this_arg);
76323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76325         this_arg_conv.is_owned = false;
76326         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
76327         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
76328         return tag_ptr(ret_conv, true);
76329 }
76330
76331 int64_t  CS_LDK_Bolt11Invoice_from_signed(int64_t signed_invoice) {
76332         LDKSignedRawBolt11Invoice signed_invoice_conv;
76333         signed_invoice_conv.inner = untag_ptr(signed_invoice);
76334         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
76335         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
76336         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
76337         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
76338         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
76339         return tag_ptr(ret_conv, true);
76340 }
76341
76342 int64_t  CS_LDK_Bolt11Invoice_timestamp(int64_t this_arg) {
76343         LDKBolt11Invoice this_arg_conv;
76344         this_arg_conv.inner = untag_ptr(this_arg);
76345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76347         this_arg_conv.is_owned = false;
76348         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
76349         return ret_conv;
76350 }
76351
76352 int64_t  CS_LDK_Bolt11Invoice_duration_since_epoch(int64_t this_arg) {
76353         LDKBolt11Invoice this_arg_conv;
76354         this_arg_conv.inner = untag_ptr(this_arg);
76355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76357         this_arg_conv.is_owned = false;
76358         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
76359         return ret_conv;
76360 }
76361
76362 int8_tArray  CS_LDK_Bolt11Invoice_payment_hash(int64_t this_arg) {
76363         LDKBolt11Invoice this_arg_conv;
76364         this_arg_conv.inner = untag_ptr(this_arg);
76365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76367         this_arg_conv.is_owned = false;
76368         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76369         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
76370         return ret_arr;
76371 }
76372
76373 int8_tArray  CS_LDK_Bolt11Invoice_payee_pub_key(int64_t this_arg) {
76374         LDKBolt11Invoice this_arg_conv;
76375         this_arg_conv.inner = untag_ptr(this_arg);
76376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76378         this_arg_conv.is_owned = false;
76379         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76380         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
76381         return ret_arr;
76382 }
76383
76384 int8_tArray  CS_LDK_Bolt11Invoice_payment_secret(int64_t this_arg) {
76385         LDKBolt11Invoice this_arg_conv;
76386         this_arg_conv.inner = untag_ptr(this_arg);
76387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76389         this_arg_conv.is_owned = false;
76390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76391         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
76392         return ret_arr;
76393 }
76394
76395 int64_t  CS_LDK_Bolt11Invoice_payment_metadata(int64_t this_arg) {
76396         LDKBolt11Invoice this_arg_conv;
76397         this_arg_conv.inner = untag_ptr(this_arg);
76398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76400         this_arg_conv.is_owned = false;
76401         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
76402         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
76403         int64_t ret_ref = tag_ptr(ret_copy, true);
76404         return ret_ref;
76405 }
76406
76407 int64_t  CS_LDK_Bolt11Invoice_features(int64_t this_arg) {
76408         LDKBolt11Invoice this_arg_conv;
76409         this_arg_conv.inner = untag_ptr(this_arg);
76410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76412         this_arg_conv.is_owned = false;
76413         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
76414         int64_t ret_ref = 0;
76415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76417         return ret_ref;
76418 }
76419
76420 int8_tArray  CS_LDK_Bolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
76421         LDKBolt11Invoice this_arg_conv;
76422         this_arg_conv.inner = untag_ptr(this_arg);
76423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76425         this_arg_conv.is_owned = false;
76426         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76427         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
76428         return ret_arr;
76429 }
76430
76431 int64_t  CS_LDK_Bolt11Invoice_expires_at(int64_t this_arg) {
76432         LDKBolt11Invoice this_arg_conv;
76433         this_arg_conv.inner = untag_ptr(this_arg);
76434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76436         this_arg_conv.is_owned = false;
76437         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76438         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
76439         int64_t ret_ref = tag_ptr(ret_copy, true);
76440         return ret_ref;
76441 }
76442
76443 int64_t  CS_LDK_Bolt11Invoice_expiry_time(int64_t this_arg) {
76444         LDKBolt11Invoice this_arg_conv;
76445         this_arg_conv.inner = untag_ptr(this_arg);
76446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76448         this_arg_conv.is_owned = false;
76449         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
76450         return ret_conv;
76451 }
76452
76453 jboolean  CS_LDK_Bolt11Invoice_is_expired(int64_t this_arg) {
76454         LDKBolt11Invoice this_arg_conv;
76455         this_arg_conv.inner = untag_ptr(this_arg);
76456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76458         this_arg_conv.is_owned = false;
76459         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
76460         return ret_conv;
76461 }
76462
76463 int64_t  CS_LDK_Bolt11Invoice_duration_until_expiry(int64_t this_arg) {
76464         LDKBolt11Invoice this_arg_conv;
76465         this_arg_conv.inner = untag_ptr(this_arg);
76466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76468         this_arg_conv.is_owned = false;
76469         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
76470         return ret_conv;
76471 }
76472
76473 int64_t  CS_LDK_Bolt11Invoice_expiration_remaining_from_epoch(int64_t this_arg, int64_t time) {
76474         LDKBolt11Invoice this_arg_conv;
76475         this_arg_conv.inner = untag_ptr(this_arg);
76476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76478         this_arg_conv.is_owned = false;
76479         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
76480         return ret_conv;
76481 }
76482
76483 jboolean  CS_LDK_Bolt11Invoice_would_expire(int64_t this_arg, int64_t at_time) {
76484         LDKBolt11Invoice this_arg_conv;
76485         this_arg_conv.inner = untag_ptr(this_arg);
76486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76488         this_arg_conv.is_owned = false;
76489         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
76490         return ret_conv;
76491 }
76492
76493 int64_t  CS_LDK_Bolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
76494         LDKBolt11Invoice this_arg_conv;
76495         this_arg_conv.inner = untag_ptr(this_arg);
76496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76498         this_arg_conv.is_owned = false;
76499         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
76500         return ret_conv;
76501 }
76502
76503 ptrArray  CS_LDK_Bolt11Invoice_fallback_addresses(int64_t this_arg) {
76504         LDKBolt11Invoice this_arg_conv;
76505         this_arg_conv.inner = untag_ptr(this_arg);
76506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76508         this_arg_conv.is_owned = false;
76509         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
76510         ptrArray ret_arr = NULL;
76511         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
76512         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
76513         for (size_t i = 0; i < ret_var.datalen; i++) {
76514                 LDKStr ret_conv_8_str = ret_var.data[i];
76515                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
76516                 Str_free(ret_conv_8_str);
76517                 ret_arr_ptr[i] = ret_conv_8_conv;
76518         }
76519         
76520         FREE(ret_var.data);
76521         return ret_arr;
76522 }
76523
76524 int64_tArray  CS_LDK_Bolt11Invoice_private_routes(int64_t this_arg) {
76525         LDKBolt11Invoice this_arg_conv;
76526         this_arg_conv.inner = untag_ptr(this_arg);
76527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76529         this_arg_conv.is_owned = false;
76530         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
76531         int64_tArray ret_arr = NULL;
76532         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76533         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76534         for (size_t o = 0; o < ret_var.datalen; o++) {
76535                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
76536                 int64_t ret_conv_14_ref = 0;
76537                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
76538                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
76539                 ret_arr_ptr[o] = ret_conv_14_ref;
76540         }
76541         
76542         FREE(ret_var.data);
76543         return ret_arr;
76544 }
76545
76546 int64_tArray  CS_LDK_Bolt11Invoice_route_hints(int64_t this_arg) {
76547         LDKBolt11Invoice this_arg_conv;
76548         this_arg_conv.inner = untag_ptr(this_arg);
76549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76551         this_arg_conv.is_owned = false;
76552         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
76553         int64_tArray ret_arr = NULL;
76554         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
76555         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
76556         for (size_t l = 0; l < ret_var.datalen; l++) {
76557                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
76558                 int64_t ret_conv_11_ref = 0;
76559                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
76560                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
76561                 ret_arr_ptr[l] = ret_conv_11_ref;
76562         }
76563         
76564         FREE(ret_var.data);
76565         return ret_arr;
76566 }
76567
76568 int32_t  CS_LDK_Bolt11Invoice_currency(int64_t this_arg) {
76569         LDKBolt11Invoice this_arg_conv;
76570         this_arg_conv.inner = untag_ptr(this_arg);
76571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76573         this_arg_conv.is_owned = false;
76574         int32_t ret_conv = LDKCurrency_to_cs(Bolt11Invoice_currency(&this_arg_conv));
76575         return ret_conv;
76576 }
76577
76578 int64_t  CS_LDK_Bolt11Invoice_amount_milli_satoshis(int64_t this_arg) {
76579         LDKBolt11Invoice this_arg_conv;
76580         this_arg_conv.inner = untag_ptr(this_arg);
76581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76583         this_arg_conv.is_owned = false;
76584         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76585         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
76586         int64_t ret_ref = tag_ptr(ret_copy, true);
76587         return ret_ref;
76588 }
76589
76590 int64_t  CS_LDK_Description_new(jstring description) {
76591         LDKStr description_conv = str_ref_to_owned_c(description);
76592         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
76593         *ret_conv = Description_new(description_conv);
76594         return tag_ptr(ret_conv, true);
76595 }
76596
76597 int64_t  CS_LDK_Description_into_inner(int64_t this_arg) {
76598         LDKDescription this_arg_conv;
76599         this_arg_conv.inner = untag_ptr(this_arg);
76600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76602         this_arg_conv = Description_clone(&this_arg_conv);
76603         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
76604         int64_t ret_ref = 0;
76605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76607         return ret_ref;
76608 }
76609
76610 jstring  CS_LDK_Description_to_str(int64_t o) {
76611         LDKDescription o_conv;
76612         o_conv.inner = untag_ptr(o);
76613         o_conv.is_owned = ptr_is_owned(o);
76614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76615         o_conv.is_owned = false;
76616         LDKStr ret_str = Description_to_str(&o_conv);
76617         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76618         Str_free(ret_str);
76619         return ret_conv;
76620 }
76621
76622 int64_t  CS_LDK_ExpiryTime_from_seconds(int64_t seconds) {
76623         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
76624         int64_t ret_ref = 0;
76625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76627         return ret_ref;
76628 }
76629
76630 int64_t  CS_LDK_ExpiryTime_from_duration(int64_t duration) {
76631         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
76632         int64_t ret_ref = 0;
76633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76635         return ret_ref;
76636 }
76637
76638 int64_t  CS_LDK_ExpiryTime_as_seconds(int64_t this_arg) {
76639         LDKExpiryTime this_arg_conv;
76640         this_arg_conv.inner = untag_ptr(this_arg);
76641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76643         this_arg_conv.is_owned = false;
76644         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
76645         return ret_conv;
76646 }
76647
76648 int64_t  CS_LDK_ExpiryTime_as_duration(int64_t this_arg) {
76649         LDKExpiryTime this_arg_conv;
76650         this_arg_conv.inner = untag_ptr(this_arg);
76651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76653         this_arg_conv.is_owned = false;
76654         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
76655         return ret_conv;
76656 }
76657
76658 int64_t  CS_LDK_PrivateRoute_new(int64_t hops) {
76659         LDKRouteHint hops_conv;
76660         hops_conv.inner = untag_ptr(hops);
76661         hops_conv.is_owned = ptr_is_owned(hops);
76662         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
76663         hops_conv = RouteHint_clone(&hops_conv);
76664         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
76665         *ret_conv = PrivateRoute_new(hops_conv);
76666         return tag_ptr(ret_conv, true);
76667 }
76668
76669 int64_t  CS_LDK_PrivateRoute_into_inner(int64_t this_arg) {
76670         LDKPrivateRoute this_arg_conv;
76671         this_arg_conv.inner = untag_ptr(this_arg);
76672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76674         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
76675         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
76676         int64_t ret_ref = 0;
76677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76679         return ret_ref;
76680 }
76681
76682 int32_t  CS_LDK_CreationError_clone(int64_t orig) {
76683         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
76684         int32_t ret_conv = LDKCreationError_to_cs(CreationError_clone(orig_conv));
76685         return ret_conv;
76686 }
76687
76688 int32_t  CS_LDK_CreationError_description_too_long() {
76689         int32_t ret_conv = LDKCreationError_to_cs(CreationError_description_too_long());
76690         return ret_conv;
76691 }
76692
76693 int32_t  CS_LDK_CreationError_route_too_long() {
76694         int32_t ret_conv = LDKCreationError_to_cs(CreationError_route_too_long());
76695         return ret_conv;
76696 }
76697
76698 int32_t  CS_LDK_CreationError_timestamp_out_of_bounds() {
76699         int32_t ret_conv = LDKCreationError_to_cs(CreationError_timestamp_out_of_bounds());
76700         return ret_conv;
76701 }
76702
76703 int32_t  CS_LDK_CreationError_invalid_amount() {
76704         int32_t ret_conv = LDKCreationError_to_cs(CreationError_invalid_amount());
76705         return ret_conv;
76706 }
76707
76708 int32_t  CS_LDK_CreationError_missing_route_hints() {
76709         int32_t ret_conv = LDKCreationError_to_cs(CreationError_missing_route_hints());
76710         return ret_conv;
76711 }
76712
76713 int32_t  CS_LDK_CreationError_min_final_cltv_expiry_delta_too_short() {
76714         int32_t ret_conv = LDKCreationError_to_cs(CreationError_min_final_cltv_expiry_delta_too_short());
76715         return ret_conv;
76716 }
76717
76718 jboolean  CS_LDK_CreationError_eq(int64_t a, int64_t b) {
76719         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
76720         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
76721         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
76722         return ret_conv;
76723 }
76724
76725 jstring  CS_LDK_CreationError_to_str(int64_t o) {
76726         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
76727         LDKStr ret_str = CreationError_to_str(o_conv);
76728         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76729         Str_free(ret_str);
76730         return ret_conv;
76731 }
76732
76733 int32_t  CS_LDK_Bolt11SemanticError_clone(int64_t orig) {
76734         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
76735         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_clone(orig_conv));
76736         return ret_conv;
76737 }
76738
76739 int32_t  CS_LDK_Bolt11SemanticError_no_payment_hash() {
76740         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_hash());
76741         return ret_conv;
76742 }
76743
76744 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_hashes() {
76745         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_hashes());
76746         return ret_conv;
76747 }
76748
76749 int32_t  CS_LDK_Bolt11SemanticError_no_description() {
76750         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_description());
76751         return ret_conv;
76752 }
76753
76754 int32_t  CS_LDK_Bolt11SemanticError_multiple_descriptions() {
76755         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_descriptions());
76756         return ret_conv;
76757 }
76758
76759 int32_t  CS_LDK_Bolt11SemanticError_no_payment_secret() {
76760         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_secret());
76761         return ret_conv;
76762 }
76763
76764 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_secrets() {
76765         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_secrets());
76766         return ret_conv;
76767 }
76768
76769 int32_t  CS_LDK_Bolt11SemanticError_invalid_features() {
76770         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_features());
76771         return ret_conv;
76772 }
76773
76774 int32_t  CS_LDK_Bolt11SemanticError_invalid_recovery_id() {
76775         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_recovery_id());
76776         return ret_conv;
76777 }
76778
76779 int32_t  CS_LDK_Bolt11SemanticError_invalid_signature() {
76780         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_signature());
76781         return ret_conv;
76782 }
76783
76784 int32_t  CS_LDK_Bolt11SemanticError_imprecise_amount() {
76785         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_imprecise_amount());
76786         return ret_conv;
76787 }
76788
76789 jboolean  CS_LDK_Bolt11SemanticError_eq(int64_t a, int64_t b) {
76790         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
76791         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
76792         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
76793         return ret_conv;
76794 }
76795
76796 jstring  CS_LDK_Bolt11SemanticError_to_str(int64_t o) {
76797         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
76798         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
76799         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76800         Str_free(ret_str);
76801         return ret_conv;
76802 }
76803
76804 void  CS_LDK_SignOrCreationError_free(int64_t this_ptr) {
76805         if (!ptr_is_owned(this_ptr)) return;
76806         void* this_ptr_ptr = untag_ptr(this_ptr);
76807         CHECK_ACCESS(this_ptr_ptr);
76808         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
76809         FREE(untag_ptr(this_ptr));
76810         SignOrCreationError_free(this_ptr_conv);
76811 }
76812
76813 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
76814         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76815         *ret_copy = SignOrCreationError_clone(arg);
76816         int64_t ret_ref = tag_ptr(ret_copy, true);
76817         return ret_ref;
76818 }
76819 int64_t  CS_LDK_SignOrCreationError_clone_ptr(int64_t arg) {
76820         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
76821         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
76822         return ret_conv;
76823 }
76824
76825 int64_t  CS_LDK_SignOrCreationError_clone(int64_t orig) {
76826         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
76827         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76828         *ret_copy = SignOrCreationError_clone(orig_conv);
76829         int64_t ret_ref = tag_ptr(ret_copy, true);
76830         return ret_ref;
76831 }
76832
76833 int64_t  CS_LDK_SignOrCreationError_sign_error() {
76834         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76835         *ret_copy = SignOrCreationError_sign_error();
76836         int64_t ret_ref = tag_ptr(ret_copy, true);
76837         return ret_ref;
76838 }
76839
76840 int64_t  CS_LDK_SignOrCreationError_creation_error(int32_t a) {
76841         LDKCreationError a_conv = LDKCreationError_from_cs(a);
76842         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
76843         *ret_copy = SignOrCreationError_creation_error(a_conv);
76844         int64_t ret_ref = tag_ptr(ret_copy, true);
76845         return ret_ref;
76846 }
76847
76848 jboolean  CS_LDK_SignOrCreationError_eq(int64_t a, int64_t b) {
76849         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
76850         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
76851         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
76852         return ret_conv;
76853 }
76854
76855 jstring  CS_LDK_SignOrCreationError_to_str(int64_t o) {
76856         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
76857         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
76858         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
76859         Str_free(ret_str);
76860         return ret_conv;
76861 }
76862
76863 int64_t  CS_LDK_payment_parameters_from_zero_amount_invoice(int64_t invoice, int64_t amount_msat) {
76864         LDKBolt11Invoice invoice_conv;
76865         invoice_conv.inner = untag_ptr(invoice);
76866         invoice_conv.is_owned = ptr_is_owned(invoice);
76867         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76868         invoice_conv.is_owned = false;
76869         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76870         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
76871         return tag_ptr(ret_conv, true);
76872 }
76873
76874 int64_t  CS_LDK_payment_parameters_from_invoice(int64_t invoice) {
76875         LDKBolt11Invoice invoice_conv;
76876         invoice_conv.inner = untag_ptr(invoice);
76877         invoice_conv.is_owned = ptr_is_owned(invoice);
76878         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
76879         invoice_conv.is_owned = false;
76880         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
76881         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
76882         return tag_ptr(ret_conv, true);
76883 }
76884
76885 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) {
76886         void* amt_msat_ptr = untag_ptr(amt_msat);
76887         CHECK_ACCESS(amt_msat_ptr);
76888         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76889         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76890         void* payment_hash_ptr = untag_ptr(payment_hash);
76891         CHECK_ACCESS(payment_hash_ptr);
76892         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76893         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76894         LDKStr description_conv = str_ref_to_owned_c(description);
76895         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76896         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76897         if (phantom_route_hints_constr.datalen > 0)
76898                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76899         else
76900                 phantom_route_hints_constr.data = NULL;
76901         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76902         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76903                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76904                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76905                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76906                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76908                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76909                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76910         }
76911         FREE(phantom_route_hints);
76912         void* entropy_source_ptr = untag_ptr(entropy_source);
76913         CHECK_ACCESS(entropy_source_ptr);
76914         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76915         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76916                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76917                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76918         }
76919         void* node_signer_ptr = untag_ptr(node_signer);
76920         CHECK_ACCESS(node_signer_ptr);
76921         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76922         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76923                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76924                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76925         }
76926         void* logger_ptr = untag_ptr(logger);
76927         CHECK_ACCESS(logger_ptr);
76928         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76929         if (logger_conv.free == LDKLogger_JCalls_free) {
76930                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76931                 LDKLogger_JCalls_cloned(&logger_conv);
76932         }
76933         LDKCurrency network_conv = LDKCurrency_from_cs(network);
76934         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76935         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76936         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76937         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
76938         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
76939         *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);
76940         return tag_ptr(ret_conv, true);
76941 }
76942
76943 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) {
76944         void* amt_msat_ptr = untag_ptr(amt_msat);
76945         CHECK_ACCESS(amt_msat_ptr);
76946         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
76947         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
76948         void* payment_hash_ptr = untag_ptr(payment_hash);
76949         CHECK_ACCESS(payment_hash_ptr);
76950         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
76951         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
76952         LDKSha256 description_hash_conv;
76953         description_hash_conv.inner = untag_ptr(description_hash);
76954         description_hash_conv.is_owned = ptr_is_owned(description_hash);
76955         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
76956         description_hash_conv = Sha256_clone(&description_hash_conv);
76957         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
76958         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
76959         if (phantom_route_hints_constr.datalen > 0)
76960                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
76961         else
76962                 phantom_route_hints_constr.data = NULL;
76963         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
76964         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
76965                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
76966                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
76967                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
76968                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
76969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
76970                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
76971                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
76972         }
76973         FREE(phantom_route_hints);
76974         void* entropy_source_ptr = untag_ptr(entropy_source);
76975         CHECK_ACCESS(entropy_source_ptr);
76976         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
76977         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
76978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76979                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
76980         }
76981         void* node_signer_ptr = untag_ptr(node_signer);
76982         CHECK_ACCESS(node_signer_ptr);
76983         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
76984         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
76985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76986                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
76987         }
76988         void* logger_ptr = untag_ptr(logger);
76989         CHECK_ACCESS(logger_ptr);
76990         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
76991         if (logger_conv.free == LDKLogger_JCalls_free) {
76992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76993                 LDKLogger_JCalls_cloned(&logger_conv);
76994         }
76995         LDKCurrency network_conv = LDKCurrency_from_cs(network);
76996         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
76997         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
76998         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
76999         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77000         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77001         *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);
77002         return tag_ptr(ret_conv, true);
77003 }
77004
77005 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) {
77006         LDKChannelManager channelmanager_conv;
77007         channelmanager_conv.inner = untag_ptr(channelmanager);
77008         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77010         channelmanager_conv.is_owned = false;
77011         void* node_signer_ptr = untag_ptr(node_signer);
77012         CHECK_ACCESS(node_signer_ptr);
77013         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77014         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77016                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77017         }
77018         void* logger_ptr = untag_ptr(logger);
77019         CHECK_ACCESS(logger_ptr);
77020         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77021         if (logger_conv.free == LDKLogger_JCalls_free) {
77022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77023                 LDKLogger_JCalls_cloned(&logger_conv);
77024         }
77025         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77026         void* amt_msat_ptr = untag_ptr(amt_msat);
77027         CHECK_ACCESS(amt_msat_ptr);
77028         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77029         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77030         LDKStr description_conv = str_ref_to_owned_c(description);
77031         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77032         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77033         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77034         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77035         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77036         *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);
77037         return tag_ptr(ret_conv, true);
77038 }
77039
77040 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) {
77041         LDKChannelManager channelmanager_conv;
77042         channelmanager_conv.inner = untag_ptr(channelmanager);
77043         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77044         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77045         channelmanager_conv.is_owned = false;
77046         void* node_signer_ptr = untag_ptr(node_signer);
77047         CHECK_ACCESS(node_signer_ptr);
77048         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77049         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77051                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77052         }
77053         void* logger_ptr = untag_ptr(logger);
77054         CHECK_ACCESS(logger_ptr);
77055         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77056         if (logger_conv.free == LDKLogger_JCalls_free) {
77057                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77058                 LDKLogger_JCalls_cloned(&logger_conv);
77059         }
77060         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77061         void* amt_msat_ptr = untag_ptr(amt_msat);
77062         CHECK_ACCESS(amt_msat_ptr);
77063         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77064         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77065         LDKSha256 description_hash_conv;
77066         description_hash_conv.inner = untag_ptr(description_hash);
77067         description_hash_conv.is_owned = ptr_is_owned(description_hash);
77068         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
77069         description_hash_conv = Sha256_clone(&description_hash_conv);
77070         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77071         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77072         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77073         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77074         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77075         *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);
77076         return tag_ptr(ret_conv, true);
77077 }
77078
77079 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) {
77080         LDKChannelManager channelmanager_conv;
77081         channelmanager_conv.inner = untag_ptr(channelmanager);
77082         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77083         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77084         channelmanager_conv.is_owned = false;
77085         void* node_signer_ptr = untag_ptr(node_signer);
77086         CHECK_ACCESS(node_signer_ptr);
77087         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77088         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77090                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77091         }
77092         void* logger_ptr = untag_ptr(logger);
77093         CHECK_ACCESS(logger_ptr);
77094         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77095         if (logger_conv.free == LDKLogger_JCalls_free) {
77096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77097                 LDKLogger_JCalls_cloned(&logger_conv);
77098         }
77099         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77100         void* amt_msat_ptr = untag_ptr(amt_msat);
77101         CHECK_ACCESS(amt_msat_ptr);
77102         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77103         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77104         LDKSha256 description_hash_conv;
77105         description_hash_conv.inner = untag_ptr(description_hash);
77106         description_hash_conv.is_owned = ptr_is_owned(description_hash);
77107         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
77108         description_hash_conv = Sha256_clone(&description_hash_conv);
77109         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77110         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77111         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77112         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77113         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77114         *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);
77115         return tag_ptr(ret_conv, true);
77116 }
77117
77118 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) {
77119         LDKChannelManager channelmanager_conv;
77120         channelmanager_conv.inner = untag_ptr(channelmanager);
77121         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77122         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77123         channelmanager_conv.is_owned = false;
77124         void* node_signer_ptr = untag_ptr(node_signer);
77125         CHECK_ACCESS(node_signer_ptr);
77126         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77127         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77128                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77129                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77130         }
77131         void* logger_ptr = untag_ptr(logger);
77132         CHECK_ACCESS(logger_ptr);
77133         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77134         if (logger_conv.free == LDKLogger_JCalls_free) {
77135                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77136                 LDKLogger_JCalls_cloned(&logger_conv);
77137         }
77138         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77139         void* amt_msat_ptr = untag_ptr(amt_msat);
77140         CHECK_ACCESS(amt_msat_ptr);
77141         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77142         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77143         LDKStr description_conv = str_ref_to_owned_c(description);
77144         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77145         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77146         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77147         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77148         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77149         *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);
77150         return tag_ptr(ret_conv, true);
77151 }
77152
77153 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) {
77154         LDKChannelManager channelmanager_conv;
77155         channelmanager_conv.inner = untag_ptr(channelmanager);
77156         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
77157         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
77158         channelmanager_conv.is_owned = false;
77159         void* node_signer_ptr = untag_ptr(node_signer);
77160         CHECK_ACCESS(node_signer_ptr);
77161         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77162         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77163                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77164                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77165         }
77166         void* logger_ptr = untag_ptr(logger);
77167         CHECK_ACCESS(logger_ptr);
77168         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77169         if (logger_conv.free == LDKLogger_JCalls_free) {
77170                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77171                 LDKLogger_JCalls_cloned(&logger_conv);
77172         }
77173         LDKCurrency network_conv = LDKCurrency_from_cs(network);
77174         void* amt_msat_ptr = untag_ptr(amt_msat);
77175         CHECK_ACCESS(amt_msat_ptr);
77176         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
77177         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
77178         LDKStr description_conv = str_ref_to_owned_c(description);
77179         LDKThirtyTwoBytes payment_hash_ref;
77180         CHECK(payment_hash->arr_len == 32);
77181         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
77182         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
77183         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
77184         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
77185         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
77186         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
77187         *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);
77188         return tag_ptr(ret_conv, true);
77189 }
77190
77191 int64_t  CS_LDK_SiPrefix_from_str(jstring s) {
77192         LDKStr s_conv = str_ref_to_owned_c(s);
77193         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
77194         *ret_conv = SiPrefix_from_str(s_conv);
77195         return tag_ptr(ret_conv, true);
77196 }
77197
77198 int64_t  CS_LDK_Bolt11Invoice_from_str(jstring s) {
77199         LDKStr s_conv = str_ref_to_owned_c(s);
77200         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
77201         *ret_conv = Bolt11Invoice_from_str(s_conv);
77202         return tag_ptr(ret_conv, true);
77203 }
77204
77205 int64_t  CS_LDK_SignedRawBolt11Invoice_from_str(jstring s) {
77206         LDKStr s_conv = str_ref_to_owned_c(s);
77207         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
77208         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
77209         return tag_ptr(ret_conv, true);
77210 }
77211
77212 jstring  CS_LDK_Bolt11ParseError_to_str(int64_t o) {
77213         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
77214         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
77215         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77216         Str_free(ret_str);
77217         return ret_conv;
77218 }
77219
77220 jstring  CS_LDK_ParseOrSemanticError_to_str(int64_t o) {
77221         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
77222         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
77223         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77224         Str_free(ret_str);
77225         return ret_conv;
77226 }
77227
77228 jstring  CS_LDK_Bolt11Invoice_to_str(int64_t o) {
77229         LDKBolt11Invoice o_conv;
77230         o_conv.inner = untag_ptr(o);
77231         o_conv.is_owned = ptr_is_owned(o);
77232         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77233         o_conv.is_owned = false;
77234         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
77235         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77236         Str_free(ret_str);
77237         return ret_conv;
77238 }
77239
77240 jstring  CS_LDK_SignedRawBolt11Invoice_to_str(int64_t o) {
77241         LDKSignedRawBolt11Invoice o_conv;
77242         o_conv.inner = untag_ptr(o);
77243         o_conv.is_owned = ptr_is_owned(o);
77244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77245         o_conv.is_owned = false;
77246         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
77247         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77248         Str_free(ret_str);
77249         return ret_conv;
77250 }
77251
77252 jstring  CS_LDK_Currency_to_str(int64_t o) {
77253         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
77254         LDKStr ret_str = Currency_to_str(o_conv);
77255         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77256         Str_free(ret_str);
77257         return ret_conv;
77258 }
77259
77260 jstring  CS_LDK_SiPrefix_to_str(int64_t o) {
77261         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
77262         LDKStr ret_str = SiPrefix_to_str(o_conv);
77263         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
77264         Str_free(ret_str);
77265         return ret_conv;
77266 }
77267
77268 void  CS_LDK_GraphSyncError_free(int64_t this_ptr) {
77269         if (!ptr_is_owned(this_ptr)) return;
77270         void* this_ptr_ptr = untag_ptr(this_ptr);
77271         CHECK_ACCESS(this_ptr_ptr);
77272         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
77273         FREE(untag_ptr(this_ptr));
77274         GraphSyncError_free(this_ptr_conv);
77275 }
77276
77277 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
77278         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77279         *ret_copy = GraphSyncError_clone(arg);
77280         int64_t ret_ref = tag_ptr(ret_copy, true);
77281         return ret_ref;
77282 }
77283 int64_t  CS_LDK_GraphSyncError_clone_ptr(int64_t arg) {
77284         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
77285         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
77286         return ret_conv;
77287 }
77288
77289 int64_t  CS_LDK_GraphSyncError_clone(int64_t orig) {
77290         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
77291         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77292         *ret_copy = GraphSyncError_clone(orig_conv);
77293         int64_t ret_ref = tag_ptr(ret_copy, true);
77294         return ret_ref;
77295 }
77296
77297 int64_t  CS_LDK_GraphSyncError_decode_error(int64_t a) {
77298         void* a_ptr = untag_ptr(a);
77299         CHECK_ACCESS(a_ptr);
77300         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
77301         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
77302         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77303         *ret_copy = GraphSyncError_decode_error(a_conv);
77304         int64_t ret_ref = tag_ptr(ret_copy, true);
77305         return ret_ref;
77306 }
77307
77308 int64_t  CS_LDK_GraphSyncError_lightning_error(int64_t a) {
77309         LDKLightningError a_conv;
77310         a_conv.inner = untag_ptr(a);
77311         a_conv.is_owned = ptr_is_owned(a);
77312         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77313         a_conv = LightningError_clone(&a_conv);
77314         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
77315         *ret_copy = GraphSyncError_lightning_error(a_conv);
77316         int64_t ret_ref = tag_ptr(ret_copy, true);
77317         return ret_ref;
77318 }
77319
77320 void  CS_LDK_RapidGossipSync_free(int64_t this_obj) {
77321         LDKRapidGossipSync this_obj_conv;
77322         this_obj_conv.inner = untag_ptr(this_obj);
77323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77325         RapidGossipSync_free(this_obj_conv);
77326 }
77327
77328 int64_t  CS_LDK_RapidGossipSync_new(int64_t network_graph, int64_t logger) {
77329         LDKNetworkGraph network_graph_conv;
77330         network_graph_conv.inner = untag_ptr(network_graph);
77331         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77332         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77333         network_graph_conv.is_owned = false;
77334         void* logger_ptr = untag_ptr(logger);
77335         CHECK_ACCESS(logger_ptr);
77336         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77337         if (logger_conv.free == LDKLogger_JCalls_free) {
77338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77339                 LDKLogger_JCalls_cloned(&logger_conv);
77340         }
77341         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
77342         int64_t ret_ref = 0;
77343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77345         return ret_ref;
77346 }
77347
77348 int64_t  CS_LDK_RapidGossipSync_sync_network_graph_with_file_path(int64_t this_arg, jstring sync_path) {
77349         LDKRapidGossipSync this_arg_conv;
77350         this_arg_conv.inner = untag_ptr(this_arg);
77351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77353         this_arg_conv.is_owned = false;
77354         LDKStr sync_path_conv = str_ref_to_owned_c(sync_path);
77355         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77356         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
77357         return tag_ptr(ret_conv, true);
77358 }
77359
77360 int64_t  CS_LDK_RapidGossipSync_update_network_graph(int64_t this_arg, int8_tArray update_data) {
77361         LDKRapidGossipSync this_arg_conv;
77362         this_arg_conv.inner = untag_ptr(this_arg);
77363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77365         this_arg_conv.is_owned = false;
77366         LDKu8slice update_data_ref;
77367         update_data_ref.datalen = update_data->arr_len;
77368         update_data_ref.data = update_data->elems;
77369         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77370         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
77371         FREE(update_data);
77372         return tag_ptr(ret_conv, true);
77373 }
77374
77375 int64_t  CS_LDK_RapidGossipSync_update_network_graph_no_std(int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
77376         LDKRapidGossipSync this_arg_conv;
77377         this_arg_conv.inner = untag_ptr(this_arg);
77378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77380         this_arg_conv.is_owned = false;
77381         LDKu8slice update_data_ref;
77382         update_data_ref.datalen = update_data->arr_len;
77383         update_data_ref.data = update_data->elems;
77384         void* current_time_unix_ptr = untag_ptr(current_time_unix);
77385         CHECK_ACCESS(current_time_unix_ptr);
77386         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
77387         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
77388         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
77389         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
77390         FREE(update_data);
77391         return tag_ptr(ret_conv, true);
77392 }
77393
77394 jboolean  CS_LDK_RapidGossipSync_is_initial_sync_complete(int64_t this_arg) {
77395         LDKRapidGossipSync this_arg_conv;
77396         this_arg_conv.inner = untag_ptr(this_arg);
77397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77399         this_arg_conv.is_owned = false;
77400         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
77401         return ret_conv;
77402 }
77403